[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Configure warning/error in m4/frexp.m4
From: |
Bruno Haible |
Subject: |
Re: Configure warning/error in m4/frexp.m4 |
Date: |
Sat, 02 Dec 2023 06:52:23 +0100 |
Hi Sam,
> The configure test in gl_FUNC_FREXP_WORKS within m4/frexp.m4 triggers
> a Clang warning/error when Clang is passed
> -Werror=incompatible-pointer-types.
Gnulib does not support CC or CPPFLAGS or CFLAGS values with -Werror at
configure time. Neither with gcc nor with clang.
The reason is that [1]
"Many GCC warning options usually don’t point to mistakes in the code;
these warnings enforce a certain programming style. It is a project
management decision whether you want your code to follow any of these
styles. Note that some of these programming styles are conflicting.
You cannot have them all; you have to choose among them."
For example, there is a warning option that attempts to enforce
explicit casts (no implicit conversions), and there is a warning option
that attempts to enforce no explicit casts. When you use such a warning
option together with -Werror, you are attempting to enforce a certain
programming style on the configure tests. Obviously the configure test
snippets cannot obey different, conflicting programming styles.
> /tmp/foo.c: In function ‘main’:
> /tmp/foo.c:59:21: warning: passing argument 2 of ‘memcmp’ discards ‘volatile’
> qualifier from pointer target type [-Wdiscarded-qualifiers]
> 59 | if (memcmp (&y, &x, sizeof x))
> | ^~
There is nothing wrong with this code (m4/frexp.m4:159, m4/frexpf.m4:83).
We don't want to add a cast here, because — as Paul argues — casts can make
code more difficult to maintain in the long run.
Bruno
[1] https://www.gnu.org/software/gnulib/manual/html_node/manywarnings.html
- Configure warning/error in m4/frexp.m4, Sam James, 2023/12/01
- Re: Configure warning/error in m4/frexp.m4,
Bruno Haible <=
- Re: Configure warning/error in m4/frexp.m4, Sam James, 2023/12/02
- Re: Configure warning/error in m4/frexp.m4, Sam James, 2023/12/02
- Re: Configure warning/error in m4/frexp.m4, Bruno Haible, 2023/12/02
- Re: Configure warning/error in m4/frexp.m4, Sam James, 2023/12/02
- Re: Configure warning/error in m4/frexp.m4, Bruno Haible, 2023/12/02
- Re: Configure warning/error in m4/frexp.m4, Sam James, 2023/12/02
Re: Configure warning/error in m4/frexp.m4, Paul Eggert, 2023/12/02