-Wno-deprecated flag not working?

Peter Rockett p.rockett@sheffield.ac.uk
Thu Nov 12 09:59:00 GMT 2009


>> I am trying to compile the simple program:
>>
>>
>> int main()
>> {
>>        char* x[] = {"hello", "my", "boy"};
>>        return 0;
>> }
>>
>> and I get a warning: deprecated conversion from string constant to
>> ‘char*’. (OK - I expect that.) But when I add the -Wno-deprecated flag
>> to the command line I still get the warning. The -Wno-deprecated flag
>> does not seem to be suppressing the warning.
>>
>> Even odder, the latest MinGW port (version 4.4.0) doesn't report any
>> warning, even without the compiler flag!
>>
>> Am I missing something?
>>
>> (Actually, I am trying to compile something with loads of embedded XPM
>> files which graphics programs produce in the style above. I don't want
>> to edit any of these, just suppress the ~1000 compilation warnings I'm
> getting.)
>>
>> BTW: Ubuntu 9.10 and gcc 4.4.2
>>
>> Peter


Alexey Salmin wrote:

>That's strange. According to documentation (as far as I get it) this
>warning is enabled by option '-Wwrite-strings' which is not even
>included in -Wall.



Alexey

Thanks for the response. I get this problem even when I don't use '-Wall'.

Replacing '-Wno-deprecated' with '-Wno-write-strings' certainly suppresses the warnings. 
Maybe some deprecated features are more deprecated than others!? But it's puzzling behaviour.

Peter





More information about the Gcc-help mailing list