r263974 - clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 17:32:46 PDT 2016


On Mon, Mar 21, 2016 at 8:09 PM, Nico Weber <thakis at chromium.org> wrote:

> Thanks, attempting to fix.
>
> On Mon, Mar 21, 2016 at 7:43 PM, Richard Smith via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Seems to have caused a bot failure:
>>
>> http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/7039
>>
>> The NOTRIPLE test appears to be picking up the version of MSVC from
>> that installed on the system, so this passes or fails depending on
>> which version of MSVC we find.
>>
>
> I think it's a bit simpler: If the triple is set, we try to parse the MSVC
> version off it if it's a MS target. If we fail to parse it, we default to
> 18 (VC2013). If the triple isn't a MS triple, we set the option to 0. I
> tested this on Linux, where the default triple is a linux triple, and hence
> the flag is 0 (and we don't print the space). On the Windows bot, the
> default triple is some MS triple, which we fail to parse, and then we
> default to the 2013 behavior.
>
> ...bleh, I was just running `svn commit` with a fix, but got a conflict.
> Seems like somewhat reverted the change at the same time I was fixing. Will
> try again some other time.
>

To be clear, the "bleh" here was directed at myself. It's always ok to
revert changes that break stuff, and it's entirely on me that I didn't fix
this earlier. So thanks for the revert!


>
>
>>
>> On Mon, Mar 21, 2016 at 12:44 PM, Nico Weber via cfe-commits
>> <cfe-commits at lists.llvm.org> wrote:
>> > Author: nico
>> > Date: Mon Mar 21 14:44:18 2016
>> > New Revision: 263974
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=263974&view=rev
>> > Log:
>> > clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.
>> >
>> > Modified:
>> >     cfe/trunk/lib/Driver/Tools.cpp
>> >     cfe/trunk/lib/Frontend/TextDiagnostic.cpp
>> >     cfe/trunk/test/Misc/diag-format.c
>> >
>> > Modified: cfe/trunk/lib/Driver/Tools.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=263974&r1=263973&r2=263974&view=diff
>> >
>> ==============================================================================
>> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> > +++ cfe/trunk/lib/Driver/Tools.cpp Mon Mar 21 14:44:18 2016
>> > @@ -3257,6 +3257,7 @@ VersionTuple visualstudio::getMSVCVersio
>> >      if (Major || Minor || Micro)
>> >        return VersionTuple(Major, Minor, Micro);
>> >
>> > +    // FIXME: Consider bumping this to 19 (MSVC2015) soon.
>> >      return VersionTuple(18);
>> >    }
>> >    return VersionTuple();
>> >
>> > Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=263974&r1=263973&r2=263974&view=diff
>> >
>> ==============================================================================
>> > --- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
>> > +++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Mon Mar 21 14:44:18 2016
>> > @@ -819,7 +819,15 @@ void TextDiagnostic::emitDiagnosticLoc(S
>> >    switch (DiagOpts->getFormat()) {
>> >    case DiagnosticOptions::Clang:
>> >    case DiagnosticOptions::Vi:    OS << ':';    break;
>> > -  case DiagnosticOptions::MSVC:  OS << ") : "; break;
>> > +  case DiagnosticOptions::MSVC:
>> > +    // MSVC2013 and before print 'file(4) : error'. MSVC2015 gets rid
>> of the
>> > +    // space and prints 'file(4): error'.
>> > +    OS << ')';
>> > +    if (LangOpts.MSCompatibilityVersion &&
>> > +        !LangOpts.isCompatibleWithMSVC(LangOptions::MSVC2015))
>> > +      OS << ' ';
>> > +    OS << ": ";
>> > +    break;
>> >    }
>> >
>> >    if (DiagOpts->ShowSourceRanges && !Ranges.empty()) {
>> >
>> > Modified: cfe/trunk/test/Misc/diag-format.c
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-format.c?rev=263974&r1=263973&r2=263974&view=diff
>> >
>> ==============================================================================
>> > --- cfe/trunk/test/Misc/diag-format.c (original)
>> > +++ cfe/trunk/test/Misc/diag-format.c Mon Mar 21 14:44:18 2016
>> > @@ -4,13 +4,15 @@
>> >  //
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fmsc-version=1300  %s 2>&1 | FileCheck %s -check-prefix=MSVC2010
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fms-compatibility-version=13.00  %s 2>&1 | FileCheck %s
>> -check-prefix=MSVC2010
>> > -// RUN: %clang -fsyntax-only -fdiagnostics-format=msvc  %s 2>&1 |
>> FileCheck %s -check-prefix=MSVC
>> > +// RUN: %clang -fsyntax-only -fdiagnostics-format=msvc  %s 2>&1 |
>> FileCheck %s -check-prefix=MSVCNOTRIPLE
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fmsc-version=1300 -target x86_64-pc-win32 %s 2>&1 | FileCheck %s
>> -check-prefix=MSVC2010
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fms-compatibility-version=13.00 -target x86_64-pc-win32 %s 2>&1 |
>> FileCheck %s -check-prefix=MSVC2010
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=msvc -target
>> x86_64-pc-win32 %s 2>&1 | FileCheck %s -check-prefix=MSVC
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fmsc-version=1300 -target x86_64-pc-win32 -fshow-column %s 2>&1 |
>> FileCheck %s -check-prefix=MSVC2010
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fms-compatibility-version=13.00 -target x86_64-pc-win32 -fshow-column %s
>> 2>&1 | FileCheck %s -check-prefix=MSVC2010
>> > -// RUN: %clang -fsyntax-only -fdiagnostics-format=msvc -target
>> x86_64-pc-win32 -fshow-column %s 2>&1 | FileCheck %s -check-prefix=MSVC
>> > +// RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fmsc-version=1800 -target x86_64-pc-win32 -fshow-column %s 2>&1 |
>> FileCheck %s -check-prefix=MSVC2013
>> > +// RN: %clang -fsyntax-only -fdiagnostics-format=msvc -target
>> x86_64-pc-win32 -fshow-column %s 2>&1 | FileCheck %s -check-prefix=MSVC
>>
>> Did you mean to leave this test disabled?
>>
>> > +// RUN: %clang -fsyntax-only -fdiagnostics-format=msvc
>> -fmsc-version=1900 -target x86_64-pc-win32 -fshow-column %s 2>&1 |
>> FileCheck %s -check-prefix=MSVC2015
>> >  //
>> >  // RUN: %clang -fsyntax-only -fdiagnostics-format=vi    %s 2>&1 |
>> FileCheck %s -check-prefix=VI
>> >  //
>> > @@ -20,11 +22,9 @@
>> >  //
>> >  // RUN: not %clang -fsyntax-only -Werror
>> -fdiagnostics-format=msvc-fallback -fmsc-version=1300 %s 2>&1 | FileCheck
>> %s -check-prefix=MSVC2010-FALLBACK
>> >  // RUN: not %clang -fsyntax-only -Werror
>> -fdiagnostics-format=msvc-fallback -fms-compatibility-version=13.00 %s 2>&1
>> | FileCheck %s -check-prefix=MSVC2010-FALLBACK
>> > -// RUN: not %clang -fsyntax-only -Werror
>> -fdiagnostics-format=msvc-fallback %s 2>&1 | FileCheck %s
>> -check-prefix=MSVC-FALLBACK
>> > -
>> > -
>> > -
>> > -
>> > +// RUN: not %clang -fsyntax-only -Werror
>> -fdiagnostics-format=msvc-fallback %s -fmsc-version=1800 2>&1 | FileCheck
>> %s -check-prefix=MSVC2013-FALLBACK
>> > +// RN: not %clang -fsyntax-only -Werror
>> -fdiagnostics-format=msvc-fallback %s 2>&1 | FileCheck %s
>> -check-prefix=MSVC-FALLBACK
>>
>> ... and this one?
>>
>> > +// RUN: not %clang -fsyntax-only -Werror
>> -fdiagnostics-format=msvc-fallback %s -fmsc-version=1900 2>&1 | FileCheck
>> %s -check-prefix=MSVC2015-FALLBACK
>> >
>> >
>> >
>> > @@ -36,10 +36,15 @@
>> >  #endif bad // extension!
>> >  // DEFAULT: {{.*}}:36:8: warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> >  // MSVC2010: {{.*}}(36,7) : warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> > +// MSVC2013: {{.*}}(36,8) : warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> >  // MSVC: {{.*}}(36,8) : warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> > +// MSVCNOTRIPLE: {{.*}}(36,8): warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> > +// MSVC2015: {{.*}}(36,8): warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> >  // VI: {{.*}} +36:8: warning: extra tokens at end of #endif directive
>> [-Wextra-tokens]
>> > -// MSVC_ORIG: {{.*}}(36) : warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> > +// MSVC_ORIG: {{.*}}(36): warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> >  // NO_COLUMN: {{.*}}:36: warning: extra tokens at end of #endif
>> directive [-Wextra-tokens]
>> >  // MSVC2010-FALLBACK: {{.*}}(36,7) : error(clang): extra tokens at end
>> of #endif directive
>> > +// MSVC2013-FALLBACK: {{.*}}(36,8) : error(clang): extra tokens at end
>> of #endif directive
>> >  // MSVC-FALLBACK: {{.*}}(36,8) : error(clang): extra tokens at end of
>> #endif directive
>> > +// MSVC2015-FALLBACK: {{.*}}(36,8): error(clang): extra tokens at end
>> of #endif directive
>> >  int x;
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160321/d4d1d5e3/attachment-0001.html>


More information about the cfe-commits mailing list