[compiler-rt] r224315 - Add an MACOS_VERSION_UNKNOWN_NEWER enum value for OS X versions above 10.10.

Kuba Brecka kuba.brecka at gmail.com
Mon Dec 15 20:46:16 PST 2014


Author: kuba.brecka
Date: Mon Dec 15 22:46:15 2014
New Revision: 224315

URL: http://llvm.org/viewvc/llvm-project?rev=224315&view=rev
Log:
Add an MACOS_VERSION_UNKNOWN_NEWER enum value for OS X versions above 10.10.

We recently had a broken version check because an newer OS X version is treated as MACOS_VERSION_UNKNOWN which is less than all the defined values. Let's have a separate enum value for unknown but newer versions, so the ">=" and "<=" version checks still work even in upcoming OS X releases.

Reviewed at http://reviews.llvm.org/D6137


Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=224315&r1=224314&r2=224315&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Mon Dec 15 22:46:15 2014
@@ -298,7 +298,11 @@ MacosVersion GetMacosVersionInternal() {
         case '2': return MACOS_VERSION_MOUNTAIN_LION;
         case '3': return MACOS_VERSION_MAVERICKS;
         case '4': return MACOS_VERSION_YOSEMITE;
-        default: return MACOS_VERSION_UNKNOWN;
+        default:
+          if (IsDigit(version[1]))
+            return MACOS_VERSION_UNKNOWN_NEWER;
+          else
+            return MACOS_VERSION_UNKNOWN;
       }
     }
     default: return MACOS_VERSION_UNKNOWN;

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h?rev=224315&r1=224314&r2=224315&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h Mon Dec 15 22:46:15 2014
@@ -27,6 +27,7 @@ enum MacosVersion {
   MACOS_VERSION_MOUNTAIN_LION,
   MACOS_VERSION_MAVERICKS,
   MACOS_VERSION_YOSEMITE,
+  MACOS_VERSION_UNKNOWN_NEWER
 };
 
 MacosVersion GetMacosVersion();





More information about the llvm-commits mailing list