]> granicus.if.org Git - clang/commitdiff
Report an error when -m<os>-version-min= does not specify a version.
authorBob Wilson <bob.wilson@apple.com>
Tue, 7 Apr 2015 01:03:35 +0000 (01:03 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 7 Apr 2015 01:03:35 +0000 (01:03 +0000)
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

lib/Driver/Driver.cpp
test/Driver/darwin-version.c

index 5b01b1c5a3ef6bff0891ca79f8b3048f55abceff..07a5e42cb1397ec91fe46df3f7bc2ff830e78426 100644 (file)
@@ -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);
index 8e909278a5df3f592067c7cce598bf9162f04274..3e7496b6bc39e3e9a353d3b420f4029d5cfe706f 100644 (file)
@@ -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 \