[llvm] r234343 - Enable W4 warnings by default for MSVC builds

Zachary Turner zturner at google.com
Mon Apr 13 11:53:11 PDT 2015


Just to be clear, what that shows is that CMake *is* in fact appending /W3
to the command line on startup.  Later, in HandleLLVMOptions.cmake, we
append /W4.  It's possible that branch isn't being hit for you for some
reason.  But if you compile a dummy cpp file with /W3 and /W4 you can at
least confirm that your compiler will spit out the same error I'm seeing if
both are on the command line.  If it does, then it just remains to figure
out why HandleLLVMOptions.cmake isn't putting /W4 on the command line for
you.  It could be a cache issue, for example if the default value of that
was changed from OFF to ON, your cache could still have the OFF value.

On Mon, Apr 13, 2015 at 11:49 AM Zachary Turner <zturner at google.com> wrote:

> That suggests that LLVM_ENABLE_WARNINGS is not set for you then and that
> it's not appending /W4 to the command line for some reason.  Can you try
> the sample program where I compile foo.cpp myself and run with /W3 and /W4?
>
> On Mon, Apr 13, 2015 at 11:43 AM Aaron Ballman <aaron at aaronballman.com>
> wrote:
>
>> When I do that, the first line of output shows /W3:
>>
>>
>> E:\llvm\x64>"D:\Program Files (x86)\Microsoft Visual Studio
>> 12.0\VC\vcvarsall.bat" amd64
>>
>> E:\llvm\x64>cmake -G "Visual Studio 12" ..\llvm
>> CMAKE_CXX_FLAGS =  /DWIN32 /D_WINDOWS /W3 /GR /EHsc
>> ....
>>
>> ~Aaron
>>
>> On Mon, Apr 13, 2015 at 2:37 PM, Zachary Turner <zturner at google.com>
>> wrote:
>> > Also what version of CMake are you using?  Maybe it's an issue with
>> CMake >=
>> > 3.0?  Try putting the following line at the top of your CMakeLists.txt
>> >
>> > message("CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
>> >
>> > If you don't see /W3 in there, you won't hit the problem.
>> >
>> > On Mon, Apr 13, 2015 at 11:36 AM Zachary Turner <zturner at google.com>
>> wrote:
>> >>
>> >> Just realized maybe 2012 was a typo.  Are you actually still using
>> 2012?
>> >> I thought support was dropped.
>> >>
>> >> On Mon, Apr 13, 2015 at 11:33 AM Aaron Ballman <aaron at aaronballman.com
>> >
>> >> wrote:
>> >>>
>> >>> I do not get the warnings when building x64 or x86 on Windows 7, MSVC
>> >>> 2012, debug build. This is when building LLVM, Clang, lld, and clang
>> >>> tools extra
>> >>>
>> >>> ~Aaron
>> >>>
>> >>> On Mon, Apr 13, 2015 at 2:22 PM, Zachary Turner <zturner at google.com>
>> >>> wrote:
>> >>> > I'm building x64.  Can you try that?  Run "vcvarsall amd64" before
>> >>> > building
>> >>> > LLVM
>> >>> >
>> >>> > On Mon, Apr 13, 2015 at 11:21 AM Kaylor, Andrew
>> >>> > <andrew.kaylor at intel.com>
>> >>> > wrote:
>> >>> >>
>> >>> >> I haven’t seen that.  I’m not seeing any warnings right now.
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> From: Zachary Turner [mailto:zturner at google.com]
>> >>> >> Sent: Monday, April 13, 2015 11:17 AM
>> >>> >> To: Kaylor, Andrew; llvm-commits at cs.uiuc.edu
>> >>> >> Subject: Re: [llvm] r234343 - Enable W4 warnings by default for
>> MSVC
>> >>> >> builds
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> Hi Andy, this is causing a huge slew of warning spam.  Is this
>> >>> >> expected?
>> >>> >> CMake passes /W3 by default, so  every single translation unit I
>> >>> >> compile
>> >>> >> gives me the following warning:
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> cl : Command line warning D9025 : overriding '/W3' with '/W4'
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> Furthermore, since this is a command line warning and not a
>> compiler
>> >>> >> warning, it cannot be suppressed.  Unless you have any better
>> ideas on
>> >>> >> how
>> >>> >> to address this, I think this should be reverted.
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> On Tue, Apr 7, 2015 at 12:07 PM Andrew Kaylor
>> >>> >> <andrew.kaylor at intel.com>
>> >>> >> wrote:
>> >>> >>
>> >>> >> Author: akaylor
>> >>> >> Date: Tue Apr  7 14:01:01 2015
>> >>> >> New Revision: 234343
>> >>> >>
>> >>> >> URL: http://llvm.org/viewvc/llvm-project?rev=234343&view=rev
>> >>> >> Log:
>> >>> >> Enable W4 warnings by default for MSVC builds
>> >>> >>
>> >>> >> Modified:
>> >>> >>     llvm/trunk/CMakeLists.txt
>> >>> >>
>> >>> >> Modified: llvm/trunk/CMakeLists.txt
>> >>> >> URL:
>> >>> >>
>> >>> >>
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=234343&r1=234342&r2=234343&view=diff
>> >>> >>
>> >>> >>
>> >>> >>
>> ==============================================================================
>> >>> >> --- llvm/trunk/CMakeLists.txt (original)
>> >>> >> +++ llvm/trunk/CMakeLists.txt Tue Apr  7 14:01:01 2015
>> >>> >> @@ -233,14 +233,7 @@ list(REMOVE_DUPLICATES LLVM_TARGETS_TO_B
>> >>> >>  include(AddLLVMDefinitions)
>> >>> >>
>> >>> >>  option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
>> >>> >> -
>> >>> >> -# MSVC has a gazillion warnings with this.
>> >>> >> -if( MSVC )
>> >>> >> -  option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF)
>> >>> >> -else()
>> >>> >> -  option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
>> >>> >> -endif()
>> >>> >> -
>> >>> >> +option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
>> >>> >>  option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled."
>> OFF)
>> >>> >>  option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)
>> >>> >>  option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
>> >>> >>
>> >>> >>
>> >>> >> _______________________________________________
>> >>> >> llvm-commits mailing list
>> >>> >> llvm-commits at cs.uiuc.edu
>> >>> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> >>> >
>> >>> >
>> >>> > _______________________________________________
>> >>> > llvm-commits mailing list
>> >>> > llvm-commits at cs.uiuc.edu
>> >>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> >>> >
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150413/4bbd9dd7/attachment.html>


More information about the llvm-commits mailing list