summaryrefslogtreecommitdiffstats
path: root/test/Preprocessor/traditional-cpp.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Preprocessor/traditional-cpp.c')
-rw-r--r--test/Preprocessor/traditional-cpp.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/test/Preprocessor/traditional-cpp.c b/test/Preprocessor/traditional-cpp.c
index 4c4633e..aa9f0f1 100644
--- a/test/Preprocessor/traditional-cpp.c
+++ b/test/Preprocessor/traditional-cpp.c
@@ -3,9 +3,9 @@
* things like using /usr/bin/cpp to preprocess non-source files. */
/*
- RUN: %clang_cc1 -traditional-cpp %s -E -o %t
- RUN: FileCheck -strict-whitespace < %t %s
+ RUN: %clang_cc1 -traditional-cpp %s -E | FileCheck -strict-whitespace %s
RUN: %clang_cc1 -traditional-cpp %s -E -C | FileCheck -check-prefix=CHECK-COMMENTS %s
+ RUN: %clang_cc1 -traditional-cpp -x c++ %s -E | FileCheck -check-prefix=CHECK-CXX %s
*/
/* -traditional-cpp should eliminate all C89 comments. */
@@ -13,7 +13,9 @@
* CHECK-COMMENTS: {{^}}/* -traditional-cpp should eliminate all C89 comments. *{{/$}}
*/
+/* -traditional-cpp should only eliminate "//" comments in C++ mode. */
/* CHECK: {{^}}foo // bar{{$}}
+ * CHECK-CXX: {{^}}foo {{$}}
*/
foo // bar
@@ -88,3 +90,20 @@ a b c in skipped block
Preserve URLs: http://clang.llvm.org
/* CHECK: {{^}}Preserve URLs: http://clang.llvm.org{{$}}
*/
+
+/* The following tests ensure we ignore # and ## in macro bodies */
+
+#define FOO_NO_STRINGIFY(a) test(# a)
+FOO_NO_STRINGIFY(foobar)
+/* CHECK: {{^}}test(# foobar){{$}}
+ */
+
+#define FOO_NO_PASTE(a, b) test(b##a)
+FOO_NO_PASTE(foo,bar)
+/* CHECK {{^}}test(bar##foo){{$}}
+ */
+
+#define BAR_NO_STRINGIFY(a) test(#a)
+BAR_NO_STRINGIFY(foobar)
+/* CHECK: {{^}}test(#foobar){{$}}
+ */
OpenPOWER on IntegriCloud