From bd3f6f82e4422cf9667f9ce75e8ba33b3f147dec Mon Sep 17 00:00:00 2001 From: Kostya Kortchinsky Date: Fri, 27 Apr 2018 15:10:50 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331042 91177308-0d34-0410-b5e6-96231b3b80d8 --- runtimes/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 06581b3c8f6..23707999a24 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -109,6 +109,9 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) # 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)