<div dir="ltr">FWIW I found the "always evaluates to 'true'" bit important to understand the warning.<div><br>We did hit this (at least once) in Chromium after all [1] (looks like a real bug – nothing for you to do about that, and thanks for the warning), and I don't think I would've understood what the warning wanted from me if I hadn't seen the old warning text in the commit.</div><div><br></div><div>[1]: <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=1011810">https://bugs.chromium.org/p/chromium/issues/detail?id=1011810</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 4, 2019 at 8:53 AM David Bolvansky via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: xbolva00<br>
Date: Fri Oct  4 05:55:13 2019<br>
New Revision: 373743<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=373743&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=373743&view=rev</a><br>
Log:<br>
[NFCI] Improve the -Wbool-operation's warning message<br>
<br>
Based on the request from the post commit review. Also added one new test.<br>
<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
    cfe/trunk/test/Sema/warn-bitwise-negation-bool.c<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=373743&r1=373742&r2=373743&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=373743&r1=373742&r2=373743&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Oct  4 05:55:13 2019<br>
@@ -6638,7 +6638,7 @@ def note_member_declared_here : Note<<br>
 def note_member_first_declared_here : Note<<br>
   "member %0 first declared here">;<br>
 def warn_bitwise_negation_bool : Warning<<br>
-  "bitwise negation of a boolean expression always evaluates to 'true'">,<br>
+  "bitwise negation of a boolean expression; did you mean a logicial negation?">,<br>
   InGroup<DiagGroup<"bool-operation">>;<br>
 def err_decrement_bool : Error<"cannot decrement expression of type bool">;<br>
 def warn_increment_bool : Warning<<br>
<br>
Modified: cfe/trunk/test/Sema/warn-bitwise-negation-bool.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-bitwise-negation-bool.c?rev=373743&r1=373742&r2=373743&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-bitwise-negation-bool.c?rev=373743&r1=373742&r2=373743&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Sema/warn-bitwise-negation-bool.c (original)<br>
+++ cfe/trunk/test/Sema/warn-bitwise-negation-bool.c Fri Oct  4 05:55:13 2019<br>
@@ -12,9 +12,11 @@ typedef _Bool boolean;<br>
 #endif<br>
<br>
 void test(boolean b, int i) {<br>
-  b = ~b; // expected-warning {{bitwise negation of a boolean expression always evaluates to 'true'}}<br>
+  b = ~b; // expected-warning {{bitwise negation of a boolean expression; did you mean a logicial negation?}}<br>
   // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:8}:"!"<br>
-  b = ~(b); // expected-warning {{bitwise negation of a boolean expression always evaluates to 'true'}}<br>
+  b = ~(b); // expected-warning {{bitwise negation of a boolean expression; did you mean a logicial negation?}}<br>
   // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:8}:"!"<br>
   b = ~i;<br>
+  i = ~b; // expected-warning {{bitwise negation of a boolean expression; did you mean a logicial negation?}}<br>
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:8}:"!"<br>
 }<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>