[libcxx-commits] [PATCH] D75955: [libcxx] Enable C++17 for the benchmarks
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 10 13:06:30 PDT 2020
Mordante created this revision.
Mordante added a reviewer: ldionne.
Mordante added a project: libc++.
Herald added subscribers: dexonsmith, mgorny.
Herald added a reviewer: EricWF.
Herald added a reviewer: mclow.lists.
The benchmarks are intended to be build with C++17 but the CMAKE_CXX_STANDARD in the LLVM forces the build to use C++14 by default. This fixes the issue by setting the CXX_STANDARD property of the benchmark targets.
The CMake documentation is not clear whether this will use the C++1z fallback for older compilers. So this may break the benchmarks if somebody uses the benchmarks with pre C++17 compilers with the C++1z fallback.
This was discovered while investigating the build issue of D62778 <https://reviews.llvm.org/D62778>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75955
Files:
libcxx/benchmarks/CMakeLists.txt
Index: libcxx/benchmarks/CMakeLists.txt
===================================================================
--- libcxx/benchmarks/CMakeLists.txt
+++ libcxx/benchmarks/CMakeLists.txt
@@ -72,16 +72,6 @@
set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx)
set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native)
-check_flag_supported("-std=c++17")
-mangle_name("LIBCXX_SUPPORTS_STD_EQ_c++17_FLAG" BENCHMARK_SUPPORTS_STD_CXX17_FLAG)
-if (${BENCHMARK_SUPPORTS_STD_CXX17_FLAG})
- set(BENCHMARK_DIALECT_FLAG "-std=c++17")
-else()
- # If the compiler doesn't support -std=c++17, attempt to fall back to -std=c++1z while still
- # requiring C++17 language features.
- set(BENCHMARK_DIALECT_FLAG "-std=c++1z")
-endif()
-
set(BENCHMARK_TEST_COMPILE_FLAGS
${BENCHMARK_DIALECT_FLAG} -O2
-fsized-deallocation
@@ -151,6 +141,7 @@
OUTPUT_NAME "${name}.libcxx.out"
RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}"
COMPILE_FLAGS "${BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS}"
+ CXX_STANDARD 17
LINK_FLAGS "${BENCHMARK_TEST_LIBCXX_LINK_FLAGS}")
cxx_link_system_libraries(${libcxx_target})
if (LIBCXX_BENCHMARK_NATIVE_STDLIB)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75955.249479.patch
Type: text/x-patch
Size: 1222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200310/50cdf0df/attachment-0001.bin>
More information about the libcxx-commits
mailing list