This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Enable warnings for runtimes
ClosedPublic

Authored by cryptoad on Apr 25 2018, 1:53 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

cryptoad created this revision.Apr 25 2018, 1:53 PM
phosek accepted this revision.Apr 25 2018, 1:57 PM

The only other way I could think is to add another option, e.g. LLVM_RUNTIMES_ENABLE_WARNING which would be handled by runtimes/CMakeLists.txt and turned into LLVM_ENABLE_WARNINGS if set, but if this works I think it's perfectly sufficient.

This revision is now accepted and ready to land.Apr 25 2018, 1:57 PM

Currently not compatible with D45997's COMPILER_RT_ENABLE_WERROR ON.

This revision was automatically updated to reflect the committed changes.