https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87161

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Nir Aizik from comment #3)
> I think what make it counter-intuitive is that warning from valid option the
> order of Werror is not important

Warnings from the code can't be emitted until compilation starts, and all
options have to be processed before that starts. The -Werror has already been
seen before compilation starts, so warnings have been turned into errors by the
time compiler warnings are emitted.

> Another thing that is troubling is when there is 2 Werror, before and after,
> it will output only warning
> 
> g++ -c -Werror -Wmissing-prototypes -Werror test.cpp -o test.o
> cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for
> C/ObjC but not for C++

That's weird, yes. I think when there are duplicates only the last one has an
effect, and so the first one (before the invalid -Wmissing-prototypes) is
ignored.

Reply via email to