[PATCH] [compiler-rt] Introduce MACOS_VERSION_UNKNOWN_NEWER for OS X versions above 10.10

Kuba Brecka kuba.brecka at gmail.com
Mon Dec 15 19:39:58 PST 2014


How about something like:

        default:
          if (IsDigit(version[1]))
            return MACOS_VERSION_UNKNOWN_NEWER;
          else
            return MACOS_VERSION_UNKNOWN;

Better?


On Mon, Dec 15, 2014 at 7:25 PM, Kuba Brecka <kuba.brecka at gmail.com> wrote:
>
> I guess I was worried about the string containing a non-digit. Like "1.5",
> which sounds like something might actually be a valid value.
>
>
> On Mon, Dec 15, 2014 at 7:19 PM, Justin Bogner <mail at justinbogner.com>
> wrote:
>>
>> Kuba Brecka <kuba.brecka at gmail.com> writes:
>> > 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.
>> >
>> > http://reviews.llvm.org/D6137
>> >
>> > Files:
>> >   projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
>> >   projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.h
>> >
>> > Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
>> > ===================================================================
>> > --- projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
>> > +++ projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
>> > @@ -298,6 +298,11 @@
>> >          case '2': return MACOS_VERSION_MOUNTAIN_LION;
>> >          case '3': return MACOS_VERSION_MAVERICKS;
>> >          case '4': return MACOS_VERSION_YOSEMITE;
>> > +        case '5':
>> > +        case '6':
>> > +        case '7':
>> > +        case '8':
>> > +        case '9': return MACOS_VERSION_UNKNOWN_NEWER;
>> >          default: return MACOS_VERSION_UNKNOWN;
>>
>> Why not just change the default case to NEWER, since this switch covers
>> every digit now?
>>
>> >        }
>> >      }
>> > Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.h
>> > ===================================================================
>> > --- projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.h
>> > +++ projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.h
>> > @@ -27,6 +27,7 @@
>> >    MACOS_VERSION_MOUNTAIN_LION,
>> >    MACOS_VERSION_MAVERICKS,
>> >    MACOS_VERSION_YOSEMITE,
>> > +  MACOS_VERSION_UNKNOWN_NEWER
>> >  };
>> >
>> >  MacosVersion GetMacosVersion();
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141215/aa200965/attachment.html>


More information about the llvm-commits mailing list