Skip to content

Commit

Permalink
cmake: Set -fno-strict-aliasing everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfonseca committed Mar 15, 2015
1 parent f1baf37 commit 8e5e379
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ else ()
# XXX: it's safer to use ssize_t everywhere instead of disabling warning
add_compiler_flags (-Wno-sign-compare) # comparison between signed and unsigned integer expressions

# Disable strict aliasing assumptions. We generate a lot of C++ code, and
# it's not always easy to guarantee or spot when strict aliasing
# assumptions are violated. Above all, the benefit is not worth the risk.
add_compiler_flags ("-fno-strict-aliasing")

# No RTTI required
#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")

Expand Down
7 changes: 0 additions & 7 deletions thirdparty/md5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
include (CheckCCompilerFlag)

check_c_compiler_flag ("-fno-strict-aliasing" C_COMPILER_FLAG_NO_STRICT_ALIASING)
if (C_COMPILER_FLAG_NO_STRICT_ALIASING)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
endif ()

add_library (md5_bundled STATIC EXCLUDE_FROM_ALL
md5.c
)
3 changes: 2 additions & 1 deletion thirdparty/snappy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ add_definitions (

# Adjust warnings
if (NOT MSVC)
add_definitions (-Wno-unused-function)
add_compiler_flags (-Wno-unused-function)
add_compiler_flags (-fstrict-aliasing)
endif ()

add_convenience_library (snappy_bundled EXCLUDE_FROM_ALL
Expand Down

0 comments on commit 8e5e379

Please sign in to comment.