[libc] remove errno.h includes (#110934)
diff --git a/libc/src/pthread/CMakeLists.txt b/libc/src/pthread/CMakeLists.txt
index e7e92e5..8480fd8 100644
--- a/libc/src/pthread/CMakeLists.txt
+++ b/libc/src/pthread/CMakeLists.txt
@@ -36,6 +36,7 @@
pthread_attr_setdetachstate.h
DEPENDS
libc.include.pthread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -56,6 +57,7 @@
pthread_attr_setguardsize.h
DEPENDS
libc.include.pthread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -76,6 +78,7 @@
pthread_attr_setstacksize.h
DEPENDS
libc.include.pthread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -98,6 +101,7 @@
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_attr_setstacksize
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -149,10 +153,10 @@
HDRS
pthread_condattr_setclock.h
DEPENDS
- libc.include.errno
libc.include.pthread
libc.include.sys_types
libc.include.time
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -163,6 +167,7 @@
pthread_condattr_setpshared.h
DEPENDS
libc.include.pthread
+ libc.src.errno.errno
)
add_header_library(
@@ -205,6 +210,7 @@
DEPENDS
.pthread_mutexattr
libc.include.pthread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -215,7 +221,7 @@
pthread_mutexattr_destroy.h
DEPENDS
.pthread_mutexattr
- libc.include.errno
+ libc.src.errno.errno
libc.include.pthread
)
@@ -238,8 +244,8 @@
pthread_mutexattr_setrobust.h
DEPENDS
.pthread_mutexattr
- libc.include.errno
libc.include.pthread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -261,8 +267,8 @@
pthread_mutexattr_setpshared.h
DEPENDS
.pthread_mutexattr
- libc.include.errno
libc.include.pthread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -273,7 +279,7 @@
pthread_mutex_init.h
DEPENDS
.pthread_mutexattr
- libc.include.errno
+ libc.src.errno.errno
libc.include.pthread
libc.src.__support.threads.mutex
)
@@ -318,7 +324,6 @@
HDRS
pthread_create.h
DEPENDS
- libc.include.errno
libc.include.pthread
libc.src.__support.threads.thread
libc.src.pthread.pthread_attr_destroy
@@ -326,6 +331,7 @@
libc.src.pthread.pthread_attr_getdetachstate
libc.src.pthread.pthread_attr_getguardsize
libc.src.pthread.pthread_attr_getstack
+ libc.src.errno.errno
COMPILE_OPTIONS
-O3
-fno-omit-frame-pointer
@@ -419,9 +425,9 @@
HDRS
pthread_key_create.h
DEPENDS
- libc.include.errno
libc.include.pthread
libc.src.__support.threads.thread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -431,9 +437,9 @@
HDRS
pthread_key_delete.h
DEPENDS
- libc.include.errno
libc.include.pthread
libc.src.__support.threads.thread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -443,8 +449,8 @@
HDRS
pthread_getspecific.h
DEPENDS
- libc.include.errno
libc.include.pthread
+ libc.src.errno.errno
libc.src.__support.threads.thread
)
@@ -455,9 +461,9 @@
HDRS
pthread_setspecific.h
DEPENDS
- libc.include.errno
libc.include.pthread
libc.src.__support.threads.thread
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -508,7 +514,7 @@
pthread_rwlockattr_setkind_np.h
DEPENDS
libc.include.pthread
- libc.include.errno
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -519,7 +525,7 @@
pthread_rwlockattr_setpshared.h
DEPENDS
libc.include.pthread
- libc.include.errno
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -554,6 +560,7 @@
DEPENDS
libc.include.pthread
libc.src.__support.threads.linux.rwlock
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -587,6 +594,7 @@
DEPENDS
libc.include.pthread
libc.src.__support.threads.linux.rwlock
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -631,6 +639,7 @@
DEPENDS
libc.include.pthread
libc.src.__support.threads.linux.rwlock
+ libc.src.errno.errno
)
add_entrypoint_object(
@@ -727,7 +736,7 @@
HDRS
pthread_atfork.h
DEPENDS
- libc.include.errno
libc.include.pthread
libc.src.__support.threads.fork_callbacks
+ libc.src.errno.errno
)
diff --git a/libc/src/pthread/pthread_atfork.cpp b/libc/src/pthread/pthread_atfork.cpp
index d3f3c25..b2c67c7 100644
--- a/libc/src/pthread/pthread_atfork.cpp
+++ b/libc/src/pthread/pthread_atfork.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/fork_callbacks.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h> // For pthread_* type definitions.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_attr_setdetachstate.cpp b/libc/src/pthread/pthread_attr_setdetachstate.cpp
index 3aa72d2..872f694 100644
--- a/libc/src/pthread/pthread_attr_setdetachstate.cpp
+++ b/libc/src/pthread/pthread_attr_setdetachstate.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_attr_setguardsize.cpp b/libc/src/pthread/pthread_attr_setguardsize.cpp
index 389ee77..fa4375e 100644
--- a/libc/src/pthread/pthread_attr_setguardsize.cpp
+++ b/libc/src/pthread/pthread_attr_setguardsize.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_attr_setstack.cpp b/libc/src/pthread/pthread_attr_setstack.cpp
index f4f2d14..1154055 100644
--- a/libc/src/pthread/pthread_attr_setstack.cpp
+++ b/libc/src/pthread/pthread_attr_setstack.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h" // For STACK_ALIGNMENT
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
#include <stdint.h>
diff --git a/libc/src/pthread/pthread_attr_setstacksize.cpp b/libc/src/pthread/pthread_attr_setstacksize.cpp
index f327d33..0a5d1af 100644
--- a/libc/src/pthread/pthread_attr_setstacksize.cpp
+++ b/libc/src/pthread/pthread_attr_setstacksize.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_condattr_setclock.cpp b/libc/src/pthread/pthread_condattr_setclock.cpp
index 5c01445..37fbd6b 100644
--- a/libc/src/pthread/pthread_condattr_setclock.cpp
+++ b/libc/src/pthread/pthread_condattr_setclock.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h> // EINVAL
#include <pthread.h> // pthread_condattr_t
#include <sys/types.h> // clockid_t
#include <time.h> // CLOCK_MONOTONIC, CLOCK_REALTIME
diff --git a/libc/src/pthread/pthread_condattr_setpshared.cpp b/libc/src/pthread/pthread_condattr_setpshared.cpp
index 536aead..433b2dc 100644
--- a/libc/src/pthread/pthread_condattr_setpshared.cpp
+++ b/libc/src/pthread/pthread_condattr_setpshared.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h> // EINVAL
#include <pthread.h> // pthread_condattr_t, PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_create.cpp b/libc/src/pthread/pthread_create.cpp
index 1fb4b50..e1b1f3b 100644
--- a/libc/src/pthread/pthread_create.cpp
+++ b/libc/src/pthread/pthread_create.cpp
@@ -19,8 +19,8 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/threads/thread.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h> // For pthread_* type definitions.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_key_create.cpp b/libc/src/pthread/pthread_key_create.cpp
index 0583bac..383762f 100644
--- a/libc/src/pthread/pthread_key_create.cpp
+++ b/libc/src/pthread/pthread_key_create.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_key_delete.cpp b/libc/src/pthread/pthread_key_delete.cpp
index 20484fa..b54db82 100644
--- a/libc/src/pthread/pthread_key_delete.cpp
+++ b/libc/src/pthread/pthread_key_delete.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_mutex_init.cpp b/libc/src/pthread/pthread_mutex_init.cpp
index 0281f73..94052e5 100644
--- a/libc/src/pthread/pthread_mutex_init.cpp
+++ b/libc/src/pthread/pthread_mutex_init.cpp
@@ -13,7 +13,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/threads/mutex.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_mutexattr_destroy.cpp b/libc/src/pthread/pthread_mutexattr_destroy.cpp
index 3b2551a..bddeb8b 100644
--- a/libc/src/pthread/pthread_mutexattr_destroy.cpp
+++ b/libc/src/pthread/pthread_mutexattr_destroy.cpp
@@ -12,8 +12,6 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
-#include <errno.h>
-
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_destroy, (pthread_mutexattr_t *)) {
diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.cpp b/libc/src/pthread/pthread_mutexattr_getpshared.cpp
index 2d83a52..0ea5d42 100644
--- a/libc/src/pthread/pthread_mutexattr_getpshared.cpp
+++ b/libc/src/pthread/pthread_mutexattr_getpshared.cpp
@@ -12,8 +12,6 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
-#include <errno.h>
-
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared,
diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.cpp b/libc/src/pthread/pthread_mutexattr_getrobust.cpp
index 508b502..b2359e0 100644
--- a/libc/src/pthread/pthread_mutexattr_getrobust.cpp
+++ b/libc/src/pthread/pthread_mutexattr_getrobust.cpp
@@ -12,8 +12,6 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
-#include <errno.h>
-
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust,
diff --git a/libc/src/pthread/pthread_mutexattr_gettype.cpp b/libc/src/pthread/pthread_mutexattr_gettype.cpp
index 3747bf5..0bd226e 100644
--- a/libc/src/pthread/pthread_mutexattr_gettype.cpp
+++ b/libc/src/pthread/pthread_mutexattr_gettype.cpp
@@ -12,8 +12,6 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
-#include <errno.h>
-
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype,
diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.cpp b/libc/src/pthread/pthread_mutexattr_setpshared.cpp
index b290de7..deeae15 100644
--- a/libc/src/pthread/pthread_mutexattr_setpshared.cpp
+++ b/libc/src/pthread/pthread_mutexattr_setpshared.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.cpp b/libc/src/pthread/pthread_mutexattr_setrobust.cpp
index e572827..9fd46f4 100644
--- a/libc/src/pthread/pthread_mutexattr_setrobust.cpp
+++ b/libc/src/pthread/pthread_mutexattr_setrobust.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_mutexattr_settype.cpp b/libc/src/pthread/pthread_mutexattr_settype.cpp
index 27e8ff8..c7e7827 100644
--- a/libc/src/pthread/pthread_mutexattr_settype.cpp
+++ b/libc/src/pthread/pthread_mutexattr_settype.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_destroy.cpp b/libc/src/pthread/pthread_rwlock_destroy.cpp
index 345076a..afc5622 100644
--- a/libc/src/pthread/pthread_rwlock_destroy.cpp
+++ b/libc/src/pthread/pthread_rwlock_destroy.cpp
@@ -12,7 +12,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_init.cpp b/libc/src/pthread/pthread_rwlock_init.cpp
index d1a3162..dc5424c 100644
--- a/libc/src/pthread/pthread_rwlock_init.cpp
+++ b/libc/src/pthread/pthread_rwlock_init.cpp
@@ -14,7 +14,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_rdlock.cpp b/libc/src/pthread/pthread_rwlock_rdlock.cpp
index 16d82301..7dee8eb 100644
--- a/libc/src/pthread/pthread_rwlock_rdlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_rdlock.cpp
@@ -12,7 +12,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_timedrdlock.cpp b/libc/src/pthread/pthread_rwlock_timedrdlock.cpp
index 9055410..112ff5c 100644
--- a/libc/src/pthread/pthread_rwlock_timedrdlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_timedrdlock.cpp
@@ -7,15 +7,14 @@
//===----------------------------------------------------------------------===//
#include "src/pthread/pthread_rwlock_timedrdlock.h"
-
#include "src/__support/common.h"
#include "src/__support/libc_assert.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/threads/linux/rwlock.h"
#include "src/__support/time/linux/abs_timeout.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_timedwrlock.cpp b/libc/src/pthread/pthread_rwlock_timedwrlock.cpp
index f77ac40..d2dc70e 100644
--- a/libc/src/pthread/pthread_rwlock_timedwrlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_timedwrlock.cpp
@@ -15,7 +15,6 @@
#include "src/__support/threads/linux/rwlock.h"
#include "src/__support/time/linux/abs_timeout.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_tryrdlock.cpp b/libc/src/pthread/pthread_rwlock_tryrdlock.cpp
index da59a57..d54b57f 100644
--- a/libc/src/pthread/pthread_rwlock_tryrdlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_tryrdlock.cpp
@@ -12,7 +12,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_trywrlock.cpp b/libc/src/pthread/pthread_rwlock_trywrlock.cpp
index ccd1bd4..a63dc89 100644
--- a/libc/src/pthread/pthread_rwlock_trywrlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_trywrlock.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_unlock.cpp b/libc/src/pthread/pthread_rwlock_unlock.cpp
index 77c50a8..e612901 100644
--- a/libc/src/pthread/pthread_rwlock_unlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_unlock.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlock_wrlock.cpp b/libc/src/pthread/pthread_rwlock_wrlock.cpp
index c2561c8..f02fb6b5 100644
--- a/libc/src/pthread/pthread_rwlock_wrlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_wrlock.cpp
@@ -12,7 +12,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp b/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
index 45dbb05..80d34a3 100644
--- a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
+++ b/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h> // pthread_rwlockattr_t
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_rwlockattr_setpshared.cpp b/libc/src/pthread/pthread_rwlockattr_setpshared.cpp
index 8088b68..5a7191a 100644
--- a/libc/src/pthread/pthread_rwlockattr_setpshared.cpp
+++ b/libc/src/pthread/pthread_rwlockattr_setpshared.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h> // EINVAL
#include <pthread.h> // pthread_rwlockattr_t, PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/pthread/pthread_setspecific.cpp b/libc/src/pthread/pthread_setspecific.cpp
index 5587a2d..70c29c1 100644
--- a/libc/src/pthread/pthread_setspecific.cpp
+++ b/libc/src/pthread/pthread_setspecific.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h"
+#include "src/errno/libc_errno.h"
-#include <errno.h>
#include <pthread.h>
namespace LIBC_NAMESPACE_DECL {