<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 - Consider enabling -Wno-expansion-to-defined for gcc 7"
   href="https://bugs.webkit.org/show_bug.cgi?id=167643">167643</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Consider enabling -Wno-expansion-to-defined for gcc 7
          </td>
        </tr>

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

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

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>Normal
          </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>tpopela&#64;redhat.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>mcatanzaro&#64;igalia.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In gcc 7 and (and in clang as well <a href="https://reviews.llvm.org/D15866">https://reviews.llvm.org/D15866</a> ) there was a new warning added -Wexpansion-to-defined (pasting the description from the clang patch):

//[cpp.cond]p4:
//   Prior to evaluation, macro invocations in the list of preprocessing
//   tokens that will become the controlling constant expression are replaced
//   (except for those macro names modified by the 'defined' unary operator),
//   just as in normal text. If the token 'defined' is generated as a result
//   of this replacement process or use of the 'defined' unary operator does
//   not match one of the two specified forms prior to macro replacement, the
//   behavior is undefined.
// This isn't an idle threat, consider this program:
//   #define FOO
//   #define BAR defined(FOO)
//   #if BAR
//   ...
//   #else
//   ...
//   #endif
// clang and gcc will pick the #if branch while Visual Studio will take the
// #else branch.  Emit a warning about this undefined behavior.

This applies for all of our USE, PLATFORM, CPU, ENABLE, ... macros. I would suggest to add -Wno-expansion-to-defined to our CFLAGS in OptionsCommon.cmake to get rid off the warning as it's more easier than rewriting the macro definitions. Also I'm not sure if the warning will be triggered on newer clang as per:

&quot;there is no easy way to rewrite a function-like macro like #define FOO(x) (defined __foo_##x &amp;&amp; __foo_##x). Function-like macros like this are used in practice, and compilers seem to not have differing behavior in that case. So make this a default-on warning only for object-like macros and an extension warning that only shows up with pedantic for function-like macros. (But it's undefined behavior in both cases.)&quot;

that we are using in the USE, PLATFORM, CPU, ENABLE, ... macros. So I'm curious if it's actually not a gcc bug.</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>