Skip to content

Commit 0c27673

Browse files
authored
[SPEC] Add compiler check for -fwrapv-pointer in xalancbmk (#237)
-fwrapv-pointer is a relatively recent flag and older versions of clang may not support it. Hopefully older versions of clang also don't perform the UB optimisation that warrants the use of the flag in the first place
1 parent be7a9dc commit 0c27673

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

External/SPEC/CINT2006/483.xalancbmk/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ add_definitions(
1414

1515
list(APPEND CXXFLAGS -std=gnu++98)
1616

17+
include(CheckCXXCompilerFlag)
18+
1719
# Workaround undefined behaviour in xerces-c dependency.
1820
# This is fixed upstream but not included in SPEC CPU 2017:
1921
# https://github.com/apache/xerces-c/commit/02e48494496dd24476490fd36c1bc97b6a37002e#diff-e2f4677367dcf43bd6d31b2bbca5b1aa89e36ec155a040fe4447b201a554cf81
20-
add_compile_options(-fwrapv-pointer)
22+
check_cxx_compiler_flag(-fwrapv-pointer
23+
HAVE_CXX_FLAG_FWRAPV_POINTER)
24+
if(HAVE_CXX_FLAG_FWRAPV_POINTER)
25+
add_compile_options(-fwrapv-pointer)
26+
endif()
2127

22-
include(CheckCXXCompilerFlag)
2328
check_cxx_compiler_flag(-fdelayed-template-parsing
2429
HAVE_CXX_FLAG_FDELAYED_TEMPLATE_PARSING)
2530
if(HAVE_CXX_FLAG_FDELAYED_TEMPLATE_PARSING)

External/SPEC/CINT2017rate/523.xalancbmk_r/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ speccpu2017_benchmark(RATE)
88

99
set(CMAKE_CXX_STANDARD 14)
1010

11+
include(CheckCXXCompilerFlag)
12+
1113
# Workaround undefined behaviour in xerces-c dependency.
1214
# This is fixed upstream but not included in SPEC CPU 2017:
1315
# https://github.com/apache/xerces-c/commit/02e48494496dd24476490fd36c1bc97b6a37002e#diff-e2f4677367dcf43bd6d31b2bbca5b1aa89e36ec155a040fe4447b201a554cf81
14-
add_compile_options(-fwrapv-pointer)
16+
check_cxx_compiler_flag(-fwrapv-pointer
17+
HAVE_CXX_FLAG_FWRAPV_POINTER)
18+
if(HAVE_CXX_FLAG_FWRAPV_POINTER)
19+
add_compile_options(-fwrapv-pointer)
20+
endif()
1521

16-
include(CheckCXXCompilerFlag)
1722
check_cxx_compiler_flag(-fdelayed-template-parsing
1823
HAVE_CXX_FLAG_FDELAYED_TEMPLATE_PARSING)
1924
if(HAVE_CXX_FLAG_FDELAYED_TEMPLATE_PARSING)

0 commit comments

Comments
 (0)