summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/macro-reserved.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Preprocessor/macro-reserved.cpp')
-rw-r--r--clang/test/Preprocessor/macro-reserved.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/macro-reserved.cpp b/clang/test/Preprocessor/macro-reserved.cpp
new file mode 100644
index 00000000000..8529ddffa1b
--- /dev/null
+++ b/clang/test/Preprocessor/macro-reserved.cpp
@@ -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 // expected-warning {{keyword is hidden by macro definition}}
+#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 // expected-warning {{keyword is hidden by macro definition}}
+#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 // expected-warning {{macro name is a reserved identifier}}
+
+#undef __cplusplus // expected-warning {{macro name is a reserved identifier}}
+#undef _HAVE_X // expected-warning {{macro name is a reserved identifier}}
+#undef X__Y // expected-warning {{macro name is a reserved identifier}}
+
+int x;
OpenPOWER on IntegriCloud