Simon Josefsson wrote:
...
> A combination of the two approaches that I've used is this:
>
> if test "$gl_gcc_warnings" = yes; then
>   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
>   gl_WARN_ADD([-Wframe-larger-than=112], [WSTACK_CFLAGS])
>
>   nw="$nw -Wsystem-headers"         # Don't let system headers trigger 
> warnings
>   nw="$nw -Wpadded"                 # Struct in src/idn_cmd.h is not padded
>   nw="$nw -Wformat"                 # Self tests and examples print size_t as 
> %d
>   nw="$nw -Wc++-compat"             # We don't care strongly about C++ 
> compilers
>   nw="$nw -Woverlength-strings"     # Some of our strings are too large
>   nw="$nw -Wsign-conversion"        # Too many warnings for now
>   nw="$nw -Wconversion"             # Too many warnings for now
>   nw="$nw -Wtraditional"            # Warns on #elif which we use often
>   nw="$nw -Wtraditional-conversion" # Too many warnings for now
>   nw="$nw -Wmissing-noreturn"       # Too many warnings for now
>   nw="$nw -Wunreachable-code"       # Too many false positives
>   nw="$nw -Wlogical-op"             # Too many false positives
>
>   gl_MANYWARN_ALL_GCC([ws])
>   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
>   for w in $ws; do
>     gl_WARN_ADD([$w])
>   done
>
>   gl_WARN_ADD([-Wno-format])
>   gl_WARN_ADD([-Wno-missing-field-initializers])
>   gl_WARN_ADD([-fdiagnostics-show-option])
> fi
>
> note the different variables, WERROR_CFLAGS, WSTACK_CFLAGS and
> WARN_CFLAGS.  Then I can use $(WERROR_CFLAGS) $(WARN_CFLAGS)
> $(WSTACK_CFLAGS) on my own code, and typically $(WARN_CFLAGS) on gnulib
> code or similar.

I use the same idea (probably got it from you ;-):

I've found that handy when some condition triggers a new warning,
yet I want to link in spite of that.  In that case, it's trivial to
retain the warnings without -Werror:
Just add WERROR_CFLAGS= to your "make" invocation line.

If you simply append -Werror onto the variable that has
all of the other warning options, it's not as convenient.

Reply via email to