summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/traditional-cpp.c
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-02-21 18:53:19 +0000
committerJordan Rose <jordan_rose@apple.com>2013-02-21 18:53:19 +0000
commitcb8a1aca35ecc33a5adcc0892aa31fb2a7750dc8 (patch)
tree579e2f5e4f7eb40093d7fb178cd34bae92420c05 /clang/test/Preprocessor/traditional-cpp.c
parent50f0c80341bb021501788ac26611cd05bf563252 (diff)
downloadbcm5719-llvm-cb8a1aca35ecc33a5adcc0892aa31fb2a7750dc8.tar.gz
bcm5719-llvm-cb8a1aca35ecc33a5adcc0892aa31fb2a7750dc8.zip
Preprocessor: preserve whitespace in -traditional-cpp mode.
Note that unlike GNU cpp we currently do not preserve whitespace in macros (even in -traditional-cpp mode). <rdar://problem/12897179> llvm-svn: 175778
Diffstat (limited to 'clang/test/Preprocessor/traditional-cpp.c')
-rw-r--r--clang/test/Preprocessor/traditional-cpp.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/clang/test/Preprocessor/traditional-cpp.c b/clang/test/Preprocessor/traditional-cpp.c
index 5fc9ee398ec..72024546ff3 100644
--- a/clang/test/Preprocessor/traditional-cpp.c
+++ b/clang/test/Preprocessor/traditional-cpp.c
@@ -4,9 +4,61 @@
/*
RUN: %clang_cc1 -traditional-cpp %s -E -o %t
- RUN: FileCheck < %t %s
+ RUN: FileCheck -strict-whitespace < %t %s
*/
-/* CHECK: foo // bar
+/* CHECK: {{^}}foo // bar{{$}}
*/
foo // bar
+
+
+/* The lines in this file contain hard tab characters and trailing whitespace;
+ * do not change them! */
+
+/* CHECK: {{^}} indented!{{$}}
+ * CHECK: {{^}}tab separated values{{$}}
+ */
+ indented!
+tab separated values
+
+#define bracket(x) >>>x<<<
+bracket(| spaces |)
+/* CHECK: {{^}}>>>| spaces |<<<{{$}}
+ */
+
+/* This is still a preprocessing directive. */
+# define foo bar
+foo!
+-
+ foo! foo!
+/* CHECK: {{^}}bar!{{$}}
+ * CHECK: {{^}} bar! bar! {{$}}
+ */
+
+/* Deliberately check a leading newline with spaces on that line. */
+
+# define foo bar
+foo!
+-
+ foo! foo!
+/* CHECK: {{^}}bar!{{$}}
+ * CHECK: {{^}} bar! bar! {{$}}
+ */
+
+/* FIXME: -traditional-cpp should not consider this a preprocessing directive
+ * because the # isn't in the first column.
+ */
+ #define foo2 bar
+foo2!
+/* If this were working, both of these checks would be on.
+ * CHECK-NOT: {{^}} #define foo2 bar{{$}}
+ * CHECK-NOT: {{^}}foo2!{{$}}
+ */
+
+/* FIXME: -traditional-cpp should not homogenize whitespace in macros.
+ */
+#define bracket2(x) >>> x <<<
+bracket2(spaces)
+/* If this were working, this check would be on.
+ * CHECK-NOT: {{^}}>>> spaces <<<{{$}}
+ */
OpenPOWER on IntegriCloud