[Openmp-commits] [openmp] 3ff4e2e - [OpenMP] Switch default C++ standard to C++ 14

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 11 15:12:31 PST 2020


Author: Johannes Doerfert
Date: 2020-02-11T17:11:54-06:00
New Revision: 3ff4e2eee8c39fd4ae13b1df412f0af219fbf382

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

LOG: [OpenMP] Switch default C++ standard to C++ 14

Reviewed By: JonChesterfield

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

Added: 
    

Modified: 
    openmp/CMakeLists.txt
    openmp/cmake/HandleOpenMPOptions.cmake
    openmp/cmake/config-ix.cmake
    openmp/libomptarget/cmake/Modules/LibomptargetNVPTXBitcodeLibrary.cmake
    openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
    openmp/runtime/test/lit.cfg
    openmp/tools/archer/tests/lit.cfg

Removed: 
    


################################################################################
diff  --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index 9825183a0dd7..7007611301f0 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -62,7 +62,7 @@ set(ENABLE_LIBOMPTARGET ON)
 # Currently libomptarget cannot be compiled on Windows or MacOS X.
 # Since the device plugins are only supported on Linux anyway,
 # there is no point in trying to compile libomptarget on other OSes.
-if (APPLE OR WIN32 OR NOT OPENMP_HAVE_STD_CPP11_FLAG)
+if (APPLE OR WIN32 OR NOT OPENMP_HAVE_STD_CPP14_FLAG)
   set(ENABLE_LIBOMPTARGET OFF)
 endif()
 
@@ -72,8 +72,8 @@ if (OPENMP_ENABLE_LIBOMPTARGET)
   # Check that the library can actually be built.
   if (APPLE OR WIN32)
     message(FATAL_ERROR "libomptarget cannot be built on Windows and MacOS X!")
-  elseif (NOT OPENMP_HAVE_STD_CPP11_FLAG)
-    message(FATAL_ERROR "Host compiler must support C++11 to build libomptarget!")
+  elseif (NOT OPENMP_HAVE_STD_CPP14_FLAG)
+    message(FATAL_ERROR "Host compiler must support C++14 to build libomptarget!")
   endif()
 
   add_subdirectory(libomptarget)

diff  --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake
index eb7b286b3383..15382bcf12de 100644
--- a/openmp/cmake/HandleOpenMPOptions.cmake
+++ b/openmp/cmake/HandleOpenMPOptions.cmake
@@ -29,7 +29,7 @@ append_if(OPENMP_HAVE_WNO_EXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 append_if(OPENMP_HAVE_WNO_PEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 append_if(OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 
-append_if(OPENMP_HAVE_STD_GNUPP11_FLAG "-std=gnu++11" CMAKE_CXX_FLAGS)
-if (NOT OPENMP_HAVE_STD_GNUPP11_FLAG)
-  append_if(OPENMP_HAVE_STD_CPP11_FLAG "-std=c++11" CMAKE_CXX_FLAGS)
+append_if(OPENMP_HAVE_STD_GNUPP14_FLAG "-std=gnu++14" CMAKE_CXX_FLAGS)
+if (NOT OPENMP_HAVE_STD_GNUPP14_FLAG)
+  append_if(OPENMP_HAVE_STD_CPP14_FLAG "-std=c++14" CMAKE_CXX_FLAGS)
 endif()

diff  --git a/openmp/cmake/config-ix.cmake b/openmp/cmake/config-ix.cmake
index ebb2530ae541..d9ea3bbb0574 100644
--- a/openmp/cmake/config-ix.cmake
+++ b/openmp/cmake/config-ix.cmake
@@ -14,5 +14,5 @@ check_cxx_compiler_flag(-Wno-extra OPENMP_HAVE_WNO_EXTRA_FLAG)
 check_cxx_compiler_flag(-Wno-pedantic OPENMP_HAVE_WNO_PEDANTIC_FLAG)
 check_cxx_compiler_flag(-Wno-maybe-uninitialized OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG)
 
-check_cxx_compiler_flag(-std=gnu++11 OPENMP_HAVE_STD_GNUPP11_FLAG)
-check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG)
+check_cxx_compiler_flag(-std=gnu++14 OPENMP_HAVE_STD_GNUPP14_FLAG)
+check_cxx_compiler_flag(-std=c++14 OPENMP_HAVE_STD_CPP14_FLAG)

diff  --git a/openmp/libomptarget/cmake/Modules/LibomptargetNVPTXBitcodeLibrary.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetNVPTXBitcodeLibrary.cmake
index 538bf9277495..6ec0cc2b61bc 100644
--- a/openmp/libomptarget/cmake/Modules/LibomptargetNVPTXBitcodeLibrary.cmake
+++ b/openmp/libomptarget/cmake/Modules/LibomptargetNVPTXBitcodeLibrary.cmake
@@ -78,7 +78,7 @@ endfunction()
 
 # These flags are required to emit LLVM Bitcode. We check them together because
 # if any of them are not supported, there is no point in finding out which are.
-set(compiler_flags_required -emit-llvm -O1 --cuda-device-only -std=c++11 --cuda-path=${CUDA_TOOLKIT_ROOT_DIR})
+set(compiler_flags_required -emit-llvm -O1 --cuda-device-only -std=c++14 --cuda-path=${CUDA_TOOLKIT_ROOT_DIR})
 set(compiler_flags_required_src "extern \"C\" __device__ int thread() { return threadIdx.x; }")
 check_bitcode_compilation(LIBOMPTARGET_NVPTX_CUDA_COMPILER_SUPPORTS_FLAGS_REQUIRED "${compiler_flags_required_src}" ${compiler_flags_required})
 

diff  --git a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
index aac7ddc28adc..ec08bd912663 100644
--- a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
+++ b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
@@ -98,7 +98,7 @@ endif()
 
 macro(add_cuda_bc_library)
   set(cu_cmd ${AOMP_BINDIR}/clang++
-    -std=c++11
+    -std=c++14
     -fcuda-rdc
     -fvisibility=default
     --cuda-device-only

diff  --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg
index 22be385ab417..8ff668aaaa00 100644
--- a/openmp/runtime/test/lit.cfg
+++ b/openmp/runtime/test/lit.cfg
@@ -111,7 +111,7 @@ config.substitutions.append(("%libomp-compile-and-run", \
 config.substitutions.append(("%libomp-cxx-compile-and-run", \
     "%libomp-cxx-compile && %libomp-run"))
 config.substitutions.append(("%libomp-cxx-compile", \
-    "%clangXX %openmp_flags %flags -std=c++11 %s -o %t" + libs))
+    "%clangXX %openmp_flags %flags -std=c++14 %s -o %t" + libs))
 config.substitutions.append(("%libomp-compile", \
     "%clang %openmp_flags %flags %s -o %t" + libs))
 config.substitutions.append(("%libomp-run", "%t"))

diff  --git a/openmp/tools/archer/tests/lit.cfg b/openmp/tools/archer/tests/lit.cfg
index 3014c020bb99..7ec88d3ca4e4 100644
--- a/openmp/tools/archer/tests/lit.cfg
+++ b/openmp/tools/archer/tests/lit.cfg
@@ -97,7 +97,7 @@ config.substitutions.append(("%libarcher-compile-and-run", \
 config.substitutions.append(("%libarcher-cxx-compile-and-run", \
     "%libarcher-cxx-compile && %libarcher-run"))
 config.substitutions.append(("%libarcher-cxx-compile", \
-    "%clang-archerXX %openmp_flags %archer_flags %flags -std=c++11 %s -o %t" + libs))
+    "%clang-archerXX %openmp_flags %archer_flags %flags -std=c++14 %s -o %t" + libs))
 config.substitutions.append(("%libarcher-compile", \
                              "%clang-archer %openmp_flags %archer_flags %flags %s -o %t" + libs))
 config.substitutions.append(("%libarcher-run-race", "%suppression %deflake %t 2>&1 | tee %t.log"))


        


More information about the Openmp-commits mailing list