From: Bob Wilson Date: Tue, 7 Apr 2015 01:03:35 +0000 (+0000) Subject: Report an error when -m-version-min= does not specify a version. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fffea95fd05616d2c225ee7fb80aee2309fbc53;p=clang Report an error when -m-version-min= does not specify a version. Currently if you use -mmacosx-version-min or -mios-version-min without specifying a version number, clang silently sets the minimum version to "0.0.0". This is almost certainly not what was intended, so it is better to report it as an error. rdar://problem/20433945 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234270 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 5b01b1c5a3..07a5e42cb1 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -2152,7 +2152,7 @@ bool Driver::GetReleaseVersion(const char *Str, unsigned &Major, Major = Minor = Micro = 0; if (*Str == '\0') - return true; + return false; char *End; Major = (unsigned) strtol(Str, &End, 10); diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index 8e909278a5..3e7496b6bc 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -30,6 +30,9 @@ // RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.10 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s // CHECK-VERSION-OSX10: "x86_64-apple-macosx10.10.0" +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min= -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-MISSING %s +// CHECK-VERSION-MISSING: invalid version number // Check environment variable gets interpreted correctly // RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 \