Using __STDC_VERSION__ macro

Mason slash.tmp@free.fr
Thu Feb 2 13:55:00 GMT 2017


On 02/02/2017 14:52, Jonathan Wakely wrote:
> On 2 February 2017 at 13:48, Vincent Lefevre wrote:
>> However, it yields false positives on code that doesn't contain any
>> ambiguity (and is easier to read than lengthier code), such as:
>>
>> #if __STDC_VERSION__ < 199901L
>>
>> Since __STDC_VERSION__ is a standard macro, it is quite obvious that
>> even if __STDC_VERSION__ is not defined, this is not a typo. So, IMHO,
>> -Wundef should whitelist some common macros (and/or perhaps let the
>> user provide his own whitelist).
> 
> Yes, it seems reasonable to not warn for __STDC_VERSION__ in C89 mode.
> 
> If you spell it wrong it won't match the whitelist and so you'll still
> get a warning.

Should we open an enhancement request on the bugzilla?

Regards.



More information about the Gcc-help mailing list