Using __STDC_VERSION__ macro

Jonathan Wakely jwakely.gcc@gmail.com
Thu Feb 2 13:52:00 GMT 2017


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.



More information about the Gcc-help mailing list