[cfe-dev] Disable GNU defines in Clang?

Jeffrey Walton noloader at gmail.com
Fri Mar 1 13:47:25 PST 2013


Hi All,

I want to disable Clang defining __GNUC__ and friends. Its causing a
few problems in a couple of projects I'm interested in. In addition,
its causes problems in other's work (confer,
https://svn.boost.org/trac/boost/ticket/7473).

$ clang -dM -E -x c /dev/null | grep -i gnu
#define __GNUC_MINOR__ 2
#define __GNUC_PATCHLEVEL__ 1
#define __GNUC_STDC_INLINE__ 1
#define __GNUC__ 4
#define __gnu_linux__ 1

I've been through http://clang.llvm.org/docs/UsersManual.html, and I
don't see an option to request the behavior.

Is there any way to instruct Clang to *not* define GNUC, GNUC_MINOR,
and GNUC_PATCHLEVEL?

Jeff



More information about the cfe-dev mailing list