<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Macro expansion producing 'defined' has undefined behavior"
   href="https://bugs.webkit.org/show_bug.cgi?id=166047#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Macro expansion producing 'defined' has undefined behavior"
   href="https://bugs.webkit.org/show_bug.cgi?id=166047">bug 166047</a>
              from <span class="vcard"><a class="email" href="mailto:ttsugrii&#64;fb.com" title="Taras Tsugrii &lt;ttsugrii&#64;fb.com&gt;"> <span class="fn">Taras Tsugrii</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=297493&amp;action=diff" name="attach_297493" title="Patch">attachment 297493</a> <a href="attachment.cgi?id=297493&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=297493&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=297493&amp;action=review</a>

<span class="quote">&gt;&gt; Source/JavaScriptCore/ChangeLog:3
&gt;&gt; +        Fix undefined behavior caused by macro expansion producing 'defined'
&gt; 
&gt; Another instance of this pattern is in WebKit2/Shared/API/Cocoa/WKFoundation.h
&gt; 
&gt; Also, ThirdParty/ANGLE/src/tests/preprocessor_tests appears to test what happens in this scenario.</span >

thanks Alexey! Indeed, I saw that this is tested in ThirdParty/ANGLE/src/tests/preprocessor_tests:ExpandedDefinedParsedInsideIf but it breaks the build by default on a master build of clang, unless the warning is disabled :(

<span class="quote">&gt;&gt;&gt; Source/JavaScriptCore/runtime/JSGlobalObject.h:302
&gt;&gt;&gt; +#if JSC_OBJC_API_ENABLED == 1
&gt;&gt; 
&gt;&gt; This is not the normal pattern for how we test for things being enabled, and thus it's error prone. Why was this part of the fix necessary?
&gt; 
&gt; == 1 is definitely not what we want here</span >

oops, sorry, this is indeed not necessary - the original code used to be a warning because of the way JSC_OBJC_API_ENABLED was defined in JSBase.h, but now with the fix above, it's fine to leave this line as it was. I'll update the patch.</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>