]> granicus.if.org Git - clang/commitdiff
Add test coverage for recent behavior change in GNU line marker pre-processing
authorReid Kleckner <rnk@google.com>
Tue, 23 May 2017 16:09:13 +0000 (16:09 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 23 May 2017 16:09:13 +0000 (16:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303642 91177308-0d34-0410-b5e6-96231b3b80d8

test/Frontend/Inputs/SystemHeaderPrefix/line-directive-in-system.h [moved from test/Frontend/Inputs/SystemHeaderPrefix/line.h with 100% similarity]
test/Frontend/Inputs/line-directive.h [new file with mode: 0644]
test/Frontend/system-header-line-directive.c
test/Preprocessor/line-directive-output.c

diff --git a/test/Frontend/Inputs/line-directive.h b/test/Frontend/Inputs/line-directive.h
new file mode 100644 (file)
index 0000000..e05e9f5
--- /dev/null
@@ -0,0 +1,2 @@
+#line 10 "foo.h"
+foo(); // will warn if not treated as a system header
index 16dde643a5b0ba796ae8a3f9b0046924c898fce1..9d4f09885f941afbb9a5107626be30529ef2684e 100644 (file)
@@ -1,20 +1,23 @@
-// RUN: %clang_cc1 -Wall %s -isystem %S/Inputs/SystemHeaderPrefix -verify
-// RUN: %clang_cc1 %s -E -o - -isystem %S/Inputs/SystemHeaderPrefix | FileCheck %s
+// RUN: %clang_cc1 -Wall %s -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix -verify
+// RUN: %clang_cc1 %s -E -o - -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix | FileCheck %s
 #include <noline.h>
-#include <line.h>
+#include <line-directive-in-system.h>
+
+// expected-warning@line-directive.h:* {{type specifier missing, defaults to 'int'}}
+#include "line-directive.h"
 
 // This tests that "#line" directives in system headers preserve system
 // header-ness just like GNU line markers that don't have filenames.  This was
 // PR30752.
 
-// expected-no-diagnostics
-
 // CHECK: # {{[0-9]+}} "{{.*}}system-header-line-directive.c" 2
 // CHECK: # 1 "{{.*}}noline.h" 1 3
 // CHECK: foo();
 // CHECK: # 4 "{{.*}}system-header-line-directive.c" 2
-// CHECK: # 1 "{{.*}}line.h" 1 3
+// CHECK: # 1 "{{.*}}line-directive-in-system.h" 1 3
 //      The "3" below indicates that "foo.h" is considered a system header.
 // CHECK: # 1 "foo.h" 3
 // CHECK: foo();
 // CHECK: # {{[0-9]+}} "{{.*}}system-header-line-directive.c" 2
+// CHECK: # 1 "{{.*}}line-directive.h" 1
+// CHECK: # 10 "foo.h"{{$}}
index 5c0aef8b32198eaa04b9cf6fbd4f1f5fc4849791..caeb88dd855cc60059174c0a1d08f3922e974682 100644 (file)
@@ -76,3 +76,10 @@ extern int z;
 
 // CHECK: # 50 "a\n.c"
 # 50 "a\012.c"
+
+# 1 "system.h" 3
+# 2
+void sys_foo(void);
+// CHECK: # 1 "system.h" 3
+// CHECK-NEXT: # 2 "system.h" 3
+// CHECK-NEXT: void sys_foo(void);