r234270 - Report an error when -m<os>-version-min= does not specify a version.
Bob Wilson
bob.wilson at apple.com
Mon Apr 6 18:03:35 PDT 2015
Author: bwilson
Date: Mon Apr 6 20:03:35 2015
New Revision: 234270
URL: http://llvm.org/viewvc/llvm-project?rev=234270&view=rev
Log:
Report an error when -m<os>-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
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/darwin-version.c
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=234270&r1=234269&r2=234270&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Apr 6 20:03:35 2015
@@ -2152,7 +2152,7 @@ bool Driver::GetReleaseVersion(const cha
Major = Minor = Micro = 0;
if (*Str == '\0')
- return true;
+ return false;
char *End;
Major = (unsigned) strtol(Str, &End, 10);
Modified: cfe/trunk/test/Driver/darwin-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-version.c?rev=234270&r1=234269&r2=234270&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-version.c (original)
+++ cfe/trunk/test/Driver/darwin-version.c Mon Apr 6 20:03:35 2015
@@ -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 \
More information about the cfe-commits
mailing list