summaryrefslogtreecommitdiff
path: root/test/Preprocessor
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
commit4c8b24812ddcd1dedaca343a6d4e76f91f398981 (patch)
tree137ebebcae16fb0ce7ab4af456992bbd8d22fced /test/Preprocessor
parent5362a71c02e7d448a8ce98cf00c47e353fba5d04 (diff)
Notes
Diffstat (limited to 'test/Preprocessor')
-rw-r--r--test/Preprocessor/assembler-with-cpp.c2
-rw-r--r--test/Preprocessor/macro-multiline.c2
-rw-r--r--test/Preprocessor/macro_fn_comma_swallow.c2
-rw-r--r--test/Preprocessor/macro_paste_mscomment.c4
-rw-r--r--test/Preprocessor/non_fragile_feature.m8
-rw-r--r--test/Preprocessor/non_fragile_feature1.m8
-rw-r--r--test/Preprocessor/pushable-diagnostics.c17
7 files changed, 38 insertions, 5 deletions
diff --git a/test/Preprocessor/assembler-with-cpp.c b/test/Preprocessor/assembler-with-cpp.c
index 2e84ed1a6b073..f7706ca676ce8 100644
--- a/test/Preprocessor/assembler-with-cpp.c
+++ b/test/Preprocessor/assembler-with-cpp.c
@@ -40,7 +40,7 @@
// rdar://6709206
// RUN: grep "5: expanded (" %t &&
#define M4 expanded
-#define M5() M4 ## (
+#define M5() M4 ## (
5: M5()
diff --git a/test/Preprocessor/macro-multiline.c b/test/Preprocessor/macro-multiline.c
index eb15668ce31f7..ba988253b2723 100644
--- a/test/Preprocessor/macro-multiline.c
+++ b/test/Preprocessor/macro-multiline.c
@@ -1,4 +1,4 @@
-// RUN: clang -E %s "-DX=A
+// RUN: clang -E %s "-DX=A &&
// RUN: THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT" > %t &&
// RUN: grep "GOOD: A" %t &&
// RUN: not grep THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT %t
diff --git a/test/Preprocessor/macro_fn_comma_swallow.c b/test/Preprocessor/macro_fn_comma_swallow.c
index e985138a5c44c..d39d4e7841d51 100644
--- a/test/Preprocessor/macro_fn_comma_swallow.c
+++ b/test/Preprocessor/macro_fn_comma_swallow.c
@@ -1,7 +1,7 @@
// Test the GNU comma swallowing extension.
// RUN: clang-cc %s -E | grep 'foo{A, }' &&
// RUN: clang-cc %s -E | grep 'fo2{A,}' &&
-// RUN: clang-cc %s -E | grep '{foo}'
+// RUN: clang-cc %s -E | grep '{foo}' &&
#define X(Y) foo{A, Y}
X()
diff --git a/test/Preprocessor/macro_paste_mscomment.c b/test/Preprocessor/macro_paste_mscomment.c
index b0fc57101c64c..d6ead91068cfb 100644
--- a/test/Preprocessor/macro_paste_mscomment.c
+++ b/test/Preprocessor/macro_paste_mscomment.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -P -E -fms-extensions %s | sed '/^#.\+/d' | tr -d '\n' |
-// RUN: grep '^int foo;int bar;int baz;$' | count 1
+// RUN: clang-cc -P -E -fms-extensions %s | sed '/^#.\+/d' | tr -d '\n' > %t &&
+// RUN: grep '^int foo;int bar;int baz;$' %t | count 1
// This horrible stuff should preprocess into (other than whitespace):
// int foo;
// int bar;
diff --git a/test/Preprocessor/non_fragile_feature.m b/test/Preprocessor/non_fragile_feature.m
new file mode 100644
index 0000000000000..cb6bc012f1c27
--- /dev/null
+++ b/test/Preprocessor/non_fragile_feature.m
@@ -0,0 +1,8 @@
+// RUN: clang-cc -fobjc-nonfragile-abi %s
+#ifndef __has_feature
+#error Should have __has_feature
+#endif
+
+#if !__has_feature(objc_nonfragile_abi)
+#error Non-fragile ABI used for compilation but feature macro not set.
+#endif
diff --git a/test/Preprocessor/non_fragile_feature1.m b/test/Preprocessor/non_fragile_feature1.m
new file mode 100644
index 0000000000000..59f665b546498
--- /dev/null
+++ b/test/Preprocessor/non_fragile_feature1.m
@@ -0,0 +1,8 @@
+// RUN: clang-cc -triple i386-unknown-unknown %s
+#ifndef __has_feature
+#error Should have __has_feature
+#endif
+
+#if __has_feature(objc_nonfragile_abi)
+#error Non-fragile ABI not used for compilation but feature macro set.
+#endif
diff --git a/test/Preprocessor/pushable-diagnostics.c b/test/Preprocessor/pushable-diagnostics.c
new file mode 100644
index 0000000000000..fe55122d66cd1
--- /dev/null
+++ b/test/Preprocessor/pushable-diagnostics.c
@@ -0,0 +1,17 @@
+// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+
+#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
+
+#pragma clang diagnostic puhs // expected-warning{{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal' 'push', or 'pop'}}
+
+char a = 'df'; // expected-warning{{multi-character character constant}}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wmultichar"
+
+char b = 'df'; // no warning.
+#pragma clang diagnostic pop
+
+char c = 'df'; // expected-warning{{multi-character character constant}}
+
+#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}