diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-08 03:03:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-08 03:03:23 +0000 |
commit | ab7b2f5623343fa4a2928b91cccbdb244fe77764 (patch) | |
tree | b89e52df3fb38b8af5066d2768b80863c0f1c4fd /clang/lib/Lex/Preprocessor.cpp | |
parent | a60cbcdfe6725a58078a46fd4bd88321ab75a754 (diff) | |
download | bcm5719-llvm-ab7b2f5623343fa4a2928b91cccbdb244fe77764.tar.gz bcm5719-llvm-ab7b2f5623343fa4a2928b91cccbdb244fe77764.zip |
Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
updated driver to pass this.
- Added __pic__
- Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).
llvm-svn: 68584
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 139f310e7d1..d3d5b8c3fd1 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -497,8 +497,10 @@ static void InitializePredefinedMacros(Preprocessor &PP, if (PP.getLangOptions().ObjC1) { DefineBuiltinMacro(Buf, "__OBJC__=1"); - if (PP.getLangOptions().ObjCNonFragileABI) + if (PP.getLangOptions().ObjCNonFragileABI) { DefineBuiltinMacro(Buf, "__OBJC2__=1"); + DefineBuiltinMacro(Buf, "OBJC_ZEROCOST_EXCEPTIONS=1"); + } if (PP.getLangOptions().getGCMode() != LangOptions::NonGC) DefineBuiltinMacro(Buf, "__OBJC_GC__=1"); @@ -629,7 +631,14 @@ static void InitializePredefinedMacros(Preprocessor &PP, DefineBuiltinMacro(Buf, "__DYNAMIC__=1"); DefineBuiltinMacro(Buf, "__FINITE_MATH_ONLY__=0"); DefineBuiltinMacro(Buf, "__NO_INLINE__=1"); - DefineBuiltinMacro(Buf, "__PIC__=1"); + + if (unsigned PICLevel = PP.getLangOptions().PICLevel) { + sprintf(MacroBuf, "__PIC__=%d", PICLevel); + DefineBuiltinMacro(Buf, MacroBuf); + + sprintf(MacroBuf, "__pic__=%d", PICLevel); + DefineBuiltinMacro(Buf, MacroBuf); + } // Macros to control C99 numerics and <float.h> DefineBuiltinMacro(Buf, "__FLT_EVAL_METHOD__=0"); |