Skip to content

Commit

Permalink
[cmake] Use -std=gnu++11 to fix alloca() on NetBSD
Browse files Browse the repository at this point in the history
Prefer using '-std=gnu++11' over '-std=c++11' when available, as NetBSD
exposes the correct alloca() implementation only with gnu* C/C++
standards.

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

llvm-svn: 348854
  • Loading branch information
mgorny committed Dec 11, 2018
1 parent b51283b commit e9d4267
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion openmp/cmake/HandleOpenMPOptions.cmake
Expand Up @@ -13,4 +13,7 @@ if (${OPENMP_ENABLE_WERROR})
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)
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()
3 changes: 2 additions & 1 deletion openmp/cmake/config-ix.cmake
Expand Up @@ -3,4 +3,5 @@ include(CheckCXXCompilerFlag)

check_c_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)

check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_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)

0 comments on commit e9d4267

Please sign in to comment.