<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 5, 2016 at 3:56 PM Chris Peterson via cfe-users <<a href="mailto:cfe-users@lists.llvm.org">cfe-users@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I suppressed a -Wunreachable-code warning in Firefox earlier this year<br>
[1] by adding extra parentheses, as suggested by Xcode's clang on OS X:<br>
<br>
objdir-osx/dom/bindings/TestJSImplGenBinding.cpp:47639:20: note: silence<br>
by adding parentheses to mark code as explicitly dead<br>
if (false && !CallerSubsumes(temp)) {<br>
^<br>
/* DISABLES CODE */ ()<br>
<br>
This is generated C++ code in Firefox, so changing the code generator to<br>
emit the extra parentheses was easier than complicating the code<br>
generator's logic for this particular case.<br>
<br>
Unfortunately, this Firefox warning is back [2] because clang 3.9 on<br>
Linux no longer recognizes the parentheses suppression. Is this an<br>
intentional change to -Wunreachable-code or a regression? I don't see<br>
the warning string "silence by adding parentheses to mark code as<br>
explicitly dead" in the clang code on GitHub [3], but I see a few clang<br>
tests that appear to expect that warning string.<br></blockquote><div><br></div><div>The string is here: <a href="https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/DiagnosticSemaKinds.td#L499">https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/DiagnosticSemaKinds.td#L499</a><br><br>Should still work. Nearest I could test seems to:<br><br><pre style="line-height:normal">blaikie@blaikie-linux:/tmp/dbginfo$ cat suppress.cpp
void f1();
bool f2(int);
void f3(int temp) {
if (false && !f2(temp))
f1();
}
blaikie@blaikie-linux:/tmp/dbginfo$ clang++-tot suppress.cpp -Wunreachable-code -fsyntax-only
suppress.cpp:5:5: warning: code will never be executed [-Wunreachable-code]
f1();
^~
suppress.cpp:4:16: note: silence by adding parentheses to mark code as explicitly dead
if (false && !f2(temp))
^
/* DISABLES CODE */ ( )
suppress.cpp:4:17: warning: code will never be executed [-Wunreachable-code]
if (false && !f2(temp))
^~
suppress.cpp:4:7: note: silence by adding parentheses to mark code as explicitly dead
if (false && !f2(temp))
^
/* DISABLES CODE */ ( )
2 warnings generated.
Then successfully suppressed:
<pre style="top: -99px;">blaikie@blaikie-linux:/tmp/dbginfo$ cat suppress.cpp
void f1();
bool f2(int);
void f3(int temp) {
if ((false) && !f2(temp))
f1();
}
blaikie@blaikie-linux:/tmp/dbginfo$ clang++-tot suppress.cpp -Wunreachable-code -fsyntax-only
blaikie@blaikie-linux:/tmp/dbginfo$ </pre>
That's with Clang from trunk/current SVN/git/etc.
Could you provide a small example that fails (warns/doesn't suppress) with 3.9/ToT but succeeds (successfully suppresses the warning) with earlier?</pre></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
thanks,<br>
chris<br>
<br>
[1] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1223265" rel="noreferrer" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=1223265</a><br>
[2] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1291397" rel="noreferrer" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=1291397</a><br>
[3] <a href="https://github.com/llvm-mirror/clang" rel="noreferrer" target="_blank">https://github.com/llvm-mirror/clang</a><br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
</blockquote></div></div>