https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114117
Bug ID: 114117
Summary: -Wno-foo handling
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pto at linuxbog dot dk
Target Milestone: ---
I have worked a lot with clang and gcc compilers for many years, with focus on
C and C++.
It we take something really simple
int f()
{
int x = 1;
return x;
}
and compile with Gcc 13.2 - all fine -> see https://godbolt.org/z/Wxqxzzj1G
However if I then add a "-Wno-" pattern e.g. -Wno-comment I still have a clean
compilation -> https://godbolt.org/z/j5Yf5ozqo
Let me then try to ignore an unknown option "-Wno-petertoft" for the same code
then surprisingly gcc is happy - see https://godbolt.org/z/efxGzhcM1
If I try the same with clang 17 then clang returns the expected
warning: unknown warning option '-Wno-petertoft'; did you mean '-Wno-selector'?
[-Wunknown-warning-option]
See https://godbolt.org/z/TvbzWPaPP
When working with large code-bases with differerent origin, it is quite
challenging to have the silent gcc behaviur that -Wno-say-hello-to-rms-from-me
is silently dropped. The clang behaviour is much more consistent if you ask me.
Can gcc adopt the clang-style of giving a warning if -Wno-<option> is used for
cases where -W<option> does not exist?