diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-22 03:42:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-22 03:42:19 +0000 |
commit | ed462a8d4434d6abb9451a542cfc9621164ea382 (patch) | |
tree | dbd3e40fd2df05d55a3aa3bb88a59dc4bc304637 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 2dfdb3ea946f95f3a1cbf6ad94173a9cfc527333 (diff) | |
download | bcm5719-llvm-ed462a8d4434d6abb9451a542cfc9621164ea382.tar.gz bcm5719-llvm-ed462a8d4434d6abb9451a542cfc9621164ea382.zip |
Fix rdar://6814950 - stdint.h isn't "-pedantic -std=c89" clean,
by marking the predefines buffer as a system header. The problem
with stdint is that it was getting problems like this:
/Volumes/Projects/cvs/llvm/Debug/lib/clang/1.0/include/stdint.h:43:9: warning: 'long long' is an extension when C99 mode is not enabled
typedef __INT64_TYPE__ int64_t;
^
<built-in>:73:29: note: instantiated from:
#define __INT64_TYPE__ long long
^
We correctly silence warnings in system headers, but only if the
spelling location of the token came from the system header. This is
designed so that if you use a system macro in your code that you don't
get punished for its definition. This is all cool except that the
predefines buffer wasn't considered a system header.
llvm-svn: 69770
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 9cc83ef2193..746eba9cf2b 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -417,13 +417,17 @@ bool InitializePreprocessor(Preprocessor &PP, const PreprocessorInitOptions& InitOpts) { std::vector<char> PredefineBuffer; + const char *LineDirective = "# 1 \"<built-in>\" 3\n"; + PredefineBuffer.insert(PredefineBuffer.end(), + LineDirective, LineDirective+strlen(LineDirective)); + // Install things like __POWERPC__, __GNUC__, etc into the macro table. InitializePredefinedMacros(PP.getTargetInfo(), PP.getLangOptions(), PredefineBuffer); // Add on the predefines from the driver. Wrap in a #line directive to report // that they come from the command line. - const char *LineDirective = "# 1 \"<command line>\" 1\n"; + LineDirective = "# 1 \"<command line>\" 1\n"; PredefineBuffer.insert(PredefineBuffer.end(), LineDirective, LineDirective+strlen(LineDirective)); @@ -451,7 +455,7 @@ bool InitializePreprocessor(Preprocessor &PP, AddImplicitInclude(PredefineBuffer, I->first); } - LineDirective = "# 2 \"<built-in>\" 2\n"; + LineDirective = "# 2 \"<built-in>\" 2 3\n"; PredefineBuffer.insert(PredefineBuffer.end(), LineDirective, LineDirective+strlen(LineDirective)); |