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.
Created attachment 223555 [details] Patch
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.
Created attachment 223558 [details] Patch
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 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.
(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.
Committed r163707: <http://trac.webkit.org/changeset/163707>
(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 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?
(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. */