https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86134
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to rguent...@suse.de from comment #4) > fails the compile but with the warning not emitted the error isn't > emitted. Also we do know the warning is guarded by -Wreturn-type > so I see no point in warning that it wasn't silenced by > -Wno-unknown-warning-option? I see what you mean: The warning that could have been silenced did not prevent compilation but the warning about the unknown option did. However, 1) Given -Wno-foo, there is no way to know if you actually meant -Wno-foooo or, -Wfoo is an alias for -Wreturn-type in some other version of GCC. Maybe you really meant to write -Wno-return-type but you mistyped it as -Wno-foo. The current behavior means "There is at least one diagnostic that could have been silenced by -Wno-foo, but this GCC does not recognize -Wfoo, maybe you gave the wrong option?" 2) The warning behaves like any other warning: It gets converted to an error with -Werror. Imagine an example where GCC gives both a warning [-Wfooo] and a warning converted to an error [-Werror=foooo], what should we report for -Wno-fooooo ? We can alleviate (2) by giving it a name (clang uses -Wunknown-warning-option) so that you can do: gcc -S -x c -Wall -Werror -Wno-error=return-type -Wno-error=unknown-warning-option -Wno-foo Another example: gcc -S -x c -Wall -Werror -Wno-misleading-identation -Wno-future If there is no warning emitted, there is no harm in the above -Wno- options. If there is a warning emitted, it will get converted to an error, and GCC does not know if you actually meant -Wno-misleading-indentation. And maybe you really want to use -Wno-future for a future -Wfuture enabled by -Wall, and you don't care but you want the same command-line to work on previous GCC versions so giving an extra warning (or error) or may be you really meant the warning used to be called -Wmisleading-identation, but it got renamed. The long history can be found here: https://gcc.gnu.org/wiki/FAQ#wnowarning