As reported by Christophe Fergeau and others, use of the
warnings modules is awkward when probing for negative
warning flags. For example, clang recognizes
-Wno-unused-command-line-argument, but gcc does not;
gcc silently ignores unknown warnings in isolation, but when
something else also causes a compilation problem, gcc then
compounds the overall message by also complaining about the
unrecongized command line option at that time. The gcc manual
documents that this behavior is intentional so that someone
can add a -Wno-foo silencer to CFLAGS for a warning that older
gcc does not understand, and where the warning is undesired
under newer gcc; it also documents that probing for the -Wfoo
positive form of the error is a reliable way to tell if the
negative form will actually suppress anything. Clang will
warn for both positive and negative forms of an unknown
option.
Since common usage includes:
for w in $list; do
gl_WARN_ADD([$w])
done
the solution must be polymorphic to work on both m4 literals
and shell variables (similar to AS_VAR_SET polymorphism).
* m4/warnings.m4 (gl_COMPILER_OPTION_IF): If name begins with
-Wno-, test if the compiler recognizes the positive form instead.