<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@fb.com" title="Taras Tsugrii <ttsugrii@fb.com>"> <span class="fn">Taras Tsugrii</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=297493&action=diff" name="attach_297493" title="Patch">attachment 297493</a> <a href="attachment.cgi?id=297493&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=297493&action=review">https://bugs.webkit.org/attachment.cgi?id=297493&action=review</a>
<span class="quote">>> Source/JavaScriptCore/ChangeLog:3
>> + Fix undefined behavior caused by macro expansion producing 'defined'
>
> Another instance of this pattern is in WebKit2/Shared/API/Cocoa/WKFoundation.h
>
> 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">>>> Source/JavaScriptCore/runtime/JSGlobalObject.h:302
>>> +#if JSC_OBJC_API_ENABLED == 1
>>
>> 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?
>
> == 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>