Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25b88b4

Browse files
authored
Disabled strict aliasing by default (vesoft-inc#1665)
1 parent bb0787d commit 25b88b4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ option(ENABLE_COVERAGE "Whether to turn unit test coverage ON or OFF" OFF)
5353
option(ENABLE_UBSAN "Whether to turn Undefined Behavior Sanitizer ON or OFF" OFF)
5454
option(ENABLE_FUZZ_TEST "Whether to turn Fuzz Test ON or OFF" OFF)
5555
option(ENABLE_WERROR "Whether to error on warnings" ON)
56+
option(ENABLE_STRICT_ALIASING "Whether to turn strict-aliasing ON or OFF" OFF)
5657
option(ENABLE_TSAN "Whether to turn Thread Sanitizer ON or OFF" OFF)
5758
option(ENABLE_STATIC_ASAN "Whether directs the GCC driver to link libasan statically" OFF)
5859
option(ENABLE_STATIC_UBSAN "Whether directs the GCC driver to link libubsan statically" OFF)
@@ -65,9 +66,8 @@ message(STATUS "ENABLE_FUZZ_TEST: ${ENABLE_FUZZ_TEST}")
6566
message(STATUS "ENABLE_TSAN: ${ENABLE_TSAN}")
6667
message(STATUS "ENABLE_STATIC_ASAN : ${ENABLE_STATIC_ASAN}")
6768
message(STATUS "ENABLE_STATIC_UBSAN : ${ENABLE_STATIC_UBSAN}")
68-
69-
70-
add_compile_options(-fno-strict-aliasing)
69+
message(STATUS "ENABLE_WERROR: ${ENABLE_WERROR}")
70+
message(STATUS "ENABLE_STRICT_ALIASING: ${ENABLE_STRICT_ALIASING}")
7171

7272
if (ENABLE_NATIVE)
7373
message(STATUS "ENABLE_NATIVE is ${ENABLE_NATIVE}")
@@ -275,6 +275,10 @@ if(ENABLE_WERROR)
275275
add_compile_options(-Werror)
276276
endif()
277277

278+
if(NOT ENABLE_STRICT_ALIASING)
279+
add_compile_options(-fno-strict-aliasing)
280+
endif()
281+
278282
include(CheckCXXCompilerFlag)
279283

280284
# TODO(dutor) Move all compiler-config-related operations to a separate file

0 commit comments

Comments
 (0)