[Webkit-unassigned] [Bug 166047] Macro expansion producing 'defined' has undefined behavior

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 20 13:52:44 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=166047

--- Comment #4 from Taras Tsugrii <ttsugrii at fb.com> ---
Comment on attachment 297493
  --> https://bugs.webkit.org/attachment.cgi?id=297493
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=297493&action=review

>> 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.

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 :(

>>> 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

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161220/18e7acf8/attachment.html>


More information about the webkit-unassigned mailing list