summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/macro-reserved.c
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2014-12-12 06:37:55 +0000
committerSerge Pavlov <sepavloff@gmail.com>2014-12-12 06:37:55 +0000
commit59da7b8a685cdbc8db9da5de9beac3c8803535e9 (patch)
treeddb483ccdad8ec5260a8f487ad3f5d027d79f912 /clang/test/Preprocessor/macro-reserved.c
parent15b8b949180e535c855e7dff5f56690082e29736 (diff)
downloadbcm5719-llvm-59da7b8a685cdbc8db9da5de9beac3c8803535e9.tar.gz
bcm5719-llvm-59da7b8a685cdbc8db9da5de9beac3c8803535e9.zip
Do not warn on keyword undef
#undef a keyword is generally harmless but used often in configuration scripts. Also added tests that I forgot to include to commit in r223114. llvm-svn: 224100
Diffstat (limited to 'clang/test/Preprocessor/macro-reserved.c')
-rw-r--r--clang/test/Preprocessor/macro-reserved.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/macro-reserved.c b/clang/test/Preprocessor/macro-reserved.c
new file mode 100644
index 00000000000..2a0e26f8e3a
--- /dev/null
+++ b/clang/test/Preprocessor/macro-reserved.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+
+#define for 0 // expected-warning {{keyword is hidden by macro definition}}
+#define final 1
+#define __HAVE_X 0
+#define _HAVE_X 0
+#define X__Y
+
+#undef __cplusplus
+#undef _HAVE_X
+#undef X__Y
+
+#pragma clang diagnostic warning "-Wreserved-id-macro"
+
+#define switch if // expected-warning {{keyword is hidden by macro definition}}
+#define final 1
+#define __HAVE_X 0 // expected-warning {{macro name is a reserved identifier}}
+#define _HAVE_X 0 // expected-warning {{macro name is a reserved identifier}}
+#define X__Y
+
+#undef __cplusplus // expected-warning {{macro name is a reserved identifier}}
+#undef _HAVE_X // expected-warning {{macro name is a reserved identifier}}
+#undef X__Y
+
+int x;
OpenPOWER on IntegriCloud