[PATCH] D37027: Fix cmake check for futimens when deploying to earlier macOS releases.

Juergen Ributzka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 14:36:40 PDT 2017


ributzka created this revision.
Herald added a subscriber: mgorny.

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.

I had to include HandleLLVMOptions.cmake into config-ix.cmake to make this work. I am not sure if this is the correct approach. I think we should do this anyways, because we should run all the checks with the same options that we use to actually compile LLVM.

Is there a reason why we are not doing this already?

In the initial patch I am making the warning an error for all platforms. Should I make this change Darwin specific?


Repository:
  rL LLVM

https://reviews.llvm.org/D37027

Files:
  llvm/cmake/config-ix.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -383,6 +383,7 @@
   append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
   append_if(LLVM_ENABLE_WERROR "-Wno-error" CMAKE_REQUIRED_FLAGS)
   add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
+  add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW)
   if (LLVM_ENABLE_CXX1Y)
     check_cxx_compiler_flag("-std=c++1y" CXX_SUPPORTS_CXX1Y)
     append_if(CXX_SUPPORTS_CXX1Y "-std=c++1y" CMAKE_CXX_FLAGS)
Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -13,6 +13,7 @@
 
 include(CheckCompilerVersion)
 include(HandleLLVMStdlib)
+include(HandleLLVMOptions)
 
 if( UNIX AND NOT (BEOS OR HAIKU) )
   # Used by check_symbol_exists:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37027.112226.patch
Type: text/x-patch
Size: 1026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170822/8c04b1bb/attachment.bin>


More information about the llvm-commits mailing list