Bug 128448 - [Mac] Fix use of availability macros on recently-added APIs
Summary: [Mac] Fix use of availability macros on recently-added APIs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Rowe (bdash)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-07 23:41 PST by Mark Rowe (bdash)
Modified: 2014-10-21 09:59 PDT (History)
6 users (show)

See Also:


Attachments
Patch (7.61 KB, patch)
2014-02-07 23:51 PST, Mark Rowe (bdash)
no flags Details | Formatted Diff | Diff
Patch (7.65 KB, patch)
2014-02-08 00:05 PST, Mark Rowe (bdash)
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rowe (bdash) 2014-02-07 23:41:12 PST
New API added to JavaScriptCore in r163590 and r163574 took a creative approach to availability macros. While it works, it is ugly, hard to follow, and doesn't allow the new APIs to be used by Safari or WebKit on anything but the current OS version. We can do better.
Comment 1 Mark Rowe (bdash) 2014-02-07 23:51:41 PST
Created attachment 223555 [details]
Patch
Comment 2 WebKit Commit Bot 2014-02-07 23:53:53 PST
Attachment 223555 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:42:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 1 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Mark Rowe (bdash) 2014-02-08 00:05:51 PST
Created attachment 223558 [details]
Patch
Comment 4 WebKit Commit Bot 2014-02-08 00:08:14 PST
Attachment 223558 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:42:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 1 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 mitz 2014-02-08 00:10:22 PST
Comment on attachment 223558 [details]
Patch

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

> Source/JavaScriptCore/ChangeLog:10
> +        newer OS X versions would expand in to when building on older OS versions.

Typo: “in to”.

> Source/JavaScriptCore/API/WebKitAvailability.h:63
> +#else /* __APPLE__ */

Comments next to #else are ambiguous and confusing. Either remove the comment or change to #endif followed by #ifndef (__APPLE__)

> Source/JavaScriptCore/postprocess-headers.sh:12
> +for HEADER in JSBase.h JSContext.h JSManagedValue.h JSValue.h JSVirtualMachine.h WebKitAvailability.h; do

It would be nicer to instead iterate over ${SCRIPT_INPUT_FILE_${i}} here for $i from 0 to $SCRIPT_INPUT_FILE_COUNT.
Comment 6 Mark Rowe (bdash) 2014-02-08 00:18:39 PST
(In reply to comment #5)
> > Source/JavaScriptCore/postprocess-headers.sh:12
> > +for HEADER in JSBase.h JSContext.h JSManagedValue.h JSValue.h JSVirtualMachine.h WebKitAvailability.h; do
> 
> It would be nicer to instead iterate over ${SCRIPT_INPUT_FILE_${i}} here for $i from 0 to $SCRIPT_INPUT_FILE_COUNT.

This is a great idea. I'll do it in a follow-up patch.
Comment 7 Mark Rowe (bdash) 2014-02-08 00:56:18 PST
Committed r163707: <http://trac.webkit.org/changeset/163707>
Comment 8 Mark Hahnenberg 2014-02-08 08:02:25 PST
(In reply to comment #7)
> Committed r163707: <http://trac.webkit.org/changeset/163707>

Thanks for fixing this! It was indeed quite a(n incorrect) hack.
Comment 9 Radu Stavila 2014-10-21 05:17:33 PDT
Comment on attachment 223558 [details]
Patch

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

> Source/JavaScriptCore/API/WebKitAvailability.h:42
> +#define __NSi_10_10 introduced=10.0

Is this (10.0 instead of 10.10) intentional?
Comment 10 Mark Rowe (bdash) 2014-10-21 09:59:18 PDT
(In reply to comment #9)
> Comment on attachment 223558 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=223558&action=review
> 
> > Source/JavaScriptCore/API/WebKitAvailability.h:42
> > +#define __NSi_10_10 introduced=10.0
> 
> Is this (10.0 instead of 10.10) intentional?

Yes:

 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
 /* To support availability macros that mention newer OS X versions when building on older OS X versions,
    we provide our own definitions of the underlying macros that the availability macros expand to. We're
    free to expand the macros as no-ops since frameworks built on older OS X versions only ship bundled with
    an application rather than as part of the system.
 */