[LLVMbugs] [Bug 8164] New: clang++ has the option '-Wswitch-enum' turned on by default

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 16 03:19:03 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8164

           Summary: clang++ has the option '-Wswitch-enum' turned on by
                    default
           Product: clang
           Version: 2.7
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: alexandre at elgato.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=5500)
 --> (http://llvm.org/bugs/attachment.cgi?id=5500)
Sample c++ file that exhibits the issue

Description:
Clang always use the '-Wswitch-enum' option when you compile a c++ file. There
are apparently no way to turn off this compiler option. When you have a huge
c++ project with third party code, you don't want to fix all these warnings.

Regression:
This issue was reproduced with clang++ from the LLVM 2.7 branch. It can also be
reproduced when using Xcode 4.0b3 (Build 4A153).

Expected behavior:
Clang should not use the '-Wswitch-enum' option by default.



Steps to reproduce:

1- Download the attached main.cpp file.
2- In a Terminal window, compile the file using clang++ (clang++
/PATH_TO/main.cpp)

Result:
clang++ reports 4 warnings although the option -Wswitch-enum was not specified:


main.cpp:16:12: warning: enumeration value 'kMyEnumType_Three' not handled in
switch [-Wswitch-enum]
    switch(deviceType)
           ^
main.cpp:16:12: warning: enumeration value 'kMyEnumType_Four' not handled in
switch [-Wswitch-enum]
main.cpp:16:12: warning: enumeration value 'kMyEnumType_Five' not handled in
switch [-Wswitch-enum]
main.cpp:16:12: warning: enumeration value 'kMyEnumType_Six' not handled in
switch [-Wswitch-enum]
4 diagnostics generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list