summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-08 18:03:55 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-08 18:03:55 +0000
commit17ddaa677eb84ecc6d91f50f8692bc43513d3aab (patch)
tree8d4923a5c6ec53bfbb5f61d0d524e73ab2577abc /clang/lib/Lex/Preprocessor.cpp
parent8462791237f56e94f2603f605ba357ac810d4a92 (diff)
downloadbcm5719-llvm-17ddaa677eb84ecc6d91f50f8692bc43513d3aab.tar.gz
bcm5719-llvm-17ddaa677eb84ecc6d91f50f8692bc43513d3aab.zip
More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be defined (instead of __DYNAMIC__). - Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz. - Set __NO_INLINE__ following GCC 4.2. - Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2. - Set __EXCEPTIONS for Objective-C NonFragile ABI. - Set __STRICT_ANSI__ for standard conforming modes. - I added a clang style test case in utils for this, but its not particularly portable and I don't think it belongs in the test suite. llvm-svn: 68621
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index d3d5b8c3fd1..452a04ccb3d 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -486,6 +486,10 @@ static void InitializePredefinedMacros(Preprocessor &PP,
DefineBuiltinMacro(Buf, "__STDC_VERSION__=199901L");
else if (0) // STDC94 ?
DefineBuiltinMacro(Buf, "__STDC_VERSION__=199409L");
+
+ // Standard conforming mode?
+ if (!PP.getLangOptions().GNUMode)
+ DefineBuiltinMacro(Buf, "__STRICT_ANSI__=1");
if (PP.getLangOptions().CPlusPlus0x)
DefineBuiltinMacro(Buf, "__GXX_EXPERIMENTAL_CXX0X__");
@@ -500,6 +504,7 @@ static void InitializePredefinedMacros(Preprocessor &PP,
if (PP.getLangOptions().ObjCNonFragileABI) {
DefineBuiltinMacro(Buf, "__OBJC2__=1");
DefineBuiltinMacro(Buf, "OBJC_ZEROCOST_EXCEPTIONS=1");
+ DefineBuiltinMacro(Buf, "__EXCEPTIONS=1");
}
if (PP.getLangOptions().getGCMode() != LangOptions::NonGC)
@@ -628,9 +633,20 @@ static void InitializePredefinedMacros(Preprocessor &PP,
// Build configuration options. FIXME: these should be controlled by
// command line options or something.
- DefineBuiltinMacro(Buf, "__DYNAMIC__=1");
DefineBuiltinMacro(Buf, "__FINITE_MATH_ONLY__=0");
- DefineBuiltinMacro(Buf, "__NO_INLINE__=1");
+
+ if (PP.getLangOptions().Static)
+ DefineBuiltinMacro(Buf, "__STATIC__=1");
+ else
+ DefineBuiltinMacro(Buf, "__DYNAMIC__=1");
+
+ if (PP.getLangOptions().GNUInline)
+ DefineBuiltinMacro(Buf, "__GNUC_GNU_INLINE__=1");
+ else
+ DefineBuiltinMacro(Buf, "__GNUC_STDC_INLINE__=1");
+
+ if (PP.getLangOptions().NoInline)
+ DefineBuiltinMacro(Buf, "__NO_INLINE__=1");
if (unsigned PICLevel = PP.getLangOptions().PICLevel) {
sprintf(MacroBuf, "__PIC__=%d", PICLevel);
OpenPOWER on IntegriCloud