[webkit-dev] Removing BUILDING_ON / TARGETING macros in favor of system availability macros
Mark Mentovai
mark at chromium.org
Thu Jul 12 11:29:57 PDT 2012
We just discovered (via a rollout on bug 91103) that there’s a bug
with __MAC_OS_X_VERSION_MAX_ALLOWED in the version of the 10.5 SDK as
present in Xcode 3.2.6. This may be the last version of the 10.5 SDK ever
released (I haven’t checked all of the early Xcode 4 releases). Chromium
uses this SDK for its builds, although will likely switch to the 10.6 SDK
in the near future.
In short, __MAC_OS_X_VERSION_MAX_ALLOWED, which is supposed to track the
SDK version, is set to 1060 instead of the expected 1050 in this version of
the 10.5 SDK.
--
// clang t.c -isysroot /Xcode3.2/SDKs/MacOSX10.5.sdk
-mmacosx-version-min=10.4 -o t
#include <Availability.h>
#include <AvailabilityMacros.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
#define PRINT_MACRO(m) printf("%s = %d\n", # m, m)
PRINT_MACRO(MAC_OS_X_VERSION_MIN_REQUIRED);
PRINT_MACRO(MAC_OS_X_VERSION_MAX_ALLOWED);
PRINT_MACRO(__MAC_OS_X_VERSION_MIN_REQUIRED);
PRINT_MACRO(__MAC_OS_X_VERSION_MAX_ALLOWED);
#undef PRINT_MACRO
return 0;
}
--
produces
MAC_OS_X_VERSION_MIN_REQUIRED = 1040
MAC_OS_X_VERSION_MAX_ALLOWED = 1050
__MAC_OS_X_VERSION_MIN_REQUIRED = 1040
__MAC_OS_X_VERSION_MAX_ALLOWED = 1060
Oops.
I traced this problem to <AvailabilityInternal.h>, which in this SDK, says
(slightly abbreviated):
#elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
#ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_6
#endif
#endif
At least for the purposes of testing whether the 10.5 SDK is in use, we’ll
need to use <AvailabilityMacros.h>’s MAC_OS_X_VERSION_MAX_ALLOWED instead
of <Availability.h>’s __MAC_OS_X_VERSION_MAX_ALLOWED. I guess it’s a
question of style whether the rest of WebKit should follow.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120712/3df6e8c5/attachment.html>
More information about the webkit-dev
mailing list