summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-27 01:25:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-27 01:25:19 +0000
commit09796b9a2316c7028a79996b731741ca1758b2ca (patch)
tree320164c70966c3278f464aa1bddeea99051725aa /clang/test
parentf5db45bc16938bbd9a2935bd6704498067ec40b5 (diff)
downloadbcm5719-llvm-09796b9a2316c7028a79996b731741ca1758b2ca.tar.gz
bcm5719-llvm-09796b9a2316c7028a79996b731741ca1758b2ca.zip
[modules] Re-enable the "ambiguous expansion of macro" warning.
Also update "test/Modules/macros.c" to test modified semantics: -When there is an ambiguous macro, expand using the latest introduced version, not the first one. -#undefs in submodules cause the macro to not be exported by that submodule, it doesn't cause undefining of macros in the translation unit that imported that submodule. This reduces macro namespace interference across modules. llvm-svn: 178105
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/macros.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/clang/test/Modules/macros.c b/clang/test/Modules/macros.c
index 406e554a7af..c715ec96517 100644
--- a/clang/test/Modules/macros.c
+++ b/clang/test/Modules/macros.c
@@ -1,4 +1,3 @@
-// XFAIL: *
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros_top %S/Inputs/module.map
// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros_left %S/Inputs/module.map
@@ -10,12 +9,12 @@
// 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{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}}
+// expected-note{{other definition of 'TOP_RIGHT_REDEF'}} expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT2'}}
// 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'}}
+
+// expected-note{{expanding this definition of 'TOP_RIGHT_REDEF'}}
@import macros;
@@ -80,8 +79,8 @@ void f() {
# error TOP should be visible
#endif
-#ifdef TOP_LEFT_UNDEF
-# error TOP_LEFT_UNDEF should not be visible
+#ifndef TOP_LEFT_UNDEF
+# error TOP_LEFT_UNDEF should still be defined
#endif
void test1() {
@@ -89,7 +88,8 @@ void test1() {
TOP_RIGHT_REDEF *ip = &i;
}
-#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}}
+#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}} \
+ // expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT2'}}
// Import right module (which also imports top)
@import macros_right;
@@ -112,11 +112,11 @@ void test2() {
int i;
float f;
double d;
- TOP_RIGHT_REDEF *ip = &i; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}}
+ TOP_RIGHT_REDEF *fp = &f; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}}
- LEFT_RIGHT_IDENTICAL *ip2 = &i;
- LEFT_RIGHT_DIFFERENT *fp = &f; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}}
- LEFT_RIGHT_DIFFERENT2 *dp = &d;
+ LEFT_RIGHT_IDENTICAL *ip = &i;
+ LEFT_RIGHT_DIFFERENT *ip2 = &i; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}}
+ LEFT_RIGHT_DIFFERENT2 *ip3 = &i; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT2}}
int LEFT_RIGHT_DIFFERENT3;
}
@@ -133,6 +133,6 @@ void test3() {
@import macros_right.undef;
-#ifdef TOP_RIGHT_UNDEF
-# error TOP_RIGHT_UNDEF should not be defined
+#ifndef TOP_RIGHT_UNDEF
+# error TOP_RIGHT_UNDEF should still be defined
#endif
OpenPOWER on IntegriCloud