aboutsummaryrefslogtreecommitdiff
path: root/test/Preprocessor
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-03 17:39:30 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-03 17:39:30 +0000
commitbd25ff8632e18bb3af761369fd3b0f1b48fdf061 (patch)
treef90c89c23c1a46c4171646584fcbabe8f70aa66e /test/Preprocessor
parent9f4f5f1ca1e1967daf64d5422717c9b1e75eeb9e (diff)
[preprocessor] Allow comparing two macro definitions syntactically instead of only lexically.
Syntactically means the function macro parameter names do not need to use the same identifiers in order for the definitions to be considered identical. Syntactic equivalence is a microsoft extension for macro redefinitions and we'll also use this kind of comparison to check for ambiguous macros coming from modules. rdar://13562254 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178671 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Preprocessor')
-rw-r--r--test/Preprocessor/macro_misc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Preprocessor/macro_misc.c b/test/Preprocessor/macro_misc.c
index 53d99821cc..3feaa210f7 100644
--- a/test/Preprocessor/macro_misc.c
+++ b/test/Preprocessor/macro_misc.c
@@ -21,3 +21,17 @@
#define FUNC_LIKE3(a) ( a) // expected-note {{previous definition is here}}
#define FUNC_LIKE3(a) (a) // expected-warning {{'FUNC_LIKE3' macro redefined}}
+// RUN: %clang_cc1 -fms-extensions -DMS_EXT %s -Eonly -verify
+#ifndef MS_EXT
+// This should under C99.
+#define FUNC_LIKE4(a,b) (a+b) // expected-note {{previous definition is here}}
+#define FUNC_LIKE4(x,y) (x+y) // expected-warning {{'FUNC_LIKE4' macro redefined}}
+#else
+// This shouldn't under MS extensions.
+#define FUNC_LIKE4(a,b) (a+b)
+#define FUNC_LIKE4(x,y) (x+y)
+
+// This should.
+#define FUNC_LIKE5(a,b) (a+b) // expected-note {{previous definition is here}}
+#define FUNC_LIKE5(x,y) (y+x) // expected-warning {{'FUNC_LIKE5' macro redefined}}
+#endif