diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-10-11 21:07:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-10-11 21:07:39 +0000 |
commit | e8219a655128b98d0573658a139de5d848451fda (patch) | |
tree | fbf31a548eb9eb74a27ff378c4d7eb101c3685c8 /test/Modules/macros.c | |
parent | 42adacbb9bc7b6172bd36f9baa297180c77ab6d7 (diff) |
Diagnose the expansion of ambiguous macro definitions. This can happen
only with modules, when two disjoint modules #define the same
identifier to different token sequences.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules/macros.c')
-rw-r--r-- | test/Modules/macros.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/Modules/macros.c b/test/Modules/macros.c index 168e2c6fce..8f6a20aa93 100644 --- a/test/Modules/macros.c +++ b/test/Modules/macros.c @@ -7,8 +7,14 @@ // RUN: %clang_cc1 -E -fmodules -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s // FIXME: When we have a syntax for modules in C, use that. // These notes come from headers in modules, and are bogus. + // FIXME: expected-note{{previous definition is here}} -// FIXME: expected-note{{previous definition is here}} +// expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT'}} +// expected-note{{expanding this definition of 'TOP_RIGHT_REDEF'}} +// FIXME: expected-note{{previous definition is here}} \ +// expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}} + +// expected-note{{other definition of 'TOP_RIGHT_REDEF'}} @__experimental_modules_import macros; @@ -109,11 +115,11 @@ void test2() { int i; float f; double d; - TOP_RIGHT_REDEF *ip = &i; // FIXME: warning + TOP_RIGHT_REDEF *ip = &i; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}} LEFT_RIGHT_IDENTICAL *ip2 = &i; - LEFT_RIGHT_DIFFERENT *fp = &f; // FIXME: warning - LEFT_RIGHT_DIFFERENT2 *dp = &d; // okay + LEFT_RIGHT_DIFFERENT *fp = &f; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}} + LEFT_RIGHT_DIFFERENT2 *dp = &d; int LEFT_RIGHT_DIFFERENT3; } |