[llvm] r360174 - Guard __builtin_available() with __has_builtin to support older host compilers.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 10:10:27 PDT 2019


Author: adrian
Date: Tue May  7 10:10:27 2019
New Revision: 360174

URL: http://llvm.org/viewvc/llvm-project?rev=360174&view=rev
Log:
Guard __builtin_available() with __has_builtin to support older host compilers.

Modified:
    llvm/trunk/lib/Support/Unix/Path.inc

Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=360174&r1=360173&r2=360174&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Tue May  7 10:10:27 2019
@@ -1137,6 +1137,7 @@ namespace fs {
 /// implementation.
 std::error_code copy_file(const Twine &From, const Twine &To) {
   uint32_t Flag = COPYFILE_DATA;
+#if __has_builtin(__builtin_available)
   if (__builtin_available(macos 10.12, *)) {
     bool IsSymlink;
     if (std::error_code Error = is_symlink_file(From, IsSymlink))
@@ -1146,7 +1147,7 @@ std::error_code copy_file(const Twine &F
     if (!IsSymlink && !exists(To))
       Flag = COPYFILE_CLONE;
   }
-
+#endif
   int Status =
       copyfile(From.str().c_str(), To.str().c_str(), /* State */ NULL, Flag);
 




More information about the llvm-commits mailing list