Skip to content

Commit c0fc219

Browse files
committedAug 29, 2017
Re-apply "Fix cmake check for futimens when deploying to earlier macOS releases."
This fixes an issue with the use of LLVM_PARALLEL_LINK_JOBS. Original commit message: macOS 10.13 added a new API (futimens). This API is only available on macOS 10.13 and later, but the cmake check we have in place only tests if the symbol is present and ignores the availability attribute. Luckily we have new warning for this and by making this warning an error the cmake check will return the correct result. See also rdar://problem/33992750. Differential Revision: https://reviews.llvm.org/D37027 llvm-svn: 311965
1 parent 2ebcca2 commit c0fc219

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
 

‎llvm/cmake/config-ix.cmake

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ include(CheckIncludeFileCXX)
88
include(CheckLibraryExists)
99
include(CheckSymbolExists)
1010
include(CheckFunctionExists)
11+
include(CheckCCompilerFlag)
1112
include(CheckCXXSourceCompiles)
1213
include(TestBigEndian)
1314

@@ -179,6 +180,14 @@ check_symbol_exists(arc4random "stdlib.h" HAVE_DECL_ARC4RANDOM)
179180
find_package(Backtrace)
180181
set(HAVE_BACKTRACE ${Backtrace_FOUND})
181182
set(BACKTRACE_HEADER ${Backtrace_HEADER})
183+
184+
# Prevent check_symbol_exists from using API that is not supported for a given
185+
# deployment target.
186+
check_c_compiler_flag("-Werror=unguarded-availability-new" "C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW")
187+
if(C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW)
188+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unguarded-availability-new")
189+
endif()
190+
182191
check_symbol_exists(_Unwind_Backtrace "unwind.h" HAVE__UNWIND_BACKTRACE)
183192
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
184193
check_symbol_exists(sysconf unistd.h HAVE_SYSCONF)

‎llvm/cmake/modules/HandleLLVMOptions.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
383383
append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
384384
append_if(LLVM_ENABLE_WERROR "-Wno-error" CMAKE_REQUIRED_FLAGS)
385385
add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
386+
add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW)
386387
if (LLVM_ENABLE_CXX1Y)
387388
check_cxx_compiler_flag("-std=c++1y" CXX_SUPPORTS_CXX1Y)
388389
append_if(CXX_SUPPORTS_CXX1Y "-std=c++1y" CMAKE_CXX_FLAGS)

0 commit comments

Comments
 (0)
Please sign in to comment.