diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2011-06-16 01:05:12 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2011-06-16 01:05:12 +0000 |
| commit | f8e06c96cab87bbb453c55611fc9bfb84e5b22c5 (patch) | |
| tree | 35f077ed16346746c0542b70742f65bc08d01fa4 | |
| parent | 08dc2ba4dfbbc480bdc35452b8d6a33f3f60dee8 (diff) | |
| download | bcm5719-llvm-f8e06c96cab87bbb453c55611fc9bfb84e5b22c5.tar.gz bcm5719-llvm-f8e06c96cab87bbb453c55611fc9bfb84e5b22c5.zip | |
Make the presentation of the warnings on 'x + y ? 1 : 0' a bit more
pretty. In particular this makes it much easier for me to read messages
such as:
x.cc:42: ?: has lower ...
Where I'm inclined to associate the third ':' with a missing column
number, but in fact column numbers have been turned off. Similar
punctuation collisions happened elsewhere as well.
llvm-svn: 133121
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 6 | ||||
| -rw-r--r-- | clang/test/Sema/parentheses.c | 24 | ||||
| -rw-r--r-- | clang/test/Sema/parentheses.cpp | 24 |
3 files changed, 27 insertions, 27 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 00d0e6fab2a..12f5f30b352 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -2757,12 +2757,12 @@ def note_precedence_bitwise_silence : Note< "place parentheses around the %0 expression to silence this warning">; def warn_precedence_conditional : Warning< - "?: has lower precedence than %0; %0 will be evaluated first">, + "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">, InGroup<Parentheses>; def note_precedence_conditional_first : Note< - "place parentheses around the ?: expression to evaluate it first">; + "place parentheses around the '?:' expression to evaluate it first">; def note_precedence_conditional_silence : Note< - "place parentheses around the %0 expression to silence this warning">; + "place parentheses around the '%0' expression to silence this warning">; def warn_logical_instead_of_bitwise : Warning< "use of logical %0 with constant operand; switch to bitwise %1 or " diff --git a/clang/test/Sema/parentheses.c b/clang/test/Sema/parentheses.c index fa3c3c26b04..95e0a930fe8 100644 --- a/clang/test/Sema/parentheses.c +++ b/clang/test/Sema/parentheses.c @@ -42,21 +42,21 @@ void bitwise_rel(unsigned i) { _Bool someConditionFunc(); void conditional_op(int x, int y, _Bool b) { - (void)(x + someConditionFunc() ? 1 : 2); // expected-warning {{?: has lower precedence than +}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the + expression to silence this warning}} + (void)(x + someConditionFunc() ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '+'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '+' expression to silence this warning}} - (void)(x - b ? 1 : 2); // expected-warning {{?: has lower precedence than -}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the - expression to silence this warning}} + (void)(x - b ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '-'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '-' expression to silence this warning}} - (void)(x * (x == y) ? 1 : 2); // expected-warning {{?: has lower precedence than *}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the * expression to silence this warning}} + (void)(x * (x == y) ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '*'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '*' expression to silence this warning}} - (void)(x / !x ? 1 : 2); // expected-warning {{?: has lower precedence than /}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the / expression to silence this warning}} + (void)(x / !x ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '/'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '/' expression to silence this warning}} (void)(x % 2 ? 1 : 2); // no warning diff --git a/clang/test/Sema/parentheses.cpp b/clang/test/Sema/parentheses.cpp index a25f2a0ce7b..c14a671292b 100644 --- a/clang/test/Sema/parentheses.cpp +++ b/clang/test/Sema/parentheses.cpp @@ -4,17 +4,17 @@ bool someConditionFunc(); void conditional_op(int x, int y, bool b) { - (void)(x + someConditionFunc() ? 1 : 2); // expected-warning {{?: has lower precedence than +}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the + expression to silence this warning}} + (void)(x + someConditionFunc() ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '+'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '+' expression to silence this warning}} - (void)(x - b ? 1 : 2); // expected-warning {{?: has lower precedence than -}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the - expression to silence this warning}} + (void)(x - b ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '-'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '-' expression to silence this warning}} - (void)(x * (x == y) ? 1 : 2); // expected-warning {{?: has lower precedence than *}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the * expression to silence this warning}} + (void)(x * (x == y) ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '*'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '*' expression to silence this warning}} } class Stream { @@ -25,7 +25,7 @@ public: }; void f(Stream& s, bool b) { - (void)(s << b ? "foo" : "bar"); // expected-warning {{?: has lower precedence than <<}} \ - // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ - // expected-note {{place parentheses around the << expression to silence this warning}} + (void)(s << b ? "foo" : "bar"); // expected-warning {{operator '?:' has lower precedence than '<<'}} \ + // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ + // expected-note {{place parentheses around the '<<' expression to silence this warning}} } |

