Hi,

Two years ago, I asked [1] whether it was OK to have different warning
options for gnulib code that is embedded in a package's code. You approved
it, and I implemented it.

The current state thus is as follows:
(I took grep-3.11 as an example, and configured it with --enable-gcc-warnings
--disable-silent-rules.) In the generated lib/Makefile I see:

GL_CFLAG_ALLOW_WARNINGS = -Wno-error
GL_CFLAG_GNULIB_WARNINGS =  -Wno-cast-qual -Wno-conversion -Wno-float-equal 
-Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter 
-Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion 
-Wno-type-limits -Wno-unsuffixed-float-constants

libgreputils_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS)

and in the build log:

gcc -ftrapv -DHAVE_CONFIG_H -I. -I../../lib -I..   
-I/media/develdata/devel/inst-x86_64-64/include -Wall -Wall -Warith-conversion 
-Wbad-function-cast -Wcast-align=strict -Wdate-time -Wdisabled-optimization 
-Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wextra 
-Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op 
-Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes 
-Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd 
-Woverlength-strings -Wpacked -Wpointer-arith -Wshadow -Wstrict-overflow 
-Wstrict-prototypes -Wsuggest-attribute=cold -Wsuggest-attribute=const 
-Wsuggest-attribute=format -Wsuggest-attribute=malloc 
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods 
-Wsuggest-final-types -Wsync-nand -Wtrampolines -Wuninitialized 
-Wunknown-pragmas -Wunsafe-loop-optimizations -Wvariadic-macros 
-Wvector-operation-performance -Wwrite-strings -Warray-bounds=2 
-Wattribute-alias=2 -Wformat-overflow=2 -Wformat=2 -Wformat-truncation=2 
-Wimplicit-fallthrough=5 -Wshift-overflow=2 -Wunused-const-variable=2 
-Wvla-larger-than=4031 -Wno-missing-field-initializers -Wno-sign-compare 
-Wno-unused-parameter -Wno-cast-function-type -Wno-deprecated-declarations 
-Wno-logical-op -Wno-format-nonliteral -Werror -Wno-cast-qual -Wno-conversion 
-Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function 
-Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthrough 
-Wno-pedantic -Wno-sign-conversion -Wno-type-limits 
-Wno-unsuffixed-float-constants -g -O2 -MT libgreputils_a-xmalloc.o -MD -MP -MF 
.deps/libgreputils_a-xmalloc.Tpo -c -o libgreputils_a-xmalloc.o `test -f 
'xmalloc.c' || echo '../../lib/'`xmalloc.c

This means, the configure.ac of the package has put -Werror in the $(AM_CFLAGS),
and thus gnulib code is being compiled with -Werror. Leading to people (like
Gleb Fotengauer-Malinovskiy today) claim that a warning in gnulib code
is an FTBFS.


Proposal:
---------

I suggest to add -Wno-error in $(GL_CFLAG_GNULIB_WARNINGS),
and thus avoid FTBFS situations if some compiler warnings occur
in gnulib code.

Rationale:
----------

The effect of the current state is that some people feel urged
to send nonsensical reports about warnings, when they don't realize that
the warnings were a consequence of *their* choice of CFLAGS and *their*
choice to use --enable-gcc-warnings.

I find it perfectly OK if you who maintain GNU grep, GNU coreutils, etc.
want to cope with such reports regarding grep or coreutils code.

But regarding gnulib code, I would like to reduce the urgency that people
feel to report warnings. I would like people to think about
  - what the warning is meaning,
  - whether fixing the warning is possible and useful,
before they send a report.

Regarding the gnulib *tests*, I already did this change on 2021-06-10.
The proposal here is about gnulib *lib* code.


Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00201.html




Reply via email to