[libc] Correct usage of __unix__ and __linux__
authorAlfred Persson Forsberg <cat@catcream.org>
Mon, 3 Jul 2023 00:07:59 +0000 (01:07 +0100)
committerSam James <sam@gentoo.org>
Mon, 3 Jul 2023 00:08:15 +0000 (01:08 +0100)
Reviewed By: michaelrj, thesamesam

Differential Revision: https://reviews.llvm.org/D153729

21 files changed:
libc/include/llvm-libc-macros/fcntl-macros.h
libc/include/llvm-libc-macros/sched-macros.h
libc/include/llvm-libc-macros/sys-ioctl-macros.h
libc/include/llvm-libc-macros/sys-mman-macros.h
libc/include/llvm-libc-macros/sys-random-macros.h
libc/include/llvm-libc-macros/sys-resource-macros.h
libc/include/llvm-libc-macros/sys-socket-macros.h
libc/include/llvm-libc-macros/sys-stat-macros.h
libc/include/llvm-libc-macros/sys-time-macros.h
libc/include/llvm-libc-macros/time-macros.h
libc/include/llvm-libc-macros/unistd-macros.h
libc/include/llvm-libc-types/__mutex_type.h
libc/include/llvm-libc-types/once_flag.h
libc/include/llvm-libc-types/pthread_once_t.h
libc/include/llvm-libc-types/struct_dirent.h
libc/include/llvm-libc-types/struct_utsname.h
libc/src/__support/File/dir.cpp
libc/src/__support/OSUtil/io.h
libc/src/__support/OSUtil/quick_exit.h
libc/src/__support/OSUtil/syscall.h
libc/src/__support/threads/mutex.h

index 4d957e1..448dcc0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __LLVM_LIBC_MACROS_FCNTL_MACROS_H
 #define __LLVM_LIBC_MACROS_FCNTL_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/fcntl-macros.h"
 #endif
 
index 2211d12..760edd9 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SCHED_MACROS_H
 #define __LLVM_LIBC_MACROS_SCHED_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sched-macros.h"
 #endif
 
index b3fbfe3..c273fab 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SYS_IOCTL_MACROS_H
 #define __LLVM_LIBC_MACROS_SYS_IOCTL_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sys-ioctl-macros.h"
 #endif
 
index 4e22318..97aeaa6 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H
 #define __LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sys-mman-macros.h"
 #endif
 
index 4e59efc..e87128d 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SYS_RANDOM_MACROS_H
 #define __LLVM_LIBC_MACROS_SYS_RANDOM_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sys-random-macros.h"
 #endif
 
index d85bdde..272723a 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SYS_RESOURCE_MACROS_H
 #define __LLVM_LIBC_MACROS_SYS_RESOURCE_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sys-resource-macros.h"
 #endif
 
index 935f433..2032360 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SYS_SOCKET_MACROS_H
 #define __LLVM_LIBC_MACROS_SYS_SOCKET_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sys-socket-macros.h"
 #endif
 
index c09b489..64f63c3 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SYS_STAT_MACROS_H
 #define __LLVM_LIBC_MACROS_SYS_STAT_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sys-stat-macros.h"
 #endif
 
index 5254cab..8e46317 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_MACROS_SYS_TIME_MACROS_H
 #define __LLVM_LIBC_MACROS_SYS_TIME_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/sys-time-macros.h"
 #endif
 
index 9d5fad5..ffd4631 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __LLVM_LIBC_MACROS_TIME_MACROS_H
 #define __LLVM_LIBC_MACROS_TIME_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/time-macros.h"
 #endif
 
index d00942f..dbcac0f 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __LLVM_LIBC_MACROS_UNISTD_MACROS_H
 #define __LLVM_LIBC_MACROS_UNISTD_MACROS_H
 
-#ifdef __unix__
+#ifdef __linux__
 #include "linux/unistd-macros.h"
 #endif
 
index ffd67e7..a7ed8f8 100644 (file)
@@ -19,7 +19,7 @@ typedef struct {
   void *__owner;
   unsigned long long __lock_count;
 
-#ifdef __unix__
+#ifdef __linux__
   __futex_word __ftxw;
 #else
 #error "Mutex type not defined for the target platform."
index e6aec5e..77bab28 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <llvm-libc-types/__futex_word.h>
 
-#ifdef __unix__
+#ifdef __linux__
 typedef __futex_word once_flag;
 #else
 #error "Once flag type not defined for the target platform."
index be5c139..6d65f8f 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <llvm-libc-types/__futex_word.h>
 
-#ifdef __unix__
+#ifdef __linux__
 typedef __futex_word pthread_once_t;
 #else
 #error "Once flag type not defined for the target platform."
index fde3f8c..de54a22 100644 (file)
@@ -14,7 +14,7 @@
 
 struct dirent {
   ino_t d_ino;
-#ifdef __unix__
+#ifdef __linux__
   off_t d_off;
   unsigned short d_reclen;
 #endif
index 8d41938..8ec426a 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __LLVM_LIBC_TYPES_STRUCT_UTSNAME_H__
 #define __LLVM_LIBC_TYPES_STRUCT_UTSNAME_H__
 
-#ifdef __unix__
+#ifdef __linux__
 #define __UTS_NAME_LENGTH 65
 #else
 // Arbitray default. Should be specialized for each platform.
@@ -22,7 +22,7 @@ struct utsname {
   char release[__UTS_NAME_LENGTH];
   char version[__UTS_NAME_LENGTH];
   char machine[__UTS_NAME_LENGTH];
-#ifdef __unix__
+#ifdef __linux__
   char domainname[__UTS_NAME_LENGTH];
 #endif
 };
index e7cc4ca..93b609d 100644 (file)
@@ -39,7 +39,7 @@ ErrorOr<struct ::dirent *> Dir::read() {
     return nullptr;
 
   struct ::dirent *d = reinterpret_cast<struct ::dirent *>(buffer + readptr);
-#ifdef __unix__
+#ifdef __linux__
   // The d_reclen field is available on Linux but not required by POSIX.
   readptr += d->d_reclen;
 #else
index 9330ee5..54b7d05 100644 (file)
@@ -15,7 +15,7 @@
 #include "gpu/io.h"
 #elif defined(__APPLE__)
 #include "darwin/io.h"
-#elif defined(__unix__)
+#elif defined(__linux__)
 #include "linux/io.h"
 #elif defined(__Fuchsia__)
 #include "fuchsia/io.h"
index ae0192d..4001e0b 100644 (file)
@@ -15,7 +15,7 @@
 #include "gpu/quick_exit.h"
 #elif defined(__APPLE__)
 #include "darwin/quick_exit.h"
-#elif defined(__unix__)
+#elif defined(__linux__)
 #include "linux/quick_exit.h"
 #endif
 
index 3601e76..6ec9f07 100644 (file)
@@ -11,7 +11,7 @@
 
 #ifdef __APPLE__
 #include "darwin/syscall.h"
-#elif defined(__unix__)
+#elif defined(__linux__)
 #include "linux/syscall.h"
 #endif
 
index 3c2291d..9f73d7c 100644 (file)
 // few global locks. So, to avoid static initialization order fiasco, we
 // want the constructors of the Mutex classes to be constexprs.
 
-#if defined(__unix__)
+#if defined(__linux__)
 #include "linux/mutex.h"
 #elif defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "gpu/mutex.h"
-#endif // __unix__
+#endif // __linux__
 
 namespace __llvm_libc {