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

Duncan Sands baldrick at free.fr
Tue Jan 15 23:59:19 PST 2013


Hi David,

On 15/01/13 18:52, David Blaikie wrote:
> 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)

it results in a warning rather than an error with gcc-4.7, gcc-4.6, gcc-4.5
and gcc-4.4.

Ciao, Duncan.



More information about the llvm-commits mailing list