r245304 - We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 18 09:15:44 PDT 2015


Author: cbieneman
Date: Tue Aug 18 11:15:44 2015
New Revision: 245304

URL: http://llvm.org/viewvc/llvm-project?rev=245304&view=rev
Log:
We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

Summary: The code comments in the Makefile indicate this was put in place to support issues when building clang with GCC. Today clang's strict aliasing works, so we shouldn't pass -fno-strict-aliasing when building with clang.

Reviewers: bogner, echristo

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12036

Modified:
    cfe/trunk/CMakeLists.txt
    cfe/trunk/Makefile

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=245304&r1=245303&r2=245304&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Tue Aug 18 11:15:44 2015
@@ -253,7 +253,10 @@ configure_file(
 
 # Add appropriate flags for GCC
 if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -fno-strict-aliasing")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual")
+  if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
+  endif ()
 
   # Enable -pedantic for Clang even if it's not enabled for LLVM.
   if (NOT LLVM_ENABLE_PEDANTIC)

Modified: cfe/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Makefile?rev=245304&r1=245303&r2=245304&view=diff
==============================================================================
--- cfe/trunk/Makefile (original)
+++ cfe/trunk/Makefile Tue Aug 18 11:15:44 2015
@@ -67,8 +67,11 @@ endif
 #   http://gcc.gnu.org/PR41874
 #   http://gcc.gnu.org/PR41838
 #
-# We can revisit this when LLVM/Clang support it.
+# We don't need to do this if the host compiler is clang.
+ifeq ($(CXX_COMPILER), "clang")
 CXX.Flags += -fno-strict-aliasing
+endif
+
 
 # Set up Clang's tblgen.
 ifndef CLANG_TBLGEN




More information about the cfe-commits mailing list