summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp8
-rw-r--r--clang/test/Misc/predefines.c5
-rw-r--r--clang/test/Sema/block-literal.c2
3 files changed, 12 insertions, 3 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));
diff --git a/clang/test/Misc/predefines.c b/clang/test/Misc/predefines.c
new file mode 100644
index 00000000000..c7fac86331a
--- /dev/null
+++ b/clang/test/Misc/predefines.c
@@ -0,0 +1,5 @@
+/* RUN: clang-cc -fsyntax-only -verify -std=c89 -pedantic-errors %s
+ * rdar://6814950
+ */
+#include <stdint.h>
+
diff --git a/clang/test/Sema/block-literal.c b/clang/test/Sema/block-literal.c
index 2c1700a7b71..c6e3931aa82 100644
--- a/clang/test/Sema/block-literal.c
+++ b/clang/test/Sema/block-literal.c
@@ -40,7 +40,7 @@ void test2() {
foo:
takeclosure(^{ x = 4; }); // expected-error {{variable is not assignable (missing __block type specifier)}}
- __block y = 7; // expected-warning {{type specifier missing, defaults to 'int'}}
+ __block y = 7;
takeclosure(^{ y = 8; });
}
OpenPOWER on IntegriCloud