[llvm] r208073 - Disable -Wcomment when building with GCC.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Tue May 6 02:46:07 PDT 2014


Author: eugenis
Date: Tue May  6 04:46:06 2014
New Revision: 208073

URL: http://llvm.org/viewvc/llvm-project?rev=208073&view=rev
Log:
Disable -Wcomment when building with GCC.

GCC version of -Wcomment is not compatible with ascii art graph diagrams.

Reverts r207629.


Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
    llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=208073&r1=208072&r2=208073&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Tue May  6 04:46:06 2014
@@ -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)

Modified: llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp?rev=208073&r1=208072&r2=208073&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp Tue May  6 04:46:06 2014
@@ -41,17 +41,17 @@ std::unique_ptr<Module> parseAssembly(co
 
 // IR forming a call graph with a diamond of triangle-shaped SCCs:
 //
-//         d1       |
-//        /  \      |
-//       d3--d2     |
-//      /     \     |
-//     b1     c1    |
-//   /  \    /  \   |
-//  b3--b2  c3--c2  |
-//       \  /       |
-//        a1        |
-//       /  \       |
-//      a3--a2      |
+//         d1
+//        /  \
+//       d3--d2
+//      /     \
+//     b1     c1
+//   /  \    /  \
+//  b3--b2  c3--c2
+//       \  /
+//        a1
+//       /  \
+//      a3--a2
 //
 // All call edges go up between SCCs, and clockwise around the SCC.
 static const char DiamondOfTriangles[] =





More information about the llvm-commits mailing list