[llvm] r331042 - [CMake] Enable warnings for runtimes

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 08:10:50 PDT 2018


Author: cryptoad
Date: Fri Apr 27 08:10:50 2018
New Revision: 331042

URL: http://llvm.org/viewvc/llvm-project?rev=331042&view=rev
Log:
[CMake] Enable warnings for runtimes

Summary:
`HandleLLVMOptions` adds `-w` to the cflags if `LLVM_ENABLE_WARNINGS` is not on.
With `-w`, `check_cxx_compiler_flag` doesn't error out for unsupported flags
(for example `-mcrc` on x86_64), and those flags end up being detected as
working - and really they aren't.

I am not entirely sure what the best way to solve this is, but setting
`LLVM_ENABLE_WARNINGS` prior to including `HandleLLVMOptions` does the job.

Reviewers: phosek, beanz

Reviewed By: phosek

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D46079

Modified:
    llvm/trunk/runtimes/CMakeLists.txt

Modified: llvm/trunk/runtimes/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtimes/CMakeLists.txt?rev=331042&r1=331041&r2=331042&view=diff
==============================================================================
--- llvm/trunk/runtimes/CMakeLists.txt (original)
+++ llvm/trunk/runtimes/CMakeLists.txt Fri Apr 27 08:10:50 2018
@@ -109,6 +109,9 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_
 
   # Avoid checking whether the compiler is working.
   set(LLVM_COMPILER_CHECKED ON)
+  # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions
+  # resulting in unjustified successes by check_cxx_compiler_flag.
+  set(LLVM_ENABLE_WARNINGS ON)
 
   # Handle common options used by all runtimes.
   include(AddLLVM)




More information about the llvm-commits mailing list