[cfe-dev] -Wreserved-id-macro and __STDC_LIMIT_MACROS

Sean McBride sean at rogue-research.com
Thu Dec 11 09:29:44 PST 2014


Hi all,

Updated my clang and discovered the new -Wreserved-id-macro warning.  Tried it against some codebases I use.  Several places do something like:

/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
 * if you want the limit (max/min) macros for int types.
 */
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif

and clang warns:

warning: reserved identifier is used as macro name [-Wreserved-id-macro]
#define __STDC_LIMIT_MACROS
        ^

Some searching suggests that C11 and C++11 no longer need this.  But of course some codebases must work with old stuff.

Could -Wreserved-id-macro whitelist #defining __STDC_LIMIT_MACROS and not warn?

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list