diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-04-21 21:27:33 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-04-21 21:27:33 +0000 |
commit | 8a3a7f36aea62a91d12a4aafd16cc32081ad11cf (patch) | |
tree | a6cfb9d68e0e72022203ee967fd23df6fdbced5c /lib/Basic/Targets.cpp | |
parent | 3e8dc2ac8926dfbebd8f2f6b74ceba4befccd4d2 (diff) |
Driver/Darwin: Allow OS X deployment targets like 10.4.11, even though they
can't be represented in the environment define.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r-- | lib/Basic/Targets.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index fd7168d16c..d06ff48be4 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -135,7 +135,7 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, // Set the appropriate OS version define. if (PlatformName == "ios") { - assert(Maj < 10 && Min < 99 && Rev < 99 && "Invalid version!"); + assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!"); char Str[6]; Str[0] = '0' + Maj; Str[1] = '0' + (Min / 10); @@ -145,13 +145,17 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, Str[5] = '\0'; Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", Str); } else { + // Note that the Driver allows versions which aren't representable in the + // define (because we only get a single digit for the minor and micro + // revision numbers). So, we limit them to the maximum representable + // version. assert(Triple.getEnvironmentName().empty() && "Invalid environment!"); - assert(Maj < 99 && Min < 10 && Rev < 10 && "Invalid version!"); + assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!"); char Str[5]; Str[0] = '0' + (Maj / 10); Str[1] = '0' + (Maj % 10); - Str[2] = '0' + Min; - Str[3] = '0' + Rev; + Str[2] = '0' + std::min(Min, 9U); + Str[3] = '0' + std::min(Rev, 9U); Str[4] = '\0'; Builder.defineMacro("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", Str); } |