[libcxx-commits] [libcxxabi] ff5050a - [libc++abi] Guard include of <unistd.h> behind __has_include

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 20 14:37:24 PDT 2021


Author: Louis Dionne
Date: 2021-10-20T17:37:19-04:00
New Revision: ff5050a3a4f2965aaddfce2f6b182476c11d78f3

URL: https://github.com/llvm/llvm-project/commit/ff5050a3a4f2965aaddfce2f6b182476c11d78f3
DIFF: https://github.com/llvm/llvm-project/commit/ff5050a3a4f2965aaddfce2f6b182476c11d78f3.diff

LOG: [libc++abi] Guard include of <unistd.h> behind __has_include

This doesn't change anything on platforms that have <unistd.h>, but
it will allow this file to compile on platforms that do not.

Added: 
    

Modified: 
    libcxxabi/src/cxa_guard_impl.h

Removed: 
    


################################################################################
diff  --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h
index 9d519bfc9f9fb..e60e15a50fa10 100644
--- a/libcxxabi/src/cxa_guard_impl.h
+++ b/libcxxabi/src/cxa_guard_impl.h
@@ -39,11 +39,13 @@
 
 #include "__cxxabi_config.h"
 #include "include/atomic_support.h" // from libc++
-#include <unistd.h>
 #if defined(__has_include)
 #  if __has_include(<sys/syscall.h>)
 #    include <sys/syscall.h>
 #  endif
+#  if __has_include(<unistd.h>)
+#    include <unistd.h>
+#  endif
 #endif
 
 #include <stdlib.h>


        


More information about the libcxx-commits mailing list