summaryrefslogtreecommitdiff
path: root/clang/test/Preprocessor/warn-disabled-macro-expansion.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Preprocessor/warn-disabled-macro-expansion.c')
-rw-r--r--clang/test/Preprocessor/warn-disabled-macro-expansion.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/warn-disabled-macro-expansion.c b/clang/test/Preprocessor/warn-disabled-macro-expansion.c
new file mode 100644
index 0000000..fe8e90c
--- /dev/null
+++ b/clang/test/Preprocessor/warn-disabled-macro-expansion.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -E -Wdisabled-macro-expansion -verify
+
+#define p p
+
+#define a b
+#define b a
+
+#define f(a) a
+
+#define g(b) a
+
+#define h(x) i(x)
+#define i(y) i(y)
+
+#define c(x) x(0)
+
+p // expected-warning {{recursive macro}}
+
+a // expected-warning {{recursive macro}}
+
+f(2)
+
+g(3) // expected-warning {{recursive macro}}
+
+h(0) // expected-warning {{recursive macro}}
+
+c(c) // expected-warning {{recursive macro}}