[Bug c++/70275] -w disables all -Werror flags
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 6 20:53:58 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70275
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-07-06
Keywords| |diagnostic
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Let me confirm this bug report, in part because -w is documented to "Inhibit
all warning messages" but it does more than that, and also behaves differently
than Clang, and in my view not intuitively. For example, the following
produces no output with GCC 10:
$ cat q.c && gcc -S -w -Wall -Werror -Wimplicit-int q.c
#pragma GCC diagnostic error "-Wimplicit-int"
f () { }
but reports an error with Clang:
$ clang -S -w -Wall -Werror -Wimplicit-int q.c
q.c:2:1: error: type specifier missing, defaults to 'int'
[-Werror,-Wimplicit-int]
f () { }
^
1 error generated.
The Clang behavior makes more sense to me (it suppresses warnings but not
errors) but if there's some deeper logic in what GCC does it would be helpful
to mention it in the manual.
More information about the Gcc-bugs
mailing list