<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang spams a -Wunreachable-code warning for some Firefox code that it didn't warn about in 3.8"
   href="https://llvm.org/bugs/show_bug.cgi?id=28994">28994</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang spams a -Wunreachable-code warning for some Firefox code that it didn't warn about in 3.8
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dholbert@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>cpeterson@mozilla.com, dblaikie@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm spinning this off to cover the behavior-difference between clang 3.8 vs 3.9
discussed in <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - -Wunreachable-code warning involving a by value argument with a non-trivial dtor can't be suppressed with extra parentheses"
   href="show_bug.cgi?id=28918">bug 28918</a>.

In the Firefox build process, we have some autogenerated C++ code[1] that looks
like this:
<span class="quote">>  JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());
> [SNIP]
>    if ((false) && !CallerSubsumes(rval)) {
>       ThrowErrorMessage(...etc...)</span >

In clang 3.8, this code compiles just fine.
In clang 3.9, this code triggers an unreachable code warning for the
ThrowErrorMessage call in clang 3.9.  It should not, because the "false" in the
if-condition is wrapped in parens, which is supposed to be a hint that
Wunreachable-code warnings should be suppressed.

My first attempt at minimizing a C++ testcase from this code produced something
that caused the same issue in older clang revisions (and <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - -Wunreachable-code warning involving a by value argument with a non-trivial dtor can't be suppressed with extra parentheses"
   href="show_bug.cgi?id=28918">bug 28918</a> is filed on
that long-standing bug)  So, I'm still not exactly sure what exact conditions
are involved in the 3.8-3.9 behavior-change here.

HOWEVER, I did try bisecting the clang source to find the first SVN revision
that exhibits the problem.  That first revision is r273312:
 <a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=273312">http://llvm.org/viewvc/llvm-project?view=revision&revision=273312</a>

If I check out & build the previous revision of clang (273311), I do not
encounter this error when building Firefox.  But with 273312, I do encounter
this error.

[1] The autogenerated C++ code in question here is
$OBJ/dom/bindings/TestCodeGenBinding.cpp ($OBJ is the object directory, i.e.
where files generated by our build process end up)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>