<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </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 - Fix -Wparentheses warning with GCC 5 in SaturatedArithmetic.h"
   href="https://bugs.webkit.org/show_bug.cgi?id=143457">143457</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Fix -Wparentheses warning with GCC 5 in SaturatedArithmetic.h
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </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>Minor
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Web Template Framework
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mcatanzaro&#64;igalia.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When building with GCC 5, I can't see any real warnings, because this buddy gets printed 3000 times [1] during compilation:

../../Source/WTF/wtf/SaturatedArithmetic.h: In function ‘bool signedAddOverflows(int32_t, int32_t, int32_t&amp;)’:
../../Source/WTF/wtf/SaturatedArithmetic.h:49:29: warning: suggest parentheses around operand of ‘!’ or change ‘&amp;’ to ‘&amp;&amp;’ or ‘!’ to ‘~’ [-Wparentheses]
     return !((ua ^ ub) &gt;&gt; 31) &amp; (uresult ^ ua) &gt;&gt; 31;
                             ^

Clang has had this same warning for a while. The warning is spurious [2], but it's a good warning so let's placate it rather than disable. Two solutions:

Add extra parentheses: return (!((ua ^ ub) &gt;&gt; 31)) &amp; (uresult ^ ua) &gt;&gt; 31;

Note that is equivalent to the original code [3].

Another option is to use &amp;&amp;:

!((ua ^ ub) &gt;&gt; 31) &amp;&amp; (uresult ^ ua) &gt;&gt; 31;

That looks better to me, since there are fewer parentheses and it avoids the confusing/unnecessary [3] mask.

[1] I just made that up, but it doesn't feel like an unreasonable guess.
[2] &amp; and &amp;&amp; both have the same precedence relative to !
[3] Provided I've squinted at this long enough.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>