<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From ab94d8e941daedf76ac64fdbd48f55e7f76f8fcd Mon Sep 17 00:00:00 2001
From: Bob Wilson &lt;bob.wilson@apple.com&gt;
Date: Fri, 8 Aug 2014 21:45:53 +0000
Subject: [PATCH 1008/1012] Change
 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ for versions &gt; 10.9.

The previous encoding only allowed a single digit for the minor version
number. This changes it to use 2 digits for both the minor version and the
revision number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215245 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit ae784bea7abea9e97f0eab91dff85061ec76669a)

Conflicts:
	lib/Basic/Targets.cpp
---
 lib/Basic/Targets.cpp          | 23 +++++++++++++++++------
 test/Frontend/darwin-version.c |  2 ++
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git llvm_release_34/tools/clang/lib/Basic/Targets.cpp macports_release_34/tools/clang/lib/Basic/Targets.cpp
index c8bfda7..96821e2 100644
--- llvm_release_34/tools/clang/lib/Basic/Targets.cpp
+++ macports_release_34/tools/clang/lib/Basic/Targets.cpp
@@ -161,12 +161,23 @@ static void getDarwinDefines(MacroBuilder &amp;Builder, const LangOptions &amp;Opts,
       // version.
       assert(Triple.getEnvironmentName().empty() &amp;&amp; "Invalid environment!");
       assert(Maj &lt; 100 &amp;&amp; Min &lt; 100 &amp;&amp; Rev &lt; 100 &amp;&amp; "Invalid version!");
-      char Str[5];
-      Str[0] = '0' + (Maj / 10);
-      Str[1] = '0' + (Maj % 10);
-      Str[2] = '0' + std::min(Min, 9U);
-      Str[3] = '0' + std::min(Rev, 9U);
-      Str[4] = '\0';
+      char Str[7];
+      if (Maj &lt; 10 || Maj == 10 &amp;&amp; Min &lt; 10) {
+        Str[0] = '0' + (Maj / 10);
+        Str[1] = '0' + (Maj % 10);
+        Str[2] = '0' + std::min(Min, 9U);
+        Str[3] = '0' + std::min(Rev, 9U);
+        Str[4] = '\0';
+      } else {
+        // Handle versions &gt; 10.9.
+        Str[0] = '0' + (Maj / 10);
+        Str[1] = '0' + (Maj % 10);
+        Str[2] = '0' + (Min / 10);
+        Str[3] = '0' + (Min % 10);
+        Str[4] = '0' + (Rev / 10);
+        Str[5] = '0' + (Rev % 10);
+        Str[6] = '\0';
+      }
       Builder.defineMacro("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", Str);
     }
   }
diff --git llvm_release_34/tools/clang/test/Frontend/darwin-version.c macports_release_34/tools/clang/test/Frontend/darwin-version.c
index 7234ab4..2e0804b 100644
--- llvm_release_34/tools/clang/test/Frontend/darwin-version.c
+++ macports_release_34/tools/clang/test/Frontend/darwin-version.c
@@ -23,3 +23,5 @@
 // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1
 // RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t %s
 // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1
+// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.10 -dM -E -o %t %s
+// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '101000' | count 1
-- 
2.10.1

</pre></body></html>