summaryrefslogtreecommitdiff
path: root/test/Preprocessor
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-04-02 08:55:10 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-04-02 08:55:10 +0000
commit11d2b2d2bb706fca0656f2760839721bb7f6cb6f (patch)
treed374cdca417e76f1bf101f139dba2db1d10ee8f7 /test/Preprocessor
parentc0c7bca4e5b8d12699dc93a0da49e9e4bb79671b (diff)
Notes
Diffstat (limited to 'test/Preprocessor')
-rw-r--r--test/Preprocessor/dependencies-and-pp.c26
-rw-r--r--test/Preprocessor/macro_disable.c34
-rw-r--r--test/Preprocessor/macro_disable2.c8
-rw-r--r--test/Preprocessor/macro_disable3.c10
-rw-r--r--test/Preprocessor/macro_disable4.c6
-rw-r--r--test/Preprocessor/output_paste_avoid.c4
6 files changed, 62 insertions, 26 deletions
diff --git a/test/Preprocessor/dependencies-and-pp.c b/test/Preprocessor/dependencies-and-pp.c
index d7bf4df51c81f..7877df3f786e6 100644
--- a/test/Preprocessor/dependencies-and-pp.c
+++ b/test/Preprocessor/dependencies-and-pp.c
@@ -1,5 +1,31 @@
+// Test -MT and -E flags, PR4063
+
// RUN: %clang -E -o %t.1 %s
// RUN: %clang -E -MD -MF %t.d -MT foo -o %t.2 %s
// RUN: diff %t.1 %t.2
// RUN: grep "foo:" %t.d
// RUN: grep "dependencies-and-pp.c" %t.d
+
+// Test -MQ flag without quoting
+
+// RUN: %clang -E -MD -MF %t.d -MQ foo -o %t %s
+// RUN: grep "foo:" %t.d
+
+// Test -MQ flag with quoting
+
+// RUN: %clang -E -MD -MF %t.d -MQ '$fo\ooo ooo\ ooo\\ ooo#oo' -o %t %s
+// RUN: fgrep '$$fo\ooo\ ooo\\\ ooo\\\\\ ooo\#oo:' %t.d
+
+// Test consecutive -MT flags
+
+// RUN: %clang -E -MD -MF %t.d -MT foo -MT bar -MT baz -o %t %s
+// RUN: diff %t.1 %t
+// RUN: fgrep "foo bar baz:" %t.d
+
+// Test consecutive -MT and -MQ flags
+
+// RUN: %clang -E -MD -MF %t.d -MT foo -MQ '$(bar)' -MT 'b az' -MQ 'qu ux' -MQ ' space' -o %t %s
+// RUN: fgrep 'foo $$(bar) b az qu\ ux \ space:' %t.d
+
+// TODO: Test default target without quoting
+// TODO: Test default target with quoting
diff --git a/test/Preprocessor/macro_disable.c b/test/Preprocessor/macro_disable.c
index d6509c35bf2cc..d7859dca77e56 100644
--- a/test/Preprocessor/macro_disable.c
+++ b/test/Preprocessor/macro_disable.c
@@ -1,5 +1,27 @@
-// RUN: %clang_cc1 -E %s | grep 'a: 2 + M_0(3)(4)(5);'
-// RUN: %clang_cc1 -E %s | grep 'b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1);'
+// RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s
+// Check for C99 6.10.3.4p2.
+
+#define f(a) f(x * (a))
+#define x 2
+#define z z[0]
+f(f(z));
+// CHECK: f(2 * (f(2 * (z[0]))));
+
+
+
+#define A A B C
+#define B B C A
+#define C C A B
+A
+// CHECK: A B C A B A C A B C A
+
+
+// PR1820
+#define i(x) h(x
+#define h(x) x(void)
+extern int i(i));
+// CHECK: int i(void)
+
#define M_0(x) M_ ## x
#define M_1(x) x + M_0(0)
@@ -11,3 +33,11 @@
a: M_0(1)(2)(3)(4)(5);
b: M_0(5)(4)(3)(2)(1);
+// CHECK: a: 2 + M_0(3)(4)(5);
+// CHECK: b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1);
+
+#define n(v) v
+#define l m
+#define m l a
+c: n(m) X
+// CHECK: c: m a X
diff --git a/test/Preprocessor/macro_disable2.c b/test/Preprocessor/macro_disable2.c
deleted file mode 100644
index 229cf3264bfe0..0000000000000
--- a/test/Preprocessor/macro_disable2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-// RUN: %clang_cc1 -E %s | grep 'A B C A B A C A B C A'
-
-#define A A B C
-#define B B C A
-#define C C A B
-
-A
-
diff --git a/test/Preprocessor/macro_disable3.c b/test/Preprocessor/macro_disable3.c
deleted file mode 100644
index eab0a5e046311..0000000000000
--- a/test/Preprocessor/macro_disable3.c
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s
-// Check for C99 6.10.3.4p2.
-
-#define f(a) f(x * (a))
-#define x 2
-#define z z[0]
-f(f(z));
-
-// CHECK: f(2 * (f(2 * (z[0]))));
-
diff --git a/test/Preprocessor/macro_disable4.c b/test/Preprocessor/macro_disable4.c
deleted file mode 100644
index 820858c37f640..0000000000000
--- a/test/Preprocessor/macro_disable4.c
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: %clang_cc1 -P -E %s | grep 'int f(void)'
-// PR1820
-
-#define f(x) h(x
-#define h(x) x(void)
-extern int f(f));
diff --git a/test/Preprocessor/output_paste_avoid.c b/test/Preprocessor/output_paste_avoid.c
index 835a921fb7d62..8c6173a78d1d0 100644
--- a/test/Preprocessor/output_paste_avoid.c
+++ b/test/Preprocessor/output_paste_avoid.c
@@ -24,3 +24,7 @@ E: test(str)
// Should expand to L "str" not L"str"
// CHECK: E: L "str"
+// Should avoid producing >>=.
+#define equal =
+F: >>equal
+// CHECK: F: >> =