Re: Using __STDC_VERSION__ macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/02/17 14:55, Mason wrote:
> 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.
> 

It would probably also make sense to whitelist the other new __STDC__
macros in cases where they are not defined (either because they don't
exist in earlier standard modes, or because the implementation chooses
not to define them):

__STDC_ISO_10646__
__STDC_MB_MIGHT_NEQ_WC__
__STDC_UTF_16__
__STDC_UTF_32__

and also the conditional feature macros (basically, everything in 6.10.8
of the C11 standards that is not otherwise defined).

There are probably some C++ predefined macros too.






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux