]> granicus.if.org Git - clang/commitdiff
We shouldn't need to pass -fno-strict-aliasing when building clang with clang.
authorChris Bieneman <beanz@apple.com>
Tue, 18 Aug 2015 16:15:44 +0000 (16:15 +0000)
committerChris Bieneman <beanz@apple.com>
Tue, 18 Aug 2015 16:15:44 +0000 (16:15 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245304 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
Makefile

index d808844b14cd1d193193cd4a98ee99f73445c259..382770b10639884e133b21a66130cb2436884f68 100644 (file)
@@ -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)
index bbc521f4c0e5c79329fb929ef36fefbb27f1a09e..38b6fd1adac74ccb1c4ec1670da950eb7f91ad45 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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