[llvm-commits] -Wno-maybe-uninitialized not working right with gcc-4.3

David Blaikie dblaikie at gmail.com
Tue Jan 15 09:52:30 PST 2013


On Tue, Jan 15, 2013 at 4:53 AM, Duncan Sands <baldrick at free.fr> wrote:
> Hi David, your -Wno-maybe-uninitialized changes broke one of my buildbots.
> The reason is that gcc-4.3 accepts this flag, however if any kind of warning
> is produced then it errors out saying it doesn't know
> -Wno-maybe-uninitialized.
>
> For example, suppose empty.cpp is an empty file, and warn.cpp contains:
>
>   int foo(int x, unsigned y) {
>     return x == y;
>   }
>
> Then:
>
> $ gcc -S empty.cpp -Wall -Wno-maybe-uninitialized
> $ gcc -S warn.cpp -Wall -Wno-maybe-uninitialized
> warn.cpp: In function ‘int foo(int, unsigned int)’:
> warn.cpp:2: warning: comparison between signed and unsigned integer
> expressions
> At global scope:
> cc1plus: error: unrecognized command line option "-Wno-maybe-uninitialized"
> $
>
> This is clearly a gcc bug.  I don't know what the right approach to solving
> this is though, any suggestions?

Is it a GCC bug? I thought this was documented behavior:

"When an unrecognized warning option is requested (e.g.,
-Wunknown-warning), GCC emits a diagnostic stating that the option is
not recognized. However, if the -Wno- form is used, the behavior is
slightly different: no diagnostic is produced for -Wno-unknown-warning
unless other diagnostics are being produced. This allows the use of
new -Wno- options with old compilers, but if something goes wrong, the
compiler warns that an unrecognized option is present."

(well, the documentation doesn't specify that the diagnostic will be
an error - I would expect a warning, but perhaps there's some other
reason for that difference)




More information about the llvm-commits mailing list