summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-05-06 09:46:06 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-05-06 09:46:06 +0000
commit0e8c40d6439acdc2a31f2c1c4eab5d547baa01a6 (patch)
tree46287c25fcd2011e10bdae3909c86b4e3d9a00a9 /cmake
parent64cd55a12676cf108f89438dfa7b47b9c1cf0b75 (diff)
downloadllvm-0e8c40d6439acdc2a31f2c1c4eab5d547baa01a6.tar.gz
llvm-0e8c40d6439acdc2a31f2c1c4eab5d547baa01a6.tar.bz2
llvm-0e8c40d6439acdc2a31f2c1c4eab5d547baa01a6.tar.xz
Disable -Wcomment when building with GCC.
GCC version of -Wcomment is not compatible with ascii art graph diagrams. Reverts r207629. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index d5afc626f9..5b332ac74d 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -295,6 +295,17 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
append_if(USE_NO_MAYBE_UNINITIALIZED "-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS)
check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" CXX_SUPPORTS_NON_VIRTUAL_DTOR_FLAG)
append_if(CXX_SUPPORTS_NON_VIRTUAL_DTOR_FLAG "-Wnon-virtual-dtor" CMAKE_CXX_FLAGS)
+
+ # Check if -Wcomment is OK with an // comment ending with '\' if the next
+ # line is also a // comment.
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Werror -Wcomment)
+ CHECK_C_SOURCE_COMPILES("// \\\\\\n//\\nint main() {return 0;}"
+ C_WCOMMENT_ALLOWS_LINE_WRAP)
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+ if (NOT C_WCOMMENT_ALLOWS_LINE_WRAP)
+ append("-Wno-comment" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ endif()
endif (LLVM_ENABLE_WARNINGS)
append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
if (LLVM_ENABLE_CXX1Y)