mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
wip on intellisense (again)
This commit is contained in:
parent
9841e2186a
commit
7642710155
18 changed files with 242 additions and 52 deletions
57
.vscode/c_cpp_properties.json
vendored
57
.vscode/c_cpp_properties.json
vendored
|
@ -8,19 +8,9 @@
|
|||
"cStandard": "c11",
|
||||
"cppStandard": "c++11",
|
||||
"compilerPath": "${workspaceFolder}/o/third_party/gcc/bin/x86_64-linux-musl-gcc",
|
||||
"forcedInclude": ["${workspaceFolder}/.vscode/vscode.h"],
|
||||
"defines": [
|
||||
"__VSCODE_INTELLISENSE__",
|
||||
"__BIGGEST_ALIGNMENT__",
|
||||
"__SHRT_MAX__",
|
||||
"__DBL_MIN__",
|
||||
"__UINT32_MAX__",
|
||||
"NULL=(void*)0",
|
||||
"true",
|
||||
"false=(!(true))",
|
||||
"COSMOPOLITAN_C_START_=",
|
||||
"COSMOPOLITAN_C_END_=",
|
||||
"libcesque=",
|
||||
"mallocesque=",
|
||||
"pureconst=",
|
||||
"paramsnonnull(x)=",
|
||||
"alignas(x)",
|
||||
|
@ -28,12 +18,34 @@
|
|||
"artificial=",
|
||||
"nodiscard=",
|
||||
"mayalias=",
|
||||
"_Vector_size(x)=",
|
||||
"forceinline=",
|
||||
"forcealign(x)=",
|
||||
"scanfesque(x)=",
|
||||
"strftimeesque(x)=",
|
||||
"wontreturn=",
|
||||
"textreal=",
|
||||
"mallocesque=",
|
||||
"callocesque=",
|
||||
"vallocesque=",
|
||||
"reallocesque=",
|
||||
"strlenesque=",
|
||||
"memcpyesque=",
|
||||
"hasatleast=",
|
||||
"noinline=",
|
||||
"textexit=",
|
||||
"returnstwice=",
|
||||
"textwindows=",
|
||||
"privileged=",
|
||||
"compatfn=",
|
||||
"noinstrument=",
|
||||
"nodebuginfo=",
|
||||
"interruptfn=",
|
||||
"optimizespeed=",
|
||||
"forcealignargpointer=",
|
||||
"noasan=",
|
||||
"noubsan=",
|
||||
"testonly=",
|
||||
"donothing=",
|
||||
"nosideeffect=",
|
||||
"unreachable=",
|
||||
"thatispacked=",
|
||||
|
@ -47,28 +59,9 @@
|
|||
"returnspointerwithnoaliases=",
|
||||
"printfesque(x)=",
|
||||
"attributeallocsize(x)=",
|
||||
"va_list=void*",
|
||||
"returnsaligned(x)=",
|
||||
"attributeallocalign(x)=",
|
||||
"nullterminated(x)=",
|
||||
"PAGESIZE",
|
||||
"g_loglevel",
|
||||
"int8_t=signed char",
|
||||
"int16_t=signed short int",
|
||||
"int32_t=signed int",
|
||||
"int64_t=signed long long",
|
||||
"uint8_t=unsigned char",
|
||||
"uint16_t=unsigned short int",
|
||||
"uint32_t=unsigned int",
|
||||
"uint64_t=unsigned long long",
|
||||
"errno_t=int",
|
||||
"size_t=uint64_t",
|
||||
"ssize_t=int64_t",
|
||||
"uintptr_t=uint64_t",
|
||||
"intptr_t=int64_t",
|
||||
"bool=uint8_t",
|
||||
"char16_t=uint16_t",
|
||||
"char32_t=uint32_t"
|
||||
"nullterminated(x)="
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
159
.vscode/vscode.h
vendored
Normal file
159
.vscode/vscode.h
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
|
||||
#define __VSCODE_INTELLISENSE__ 1
|
||||
#define __BIGGEST_ALIGNMENT__ 1
|
||||
#define __CHAR_MAX__ 0x7F
|
||||
#define __SCHAR_MAX__ __CHAR_MAX__
|
||||
#define __SHRT_MAX__ 0x7FFF
|
||||
#define __INT_MAX__ 0x7FFFFFFF
|
||||
#define __LONG_MAX__ 0x7FFFFFFFFFFFFFFF
|
||||
#define __LONG_LONG_MAX__ __LONG_MAX__
|
||||
#define __CHAR_MIN__ -((__CHAR_MAX__)+1)
|
||||
#define __SHRT_MIN__ -((__SHRT_MAX__)+1)
|
||||
#define __INT_MIN__ -((__INT_MAX__)+1)
|
||||
#define __LONG_MIN__ -((__LONG_MAX__)+1)
|
||||
#define __LONG_LONG_MIN__ -((__LONG_LONG_MAX__)+1)
|
||||
#define __UCHAR_MAX__ 0xFF
|
||||
#define __USHRT_MAX__ 0xFFFF
|
||||
#define __UINT_MAX__ 0xFFFFFFFF
|
||||
#define __ULONG_MAX__ 0xFFFFFFFFFFFFFFFF
|
||||
#define __SIZE_MAX__ __ULONG_MAX__
|
||||
#define __SSIZE_MAX__ __LONG_MAX__
|
||||
#define __UINTPTR_MAX__ __SIZE_MAX__
|
||||
#define __INTPTR_MAX__ __SSIZE_MAX__
|
||||
#define __WCHAR_MAX__ __UINT_MAX__
|
||||
#define __PTRDIFF_MAX__ __UINTPTR_MAX__
|
||||
#define __INTMAX_MAX__ __ULONG_MAX__
|
||||
#define __SIZEOF_POINTER__ 8
|
||||
#define __SIZEOF_SHORT__ 2
|
||||
#define __SIZEOF_INT__ 4
|
||||
#define __SIZEOF_LONG__ 8
|
||||
#define __SIZEOF_LONG_LONG__ 8
|
||||
#define __SIZEOF_PTRDIFF_T__ 8
|
||||
#define __SIZEOF_SIZE_T__ 8
|
||||
#define __SIZEOF_WCHAR_T__ 4
|
||||
#define __SIZEOF_WINT_T__ 4
|
||||
#define __SIZEOF_FLOAT__ 4
|
||||
#define __SIZEOF_FLOAT128__ 16
|
||||
#define __SIZEOF_DOUBLE__ 8
|
||||
#define __SIZEOF_FLOAT80__ 10
|
||||
#define __SIZEOF_LONG_DOUBLE__ 16
|
||||
#define __FLT_MAX__ 1
|
||||
#define __DBL_MAX__ 1
|
||||
|
||||
#define __INT_LEAST8_TYPE__ signed char;
|
||||
#define __INT_LEAST16_TYPE__ signed short;
|
||||
#define __INT_LEAST32_TYPE__ signed int;
|
||||
#define __INT_LEAST64_TYPE__ signed long long;
|
||||
#define __UINT_LEAST8_TYPE__ unsigned char;
|
||||
#define __UINT_LEAST16_TYPE__ unsigned short;
|
||||
#define __UINT_LEAST32_TYPE__ unsigned int;
|
||||
#define __UINT_LEAST64_TYPE__ unsigned long long;
|
||||
|
||||
#define __UINT8_MAX__ __UCHAR_MAX__
|
||||
#define __UINT16_MAX__ __USHRT_MAX__
|
||||
#define __UINT32_MAX__ __UINT_MAX__
|
||||
#define __UINT64_MAX__ __ULONG_MAX__
|
||||
|
||||
#define __INT8_MAX__ __CHAR_MAX__
|
||||
#define __INT16_MAX__ __SHRT_MAX__
|
||||
#define __INT32_MAX__ __INT_MAX__
|
||||
#define __INT64_MAX__ __LONG_MAX__
|
||||
|
||||
#define ATEXIT_MAX 1
|
||||
#define STACKSIZE 0x10000
|
||||
#define ARG_MAX 255
|
||||
#define OPEN_MAX 0x7FFF
|
||||
#define CHAR_BIT 7
|
||||
#define NSIG 1
|
||||
#define NULL (0)
|
||||
#define false 0
|
||||
#define true (!(false))
|
||||
#define COSMOPOLITAN_C_START_
|
||||
#define COSMOPOLITAN_C_END_
|
||||
#define PAGESIZE 0x1000
|
||||
#define BIGPAGESIZE 0x10000
|
||||
#define NAME_MAX 255
|
||||
|
||||
#define SWITCHEROO(...) 0
|
||||
|
||||
extern unsigned g_loglevel;
|
||||
|
||||
typedef void * va_list;
|
||||
|
||||
#define va_start(...) 0
|
||||
#define va_end(...) 0
|
||||
#define va_arg(x, y) (y)(0)
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
#define int64_t long long
|
||||
#define int128_t int64_t
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long uint128_t;
|
||||
|
||||
typedef int errno_t;
|
||||
typedef uint64_t size_t;
|
||||
typedef unsigned long long ssize_t;
|
||||
typedef uint64_t uintptr_t;
|
||||
typedef long long intptr_t;
|
||||
|
||||
typedef unsigned long long uintmax_t;
|
||||
typedef long long intmax_t;
|
||||
|
||||
typedef uint32_t bool32;
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef uint8_t bool;
|
||||
typedef uint16_t char16_t;
|
||||
typedef uint32_t char32_t;
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef char32_t wint_t;
|
||||
typedef char32_t wchar_t;
|
||||
typedef struct { int ax, dx; } axdx_t;
|
||||
|
||||
/* duplicate and replace xmmintrin.internal.h to fix it for IntelliSense
|
||||
* SEE: <> */
|
||||
|
||||
#define _Vector_size(x) __attribute__(( vector_size( x ) ))
|
||||
|
||||
#define __SIGACTION(...) (0)
|
||||
#define VEIL(x, y) (y)
|
||||
#define STATIC_YOINK(x)
|
||||
#define BUFSIZ 1
|
||||
#define FRAMESIZE 0x10000
|
||||
#define PATH_MAX 252
|
||||
#define concat(x, y, z) 0
|
||||
#define CONCAT(a, b, c, d, e) 0
|
||||
#define shuffle(...) 0
|
||||
#define reverse(x, y) 0
|
||||
#define atomic_load(...) 0
|
||||
#define atomic_store(...) 0
|
||||
|
||||
#define _Generic_(...) (void*)(0)
|
||||
#define _Generic(...) _Generic_
|
||||
|
||||
#define offsetof(x, y) 0
|
||||
#define cmpxchg(...) 0
|
||||
#define lockxchg(...) 0
|
||||
#define lockcmpxchg(...) 0
|
||||
#define xgetbv(...) 0
|
||||
#define rdmsr(...) 0
|
||||
#define INITIALIZER(...) struct _dummy
|
||||
#define __far
|
||||
#define tinystrstr(...) 0
|
||||
#define BENCHLOOP(...) 0
|
||||
|
||||
#ifdef __hook
|
||||
#undef __hook
|
||||
#endif /* __hook */
|
||||
|
||||
#ifdef UriKeyval
|
||||
#undef UriKeyval
|
||||
#endif /* UriKeyval */
|
||||
|
||||
#define _Static_assert(...) 0
|
|
@ -72,6 +72,7 @@ void ttyquantsetup(enum TtyQuantizationAlgorithm, enum TtyQuantizationChannels,
|
|||
extern char *ttyraster(char *, const struct TtyRgb *, size_t, size_t,
|
||||
struct TtyRgb, struct TtyRgb);
|
||||
|
||||
#ifndef ttyquant
|
||||
#define ttyquant() (&g_ttyquant_)
|
||||
#define TTYQUANT() VEIL("r", &g_ttyquant_)
|
||||
#define rgb2tty(...) (ttyquant()->rgb2tty(__VA_ARGS__))
|
||||
|
@ -81,6 +82,7 @@ extern char *ttyraster(char *, const struct TtyRgb *, size_t, size_t,
|
|||
#define setbg(...) (ttyquant()->setbg(__VA_ARGS__))
|
||||
#define setfg(...) (ttyquant()->setfg(__VA_ARGS__))
|
||||
#define setbgfg(...) (ttyquant()->setbgfg(__VA_ARGS__))
|
||||
#endif /* ttyquant */
|
||||
|
||||
forceinline bool ttyeq(struct TtyRgb x, struct TtyRgb y) {
|
||||
return x.r == y.r && x.g == y.g && x.b == y.b;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#define append(ARRAYLIST, ITEM) concat((ARRAYLIST), (ITEM), 1)
|
||||
|
||||
#ifndef concat
|
||||
#define concat(ARRAYLIST, ITEM, COUNT) \
|
||||
({ \
|
||||
autotype(ARRAYLIST) List = (ARRAYLIST); \
|
||||
|
@ -43,6 +44,7 @@
|
|||
} \
|
||||
(ssize_t)(Idx); \
|
||||
})
|
||||
#endif /* concat */
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_ALG_ARRAYLIST_H_ */
|
||||
|
|
|
@ -10,6 +10,7 @@ COSMOPOLITAN_C_START_
|
|||
#define APPEND(LIST_P, LIST_I, LIST_N, ITEM) \
|
||||
CONCAT(LIST_P, LIST_I, LIST_N, ITEM, 1)
|
||||
|
||||
#ifndef CONCAT
|
||||
#define CONCAT(LIST_P, LIST_I, LIST_N, ITEM, COUNT) \
|
||||
({ \
|
||||
autotype(LIST_P) ListP = (LIST_P); \
|
||||
|
@ -31,6 +32,7 @@ COSMOPOLITAN_C_START_
|
|||
} \
|
||||
Entry; \
|
||||
})
|
||||
#endif /* CONCAT */
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* @return pointer to start of array
|
||||
* @see ARRAYLEN()
|
||||
*/
|
||||
#ifndef reverse
|
||||
#define reverse(ARRAY, COUNT) \
|
||||
({ \
|
||||
autotype(&(ARRAY)[0]) Array = (ARRAY); \
|
||||
|
@ -26,6 +27,7 @@
|
|||
} \
|
||||
Array; \
|
||||
})
|
||||
#endif /* reverse */
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_ALG_REVERSE_H_ */
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* @param n is the number of items in A
|
||||
* @see ARRAYLEN()
|
||||
*/
|
||||
#ifndef shuffle
|
||||
#define shuffle(R, A, n) \
|
||||
do { \
|
||||
autotype(A) Array = (A); \
|
||||
|
@ -18,6 +19,7 @@
|
|||
xchg(&Array[i], &Array[R() % (i + 1)]); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif /* shuffle */
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_RAND_SHUFFLE_H_ */
|
||||
|
|
|
@ -205,6 +205,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
* @see Intel's Six-Thousand Page Manual V.3A §8.2.3.1
|
||||
* @see atomic_store()
|
||||
*/
|
||||
#ifndef atomic_load
|
||||
#define atomic_load(MEM) \
|
||||
({ \
|
||||
autotype(MEM) Mem = (MEM); \
|
||||
|
@ -212,6 +213,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
asm("mov\t%1,%0" : "=r"(Reg) : "m"(*Mem)); \
|
||||
Reg; \
|
||||
})
|
||||
#endif /* atomic_load */
|
||||
|
||||
/**
|
||||
* Saves scalar to memory w/ one operation.
|
||||
|
@ -229,6 +231,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
* @see Intel Six-Thousand Page Manual Manual V.3A §8.2.3.1
|
||||
* @see atomic_load()
|
||||
*/
|
||||
#ifndef atomic_store
|
||||
#define atomic_store(MEM, VAL) \
|
||||
({ \
|
||||
autotype(VAL) Val = (VAL); \
|
||||
|
@ -236,6 +239,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
asm("mov%z1\t%1,%0" : "=m"(*Mem) : "r"(Val)); \
|
||||
Val; \
|
||||
})
|
||||
#endif /* atomic_store */
|
||||
|
||||
#define bts(MEM, BIT) __BitOp("bts", BIT, MEM) /** bit test and set */
|
||||
#define btr(MEM, BIT) __BitOp("btr", BIT, MEM) /** bit test and reset */
|
||||
|
@ -263,6 +267,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
* @return LOCALVAR[0]
|
||||
* @see xchg()
|
||||
*/
|
||||
#ifndef lockxchg
|
||||
#define lockxchg(MEMORY, LOCALVAR) \
|
||||
({ \
|
||||
_Static_assert( \
|
||||
|
@ -270,6 +275,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
asm("xchg\t%0,%1" : "+%m"(*(MEMORY)), "+r"(*(LOCALVAR))); \
|
||||
*(LOCALVAR); \
|
||||
})
|
||||
#endif /* lockxchg */
|
||||
|
||||
/**
|
||||
* Compares and exchanges.
|
||||
|
@ -278,6 +284,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
* @return true if value was exchanged, otherwise false
|
||||
* @see lockcmpxchg()
|
||||
*/
|
||||
#ifndef cmpxchg
|
||||
#define cmpxchg(IFTHING, ISEQUALTOME, REPLACEITWITHME) \
|
||||
({ \
|
||||
bool DidIt; \
|
||||
|
@ -290,6 +297,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
: "cc"); \
|
||||
DidIt; \
|
||||
})
|
||||
#endif /* cmpxchg */
|
||||
|
||||
/**
|
||||
* Compares and exchanges w/ one operation.
|
||||
|
@ -298,6 +306,7 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
* @return true if value was exchanged, otherwise false
|
||||
* @see lockcmpxchg()
|
||||
*/
|
||||
#ifndef lockcmpxchg
|
||||
#define lockcmpxchg(IFTHING, ISEQUALTOME, REPLACEITWITHME) \
|
||||
({ \
|
||||
bool DidIt; \
|
||||
|
@ -310,27 +319,32 @@ unsigned long hamming(unsigned long, unsigned long) pureconst;
|
|||
: "cc"); \
|
||||
DidIt; \
|
||||
})
|
||||
#endif /* lockcmpxchg */
|
||||
|
||||
/**
|
||||
* Gets value of extended control register.
|
||||
*/
|
||||
#ifndef xgetbv
|
||||
#define xgetbv(xcr_register_num) \
|
||||
({ \
|
||||
unsigned hi, lo; \
|
||||
asm("xgetbv" : "=d"(hi), "=a"(lo) : "c"(cr_register_num)); \
|
||||
(uint64_t) hi << 32 | lo; \
|
||||
})
|
||||
#endif /* xgetbv */
|
||||
|
||||
/**
|
||||
* Reads model-specific register.
|
||||
* @note programs running as guests won't have authorization
|
||||
*/
|
||||
#ifndef rdmsr
|
||||
#define rdmsr(msr) \
|
||||
({ \
|
||||
uint32_t lo, hi; \
|
||||
asm volatile("rdmsr" : "=a"(lo), "=d"(hi) : "c"(msr)); \
|
||||
(uint64_t) hi << 32 | lo; \
|
||||
})
|
||||
#endif rdmsr
|
||||
|
||||
/**
|
||||
* Writes model-specific register.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
/**
|
||||
* Teleports code fragment inside _init().
|
||||
*/
|
||||
#ifndef INITIALIZER
|
||||
#define INITIALIZER(PRI, NAME, CODE) \
|
||||
asm(".section .init." #PRI "." #NAME ",\"ax\",@progbits\n\t" \
|
||||
"call\t" #NAME "\n\t" \
|
||||
|
@ -15,6 +16,7 @@
|
|||
CODE; \
|
||||
asm volatile("" : /* no outputs */ : "D"(rdi), "S"(rsi)); \
|
||||
}
|
||||
#endif /* INITIALIZER */
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_BITS_INITIALIZER_H_ */
|
||||
|
|
|
@ -251,6 +251,7 @@ int vdprintf(int, const char *, va_list) paramsnonnull();
|
|||
void _init_onntconsoleevent(void);
|
||||
void _init_wincrash(void);
|
||||
|
||||
#ifndef __SIGACTION
|
||||
#define __SIGACTION(FN, SIG, ...) \
|
||||
({ \
|
||||
if (SupportsWindows()) { \
|
||||
|
@ -279,6 +280,7 @@ void _init_wincrash(void);
|
|||
} \
|
||||
(FN)(SIG, __VA_ARGS__); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define dprintf(FD, FMT, ...) (dprintf)(FD, PFLINK(FMT), ##__VA_ARGS__)
|
||||
#define sigaction(SIG, ACT, OLD) __SIGACTION(sigaction, SIG, ACT, OLD)
|
||||
|
|
|
@ -36,14 +36,7 @@ struct IoctlPtmGet {
|
|||
char theduxname[16];
|
||||
char workername[16];
|
||||
};
|
||||
|
||||
struct Fds {
|
||||
size_t f; // lowest free slot
|
||||
size_t n; // monotonic capacity
|
||||
struct Fd {
|
||||
int64_t handle;
|
||||
int64_t extra;
|
||||
enum FdKind {
|
||||
enum FdKind {
|
||||
kFdEmpty,
|
||||
kFdFile,
|
||||
kFdSocket,
|
||||
|
@ -52,9 +45,19 @@ struct Fds {
|
|||
kFdSerial,
|
||||
kFdZip,
|
||||
kFdEpoll,
|
||||
} kind;
|
||||
};
|
||||
|
||||
struct Fd {
|
||||
int64_t handle;
|
||||
int64_t extra;
|
||||
int kind;
|
||||
unsigned flags;
|
||||
} * p;
|
||||
};
|
||||
|
||||
struct Fds {
|
||||
size_t f; // lowest free slot
|
||||
size_t n; // monotonic capacity
|
||||
struct Fd * p;
|
||||
struct Fd __init_p[OPEN_MAX];
|
||||
};
|
||||
|
||||
|
@ -76,7 +79,7 @@ forceinline bool __isfdopen(int fd) {
|
|||
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind != kFdEmpty;
|
||||
}
|
||||
|
||||
forceinline bool __isfdkind(int fd, enum FdKind kind) {
|
||||
forceinline bool __isfdkind(int fd, int kind) {
|
||||
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind == kind;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ union metasigaction {
|
|||
struct sigaction$xnu_out xnu_out;
|
||||
};
|
||||
|
||||
#ifndef SWITCHEROO
|
||||
#define SWITCHEROO(S1, S2, A, B, C, D) \
|
||||
do { \
|
||||
autotype((S2).A) a = (typeof((S2).A))(S1).A; \
|
||||
|
@ -59,6 +60,7 @@ union metasigaction {
|
|||
memset(&((S2).D), 0, sizeof((S2).D)); \
|
||||
memcpy(&((S2).D), &d, MIN(sizeof(d), sizeof((S2).D))); \
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
static void sigaction$cosmo2native(union metasigaction *sa) {
|
||||
if (!sa) return;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "libc/calls/struct/metastat.internal.h"
|
||||
#include "libc/dce.h"
|
||||
|
||||
#ifndef SWITCHEROO
|
||||
#define SWITCHEROO(S1, S2, A, B, C, D, E, F, G, H, I, J, K, L, M) \
|
||||
do { \
|
||||
autotype((S2).A) a = (typeof((S2).A))(S1).A; \
|
||||
|
@ -49,6 +50,7 @@
|
|||
(S2).L = l; \
|
||||
(S2).M = m; \
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
forceinline void stat2linux_xnu(union metastat *ms) {
|
||||
SWITCHEROO(ms->xnu, ms->linux, st_dev, st_ino, st_nlink, st_mode, st_uid,
|
||||
|
|
|
@ -759,12 +759,14 @@ typedef uint64_t uintmax_t;
|
|||
|
||||
#define DebugBreak() asm("int3")
|
||||
|
||||
#ifndef VEIL
|
||||
#define VEIL(CONSTRAINT, EXPRESSION) \
|
||||
({ \
|
||||
autotype(EXPRESSION) VeiledValue = (EXPRESSION); \
|
||||
asm("" : "=" CONSTRAINT ""(VeiledValue) : "0"(VeiledValue)); \
|
||||
VeiledValue; \
|
||||
})
|
||||
#endif /* VEIL */
|
||||
|
||||
#define CONCEAL(CONSTRAINT, EXPRESSION) \
|
||||
({ \
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
#define SYMBOLIC(NAME) NAME(%rip)
|
||||
#define LITERALLY(NAME) $NAME
|
||||
/* clang-format on */
|
||||
#elif defined(__VSCODE_INTELLISENSE__)
|
||||
#define SYMBOLIC(NAME) 1
|
||||
#define LITERALLY(NAME) 1
|
||||
#else
|
||||
#define SYMBOLIC(NAME) NAME
|
||||
#define LITERALLY(NAME) NAME
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "libc/str/str.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
#ifndef tinystrstr
|
||||
#define tinystrstr(HAYSTACK, NEEDLE) \
|
||||
({ \
|
||||
autotype(HAYSTACK) Haystack = (HAYSTACK); \
|
||||
|
@ -21,6 +22,7 @@
|
|||
Found: \
|
||||
Haystack; \
|
||||
})
|
||||
#endif /* tinystrstr */
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_STR_TINYSTRSTR_H_ */
|
||||
|
|
|
@ -27,7 +27,7 @@ forceinline int tpdecodecb(wint_t *out, int first,
|
|||
if ((cb & 0b11000000) == 0b10000000) {
|
||||
wc = wc << 6 | (cb & 0b00111111);
|
||||
} else {
|
||||
if (out) *out = u'<EFBFBD>';
|
||||
if (out) *out = u'\xFFFD';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ COSMOPOLITAN_C_START_
|
|||
* @fileoverview Microbenchmarking tools.
|
||||
*/
|
||||
|
||||
#ifndef BENCHLOOP
|
||||
#define BENCHLOOP(START, STOP, N, INIT, EXPR) \
|
||||
({ \
|
||||
unsigned long Iter, Count; \
|
||||
|
@ -22,6 +23,7 @@ COSMOPOLITAN_C_START_
|
|||
} \
|
||||
Average; \
|
||||
})
|
||||
#endif /* BENCHLOOP */
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
Loading…
Reference in a new issue