[lld] r230422 - Suppress 'warning C4062: enumerator X in switch of enum Y is not handled' from system header.

Aaron Ballman aaron at aaronballman.com
Wed Feb 25 05:19:57 PST 2015


On Tue, Feb 24, 2015 at 9:47 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
> On Tue, Feb 24, 2015 at 6:12 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Tue, Feb 24, 2015 at 8:30 PM, Michael J. Spencer
>> <bigcheesegs at gmail.com> wrote:
>>> Author: mspencer
>>> Date: Tue Feb 24 19:30:13 2015
>>> New Revision: 230422
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=230422&view=rev
>>> Log:
>>> Suppress 'warning C4062: enumerator X in switch of enum Y is not handled' from system header.
>>>
>>> Modified:
>>>     lld/trunk/CMakeLists.txt
>>>
>>> Modified: lld/trunk/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/CMakeLists.txt?rev=230422&r1=230421&r2=230422&view=diff
>>> ==============================================================================
>>> --- lld/trunk/CMakeLists.txt (original)
>>> +++ lld/trunk/CMakeLists.txt Tue Feb 24 19:30:13 2015
>>> @@ -88,6 +88,7 @@ endif()
>>>
>>>  if (MSVC)
>>>    add_definitions(-wd4530) # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
>>> +  add_definitions(-wd4062) # Suppress 'warning C4062: enumerator X in switch of enum Y is not handled' from system header.
>>>  endif()
>>>
>>>  include_directories(BEFORE
>>
>> I think it would be better to limit this to just the file causing the
>> warning instead of for all files in lld. I've narrowed (and reported
>> to Microsoft) the issue down to being lld/Core/Parallel.h where it
>> includes concrt.h and ppl.h for MSCV builds. Since it's already in an
>> _MSC_VER block, we could use MSVC's #pragma warning to disable it
>> without introducing any new conditional compilation, either.
>>
>> ~Aaron
>
> I suppose that's fine. I felt it wasn't worth the effort at the time
> as clang has much better warnings for this case.

It does, but not everyone bootstraps and so we lose out on warning
coverage. The sad part is: at least for me, this change had no effect
(the warnings are still generated). Even more entertaining, neither
does manually disabling the diagnostic, possibly because the
diagnostic is generated during template instantiation time, and
possibly because LLVM promotes that warning to a lower warning level.

~Aaron

>
> - Michael Spencer



More information about the llvm-commits mailing list