summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/line-directive.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Preprocessor/line-directive.c')
-rw-r--r--clang/test/Preprocessor/line-directive.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/line-directive.c b/clang/test/Preprocessor/line-directive.c
index 6946ad48545..0a4b5822392 100644
--- a/clang/test/Preprocessor/line-directive.c
+++ b/clang/test/Preprocessor/line-directive.c
@@ -34,3 +34,23 @@
#error ABC // expected-error {{#error ABC}}
#error DEF // expected-error {{#error DEF}}
+
+// Verify that linemarker diddling of the system header flag works.
+
+# 192 "glomp.h" // not a system header.
+typedef int x; // expected-note {{previous definition is here}}
+typedef int x; // expected-error {{redefinition of 'x'}}
+
+# 192 "glomp.h" 3 // System header.
+typedef int y; // ok
+typedef int y; // ok
+
+#line 42 "blonk.h" // doesn't change system headerness.
+
+typedef int z; // ok
+typedef int z; // ok
+
+# 42 "blonk.h" // DOES change system headerness.
+
+typedef int w; // expected-note {{previous definition is here}}
+typedef int w; // expected-error {{redefinition of 'w'}}
OpenPOWER on IntegriCloud