[cfe-dev] disabling MS extensions on some tests

John Thompson john.thompson.jtsoftware at gmail.com
Tue Oct 27 07:40:24 PDT 2009


Thanks, Doug.  I've commited the one you indicated in 85236.

For typedef-redecl.cpp, it does appear that VC++ doesn't flag line 10 as an
error:

C:\Tools\llvm\tools\clang\test\SemaCXX>cl -c typedef-redecl.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for
80x86
Copyright (C) Microsoft Corporation.  All rights reserved.
typedef-redecl.cpp
typedef-redecl.cpp(6) : error C2371: 'REALLY_INT' : redefinition; different
basic types
        typedef-redecl.cpp(3) : see declaration of 'REALLY_INT'
typedef-redecl.cpp(14) : error C2371: 'Y' : redefinition; different basic
types
        typedef-redecl.cpp(13) : see declaration of 'Y'
typedef-redecl.cpp(17) : error C2371: 'Y2' : redefinition; different basic
types
        typedef-redecl.cpp(16) : see declaration of 'Y2'
typedef-redecl.cpp(20) : error C2365: 'f' : redefinition; previous
definition was 'function'
        typedef-redecl.cpp(19) : see declaration of 'f'
typedef-redecl.cpp(23) : error C2365: 'f2' : redefinition; previous
definition was 'typedef'
        typedef-redecl.cpp(22) : see declaration of 'f2'

-John

On Mon, Oct 26, 2009 at 5:31 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> On Oct 21, 2009, at 12:05 PM, John Thompson wrote:
>
> By adding -fms-extensions=0 to some of the tests previously failing on
>> Windows, it makes these 6 tests pass on Windows.
>>
>> The question is, are these legitimate differences between the default
>> Clang behavior and MSVC?
>>
>
> Yes, except possibly for typedef-redecl.cpp; see my comment below.
>
>
> They seem sort of reasonable, but I'm not knowledgeable enough to say for
>> sure.
>>
>
> They match up with a few specific places where we try to match MSVC's
> behavior; comments below.
>
>
> The enclosed patch contains these changes.
>>
>
> Please go ahead and apply the patch for everything except
> typedef-redecl.cpp; for that file, we'll need some more information about
> how MSVC behaves to do the right thing.
>
>
> Here is the previous test output:
>>
>> 1>********************
>> 1>FAIL: Clang::SemaTemplate/nested-name-spec-template.cpp (1664 of 1692)
>> 1>******************** TEST
>> 'Clang::SemaTemplate/nested-name-spec-template.cpp' FAILED
>> ********************
>> 1>Script:
>> 1>--
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -fsyntax-only -verify
>> C:\Tools\llvm\tools\clang\test\SemaTemplate\nested-name-spec-template.cpp
>> 1>--
>> 1>Exit Code: 1
>> 1>Command Output (stdout):
>> 1>--
>> 1>Command 0: "C:/Tools/llvm/bin/Debug/clang-cc.exe" "-fsyntax-only"
>> "-verify"
>> "C:\Tools\llvm\tools\clang\test\SemaTemplate\nested-name-spec-template.cpp"
>> 1>Command 0 Result: 1
>> 1>Command 0 Output:
>> 1>Command 0 Stderr:
>> 1>Errors expected but not seen:
>> 1>  Line 34: C++ requires a type specifier for all declarations
>> 1>Warnings seen but not expected:
>> 1>  Line 34: type specifier missing, defaults to 'int'
>>
>
> Makes sense. Visual C++ appears to support C's "implicit int" even in C++
> mode, so we mimic that in Clang.
>
>
> 1>Command Output (stderr):
>> 1>--
>> 1>--
>> 1>********************
>> 1>FAIL: Clang::Preprocessor/line-directive.c (903 of 1692)
>> 1>******************** TEST 'Clang::Preprocessor/line-directive.c' FAILED
>> ********************
>> 1>Script:
>> 1>--
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -fsyntax-only -verify -pedantic
>> C:\Tools\llvm\tools\clang\test\Preprocessor\line-directive.c
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -E
>> C:\Tools\llvm\tools\clang\test\Preprocessor\line-directive.c 2>&1 | grep
>> 'blonk.c:92:2: error: #error ABC'
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -E
>> C:\Tools\llvm\tools\clang\test\Preprocessor\line-directive.c 2>&1 | grep
>> 'blonk.c:93:2: error: #error DEF'
>> 1>--
>> 1>Exit Code: 1
>> 1>Command Output (stdout):
>> 1>--
>> 1>Command 0: "C:/Tools/llvm/bin/Debug/clang-cc.exe" "-fsyntax-only"
>> "-verify" "-pedantic"
>> "C:\Tools\llvm\tools\clang\test\Preprocessor\line-directive.c"
>> 1>Command 0 Result: 1
>> 1>Command 0 Output:
>> 1>Command 0 Stderr:
>> 1>Errors expected but not seen:
>> 1>  Line 44: redefinition of typedef 'x' is invalid in C
>> 1>  Line 65: redefinition of typedef 'w' is invalid in C
>> 1>Notes expected but not seen:
>> 1>  Line 43: previous definition is here
>> 1>  Line 64: previous definition is here
>>
>
> Makes sense. Visual C++ appears to support typedef redefinition even in C,
> so we mimic that in Clang.
>
>
> 1>Command Output (stderr):
>> 1>--
>> 1>--
>> 1>********************
>> 1>FAIL: Clang::Parser/cxx-template-decl.cpp (793 of 1692)
>> 1>******************** TEST 'Clang::Parser/cxx-template-decl.cpp' FAILED
>> ********************
>> 1>Script:
>> 1>--
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -fsyntax-only -verify
>> C:\Tools\llvm\tools\clang\test\Parser\cxx-template-decl.cpp
>> 1>--
>> 1>Exit Code: 1
>> 1>Command Output (stdout):
>> 1>--
>> 1>Command 0: "C:/Tools/llvm/bin/Debug/clang-cc.exe" "-fsyntax-only"
>> "-verify" "C:\Tools\llvm\tools\clang\test\Parser\cxx-template-decl.cpp"
>> 1>Command 0 Result: 1
>> 1>Command 0 Output:
>> 1>Command 0 Stderr:
>> 1>Errors expected but not seen:
>> 1>  Line 5: C++ requires a type specifier for all declarations
>> 1>  Line 57: declaration of 'T' shadows template parameter
>> 1>  Line 61: declaration of 'T' shadows template parameter
>> 1>  Line 64: declaration of 'T' shadows template parameter
>> 1>  Line 68: declaration of 'Size' shadows template parameter
>> 1>  Line 73: shadows
>> 1>  Line 78: shadows
>> 1>Warnings seen but not expected:
>> 1>  Line 5: type specifier missing, defaults to 'int'
>> 1>Notes expected but not seen:
>> 1>  Line 56: template parameter is declared here
>> 1>  Line 60: template parameter is declared here
>> 1>  Line 63: template parameter is declared here
>> 1>  Line 67: template parameter is declared here
>> 1>  Line 71: here
>> 1>  Line 76: here
>>
>
> Okay. Visual C++ does not diagnose shadowing of template parameters, so we
> allow such shadowing in Microsoft-extensions mode.
>
>
> 1>Command Output (stderr):
>> 1>--
>> 1>--
>> 1>********************
>> 1>FAIL: Clang::SemaCXX/implicit-int.cpp (1290 of 1692)
>> 1>******************** TEST 'Clang::SemaCXX/implicit-int.cpp' FAILED
>> ********************
>> 1>Script:
>> 1>--
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -fsyntax-only -verify
>> C:\Tools\llvm\tools\clang\test\SemaCXX\implicit-int.cpp
>> 1>--
>> 1>Exit Code: 1
>> 1>Command Output (stdout):
>> 1>--
>> 1>Command 0: "C:/Tools/llvm/bin/Debug/clang-cc.exe" "-fsyntax-only"
>> "-verify" "C:\Tools\llvm\tools\clang\test\SemaCXX\implicit-int.cpp"
>> 1>Command 0 Result: 1
>> 1>Command 0 Output:
>> 1>Command 0 Stderr:
>> 1>Errors expected but not seen:
>> 1>  Line 3: C++ requires a type specifier for all declarations
>> 1>  Line 5: C++ requires a type specifier for all declarations
>> 1>Warnings seen but not expected:
>> 1>  Line 3: type specifier missing, defaults to 'int'
>> 1>  Line 5: type specifier missing, defaults to 'int'
>>
>
> Again with the implicit-int-in-C++ extension.
>
>
> 1>Command Output (stderr):
>> 1>--
>> 1>--
>> 1>********************
>> 1>FAIL: Clang::SemaCXX/typedef-redecl.cpp (1352 of 1692)
>> 1>******************** TEST 'Clang::SemaCXX/typedef-redecl.cpp' FAILED
>> ********************
>> 1>Script:
>> 1>--
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -fsyntax-only -verify
>> C:\Tools\llvm\tools\clang\test\SemaCXX\typedef-redecl.cpp
>> 1>--
>> 1>Exit Code: 1
>> 1>Command Output (stdout):
>> 1>--
>> 1>Command 0: "C:/Tools/llvm/bin/Debug/clang-cc.exe" "-fsyntax-only"
>> "-verify" "C:\Tools\llvm\tools\clang\test\SemaCXX\typedef-redecl.cpp"
>> 1>Command 0 Result: 1
>> 1>Command 0 Output:
>> 1>Command 0 Stderr:
>> 1>Errors expected but not seen:
>> 1>  Line 10: redefinition of 'result_type'
>> 1>Notes expected but not seen:
>> 1>  Line 9: previous definition is here
>>
>
> Hrm. This might actually be a Clang bug... does Visual C++ diagnose this as
> an error?
>
>
> 1>Command Output (stderr):
>> 1>--
>> 1>--
>> 1>********************
>> 1>FAIL: Clang::SemaCXX/nested-name-spec.cpp (1309 of 1692)
>> 1>******************** TEST 'Clang::SemaCXX/nested-name-spec.cpp' FAILED
>> ********************
>> 1>Script:
>> 1>--
>> 1>C:/Tools/llvm/bin/Debug/clang-cc.exe -fsyntax-only -std=c++98 -verify
>> C:\Tools\llvm\tools\clang\test\SemaCXX\nested-name-spec.cpp
>> 1>--
>> 1>Exit Code: 1
>> 1>Command Output (stdout):
>> 1>--
>> 1>Command 0: "C:/Tools/llvm/bin/Debug/clang-cc.exe" "-fsyntax-only"
>> "-std=c++98" "-verify"
>> "C:\Tools\llvm\tools\clang\test\SemaCXX\nested-name-spec.cpp"
>> 1>Command 0 Result: 1
>> 1>Command 0 Output:
>> 1>Command 0 Stderr:
>> 1>Errors expected but not seen:
>> 1>  Line 171: C++ requires a type specifier for all declarations
>> 1>  Line 192: C++ requires a type specifier for all declarations
>> 1>Errors seen but not expected:
>> 1>  Line 195: cannot initialize 'a3' with an lvalue of type 'int'
>> 1>Warnings seen but not expected:
>> 1>  Line 171: type specifier missing, defaults to 'int'
>> 1>  Line 192: type specifier missing, defaults to 'int'
>>
>
> This is the implicit-int-in-C++ extension.
>
> Thanks for working on this!
>
>        - Doug
>



-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091027/a5cd1144/attachment.html>


More information about the cfe-dev mailing list