summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAndy Gibbs <andyg1001@hotmail.co.uk>2016-04-01 19:02:20 +0000
committerAndy Gibbs <andyg1001@hotmail.co.uk>2016-04-01 19:02:20 +0000
commit6f8cfccbd36de601b6f35a854cb0dba5b9757495 (patch)
tree4d424e7ba66e2fa8707033736822d609e9efefcb /clang/test
parentdd711b93e0bc525119ef82e4647d2a096ddb624e (diff)
downloadbcm5719-llvm-6f8cfccbd36de601b6f35a854cb0dba5b9757495.tar.gz
bcm5719-llvm-6f8cfccbd36de601b6f35a854cb0dba5b9757495.zip
Diagnose missing macro argument following charize operator.
For completeness, add a test-case for the equivalent stringize operator diagnostic too. llvm-svn: 265177
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Parser/MicrosoftExtensions.c3
-rw-r--r--clang/test/Preprocessor/stringize_misc.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/test/Parser/MicrosoftExtensions.c b/clang/test/Parser/MicrosoftExtensions.c
index e58a7455c08..39ab51f31fa 100644
--- a/clang/test/Parser/MicrosoftExtensions.c
+++ b/clang/test/Parser/MicrosoftExtensions.c
@@ -35,6 +35,9 @@ void test_ms_alignof_alias(void) {
/* Charify extension. */
#define FOO(x) #@x
char x = FOO(a);
+#define HASHAT #@
+#define MISSING_ARG(x) #@
+/* expected-error@-1 {{'#@' is not followed by a macro parameter}} */
typedef enum E { e1 };
diff --git a/clang/test/Preprocessor/stringize_misc.c b/clang/test/Preprocessor/stringize_misc.c
index 6c2c78d17ac..fc7253e5049 100644
--- a/clang/test/Preprocessor/stringize_misc.c
+++ b/clang/test/Preprocessor/stringize_misc.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
+#ifdef TEST1
+// RUN: %clang_cc1 -E %s -DTEST1 | FileCheck -strict-whitespace %s
#define M(x, y) #x #y
@@ -28,3 +29,13 @@ START_END( {a=1 , b=2;} ) /* braces are not parentheses */
M(a COMMA b, (a, b))
// CHECK: "a COMMA b" "(a, b)"
+#endif
+
+#ifdef TEST2
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST2
+
+#define HASH #
+#define INVALID() #
+// expected-error@-1{{'#' is not followed by a macro parameter}}
+
+#endif
OpenPOWER on IntegriCloud