[libc] Correct usage of __unix__ and __linux__

Reviewed By: michaelrj, thesamesam

Differential Revision: https://reviews.llvm.org/D153729
This commit is contained in:
Alfred Persson Forsberg 2023-07-03 01:07:59 +01:00 committed by Sam James
parent 3878564712
commit cae84d8acf
21 changed files with 23 additions and 23 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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."

View 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."

View 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."

View File

@ -14,7 +14,7 @@
struct dirent {
ino_t d_ino;
#ifdef __unix__
#ifdef __linux__
off_t d_off;
unsigned short d_reclen;
#endif

View 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
};

View 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

View 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"

View 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

View File

@ -11,7 +11,7 @@
#ifdef __APPLE__
#include "darwin/syscall.h"
#elif defined(__unix__)
#elif defined(__linux__)
#include "linux/syscall.h"
#endif

View File

@ -37,11 +37,11 @@
// 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 {