From: Saleem Abdulrasool Date: Mon, 23 Jun 2014 17:36:36 +0000 (+0000) Subject: Driver: correct behaviour of -fmsc-version=MAJOR X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a91f0e5edcd60f82eec602740b2c0f449ee5facd;p=clang Driver: correct behaviour of -fmsc-version=MAJOR Ensure that we properly handle the case where just the major version component is provided by the user. Thanks to Alp Toker for pointing out that this was not handled correctly! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211506 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 9174e4fb70..71138861d0 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1223,7 +1223,11 @@ static unsigned parseMSCVersion(ArgList &Args, DiagnosticsEngine &Diags) { << Arg->getAsString(Args) << Value; return 0; } - return (Version < 100000) ? Version * 100000 : Version; + if (Version < 100) + Version = Version * 100; // major -> major.minor + if (Version < 100000) + Version = Version * 100000; // major.minor -> major.minor.build + return Version; } // parse the dot-delimited component version diff --git a/test/Driver/msc-version.c b/test/Driver/msc-version.c index 09115c9fe9..027072ffd8 100644 --- a/test/Driver/msc-version.c +++ b/test/Driver/msc-version.c @@ -16,6 +16,12 @@ // CHECK-MSC-VERSION-EXT: _MSC_FULL_VER 160030319 // CHECK-MSC-VERSION-EXT: _MSC_VER 1600 +// RUN: %clang -target i686-windows -fms-compatibility -fmsc-version=14 -dM -E -