Skip to content

Commit c5635a6

Browse files
author
Chris Bieneman
committed
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 llvm-svn: 245304
1 parent f2bd72e commit c5635a6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

clang/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ configure_file(
253253

254254
# Add appropriate flags for GCC
255255
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
256-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -fno-strict-aliasing")
256+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual")
257+
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
258+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
259+
endif ()
257260

258261
# Enable -pedantic for Clang even if it's not enabled for LLVM.
259262
if (NOT LLVM_ENABLE_PEDANTIC)

clang/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,11 @@ endif
6767
# http://gcc.gnu.org/PR41874
6868
# http://gcc.gnu.org/PR41838
6969
#
70-
# We can revisit this when LLVM/Clang support it.
70+
# We don't need to do this if the host compiler is clang.
71+
ifeq ($(CXX_COMPILER), "clang")
7172
CXX.Flags += -fno-strict-aliasing
73+
endif
74+
7275

7376
# Set up Clang's tblgen.
7477
ifndef CLANG_TBLGEN

0 commit comments

Comments
 (0)