diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-12-01 01:15:54 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-12-01 01:15:54 +0000 |
| commit | fe9d110f3a3cb7488cd74b7e2eb89b16d9ba22d3 (patch) | |
| tree | aecd3957f95cec746138336ab66390e23d79c6c5 /clang/test | |
| parent | da2b6b381a0c7410895d367f4c1fc4f18ffa7d97 (diff) | |
| download | bcm5719-llvm-fe9d110f3a3cb7488cd74b7e2eb89b16d9ba22d3.tar.gz bcm5719-llvm-fe9d110f3a3cb7488cd74b7e2eb89b16d9ba22d3.zip | |
Try to make the source location information for token pastes a bit more consistent.
Fixes a crash printing diagnostics on the gcc testsuite, and also makes
diagnostic range printing print nicer results for token pastes.
llvm-svn: 169068
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Misc/caret-diags-macros.c | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/clang/test/Misc/caret-diags-macros.c b/clang/test/Misc/caret-diags-macros.c index a41816f0eed..ce62425e780 100644 --- a/clang/test/Misc/caret-diags-macros.c +++ b/clang/test/Misc/caret-diags-macros.c @@ -113,21 +113,29 @@ void test3() { // CHECK: {{.*}}:102:41: note: expanded from macro 'variadic_pasting_args1' variadic_pasting_args3a(1, 2, 3, 4); - // CHECK: {{.*}}:115:30: warning: expression result unused - // CHECK: {{.*}}:106:71: note: expanded from macro 'variadic_pasting_args3a' - // CHECK: {{.*}}:104:70: note: expanded from macro 'variadic_pasting_args2a' - // CHECK: {{.*}}:102:41: note: expanded from macro 'variadic_pasting_args1' + // CHECK: {{.*}}:115:3: warning: expression result unused + // CHECK-NEXT: variadic_pasting_args3a(1, 2, 3, 4); + // CHECK-NEXT: {{ \^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}} + // CHECK: {{.*}}:106:44: note: expanded from macro 'variadic_pasting_args3a' + // CHECK-NEXT: #define variadic_pasting_args3a(x, y, ...) variadic_pasting_args2a(x, y, __VA_ARGS__) + // CHECK-NEXT: {{ \^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}} + // CHECK: {{.*}}:104:70: note: expanded from macro 'variadic_pasting_args2a' + // CHECK-NEXT: #define variadic_pasting_args2a(x, y, ...) variadic_pasting_args1(x, y ## __VA_ARGS__) + // CHECK-NEXT: {{ \^~~~~~~~~~~~~~~~}} + // CHECK: {{.*}}:102:41: note: expanded from macro 'variadic_pasting_args1' + // CHECK-NEXT: #define variadic_pasting_args1(x, y, z) y + // CHECK-NEXT: {{ \^}} } #define BAD_CONDITIONAL_OPERATOR (2<3)?2:3 int test4 = BAD_CONDITIONAL_OPERATOR+BAD_CONDITIONAL_OPERATOR; -// CHECK: {{.*}}:122:39: note: expanded from macro 'BAD_CONDITIONAL_OPERATOR' +// CHECK: {{.*}}:130:39: note: expanded from macro 'BAD_CONDITIONAL_OPERATOR' // CHECK-NEXT: #define BAD_CONDITIONAL_OPERATOR (2<3)?2:3 // CHECK-NEXT: {{^ \^}} -// CHECK: {{.*}}:122:39: note: expanded from macro 'BAD_CONDITIONAL_OPERATOR' +// CHECK: {{.*}}:130:39: note: expanded from macro 'BAD_CONDITIONAL_OPERATOR' // CHECK-NEXT: #define BAD_CONDITIONAL_OPERATOR (2<3)?2:3 // CHECK-NEXT: {{^ \^}} -// CHECK: {{.*}}:122:39: note: expanded from macro 'BAD_CONDITIONAL_OPERATOR' +// CHECK: {{.*}}:130:39: note: expanded from macro 'BAD_CONDITIONAL_OPERATOR' // CHECK-NEXT: #define BAD_CONDITIONAL_OPERATOR (2<3)?2:3 // CHECK-NEXT: {{^ ~~~~~\^~~~}} @@ -135,32 +143,32 @@ int test4 = BAD_CONDITIONAL_OPERATOR+BAD_CONDITIONAL_OPERATOR; #define TWOL (2< #define X 1+TWOL 3) QMARK 4:5 int x = X; -// CHECK: {{.*}}:137:9: note: place parentheses around the '+' expression to silence this warning +// CHECK: {{.*}}:145:9: note: place parentheses around the '+' expression to silence this warning // CHECK-NEXT: int x = X; // CHECK-NEXT: {{^ \^}} -// CHECK-NEXT: {{.*}}:136:21: note: expanded from macro 'X' +// CHECK-NEXT: {{.*}}:144:21: note: expanded from macro 'X' // CHECK-NEXT: #define X 1+TWOL 3) QMARK 4:5 // CHECK-NEXT: {{^ ~~~~~~~~~ \^}} -// CHECK-NEXT: {{.*}}:134:15: note: expanded from macro 'QMARK' +// CHECK-NEXT: {{.*}}:142:15: note: expanded from macro 'QMARK' // CHECK-NEXT: #define QMARK ? // CHECK-NEXT: {{^ \^}} -// CHECK-NEXT: {{.*}}:137:9: note: place parentheses around the '?:' expression to evaluate it first +// CHECK-NEXT: {{.*}}:145:9: note: place parentheses around the '?:' expression to evaluate it first // CHECK-NEXT: int x = X; // CHECK-NEXT: {{^ \^}} -// CHECK-NEXT: {{.*}}:136:21: note: expanded from macro 'X' +// CHECK-NEXT: {{.*}}:144:21: note: expanded from macro 'X' // CHECK-NEXT: #define X 1+TWOL 3) QMARK 4:5 // CHECK-NEXT: {{^ ~~~~~~~~\^~~~~~~~~}} #define ONEPLUS 1+ #define Y ONEPLUS (2<3) QMARK 4:5 int y = Y; -// CHECK: {{.*}}:156:9: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first +// CHECK: {{.*}}:164:9: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first // CHECK-NEXT: int y = Y; // CHECK-NEXT: {{^ \^}} -// CHECK-NEXT: {{.*}}:155:25: note: expanded from macro 'Y' +// CHECK-NEXT: {{.*}}:163:25: note: expanded from macro 'Y' // CHECK-NEXT: #define Y ONEPLUS (2<3) QMARK 4:5 // CHECK-NEXT: {{^ ~~~~~~~~~~~~~ \^}} -// CHECK-NEXT: {{.*}}:134:15: note: expanded from macro 'QMARK' +// CHECK-NEXT: {{.*}}:142:15: note: expanded from macro 'QMARK' // CHECK-NEXT: #define QMARK ? // CHECK-NEXT: {{^ \^}} @@ -171,9 +179,29 @@ void foo_aa() #define /* */ BARC(c, /* */b, a, ...) (a+b+/* */c + __VA_ARGS__ +0) iequals(__LINE__, BARC(4,3,2,6,8), 8); } -// CHECK: {{.*}}:172:21: warning: expression result unused +// CHECK: {{.*}}:180:21: warning: expression result unused // CHECK-NEXT: iequals(__LINE__, BARC(4,3,2,6,8), 8); // CHECK-NEXT: {{^ \^~~~~~~~~~~~~~~}} -// CHECK-NEXT: {{.*}}:171:51: note: expanded from macro 'BARC' +// CHECK-NEXT: {{.*}}:179:51: note: expanded from macro 'BARC' // CHECK-NEXT: #define /* */ BARC(c, /* */b, a, ...) (a+b+/* */c + __VA_ARGS__ +0) // CHECK-NEXT: {{^ ~~~~~~~~~~ \^}} + +#define APPEND2(NUM, SUFF) -1 != NUM ## SUFF +#define APPEND(NUM, SUFF) APPEND2(NUM, SUFF) +#define UTARG_MAX_U APPEND (MAX_UINT, UL) +#define MAX_UINT 18446744073709551615 +#if UTARG_MAX_U +#endif + +// CHECK: {{.*}}:193:5: warning: left side of operator converted from negative value to unsigned: -1 to 18446744073709551615 +// CHECK-NEXT: #if UTARG_MAX_U +// CHECK-NEXT: {{^ \^~~~~~~~~~~}} +// CHECK-NEXT: {{.*}}:191:21: note: expanded from macro 'UTARG_MAX_U' +// CHECK-NEXT: #define UTARG_MAX_U APPEND (MAX_UINT, UL) +// CHECK-NEXT: {{^ \^~~~~~~~~~~~~~~~~~~~~}} +// CHECK-NEXT: {{.*}}:190:27: note: expanded from macro 'APPEND' +// CHECK-NEXT: #define APPEND(NUM, SUFF) APPEND2(NUM, SUFF) +// CHECK-NEXT: {{^ \^~~~~~~~~~~~~~~~~~}} +// CHECK-NEXT: {{.*}}:189:31: note: expanded from macro 'APPEND2' +// CHECK-NEXT: #define APPEND2(NUM, SUFF) -1 != NUM ## SUFF +// CHECK-NEXT: {{^ ~~ \^ ~~~~~~~~~~~}} |

