[Openmp-commits] [PATCH] D55477: [openmp] [cmake] Use -std=gnu++11 to fix alloca() on NetBSD

Michał Górny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Dec 8 08:34:14 PST 2018


mgorny created this revision.
mgorny added reviewers: krytarowski, Hahnfeld.
Herald added a subscriber: guansong.

Prefer using '-std=gnu++11' over '-std=c++11' when available, as NetBSD
exposes the correct alloca() implementation only with gnu* C/C++
standards.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D55477

Files:
  cmake/HandleOpenMPOptions.cmake
  cmake/config-ix.cmake


Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -3,4 +3,5 @@
 
 check_c_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)
 
-check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG)
\ No newline at end of file
+check_cxx_compiler_flag(-std=gnu++11 OPENMP_HAVE_STD_GNUPP11_FLAG)
+check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG)
Index: cmake/HandleOpenMPOptions.cmake
===================================================================
--- cmake/HandleOpenMPOptions.cmake
+++ cmake/HandleOpenMPOptions.cmake
@@ -13,4 +13,7 @@
   append_if(OPENMP_HAVE_WERROR_FLAG "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 endif()
 
-append_if(OPENMP_HAVE_STD_CPP11_FLAG "-std=c++11" CMAKE_CXX_FLAGS)
\ No newline at end of file
+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)
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55477.177395.patch
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20181208/8cb6dc57/attachment.bin>


More information about the Openmp-commits mailing list