turn down the logical bitwise confusion warning to not warn
when the RHS of the ||/&& is ever 0 or 1. This handles a variety of
creative idioms for "true" used in C programs and fixes many false
positives at the expense of a few false negatives. This fixes
rdar://8230351.
llvm-svn: 109314
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c
index 9d3da90..56a52be 100644
--- a/clang/test/Sema/exprs.c
+++ b/clang/test/Sema/exprs.c
@@ -145,5 +145,8 @@
int test20(int x) {
return x && 4; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}}
- return x && sizeof(int) == 4; // no warning.
+ return x && sizeof(int) == 4; // no warning, RHS is logical op.
+
+ // no warning, this is an idiom for "true" in old C style.
+ return x && (signed char)1;
}