[cfe-commits] r156033 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td test/SemaCXX/warn-loop-analysis.cpp
Richard Trieu
rtrieu at google.com
Wed May 2 15:48:45 PDT 2012
Author: rtrieu
Date: Wed May 2 17:48:45 2012
New Revision: 156033
URL: http://llvm.org/viewvc/llvm-project?rev=156033&view=rev
Log:
Add commas to for loop warning to separate variable names.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/SemaCXX/warn-loop-analysis.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=156033&r1=156032&r2=156033&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed May 2 17:48:45 2012
@@ -16,7 +16,7 @@
// For loop analysis
def warn_variables_not_in_loop_body : Warning<
- "variable%select{s| %1|s %1 and %2|s %1 %2 and %3|s %1 %2 %3 and %4}0 "
+ "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
"used in loop condition not modified in loop body">,
InGroup<DiagGroup<"loop-analysis">>, DefaultIgnore;
Modified: cfe/trunk/test/SemaCXX/warn-loop-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-loop-analysis.cpp?rev=156033&r1=156032&r2=156033&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-loop-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-loop-analysis.cpp Wed May 2 17:48:45 2012
@@ -83,7 +83,7 @@
for (; i != 3i; ) { ++i; }
// Testing ConditionalOperator
- for (; i ? j : k; ) {} // expected-warning {{variables 'i' 'j' and 'k' used in loop condition not modified in loop body}}
+ for (; i ? j : k; ) {} // expected-warning {{variables 'i', 'j', and 'k' used in loop condition not modified in loop body}}
for (; i ? j : k; ) { ++i; }
for (; i ? j : k; ) { ++j; }
for (; i ? j : k; ) { ++k; }
@@ -124,12 +124,12 @@
int a, b, c, d, e, f;
for (; a;); // expected-warning {{variable 'a' used in loop condition not modified in loop body}}
for (; a + b;); // expected-warning {{variables 'a' and 'b' used in loop condition not modified in loop body}}
- for (; a + b + c;); // expected-warning {{variables 'a' 'b' and 'c' used in loop condition not modified in loop body}}
- for (; a + b + c + d;); // expected-warning {{variables 'a' 'b' 'c' and 'd' used in loop condition not modified in loop body}}
+ for (; a + b + c;); // expected-warning {{variables 'a', 'b', and 'c' used in loop condition not modified in loop body}}
+ for (; a + b + c + d;); // expected-warning {{variables 'a', 'b', 'c', and 'd' used in loop condition not modified in loop body}}
for (; a + b + c + d + e;); // expected-warning {{variables used in loop condition not modified in loop body}}
for (; a + b + c + d + e + f;); // expected-warning {{variables used in loop condition not modified in loop body}}
- for (; a + c + d + b;); // expected-warning {{variables 'a' 'c' 'd' and 'b' used in loop condition not modified in loop body}}
- for (; d + c + b + a;); // expected-warning {{variables 'd' 'c' 'b' and 'a' used in loop condition not modified in loop body}}
+ for (; a + c + d + b;); // expected-warning {{variables 'a', 'c', 'd', and 'b' used in loop condition not modified in loop body}}
+ for (; d + c + b + a;); // expected-warning {{variables 'd', 'c', 'b', and 'a' used in loop condition not modified in loop body}}
}
// Ensure that the warning doesn't fail when lots of variables are used
More information about the cfe-commits
mailing list