summaryrefslogtreecommitdiffstats
path: root/test/Preprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'test/Preprocessor')
-rw-r--r--test/Preprocessor/include-directive2.c2
-rw-r--r--test/Preprocessor/init.c2
-rw-r--r--test/Preprocessor/macro_paste_bad.c1
-rw-r--r--test/Preprocessor/macro_paste_hashhash.c6
-rw-r--r--test/Preprocessor/macro_paste_simple.c13
-rw-r--r--test/Preprocessor/pragma_diagnostic_output.c26
-rw-r--r--test/Preprocessor/warn-macro-unused.c5
-rw-r--r--test/Preprocessor/warn-macro-unused.h1
8 files changed, 50 insertions, 6 deletions
diff --git a/test/Preprocessor/include-directive2.c b/test/Preprocessor/include-directive2.c
index 5f1ee3c..b1a9940 100644
--- a/test/Preprocessor/include-directive2.c
+++ b/test/Preprocessor/include-directive2.c
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s
-# define HEADER <float.h>
+# define HEADER <stdarg.h>
# include HEADER
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index b0515b3..f0920c9 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -15,7 +15,7 @@
// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1
// CXX0X:#define __GXX_RTTI 1
// CXX0X:#define __GXX_WEAK__ 1
-// CXX0X:#define __cplusplus 199711L
+// CXX0X:#define __cplusplus 201103L
// CXX0X:#define __private_extern__ extern
//
//
diff --git a/test/Preprocessor/macro_paste_bad.c b/test/Preprocessor/macro_paste_bad.c
index 2af0173..0a028a4 100644
--- a/test/Preprocessor/macro_paste_bad.c
+++ b/test/Preprocessor/macro_paste_bad.c
@@ -32,4 +32,3 @@ XX // expected-error {{attempt to use a poisoned identifier}}
#define VA __VA_ ## ARGS__
int VA; // expected-warning {{__VA_ARGS__ can only appear in the expansion of a C99 variadic macro}}
-
diff --git a/test/Preprocessor/macro_paste_hashhash.c b/test/Preprocessor/macro_paste_hashhash.c
index e7993cc..f4b03be 100644
--- a/test/Preprocessor/macro_paste_hashhash.c
+++ b/test/Preprocessor/macro_paste_hashhash.c
@@ -1,7 +1,11 @@
-// RUN: %clang_cc1 -E %s | grep '^"x ## y";$'
+// RUN: %clang_cc1 -E %s | FileCheck %s
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
#define join(c, d) in_between(c hash_hash d)
+// CHECK: "x ## y";
join(x, y);
+#define FOO(x) A x B
+// CHECK: A ## B;
+FOO(##);
diff --git a/test/Preprocessor/macro_paste_simple.c b/test/Preprocessor/macro_paste_simple.c
index 563d7f4..0e62ba4 100644
--- a/test/Preprocessor/macro_paste_simple.c
+++ b/test/Preprocessor/macro_paste_simple.c
@@ -1,5 +1,14 @@
-// RUN: %clang_cc1 %s -E | grep "barbaz123"
+// RUN: %clang_cc1 %s -E | FileCheck %s
#define FOO bar ## baz ## 123
-FOO
+// CHECK: A: barbaz123
+A: FOO
+
+// PR9981
+#define M1(A) A
+#define M2(X) X
+B: M1(M2(##))
+
+// CHECK: B: ##
+
diff --git a/test/Preprocessor/pragma_diagnostic_output.c b/test/Preprocessor/pragma_diagnostic_output.c
new file mode 100644
index 0000000..e847107
--- /dev/null
+++ b/test/Preprocessor/pragma_diagnostic_output.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -E %s | FileCheck %s
+// CHECK: #pragma GCC diagnostic warning "-Wall"
+#pragma GCC diagnostic warning "-Wall"
+// CHECK: #pragma GCC diagnostic ignored "-Wall"
+#pragma GCC diagnostic ignored "-Wall"
+// CHECK: #pragma GCC diagnostic error "-Wall"
+#pragma GCC diagnostic error "-Wall"
+// CHECK: #pragma GCC diagnostic fatal "-Wall"
+#pragma GCC diagnostic fatal "-Wall"
+// CHECK: #pragma GCC diagnostic push
+#pragma GCC diagnostic push
+// CHECK: #pragma GCC diagnostic pop
+#pragma GCC diagnostic pop
+
+// CHECK: #pragma clang diagnostic warning "-Wall"
+#pragma clang diagnostic warning "-Wall"
+// CHECK: #pragma clang diagnostic ignored "-Wall"
+#pragma clang diagnostic ignored "-Wall"
+// CHECK: #pragma clang diagnostic error "-Wall"
+#pragma clang diagnostic error "-Wall"
+// CHECK: #pragma clang diagnostic fatal "-Wall"
+#pragma clang diagnostic fatal "-Wall"
+// CHECK: #pragma clang diagnostic push
+#pragma clang diagnostic push
+// CHECK: #pragma clang diagnostic pop
+#pragma clang diagnostic pop
diff --git a/test/Preprocessor/warn-macro-unused.c b/test/Preprocessor/warn-macro-unused.c
index 8a6d7c2..c33aeb5 100644
--- a/test/Preprocessor/warn-macro-unused.c
+++ b/test/Preprocessor/warn-macro-unused.c
@@ -1,5 +1,10 @@
// RUN: %clang_cc1 %s -Wunused-macros -Dfoo -Dfoo -verify
+#include "warn-macro-unused.h"
+
#define unused // expected-warning {{macro is not used}}
#define unused
unused
+
+// rdar://9745065
+#undef unused_from_header // no warning
diff --git a/test/Preprocessor/warn-macro-unused.h b/test/Preprocessor/warn-macro-unused.h
new file mode 100644
index 0000000..0c2c267
--- /dev/null
+++ b/test/Preprocessor/warn-macro-unused.h
@@ -0,0 +1 @@
+#define unused_from_header
OpenPOWER on IntegriCloud