[libcxx-commits] [libcxx] d184d02 - [libcxx] Enable C++17 for the benchmarks.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 12 13:35:19 PDT 2020


Author: Mark de Wever
Date: 2020-03-12T21:35:00+01:00
New Revision: d184d0226301d8bb8b3fdaee52bb636faddd81bc

URL: https://github.com/llvm/llvm-project/commit/d184d0226301d8bb8b3fdaee52bb636faddd81bc
DIFF: https://github.com/llvm/llvm-project/commit/d184d0226301d8bb8b3fdaee52bb636faddd81bc.diff

LOG: [libcxx] Enable C++17 for the benchmarks.

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.

Differential Revision: https://reviews.llvm.org/D75955

Added: 
    

Modified: 
    libcxx/benchmarks/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/benchmarks/CMakeLists.txt
index bd38de97d7a9..6bd8f4152953 100644
--- a/libcxx/benchmarks/CMakeLists.txt
+++ b/libcxx/benchmarks/CMakeLists.txt
@@ -72,18 +72,8 @@ set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
 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
+    -O2
     -fsized-deallocation
     -I${BENCHMARK_LIBCXX_INSTALL}/include
     -I${LIBCXX_SOURCE_DIR}/test/support
@@ -151,6 +141,7 @@ function(add_benchmark_test name source_file)
           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)


        


More information about the libcxx-commits mailing list