Run clang-format (#1197)

This commit is contained in:
Jōshin 2024-06-01 13:30:43 -07:00 committed by GitHub
parent ea081b262c
commit f032b5570b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
183 changed files with 1074 additions and 983 deletions

View file

@ -132,7 +132,7 @@
#define SHSTUB2(SYM, X) \ #define SHSTUB2(SYM, X) \
HIDDEN(SYM##_bcs0 = BCD_LEFT(X)); \ HIDDEN(SYM##_bcs0 = BCD_LEFT(X)); \
HIDDEN(SYM##_bcs1 = BCD_RIGHT(X)) HIDDEN(SYM##_bcs1 = BCD_RIGHT(X))
#define BCD_SMEAR(X) ((X) + (X) * 10000) #define BCD_SMEAR(X) ((X) + (X)*10000)
#define BCD_LEFT(X) \ #define BCD_LEFT(X) \
(((X)) < 10000 ? BCD_RIGHT(BCD_SMEAR(X)) | 0x10 \ (((X)) < 10000 ? BCD_RIGHT(BCD_SMEAR(X)) | 0x10 \
: (X) < 100000 ? BCD_RIGHT(BCD_SMEAR((X) / 10)) \ : (X) < 100000 ? BCD_RIGHT(BCD_SMEAR((X) / 10)) \
@ -142,20 +142,13 @@
: 0xffffffffffffffff) : 0xffffffffffffffff)
#define BCD_RIGHT(X) \ #define BCD_RIGHT(X) \
(((X)) < 10000 ? 0x20202020 \ (((X)) < 10000 ? 0x20202020 \
: (X) < 100000 ? 0x20202030 + \ : (X) < 100000 ? 0x20202030 + (X) % 10 \
(X) % 10 \ : (X) < 1000000 ? 0x20203030 + ((X) / 10) % 10 + (X) % 10 * 0x100 \
: (X) < 1000000 ? 0x20203030 + \ : (X) < 10000000 ? 0x20303030 + ((X) / 100) % 10 + \
((X) / 10) % 10 + \ ((X) / 10) % 10 * 0x100 + (X) % 10 * 0x10000 \
(X) % 10 * 0x100 \ : (X) < 100000000 \
: (X) < 10000000 ? 0x20303030 + \ ? 0x30303030 + ((X) / 1000) % 10 + ((X) / 100) % 10 * 0x100 + \
((X) / 100) % 10 + \ ((X) / 10) % 10 * 0x10000 + (X) % 10 * 0x1000000 \
((X) / 10) % 10 * 0x100 + \
(X) % 10 * 0x10000 \
: (X) < 100000000 ? 0x30303030 + \
((X) / 1000) % 10 + \
((X) / 100) % 10 * 0x100 + \
((X) / 10) % 10 * 0x10000 + \
(X) % 10 * 0x1000000 \
: 0xffffffffffffffff) : 0xffffffffffffffff)
/** /**
@ -166,14 +159,10 @@
HIDDEN(SYM##_desc_ent1 = TSSDESC_ENT1(BASE)); \ HIDDEN(SYM##_desc_ent1 = TSSDESC_ENT1(BASE)); \
ASSERT((LIM) >= 0 && (LIM) <= 0xffff, "bare metal TSS is suspiciously fat") ASSERT((LIM) >= 0 && (LIM) <= 0xffff, "bare metal TSS is suspiciously fat")
#define TSSDESC_ENT0(BASE, LIM) \ #define TSSDESC_ENT0(BASE, LIM) \
(((LIM) << 0 & 0x000000000000ffff) | \ (((LIM) << 0 & 0x000000000000ffff) | ((BASE) << 16 & 0x000000ffffff0000) | \
((BASE) << 16 & 0x000000ffffff0000) | \ 0x89 << 40 | ((LIM) >> 16 << 48 & 0x000f000000000000) | 0x2 << 52 | \
0x89 << 40 | \
((LIM) >> 16 << 48 & 0x000f000000000000) | \
0x2 << 52 | \
((BASE) >> 24 << 56 & 0xff00000000000000)) ((BASE) >> 24 << 56 & 0xff00000000000000))
#define TSSDESC_ENT1(BASE) \ #define TSSDESC_ENT1(BASE) ((BASE) >> 32 << 0 & 0x00000000ffffffff)
((BASE) >> 32 << 0 & 0x00000000ffffffff)
#endif /* __ASSEMBLER__ */ #endif /* __ASSEMBLER__ */
#endif /* APE_MACROS_H_ */ #endif /* APE_MACROS_H_ */

View file

@ -9,8 +9,8 @@ int mulaw(int);
int unmulaw(int); int unmulaw(int);
void *double2byte(long, const void *, double, double) vallocesque; void *double2byte(long, const void *, double, double) vallocesque;
void *byte2double(long, const void *, double, double) vallocesque; void *byte2double(long, const void *, double, double) vallocesque;
void *dct(float[restrict hasatleast 8][8], unsigned, void *dct(float[restrict hasatleast 8][8], unsigned, float, float, float, float,
float, float, float, float, float); float);
void *dctjpeg(float[restrict hasatleast 8][8], unsigned); void *dctjpeg(float[restrict hasatleast 8][8], unsigned);
double det3(const double[3][3]) nosideeffect; double det3(const double[3][3]) nosideeffect;
void *inv3(double[restrict 3][3], const double[restrict 3][3], double); void *inv3(double[restrict 3][3], const double[restrict 3][3], double);

View file

@ -65,8 +65,8 @@
* *
* @cost ~100ns * @cost ~100ns
*/ */
void *dct(float M[restrict hasatleast 8][8], unsigned stride, void *dct(float M[restrict hasatleast 8][8], unsigned stride, float c0,
float c0, float c1, float c2, float c3, float c4) { float c1, float c2, float c3, float c4) {
unsigned y, x; unsigned y, x;
for (y = 0; y < stride * 8; y += stride) { for (y = 0; y < stride * 8; y += stride) {
DCT(M[y][0], M[y][1], M[y][2], M[y][3], M[y][4], M[y][5], M[y][6], M[y][7], DCT(M[y][0], M[y][1], M[y][2], M[y][3], M[y][4], M[y][5], M[y][6], M[y][7],

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "dsp/core/core.h"
#include "dsp/core/gamma.h" #include "dsp/core/gamma.h"
#include "dsp/core/core.h"
#include "libc/math.h" #include "libc/math.h"
double rgb2stdpc(double x, double g) { double rgb2stdpc(double x, double g) {

View file

@ -64,7 +64,8 @@ forceinline bool plm_buffer_has(plm_buffer_t *b, size_t bits) {
} }
forceinline int plm_buffer_read(plm_buffer_t *self, int count) { forceinline int plm_buffer_read(plm_buffer_t *self, int count) {
if (!plm_buffer_has(self, count)) return 0; if (!plm_buffer_has(self, count))
return 0;
int value = 0; int value = 0;
while (count) { while (count) {
int current_byte = self->bytes[self->bit_index >> 3]; int current_byte = self->bytes[self->bit_index >> 3];

View file

@ -24,9 +24,13 @@
* The alternate buffer trick lets one restore the console exactly as it * The alternate buffer trick lets one restore the console exactly as it
* was, once the program is done running. * was, once the program is done running.
*/ */
int ttyenablealtbuf(int ttyfd) { return ttysend(ttyfd, "\e[?1049h"); } int ttyenablealtbuf(int ttyfd) {
return ttysend(ttyfd, "\e[?1049h");
}
/** /**
* Asks teletypewriter to restore blinking box thing. * Asks teletypewriter to restore blinking box thing.
*/ */
int ttydisablealtbuf(int ttyfd) { return ttysend(ttyfd, "\e[?1049l"); } int ttydisablealtbuf(int ttyfd) {
return ttysend(ttyfd, "\e[?1049l");
}

View file

@ -21,9 +21,13 @@
/** /**
* Asks teletypewriter to push current position. * Asks teletypewriter to push current position.
*/ */
int ttysavecursor(int ttyfd) { return ttysend(ttyfd, "\e[s"); } int ttysavecursor(int ttyfd) {
return ttysend(ttyfd, "\e[s");
}
/** /**
* Asks teletypewriter to pop previous position. * Asks teletypewriter to pop previous position.
*/ */
int ttyrestorecursor(int ttyfd) { return ttysend(ttyfd, "\e[u"); } int ttyrestorecursor(int ttyfd) {
return ttysend(ttyfd, "\e[u");
}

View file

@ -39,8 +39,12 @@ static char *setansibgfg(char *p, unsigned bg, unsigned fg) {
return p; return p;
} }
char *setbg16_(char *p, struct TtyRgb bg) { return setansibgfg(p, bg.xt, -1u); } char *setbg16_(char *p, struct TtyRgb bg) {
char *setfg16_(char *p, struct TtyRgb fg) { return setansibgfg(p, -1u, fg.xt); } return setansibgfg(p, bg.xt, -1u);
}
char *setfg16_(char *p, struct TtyRgb fg) {
return setansibgfg(p, -1u, fg.xt);
}
char *setbgfg16_(char *p, struct TtyRgb bg, struct TtyRgb fg) { char *setbgfg16_(char *p, struct TtyRgb bg, struct TtyRgb fg) {
return setansibgfg(p, bg.xt, fg.xt); return setansibgfg(p, bg.xt, fg.xt);
} }

View file

@ -1,9 +1,9 @@
#include "libc/stdio/stdio.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
fprintf(stderr, "%s (%s)\n", argv[0], GetProgramExecutableName()); fprintf(stderr, "%s (%s)\n", argv[0], GetProgramExecutableName());
for (char **p = environ; *p; ++p) { for (char** p = environ; *p; ++p) {
printf("%s\n", *p); printf("%s\n", *p);
} }
return 0; return 0;

View file

@ -7,11 +7,11 @@
http://creativecommons.org/publicdomain/zero/1.0/ │ http://creativecommons.org/publicdomain/zero/1.0/ │
*/ */
#endif #endif
#include "libc/runtime/runtime.h" #include "third_party/hiredis/hiredis.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "third_party/hiredis/hiredis.h"
/** /**
* @fileoverview Demo of using hiredis to connect to a Redis server * @fileoverview Demo of using hiredis to connect to a Redis server

View file

@ -2,13 +2,13 @@
#define PARSE_AND_PRINT(type, scan_fmt, print_fmt, str) \ #define PARSE_AND_PRINT(type, scan_fmt, print_fmt, str) \
do { \ do { \
type val; int ret; \ type val; \
int ret; \
ret = sscanf(str, scan_fmt, &val); \ ret = sscanf(str, scan_fmt, &val); \
printf("\"%s\" => " print_fmt " = %d\n", str, val, ret); \ printf("\"%s\" => " print_fmt " = %d\n", str, val, ret); \
} while (0) } while (0)
int main() int main() {
{
PARSE_AND_PRINT(float, "%f", "%f", "0.3715"); PARSE_AND_PRINT(float, "%f", "%f", "0.3715");
PARSE_AND_PRINT(float, "%f", "%f", ".3715"); PARSE_AND_PRINT(float, "%f", "%f", ".3715");
PARSE_AND_PRINT(float, "%f", "%f", "3715"); PARSE_AND_PRINT(float, "%f", "%f", "3715");

View file

@ -2601,7 +2601,8 @@ static int shlex() {
case 'y': case 'y':
case 'z': case 'z':
p = buf; p = buf;
while (buf++, is_in_name(*buf)); while (buf++, is_in_name(*buf))
;
yylval.name = stalloc(buf - p + 1); yylval.name = stalloc(buf - p + 1);
*(char *)mempcpy(yylval.name, p, buf - p) = 0; *(char *)mempcpy(yylval.name, p, buf - p) = 0;
value = ARITH_VAR; value = ARITH_VAR;
@ -7757,7 +7758,8 @@ static int ulimitcmd(int argc, char **argv) {
what = optc; what = optc;
} }
} }
for (l = limits; l->option != what; l++); for (l = limits; l->option != what; l++)
;
set = *argptr ? 1 : 0; set = *argptr ? 1 : 0;
if (set) { if (set) {
char *p = *argptr; char *p = *argptr;
@ -7986,7 +7988,8 @@ static void setparam(char **argv) {
char **newparam; char **newparam;
char **ap; char **ap;
int nparam; int nparam;
for (nparam = 0; argv[nparam]; nparam++); for (nparam = 0; argv[nparam]; nparam++)
;
ap = newparam = ckmalloc((nparam + 1) * sizeof *ap); ap = newparam = ckmalloc((nparam + 1) * sizeof *ap);
while (*argv) { while (*argv) {
*ap++ = savestr(*argv++); *ap++ = savestr(*argv++);
@ -8664,7 +8667,8 @@ static void parsefname(void) {
if (heredoclist == NULL) if (heredoclist == NULL)
heredoclist = here; heredoclist = here;
else { else {
for (p = heredoclist; p->next; p = p->next); for (p = heredoclist; p->next; p = p->next)
;
p->next = here; p->next = here;
} }
} else if (n->type == NTOFD || n->type == NFROMFD) { } else if (n->type == NTOFD || n->type == NFROMFD) {
@ -8788,7 +8792,8 @@ static int xxreadtoken(void) {
case '\t': case '\t':
continue; continue;
case '#': case '#':
while ((c = pgetc()) != '\n' && c != PEOF); while ((c = pgetc()) != '\n' && c != PEOF)
;
pungetc(); pungetc();
continue; continue;
case '\n': case '\n':
@ -8912,7 +8917,7 @@ static int readtoken1(int firstc, char const *syntax, char *eofmark,
quotef = 0; quotef = 0;
bqlist = NULL; bqlist = NULL;
STARTSTACKSTR(out); STARTSTACKSTR(out);
loop: { /* for each line, until end of word */ loop : { /* for each line, until end of word */
CHECKEND(); /* set c to PEOF if at end of here document */ CHECKEND(); /* set c to PEOF if at end of here document */
for (;;) { /* until end of line or end of word */ for (;;) { /* until end of line or end of word */
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
@ -9064,7 +9069,7 @@ endword:
* is called, c is set to the first character of the next input line. If * is called, c is set to the first character of the next input line. If
* we are at the end of the here document, this routine sets the c to PEOF. * we are at the end of the here document, this routine sets the c to PEOF.
*/ */
checkend: { checkend : {
if (realeofmark(eofmark)) { if (realeofmark(eofmark)) {
int markloc; int markloc;
char *p; char *p;
@ -9107,7 +9112,7 @@ checkend: {
* specifying the fd to be redirected. The variable "c" contains the * specifying the fd to be redirected. The variable "c" contains the
* first character of the redirection operator. * first character of the redirection operator.
*/ */
parseredir: { parseredir : {
char fd = *out; char fd = *out;
union node *np; union node *np;
np = (union node *)stalloc(sizeof(struct nfile)); np = (union node *)stalloc(sizeof(struct nfile));
@ -9164,7 +9169,7 @@ parseredir: {
* Parse a substitution. At this point, we have read the dollar sign * Parse a substitution. At this point, we have read the dollar sign
* and nothing else. * and nothing else.
*/ */
parsesub: { parsesub : {
int subtype; int subtype;
int typeloc; int typeloc;
char *p; char *p;
@ -9282,7 +9287,7 @@ parsesub: {
* list of commands (passed by reference), and savelen is the number of * list of commands (passed by reference), and savelen is the number of
* characters on the top of the stack which must be preserved. * characters on the top of the stack which must be preserved.
*/ */
parsebackq: { parsebackq : {
struct nodelist **nlpp; struct nodelist **nlpp;
union node *n; union node *n;
char *str; char *str;
@ -9377,7 +9382,7 @@ parsebackq: {
/* /*
* Parse an arithmetic expansion (indicate start of one and set state) * Parse an arithmetic expansion (indicate start of one and set state)
*/ */
parsearith: { parsearith : {
synstack_push(&synstack, synstack->prev ?: alloca(sizeof(*synstack)), synstack_push(&synstack, synstack->prev ?: alloca(sizeof(*synstack)),
ARISYNTAX); ARISYNTAX);
synstack->dblquote = 1; synstack->dblquote = 1;

View file

@ -9,11 +9,11 @@
#endif #endif
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/ftw.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/exit.h" #include "libc/sysv/consts/exit.h"
#include "libc/sysv/consts/s.h" #include "libc/sysv/consts/s.h"
#include "libc/stdio/ftw.h"
/** /**
* @fileoverview Directory walker example. * @fileoverview Directory walker example.

View file

@ -23,8 +23,8 @@
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/intrin/strace.internal.h" #include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h" #include "libc/runtime/zipos.internal.h"
#include "libc/sysv/errfuns.h"
/** /**
* Duplicates file descriptor. * Duplicates file descriptor.

View file

@ -66,7 +66,7 @@ static struct HostAdapterInfoNode {
struct sockaddr netmask; struct sockaddr netmask;
struct sockaddr broadcast; struct sockaddr broadcast;
short flags; short flags;
} * __hostInfo; } *__hostInfo;
static int ioctl_default(int fd, unsigned long request, void *arg) { static int ioctl_default(int fd, unsigned long request, void *arg) {
int rc; int rc;

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/serialize.h"
#include "libc/proc/execve.internal.h" #include "libc/proc/execve.internal.h"
#include "libc/serialize.h"
/** /**
* Returns true if executable image is supported by APE Loader. * Returns true if executable image is supported by APE Loader.

View file

@ -24,8 +24,8 @@
#include "libc/intrin/describeflags.internal.h" #include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h" #include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h" #include "libc/runtime/zipos.internal.h"
#include "libc/sysv/errfuns.h"
/** /**
* Creates hard filesystem link. * Creates hard filesystem link.

View file

@ -24,9 +24,9 @@
#include "libc/intrin/describeflags.internal.h" #include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h" #include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/consts/at.h" #include "libc/sysv/consts/at.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
/** /**
* Creates directory a.k.a. folder. * Creates directory a.k.a. folder.

View file

@ -27,13 +27,13 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/pc.internal.h" #include "libc/runtime/pc.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/at.h" #include "libc/sysv/consts/at.h"
#include "libc/sysv/consts/map.h" #include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h" #include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/prot.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
#ifdef __x86_64__ #ifdef __x86_64__

View file

@ -24,9 +24,9 @@
#include "libc/intrin/describeflags.internal.h" #include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h" #include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/consts/at.h" #include "libc/sysv/consts/at.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
/** /**
* Renames files relative to directories. * Renames files relative to directories.

View file

@ -17,10 +17,10 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/stdio/sysparam.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/paths.h" #include "libc/paths.h"
#include "libc/stdio/sysparam.h"
/** /**
* Returns name of terminal. * Returns name of terminal.

View file

@ -26,9 +26,9 @@
#include "libc/intrin/describeflags.internal.h" #include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h" #include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/consts/s.h" #include "libc/sysv/consts/s.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
/** /**
* Deletes inode and maybe the file too. * Deletes inode and maybe the file too.

View file

@ -5,9 +5,9 @@
#include "libc/elf/struct/phdr.h" #include "libc/elf/struct/phdr.h"
#include "libc/elf/struct/shdr.h" #include "libc/elf/struct/shdr.h"
#include "libc/elf/struct/sym.h" #include "libc/elf/struct/sym.h"
#include "libc/serialize.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/log/libfatal.internal.h" #include "libc/log/libfatal.internal.h"
#include "libc/serialize.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
#define GetStr(tab, rva) ((char *)(tab) + (rva)) #define GetStr(tab, rva) ((char *)(tab) + (rva))
@ -30,7 +30,8 @@ static inline char *GetStrtab(const Elf64_Ehdr *e, size_t *n) {
if (shdr->sh_type == SHT_STRTAB) { if (shdr->sh_type == SHT_STRTAB) {
name = GetSectionName(e, GetShdr(e, i)); name = GetSectionName(e, GetShdr(e, i));
if (name && READ64LE(name) == READ64LE(".strtab")) { if (name && READ64LE(name) == READ64LE(".strtab")) {
if (n) *n = shdr->sh_size; if (n)
*n = shdr->sh_size;
return GetSection(e, shdr); return GetSection(e, shdr);
} }
} }
@ -44,7 +45,8 @@ static inline Elf64_Sym *GetSymtab(const Elf64_Ehdr *e, Elf64_Xword *n) {
for (i = e->e_shnum; i-- > 0;) { for (i = e->e_shnum; i-- > 0;) {
shdr = GetShdr(e, i); shdr = GetShdr(e, i);
if (shdr->sh_type == SHT_SYMTAB) { if (shdr->sh_type == SHT_SYMTAB) {
if (n) *n = shdr->sh_size / sizeof(Elf64_Sym); if (n)
*n = shdr->sh_size / sizeof(Elf64_Sym);
return GetSection(e, shdr); return GetSection(e, shdr);
} }
} }
@ -60,14 +62,19 @@ static inline void GetImageRange(const Elf64_Ehdr *elf, intptr_t *x,
end = 0; end = 0;
for (i = 0; i < elf->e_phnum; ++i) { for (i = 0; i < elf->e_phnum; ++i) {
phdr = GetPhdr(elf, i); phdr = GetPhdr(elf, i);
if (phdr->p_type != PT_LOAD) continue; if (phdr->p_type != PT_LOAD)
continue;
pstart = phdr->p_vaddr; pstart = phdr->p_vaddr;
pend = phdr->p_vaddr + phdr->p_memsz; pend = phdr->p_vaddr + phdr->p_memsz;
if (pstart < start) start = pstart; if (pstart < start)
if (pend > end) end = pend; start = pstart;
if (pend > end)
end = pend;
} }
if (x) *x = start; if (x)
if (y) *y = end; *x = start;
if (y)
*y = end;
} }
static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name, static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name,
@ -75,8 +82,10 @@ static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name,
Elf64_Xword i, n; Elf64_Xword i, n;
const char *stab; const char *stab;
const Elf64_Sym *st; const Elf64_Sym *st;
if (!(stab = GetStrtab(ehdr, 0))) return false; if (!(stab = GetStrtab(ehdr, 0)))
if (!(st = GetSymtab(ehdr, &n))) return false; return false;
if (!(st = GetSymtab(ehdr, &n)))
return false;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
if (!__strcmp(GetStr(stab, st[i].st_name), name)) { if (!__strcmp(GetStr(stab, st[i].st_name), name)) {
*res = st[i].st_value; *res = st[i].st_value;

View file

@ -4,12 +4,15 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#define CONSUME_SPACES(t, s, c) \ #define CONSUME_SPACES(t, s, c) \
if (endptr) *endptr = (t *)(s); \ if (endptr) \
while (c == ' ' || c == '\t') c = *++s *endptr = (t *)(s); \
while (c == ' ' || c == '\t') \
c = *++s
#define GET_SIGN(s, c, d) \ #define GET_SIGN(s, c, d) \
d = c == '-' ? -1 : 1; \ d = c == '-' ? -1 : 1; \
if (c == '-' || c == '+') c = *++s if (c == '-' || c == '+') \
c = *++s
#define GET_RADIX(s, c, r) \ #define GET_RADIX(s, c, r) \
if (!r) { \ if (!r) { \

View file

@ -33,19 +33,22 @@ static inline struct Dll *dll_last(struct Dll *list) {
static inline struct Dll *dll_first(struct Dll *list) { static inline struct Dll *dll_first(struct Dll *list) {
struct Dll *first = 0; struct Dll *first = 0;
if (list) first = list->next; if (list)
first = list->next;
return first; return first;
} }
static inline struct Dll *dll_next(struct Dll *list, struct Dll *e) { static inline struct Dll *dll_next(struct Dll *list, struct Dll *e) {
struct Dll *next = 0; struct Dll *next = 0;
if (e != list) next = e->next; if (e != list)
next = e->next;
return next; return next;
} }
static inline struct Dll *dll_prev(struct Dll *list, struct Dll *e) { static inline struct Dll *dll_prev(struct Dll *list, struct Dll *e) {
struct Dll *prev = 0; struct Dll *prev = 0;
if (e != list->next) prev = e->prev; if (e != list->next)
prev = e->prev;
return prev; return prev;
} }

View file

@ -22,7 +22,7 @@
*/ */
#define asint(x) ((union pun){x}).i #define asint(x) ((union pun){x}).i
#define isnan(x) (((x) & 0x7fff) > 0x7c00) #define isnan(x) (((x)&0x7fff) > 0x7c00)
union pun { union pun {
_Float16 f; _Float16 f;

View file

@ -49,7 +49,8 @@ void uvprintf(const char *, va_list) libcesque;
do { \ do { \
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \ kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
##__VA_ARGS__); \ ##__VA_ARGS__); \
for (;;) asm volatile("cli\n\thlt"); \ for (;;) \
asm volatile("cli\n\thlt"); \
} while (0) } while (0)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_

View file

@ -45,7 +45,7 @@
#ifdef __x86_64__ #ifdef __x86_64__
#define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x))) #define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x)))
#define NOPAGE ((uint64_t) - 1) #define NOPAGE ((uint64_t)-1)
#define APE_STACK_VADDR \ #define APE_STACK_VADDR \
({ \ ({ \

View file

@ -5,7 +5,8 @@
forceinline void repmovsb(void **dest, const void **src, size_t cx) { forceinline void repmovsb(void **dest, const void **src, size_t cx) {
char *di = (char *)*dest; char *di = (char *)*dest;
const char *si = (const char *)*src; const char *si = (const char *)*src;
while (cx) *di++ = *si++, cx--; while (cx)
*di++ = *si++, cx--;
*dest = di, *src = si; *dest = di, *src = si;
} }

View file

@ -4,7 +4,8 @@
forceinline void *repstosb(void *dest, unsigned char al, size_t cx) { forceinline void *repstosb(void *dest, unsigned char al, size_t cx) {
unsigned char *di = (unsigned char *)dest; unsigned char *di = (unsigned char *)dest;
while (cx) *di++ = al, cx--; while (cx)
*di++ = al, cx--;
return di; return di;
} }

View file

@ -48,7 +48,8 @@ COSMOPOLITAN_C_START_
({ \ ({ \
autotype(a) FirstNonNullA = (a); \ autotype(a) FirstNonNullA = (a); \
autotype(a) FirstNonNullB = (b); \ autotype(a) FirstNonNullB = (b); \
if (!FirstNonNullA && !FirstNonNullB) abort(); \ if (!FirstNonNullA && !FirstNonNullB) \
abort(); \
FirstNonNullA ? FirstNonNullA : FirstNonNullB; \ FirstNonNullA ? FirstNonNullA : FirstNonNullB; \
}) })

View file

@ -16,9 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/errno.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/runtime/internal.h" #include "libc/runtime/internal.h"
#include "libc/errno.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
__attribute__((__weak__)) void __stack_chk_fail(void) { __attribute__((__weak__)) void __stack_chk_fail(void) {

View file

@ -31,7 +31,7 @@ static __vex size_t __strlen(const char *s) {
m = __builtin_ia32_pmovmskb128(*++p == z); m = __builtin_ia32_pmovmskb128(*++p == z);
return (const char *)p + __builtin_ctzl(m) - s; return (const char *)p + __builtin_ctzl(m) - s;
#else #else
#define ONES ((word) - 1 / 255) #define ONES ((word)-1 / 255)
#define BANE (ONES * (255 / 2 + 1)) #define BANE (ONES * (255 / 2 + 1))
typedef unsigned long mayalias word; typedef unsigned long mayalias word;
word w; word w;

View file

@ -62,8 +62,8 @@ textstartup void _AcpiFadtInit(void) {
_Static_assert(offsetof(AcpiTableFadt, Dsdt) == 40); _Static_assert(offsetof(AcpiTableFadt, Dsdt) == 40);
_Static_assert(offsetof(AcpiTableFadt, BootFlags) == 109); _Static_assert(offsetof(AcpiTableFadt, BootFlags) == 109);
_Static_assert(offsetof(AcpiTableFadt, XDsdt) == 140); _Static_assert(offsetof(AcpiTableFadt, XDsdt) == 140);
if (length >= offsetof(AcpiTableFadt, BootFlags) + sizeof(fadt->BootFlags)) if (length >=
{ offsetof(AcpiTableFadt, BootFlags) + sizeof(fadt->BootFlags)) {
_AcpiBootFlags = flags = fadt->BootFlags; _AcpiBootFlags = flags = fadt->BootFlags;
KINFOF("FADT: boot flags %#x", (unsigned)flags); KINFOF("FADT: boot flags %#x", (unsigned)flags);
} }

View file

@ -26,7 +26,6 @@
*/ */
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/intrin/atomic.h" #include "libc/intrin/atomic.h"
#include "libc/serialize.h"
#include "libc/intrin/directmap.internal.h" #include "libc/intrin/directmap.internal.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/irq/acpi.internal.h" #include "libc/irq/acpi.internal.h"
@ -34,6 +33,7 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/nt/efi.h" #include "libc/nt/efi.h"
#include "libc/runtime/pc.internal.h" #include "libc/runtime/pc.internal.h"
#include "libc/serialize.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/map.h" #include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/prot.h"

View file

@ -1,5 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ #ifndef COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
#include "third_party/libcxxabi/include/cxxabi.h"
#include "libc/cxxabi.h" #include "libc/cxxabi.h"
#include "third_party/libcxxabi/include/cxxabi.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ */ #endif /* COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ */

View file

@ -1,6 +1,6 @@
#ifndef _FTW_H #ifndef _FTW_H
#define _FTW_H #define _FTW_H
#include "libc/calls/weirdtypes.h" #include "libc/calls/weirdtypes.h"
#include "libc/sysv/consts/s.h"
#include "libc/stdio/ftw.h" #include "libc/stdio/ftw.h"
#include "libc/sysv/consts/s.h"
#endif /* _FTW_H */ #endif /* _FTW_H */

View file

@ -1,12 +1,12 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_ #ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_
#include "libc/intrin/newbie.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/rlimit.h" #include "libc/calls/struct/rlimit.h"
#include "libc/calls/struct/rusage.h" #include "libc/calls/struct/rusage.h"
#include "libc/stdio/sysparam.h"
#include "libc/calls/weirdtypes.h" #include "libc/calls/weirdtypes.h"
#include "libc/intrin/newbie.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/stdio/sysparam.h"
#include "libc/sysv/consts/endian.h" #include "libc/sysv/consts/endian.h"
#include "libc/sysv/consts/prio.h" #include "libc/sysv/consts/prio.h"
#include "libc/sysv/consts/rlim.h" #include "libc/sysv/consts/rlim.h"

View file

@ -3,6 +3,6 @@
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo.h" #include "libc/calls/struct/siginfo.h"
#include "libc/sysv/consts/sig.h"
#include "libc/sysv/consts/sicode.h" #include "libc/sysv/consts/sicode.h"
#include "libc/sysv/consts/sig.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */

View file

@ -8,323 +8,315 @@
/* from https://en.cppreference.com/w/c/numeric/tgmath */ /* from https://en.cppreference.com/w/c/numeric/tgmath */
#define fabs(x) \ #define fabs(x) \
_Generic((x), float \ _Generic((x), \
: fabsf, default \ float: fabsf, \
: fabs, long double \ default: fabs, \
: fabsl, complex float \ long double: fabsl, \
: cabsf, complex double \ complex float: cabsf, \
: cabs, complex long double \ complex double: cabs, \
: cabsl)(x) complex long double: cabsl)(x)
#define exp(x) \ #define exp(x) \
_Generic((x), float \ _Generic((x), \
: expf, default \ float: expf, \
: exp, long double \ default: exp, \
: expl, complex float \ long double: expl, \
: cexpf, complex double \ complex float: cexpf, \
: cexp, complex long double \ complex double: cexp, \
: cexpl)(x) complex long double: cexpl)(x)
#define log(x) \ #define log(x) \
_Generic((x), float \ _Generic((x), \
: logf, default \ float: logf, \
: log, long double \ default: log, \
: logl, complex float \ long double: logl, \
: clogf, complex double \ complex float: clogf, \
: clog, complex long double \ complex double: clog, \
: clogl)(x) complex long double: clogl)(x)
#define pow(x, y) \ #define pow(x, y) \
_Generic((x), float \ _Generic((x), \
: powf, default \ float: powf, \
: pow, long double \ default: pow, \
: powl, complex float \ long double: powl, \
: cpowf, complex double \ complex float: cpowf, \
: cpow, complex long double \ complex double: cpow, \
: cpowl)(x, y) complex long double: cpowl)(x, y)
#define sqrt(x) \ #define sqrt(x) \
_Generic((x), float \ _Generic((x), \
: sqrtf, default \ float: sqrtf, \
: sqrt, long double \ default: sqrt, \
: sqrtl, complex float \ long double: sqrtl, \
: csqrtf, complex double \ complex float: csqrtf, \
: csqrt, complex long double \ complex double: csqrt, \
: csqrtl)(x) complex long double: csqrtl)(x)
#define sin(x) \ #define sin(x) \
_Generic((x), float \ _Generic((x), \
: sinf, default \ float: sinf, \
: sin, long double \ default: sin, \
: sinl, complex float \ long double: sinl, \
: csinf, complex double \ complex float: csinf, \
: csin, complex long double \ complex double: csin, \
: csinl)(x) complex long double: csinl)(x)
#define cos(x) \ #define cos(x) \
_Generic((x), float \ _Generic((x), \
: cosf, default \ float: cosf, \
: cos, long double \ default: cos, \
: cosl, complex float \ long double: cosl, \
: ccosf, complex double \ complex float: ccosf, \
: ccos, complex long double \ complex double: ccos, \
: ccosl)(x) complex long double: ccosl)(x)
#define tan(x) \ #define tan(x) \
_Generic((x), float \ _Generic((x), \
: tanf, default \ float: tanf, \
: tan, long double \ default: tan, \
: tanl, complex float \ long double: tanl, \
: ctanf, complex double \ complex float: ctanf, \
: ctan, complex long double \ complex double: ctan, \
: ctanl)(x) complex long double: ctanl)(x)
#define asin(x) \ #define asin(x) \
_Generic((x), float \ _Generic((x), \
: asinf, default \ float: asinf, \
: asin, long double \ default: asin, \
: asinl, complex float \ long double: asinl, \
: casinf, complex double \ complex float: casinf, \
: casin, complex long double \ complex double: casin, \
: casinl)(x) complex long double: casinl)(x)
#define acos(x) \ #define acos(x) \
_Generic((x), float \ _Generic((x), \
: acosf, default \ float: acosf, \
: acos, long double \ default: acos, \
: acosl, complex float \ long double: acosl, \
: cacosf, complex double \ complex float: cacosf, \
: cacos, complex long double \ complex double: cacos, \
: cacosl)(x) complex long double: cacosl)(x)
#define atan(x) \ #define atan(x) \
_Generic((x), float \ _Generic((x), \
: atanf, default \ float: atanf, \
: atan, long double \ default: atan, \
: atanl, complex float \ long double: atanl, \
: catanf, complex double \ complex float: catanf, \
: catan, complex long double \ complex double: catan, \
: catanl)(x) complex long double: catanl)(x)
#define sinh(x) \ #define sinh(x) \
_Generic((x), float \ _Generic((x), \
: sinhf, default \ float: sinhf, \
: sinh, long double \ default: sinh, \
: sinhl, complex float \ long double: sinhl, \
: csinhf, complex double \ complex float: csinhf, \
: csinh, complex long double \ complex double: csinh, \
: csinhl)(x) complex long double: csinhl)(x)
#define cosh(x) \ #define cosh(x) \
_Generic((x), float \ _Generic((x), \
: coshf, default \ float: coshf, \
: cosh, long double \ default: cosh, \
: coshl, complex float \ long double: coshl, \
: ccoshf, complex double \ complex float: ccoshf, \
: ccosh, complex long double \ complex double: ccosh, \
: ccoshl)(x) complex long double: ccoshl)(x)
#define tanh(x) \ #define tanh(x) \
_Generic((x), float \ _Generic((x), \
: tanhf, default \ float: tanhf, \
: tanh, long double \ default: tanh, \
: tanhl, complex float \ long double: tanhl, \
: ctanhf, complex double \ complex float: ctanhf, \
: ctanh, complex long double \ complex double: ctanh, \
: ctanhl)(x) complex long double: ctanhl)(x)
#define asinh(x) \ #define asinh(x) \
_Generic((x), float \ _Generic((x), \
: asinhf, default \ float: asinhf, \
: asinh, long double \ default: asinh, \
: asinhl, complex float \ long double: asinhl, \
: casinhf, complex double \ complex float: casinhf, \
: casinh, complex long double \ complex double: casinh, \
: casinhl)(x) complex long double: casinhl)(x)
#define acosh(x) \ #define acosh(x) \
_Generic((x), float \ _Generic((x), \
: acoshf, default \ float: acoshf, \
: acosh, long double \ default: acosh, \
: acoshl, complex float \ long double: acoshl, \
: cacoshf, complex double \ complex float: cacoshf, \
: cacosh, complex long double \ complex double: cacosh, \
: cacoshl)(x) complex long double: cacoshl)(x)
#define atanh(x) \ #define atanh(x) \
_Generic((x), float \ _Generic((x), \
: atanhf, default \ float: atanhf, \
: atanh, long double \ default: atanh, \
: atanhl, complex float \ long double: atanhl, \
: catanhf, complex double \ complex float: catanhf, \
: catanh, complex long double \ complex double: catanh, \
: catanhl)(x) complex long double: catanhl)(x)
#define atan2(x, y) \ #define atan2(x, y) \
_Generic((x), float : atan2f, default : atan2, long double : atan2l)(x, y) _Generic((x), float: atan2f, default: atan2, long double: atan2l)(x, y)
#define cbrt(x) \ #define cbrt(x) \
_Generic((x), float : cbrtf, default : cbrt, long double : cbrtl)(x) _Generic((x), float: cbrtf, default: cbrt, long double: cbrtl)(x)
#define ceil(x) \ #define ceil(x) \
_Generic((x), float : ceilf, default : ceil, long double : ceill)(x) _Generic((x), float: ceilf, default: ceil, long double: ceill)(x)
#define copysign(x, y) \ #define copysign(x, y) \
_Generic((x), float \ _Generic((x), float: copysignf, default: copysign, long double: copysignl)( \
: copysignf, default \ x, y)
: copysign, long double \
: copysignl)(x, y)
#define erf(x) _Generic((x), float : erff, default : erf, long double : erfl)(x) #define erf(x) _Generic((x), float: erff, default: erf, long double: erfl)(x)
#define erfc(x) \ #define erfc(x) \
_Generic((x), float : erfcf, default : erfc, long double : erfcl)(x) _Generic((x), float: erfcf, default: erfc, long double: erfcl)(x)
#define exp2(x) \ #define exp2(x) \
_Generic((x), float : exp2f, default : exp2, long double : exp2l)(x) _Generic((x), float: exp2f, default: exp2, long double: exp2l)(x)
#define expm1(x) \ #define expm1(x) \
_Generic((x), float : expm1f, default : expm1, long double : expm1l)(x) _Generic((x), float: expm1f, default: expm1, long double: expm1l)(x)
#define fdim(x, y) \ #define fdim(x, y) \
_Generic((x), float : fdimf, default : fdim, long double : fdiml)(x, y) _Generic((x), float: fdimf, default: fdim, long double: fdiml)(x, y)
#define floor(x) \ #define floor(x) \
_Generic((x), float : floorf, default : floor, long double : floorl)(x) _Generic((x), float: floorf, default: floor, long double: floorl)(x)
#define fma(x, y, z) \ #define fma(x, y, z) \
_Generic((x), float : fmaf, default : fma, long double : fmal)(x, y, z) _Generic((x), float: fmaf, default: fma, long double: fmal)(x, y, z)
#define fmax(x, y) \ #define fmax(x, y) \
_Generic((x), float : fmaxf, default : fmax, long double : fmaxl)(x, y) _Generic((x), float: fmaxf, default: fmax, long double: fmaxl)(x, y)
#define fmin(x, y) \ #define fmin(x, y) \
_Generic((x), float : fminf, default : fmin, long double : fminl)(x, y) _Generic((x), float: fminf, default: fmin, long double: fminl)(x, y)
#define fmod(x, y) \ #define fmod(x, y) \
_Generic((x), float : fmodf, default : fmod, long double : fmodl)(x, y) _Generic((x), float: fmodf, default: fmod, long double: fmodl)(x, y)
#define frexp(x, y) \ #define frexp(x, y) \
_Generic((x), float : frexpf, default : frexp, long double : frexpl)(x, y) _Generic((x), float: frexpf, default: frexp, long double: frexpl)(x, y)
#define hypot(x, y) \ #define hypot(x, y) \
_Generic((x), float : hypotf, default : hypot, long double : hypotl)(x, y) _Generic((x), float: hypotf, default: hypot, long double: hypotl)(x, y)
#define ilogb(x) \ #define ilogb(x) \
_Generic((x), float : ilogbf, default : ilogb, long double : ilogbl)(x) _Generic((x), float: ilogbf, default: ilogb, long double: ilogbl)(x)
#define ldexp(x, y) \ #define ldexp(x, y) \
_Generic((x), float : ldexpf, default : ldexp, long double : ldexpl)(x, y) _Generic((x), float: ldexpf, default: ldexp, long double: ldexpl)(x, y)
#define lgamma(x) \ #define lgamma(x) \
_Generic((x), float : lgammaf, default : lgamma, long double : lgammal)(x) _Generic((x), float: lgammaf, default: lgamma, long double: lgammal)(x)
#define llrint(x) \ #define llrint(x) \
_Generic((x), float : llrintf, default : llrint, long double : llrintl)(x) _Generic((x), float: llrintf, default: llrint, long double: llrintl)(x)
#define llround(x) \ #define llround(x) \
_Generic((x), float : llroundf, default : llround, long double : llroundl)(x) _Generic((x), float: llroundf, default: llround, long double: llroundl)(x)
#define log10(x) \ #define log10(x) \
_Generic((x), float : log10f, default : log10, long double : log10l)(x) _Generic((x), float: log10f, default: log10, long double: log10l)(x)
#define log1p(x) \ #define log1p(x) \
_Generic((x), float : log1pf, default : log1p, long double : log1pl)(x) _Generic((x), float: log1pf, default: log1p, long double: log1pl)(x)
#define log2(x) \ #define log2(x) \
_Generic((x), float : log2f, default : log2, long double : log2l)(x) _Generic((x), float: log2f, default: log2, long double: log2l)(x)
#define logb(x) \ #define logb(x) \
_Generic((x), float : logbf, default : logb, long double : logbl)(x) _Generic((x), float: logbf, default: logb, long double: logbl)(x)
#define lrint(x) \ #define lrint(x) \
_Generic((x), float : lrintf, default : lrint, long double : lrintl)(x) _Generic((x), float: lrintf, default: lrint, long double: lrintl)(x)
#define lround(x) \ #define lround(x) \
_Generic((x), float : lroundf, default : lround, long double : lroundl)(x) _Generic((x), float: lroundf, default: lround, long double: lroundl)(x)
#define nearbyint(x) \ #define nearbyint(x) \
_Generic((x), float \ _Generic((x), \
: nearbyintf, default \ float: nearbyintf, \
: nearbyint, long double \ default: nearbyint, \
: nearbyintl)(x) long double: nearbyintl)(x)
#define nextafter(x, y) \ #define nextafter(x, y) \
_Generic((x), float \ _Generic((x), \
: nextafterf, default \ float: nextafterf, \
: nextafter, long double \ default: nextafter, \
: nextafterl)(x, y) long double: nextafterl)(x, y)
#define nexttoward(x, y) \ #define nexttoward(x, y) \
_Generic((x), float \ _Generic((x), \
: nexttowardf, default \ float: nexttowardf, \
: nexttoward, long double \ default: nexttoward, \
: nexttowardl)(x, y) long double: nexttowardl)(x, y)
#define remainder(x, y) \ #define remainder(x, y) \
_Generic((x), float \ _Generic((x), \
: remainderf, default \ float: remainderf, \
: remainder, long double \ default: remainder, \
: remainderl)(x, y) long double: remainderl)(x, y)
#define remquo(x, y, z) \ #define remquo(x, y, z) \
_Generic((x), float \ _Generic((x), float: remquof, default: remquo, long double: remquol)(x, y, z)
: remquof, default \
: remquo, long double \
: remquol)(x, y, z)
#define rint(x) \ #define rint(x) \
_Generic((x), float : rintf, default : rint, long double : rintl)(x) _Generic((x), float: rintf, default: rint, long double: rintl)(x)
#define round(x) \ #define round(x) \
_Generic((x), float : roundf, default : round, long double : roundl)(x) _Generic((x), float: roundf, default: round, long double: roundl)(x)
#define scalbln(x, y) \ #define scalbln(x, y) \
_Generic((x), float \ _Generic((x), float: scalblnf, default: scalbln, long double: scalblnl)(x, y)
: scalblnf, default \
: scalbln, long double \
: scalblnl)(x, y)
#define scalbn(x, y) \ #define scalbn(x, y) \
_Generic((x), float : scalbnf, default : scalbn, long double : scalbnl)(x, y) _Generic((x), float: scalbnf, default: scalbn, long double: scalbnl)(x, y)
#define tgamma(x) \ #define tgamma(x) \
_Generic((x), float : tgammaf, default : tgamma, long double : tgammal)(x) _Generic((x), float: tgammaf, default: tgamma, long double: tgammal)(x)
#define trunc(x) \ #define trunc(x) \
_Generic((x), float : truncf, default : trunc, long double : truncl)(x) _Generic((x), float: truncf, default: trunc, long double: truncl)(x)
#define carg(x) \ #define carg(x) \
_Generic((x), complex float \ _Generic((x), \
: cargf, default \ complex float: cargf, \
: carg, complex long double \ default: carg, \
: cargl)(x) complex long double: cargl)(x)
#define conj(x) \ #define conj(x) \
_Generic((x), complex float \ _Generic((x), \
: conjf, default \ complex float: conjf, \
: conj, complex long double \ default: conj, \
: conjl)(x) complex long double: conjl)(x)
#undef creal #undef creal
#define creal(x) \ #define creal(x) \
_Generic((x), complex float \ _Generic((x), \
: crealf, default \ complex float: crealf, \
: creal, complex long double \ default: creal, \
: creall)(x) complex long double: creall)(x)
#undef cimag #undef cimag
#define cimag(x) \ #define cimag(x) \
_Generic((x), complex float \ _Generic((x), \
: cimagf, default \ complex float: cimagf, \
: cimag, complex long double \ default: cimag, \
: cimagl)(x) complex long double: cimagl)(x)
#define cproj(x) \ #define cproj(x) \
_Generic((x), complex float \ _Generic((x), \
: cprojf, default \ complex float: cprojf, \
: cproj, complex long double \ default: cproj, \
: cprojl)(x) complex long double: cprojl)(x)
#endif /* C11 */ #endif /* C11 */
#endif /* _TGMATH_H */ #endif /* _TGMATH_H */

View file

@ -18,10 +18,10 @@
*/ */
#include "libc/calls/struct/rusage.h" #include "libc/calls/struct/rusage.h"
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/serialize.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/runtime/clktck.h" #include "libc/runtime/clktck.h"
#include "libc/serialize.h"
#include "libc/stdio/append.h" #include "libc/stdio/append.h"
struct State { struct State {

View file

@ -36,7 +36,8 @@ COSMOPOLITAN_C_START_
: "=r"(Info)); \ : "=r"(Info)); \
Cond = (x); \ Cond = (x); \
++Info->total; \ ++Info->total; \
if (Cond) ++Info->taken; \ if (Cond) \
++Info->taken; \
Cond; \ Cond; \
}) })

View file

@ -31,7 +31,8 @@ int AttachDebugger(intptr_t);
while ((Rc = __inline_wait4(Pid, NULL, WNOHANG, NULL)) == 0) { \ while ((Rc = __inline_wait4(Pid, NULL, WNOHANG, NULL)) == 0) { \
if (g_gdbsync) { \ if (g_gdbsync) { \
g_gdbsync = 0; \ g_gdbsync = 0; \
if (Rc > 0) Pid = 0; \ if (Rc > 0) \
Pid = 0; \
break; \ break; \
} else { \ } else { \
sched_yield(); \ sched_yield(); \

View file

@ -5,13 +5,15 @@ COSMOPOLITAN_C_START_
forceinline unsigned long __strlen(const char *s) { forceinline unsigned long __strlen(const char *s) {
unsigned long n = 0; unsigned long n = 0;
while (*s++) ++n; while (*s++)
++n;
return n; return n;
} }
forceinline int __strcmp(const char *l, const char *r) { forceinline int __strcmp(const char *l, const char *r) {
size_t i = 0; size_t i = 0;
while (l[i] == r[i] && r[i]) ++i; while (l[i] == r[i] && r[i])
++i;
return (l[i] & 255) - (r[i] & 255); return (l[i] & 255) - (r[i] & 255);
} }
@ -86,12 +88,14 @@ forceinline char *__uintcpy(char p[hasatleast 21], uint64_t x) {
} }
forceinline char *__intcpy(char p[hasatleast 21], int64_t x) { forceinline char *__intcpy(char p[hasatleast 21], int64_t x) {
if (x < 0) *p++ = '-', x = -(uint64_t)x; if (x < 0)
*p++ = '-', x = -(uint64_t)x;
return __uintcpy(p, x); return __uintcpy(p, x);
} }
forceinline char *__fixcpy(char p[hasatleast 17], uint64_t x, uint8_t k) { forceinline char *__fixcpy(char p[hasatleast 17], uint64_t x, uint8_t k) {
while (k > 0) *p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15]; while (k > 0)
*p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15];
*p = '\0'; *p = '\0';
return p; return p;
} }
@ -114,11 +118,15 @@ forceinline char *__strstr(const char *haystack, const char *needle) {
size_t i; size_t i;
for (;;) { for (;;) {
for (i = 0;; ++i) { for (i = 0;; ++i) {
if (!needle[i]) return (/*unconst*/ char *)haystack; if (!needle[i])
if (!haystack[i]) break; return (/*unconst*/ char *)haystack;
if (needle[i] != haystack[i]) break; if (!haystack[i])
break;
if (needle[i] != haystack[i])
break;
} }
if (!*haystack++) break; if (!*haystack++)
break;
} }
return 0; return 0;
} }
@ -128,35 +136,44 @@ forceinline char16_t *__strstr16(const char16_t *haystack,
size_t i; size_t i;
for (;;) { for (;;) {
for (i = 0;; ++i) { for (i = 0;; ++i) {
if (!needle[i]) return (/*unconst*/ char16_t *)haystack; if (!needle[i])
if (!haystack[i]) break; return (/*unconst*/ char16_t *)haystack;
if (needle[i] != haystack[i]) break; if (!haystack[i])
break;
if (needle[i] != haystack[i])
break;
} }
if (!*haystack++) break; if (!*haystack++)
break;
} }
return 0; return 0;
} }
forceinline const char *__strchr(const char *s, unsigned char c) { forceinline const char *__strchr(const char *s, unsigned char c) {
for (;; ++s) { for (;; ++s) {
if ((*s & 255) == c) return s; if ((*s & 255) == c)
if (!*s) return 0; return s;
if (!*s)
return 0;
} }
} }
forceinline unsigned long __atoul(const char *p) { forceinline unsigned long __atoul(const char *p) {
int c; int c;
unsigned long x = 0; unsigned long x = 0;
while ('0' <= (c = *p++) && c <= '9') x *= 10, x += c - '0'; while ('0' <= (c = *p++) && c <= '9')
x *= 10, x += c - '0';
return x; return x;
} }
forceinline long __atol(const char *p) { forceinline long __atol(const char *p) {
int s = *p; int s = *p;
unsigned long x; unsigned long x;
if (s == '-' || s == '+') ++p; if (s == '-' || s == '+')
++p;
x = __atoul(p); x = __atoul(p);
if (s == '-') x = -x; if (s == '-')
x = -x;
return x; return x;
} }

View file

@ -61,22 +61,26 @@ extern unsigned __log_level; /* log level for runtime check */
// log a message with the specified log level (not checking if LOGGABLE) // log a message with the specified log level (not checking if LOGGABLE)
#define LOGF(LEVEL, FMT, ...) \ #define LOGF(LEVEL, FMT, ...) \
do { \ do { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} while (0) } while (0)
// report an error without backtrace and debugger invocation // report an error without backtrace and debugger invocation
#define FATALF(FMT, ...) \ #define FATALF(FMT, ...) \
do { \ do { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogError, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ flogf(kLogError, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
_log_exit(1); \ _log_exit(1); \
} while (0) } while (0)
#define DIEF(FMT, ...) \ #define DIEF(FMT, ...) \
do { \ do { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
ffatalf(kLogFatal, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ ffatalf(kLogFatal, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
__builtin_unreachable(); \ __builtin_unreachable(); \
} while (0) } while (0)
@ -105,51 +109,62 @@ extern unsigned __log_level; /* log level for runtime check */
#define VERBOSEF(FMT, ...) \ #define VERBOSEF(FMT, ...) \
do { \ do { \
if (LOGGABLE(kLogVerbose)) { \ if (LOGGABLE(kLogVerbose)) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
fverbosef(kLogVerbose, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ fverbosef(kLogVerbose, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} \ } \
} while (0) } while (0)
#define DEBUGF(FMT, ...) \ #define DEBUGF(FMT, ...) \
do { \ do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \ if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
fdebugf(kLogDebug, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ fdebugf(kLogDebug, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} \ } \
} while (0) } while (0)
#define NOISEF(FMT, ...) \ #define NOISEF(FMT, ...) \
do { \ do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \ if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
fnoisef(kLogNoise, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ fnoisef(kLogNoise, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} \ } \
} while (0) } while (0)
#define FLOGF(F, FMT, ...) \ #define FLOGF(F, FMT, ...) \
do { \ do { \
if (LOGGABLE(kLogInfo)) { \ if (LOGGABLE(kLogInfo)) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogInfo, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ flogf(kLogInfo, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} \ } \
} while (0) } while (0)
#define FWARNF(F, FMT, ...) \ #define FWARNF(F, FMT, ...) \
do { \ do { \
if (LOGGABLE(kLogWarn)) { \ if (LOGGABLE(kLogWarn)) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogWarn, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ flogf(kLogWarn, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} \ } \
} while (0) } while (0)
#define FFATALF(F, FMT, ...) \ #define FFATALF(F, FMT, ...) \
do { \ do { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogError, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ flogf(kLogError, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
_log_exit(1); \ _log_exit(1); \
} while (0) } while (0)
@ -157,18 +172,22 @@ extern unsigned __log_level; /* log level for runtime check */
#define FDEBUGF(F, FMT, ...) \ #define FDEBUGF(F, FMT, ...) \
do { \ do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \ if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
fdebugf(kLogDebug, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ fdebugf(kLogDebug, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} \ } \
} while (0) } while (0)
#define FNOISEF(F, FMT, ...) \ #define FNOISEF(F, FMT, ...) \
do { \ do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \ if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
fnoisef(kLogNoise, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ fnoisef(kLogNoise, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
} \ } \
} while (0) } while (0)
@ -177,9 +196,11 @@ extern unsigned __log_level; /* log level for runtime check */
int e = _log_get_errno(); \ int e = _log_get_errno(); \
autotype(FORM) Ax = (FORM); \ autotype(FORM) Ax = (FORM); \
if (_LOG_UNLIKELY(Ax == (typeof(Ax))(-1)) && LOGGABLE(kLogWarn)) { \ if (_LOG_UNLIKELY(Ax == (typeof(Ax))(-1)) && LOGGABLE(kLogWarn)) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
_log_errno(__FILE__, __LINE__, #FORM); \ _log_errno(__FILE__, __LINE__, #FORM); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
_log_set_errno(e); \ _log_set_errno(e); \
} \ } \
Ax; \ Ax; \
@ -190,9 +211,11 @@ extern unsigned __log_level; /* log level for runtime check */
int e = _log_get_errno(); \ int e = _log_get_errno(); \
autotype(FORM) Ax = (FORM); \ autotype(FORM) Ax = (FORM); \
if (Ax == NULL && LOGGABLE(kLogWarn)) { \ if (Ax == NULL && LOGGABLE(kLogWarn)) { \
if (!_LOG_TINY) _log_untrace(); \ if (!_LOG_TINY) \
_log_untrace(); \
_log_errno(__FILE__, __LINE__, #FORM); \ _log_errno(__FILE__, __LINE__, #FORM); \
if (!_LOG_TINY) _log_retrace(); \ if (!_LOG_TINY) \
_log_retrace(); \
_log_set_errno(e); \ _log_set_errno(e); \
} \ } \
Ax; \ Ax; \

View file

@ -16,12 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/serialize.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h" #include "libc/log/backtrace.internal.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h" #include "libc/runtime/symbols.internal.h"
#include "libc/serialize.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#ifdef __x86_64__ #ifdef __x86_64__

View file

@ -21,8 +21,8 @@
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
#define IS2POW(X) (!((X) & ((X) - 1))) #define IS2POW(X) (!((X) & ((X)-1)))
#define ROUNDUP(X, K) (((X) + (K) - 1) & -(K)) #define ROUNDUP(X, K) (((X) + (K)-1) & -(K))
#define ROUNDDOWN(X, K) ((X) & -(K)) #define ROUNDDOWN(X, K) ((X) & -(K))
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
#define ABS(X) ((X) >= 0 ? (X) : -(X)) #define ABS(X) ((X) >= 0 ? (X) : -(X))
@ -40,7 +40,7 @@
#define STRINGIFY(A) __STRINGIFY(A) #define STRINGIFY(A) __STRINGIFY(A)
#define EQUIVALENT(X, Y) (__builtin_constant_p((X) == (Y)) && ((X) == (Y))) #define EQUIVALENT(X, Y) (__builtin_constant_p((X) == (Y)) && ((X) == (Y)))
#define TYPE_BIT(type) (sizeof(type) * CHAR_BIT) #define TYPE_BIT(type) (sizeof(type) * CHAR_BIT)
#define TYPE_SIGNED(type) (((type) - 1) < 0) #define TYPE_SIGNED(type) (((type)-1) < 0)
#define TYPE_INTEGRAL(type) (((type)0.5) != 0.5) #define TYPE_INTEGRAL(type) (((type)0.5) != 0.5)
#define ARRAYLEN(A) \ #define ARRAYLEN(A) \

View file

@ -5,7 +5,7 @@
#include "libc/nexgen32e/x86feature.h" #include "libc/nexgen32e/x86feature.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
#define TSC_AUX_CORE(MSR) ((MSR) & 0xfff) #define TSC_AUX_CORE(MSR) ((MSR)&0xfff)
#define TSC_AUX_NODE(MSR) (((MSR) >> 12) & 0xfff) #define TSC_AUX_NODE(MSR) (((MSR) >> 12) & 0xfff)
/** /**
@ -25,7 +25,8 @@ COSMOPOLITAN_C_START_
: /* no inputs */ \ : /* no inputs */ \
: "memory"); \ : "memory"); \
EcxOut = (OPT_OUT_IA32_TSC_AUX); \ EcxOut = (OPT_OUT_IA32_TSC_AUX); \
if (EcxOut) *EcxOut = Ecx; \ if (EcxOut) \
*EcxOut = Ecx; \
Rdx << 32 | Rax; \ Rdx << 32 | Rax; \
}) })

View file

@ -4,7 +4,6 @@
#define kNtExceptionMaximumParameters 15 #define kNtExceptionMaximumParameters 15
#define kNtExceptionNoncontinuable 1 #define kNtExceptionNoncontinuable 1
struct NtExceptionRecord { struct NtExceptionRecord {
uint32_t ExceptionCode; /* kNtException... */ uint32_t ExceptionCode; /* kNtException... */
uint32_t ExceptionFlags; /* kNtExceptionNoncontinuable */ uint32_t ExceptionFlags; /* kNtExceptionNoncontinuable */

View file

@ -31,8 +31,7 @@ static int __zipos_dupfd(int fd, int cmd, int start) {
if (start < 0) if (start < 0)
return einval(); return einval();
if (IsWindows()) { if (IsWindows()) {
return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0), return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0), start);
start);
} }
rc = sys_fcntl(fd, cmd, start, __sys_fcntl); rc = sys_fcntl(fd, cmd, start, __sys_fcntl);
if (rc != -1) { if (rc != -1) {

View file

@ -17,8 +17,8 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h" #include "libc/runtime/zipos.internal.h"
#include "libc/sysv/errfuns.h"
int __zipos_notat(int dirfd, const char *path) { int __zipos_notat(int dirfd, const char *path) {
struct ZiposUri zipname; struct ZiposUri zipname;

View file

@ -127,7 +127,7 @@ https://github.com/piscisaureus/wepoll");
} while (0) } while (0)
#define CONTAINOF(ptr, type, member) \ #define CONTAINOF(ptr, type, member) \
((type *)((uintptr_t)(ptr) - offsetof(type, member))) ((type *)((uintptr_t)(ptr)-offsetof(type, member)))
#define TREE__ROTATE(cis, trans) \ #define TREE__ROTATE(cis, trans) \
struct TreeNode *p = node; \ struct TreeNode *p = node; \

View file

@ -20,11 +20,11 @@
#include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall-sysv.internal.h"
#include "libc/calls/syscall_support-nt.internal.h" #include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/serialize.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/nt/errors.h" #include "libc/nt/errors.h"
#include "libc/nt/iphlpapi.h" #include "libc/nt/iphlpapi.h"
#include "libc/serialize.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"

View file

@ -553,9 +553,10 @@ int __vcscanf(int callback(void *), //
items = -1; items = -1;
goto Done; goto Done;
} else if (rawmode && j != width) { } else if (rawmode && j != width) {
/* The C standard says that %c "matches a sequence of characters of /* The C standard says that %c "matches a sequence of characters
* **exactly** the number specified by the field width". If we have * of
* fewer characters, what we've just read is invalid. */ * **exactly** the number specified by the field width". If we
* have fewer characters, what we've just read is invalid. */
goto Done; goto Done;
} else if (!rawmode && j < bufsize) { } else if (!rawmode && j < bufsize) {
if (charbytes == sizeof(char)) { if (charbytes == sizeof(char)) {

View file

@ -21,7 +21,7 @@
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
#define LC_GLOBAL_LOCALE ((locale_t) - 1) #define LC_GLOBAL_LOCALE ((locale_t)-1)
struct __locale_map { struct __locale_map {
const void *map; const void *map;

View file

@ -16,10 +16,10 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/serialize.h"
#include "libc/intrin/pushpop.internal.h" #include "libc/intrin/pushpop.internal.h"
#include "libc/intrin/repmovsb.h" #include "libc/intrin/repmovsb.h"
#include "libc/nexgen32e/kompressor.h" #include "libc/nexgen32e/kompressor.h"
#include "libc/serialize.h"
#include "libc/str/str.h" #include "libc/str/str.h"
/** /**

View file

@ -13,25 +13,30 @@
forceinline int tpdecodecb(wint_t *out, int first, forceinline int tpdecodecb(wint_t *out, int first,
int get(void *arg, uint32_t i), void *arg) { int get(void *arg, uint32_t i), void *arg) {
uint32_t wc, cb, need, msb, j, i = 1; uint32_t wc, cb, need, msb, j, i = 1;
if (__builtin_expect((wc = first) == -1, 0)) return -1; if (__builtin_expect((wc = first) == -1, 0))
return -1;
while (__builtin_expect((wc & 0b11000000) == 0b10000000, 0)) { while (__builtin_expect((wc & 0b11000000) == 0b10000000, 0)) {
if ((wc = get(arg, i++)) == -1) return -1; if ((wc = get(arg, i++)) == -1)
return -1;
} }
if (__builtin_expect(!(0 <= wc && wc <= 0x7F), 0)) { if (__builtin_expect(!(0 <= wc && wc <= 0x7F), 0)) {
msb = wc < 252 ? bsr(~wc & 0xff) : 1; msb = wc < 252 ? bsr(~wc & 0xff) : 1;
need = 7 - msb; need = 7 - msb;
wc &= ((1u << msb) - 1) | 0b00000011; wc &= ((1u << msb) - 1) | 0b00000011;
for (j = 1; j < need; ++j) { for (j = 1; j < need; ++j) {
if ((cb = get(arg, i++)) == -1) return -1; if ((cb = get(arg, i++)) == -1)
return -1;
if ((cb & 0b11000000) == 0b10000000) { if ((cb & 0b11000000) == 0b10000000) {
wc = wc << 6 | (cb & 0b00111111); wc = wc << 6 | (cb & 0b00111111);
} else { } else {
if (out) *out = u'\xFFFD'; if (out)
*out = u'\xFFFD';
return -1; return -1;
} }
} }
} }
if (__builtin_expect(!!out, 1)) *out = (wint_t)wc; if (__builtin_expect(!!out, 1))
*out = (wint_t)wc;
return i; return i;
} }

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/serialize.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/serialize.h"
#include "libc/str/str.h" #include "libc/str/str.h"
static const char kWcTypeNames[][8] = { static const char kWcTypeNames[][8] = {

View file

@ -22,14 +22,11 @@
#define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT #define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT
#define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE #define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE
#define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST #define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME \ #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME
ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME \
ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN \ #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ICMP6_RR_RESULT_FLAGS_FORBIDDEN
ICMP6_RR_RESULT_FLAGS_FORBIDDEN
#define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB #define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB
#define ICMP6_TIME_EXCEEDED ICMP6_TIME_EXCEEDED #define ICMP6_TIME_EXCEEDED ICMP6_TIME_EXCEEDED
#define ICMP6_TIME_EXCEED_REASSEMBLY ICMP6_TIME_EXCEED_REASSEMBLY #define ICMP6_TIME_EXCEED_REASSEMBLY ICMP6_TIME_EXCEED_REASSEMBLY

View file

@ -38,5 +38,4 @@ COSMOPOLITAN_C_END_
#define IFF_RUNNING IFF_RUNNING #define IFF_RUNNING IFF_RUNNING
#define IFF_SLAVE IFF_SLAVE #define IFF_SLAVE IFF_SLAVE
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IFF_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IFF_H_ */

View file

@ -102,6 +102,5 @@ extern const int IP_XFRM_POLICY;
#define IP_UNICAST_IF IP_UNICAST_IF #define IP_UNICAST_IF IP_UNICAST_IF
#define IP_XFRM_POLICY IP_XFRM_POLICY #define IP_XFRM_POLICY IP_XFRM_POLICY
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IP_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IP_H_ */

View file

@ -122,6 +122,5 @@ extern const int IPV6_XFRM_POLICY;
#define IPV6_V6ONLY IPV6_V6ONLY #define IPV6_V6ONLY IPV6_V6ONLY
#define IPV6_XFRM_POLICY IPV6_XFRM_POLICY #define IPV6_XFRM_POLICY IPV6_XFRM_POLICY
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IPV6_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IPV6_H_ */

View file

@ -24,6 +24,5 @@ extern const int MAX_INPUT;
#define MAX_CANON MAX_CANON #define MAX_CANON MAX_CANON
#define MAX_INPUT MAX_INPUT #define MAX_INPUT MAX_INPUT
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LIMITS_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LIMITS_H_ */

View file

@ -15,5 +15,4 @@ COSMOPOLITAN_C_END_
#define LOCK_SH LOCK_SH #define LOCK_SH LOCK_SH
#define LOCK_UN LOCK_UN #define LOCK_UN LOCK_UN
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LOCK_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LOCK_H_ */

View file

@ -36,6 +36,5 @@ extern const int TIOCM_ST;
#define TIOCMBIC TIOCMBIC #define TIOCMBIC TIOCMBIC
#define TIOCMBIS TIOCMBIS #define TIOCMBIS TIOCMBIS
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MODEM_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MODEM_H_ */

View file

@ -92,6 +92,5 @@ extern const int MNT_SNAPSHOT;
#define MNT_NOCLUSTERW MNT_NOCLUSTERW #define MNT_NOCLUSTERW MNT_NOCLUSTERW
#define MNT_SNAPSHOT MNT_SNAPSHOT #define MNT_SNAPSHOT MNT_SNAPSHOT
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */

View file

@ -94,6 +94,5 @@ extern const int PF_X25;
#define PF_WANPIPE PF_WANPIPE #define PF_WANPIPE PF_WANPIPE
#define PF_X25 PF_X25 #define PF_X25 PF_X25
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PF_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PF_H_ */

View file

@ -27,6 +27,5 @@ extern const int16_t POLLWRNORM;
#define POLLWRBAND POLLWRBAND #define POLLWRBAND POLLWRBAND
#define POLLWRNORM POLLWRNORM #define POLLWRNORM POLLWRNORM
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POLL_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POLL_H_ */

View file

@ -22,6 +22,5 @@ extern const int POSIX_MADV_DONTNEED;
#define POSIX_MADV_DONTNEED POSIX_MADV_DONTNEED #define POSIX_MADV_DONTNEED POSIX_MADV_DONTNEED
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POSIX_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POSIX_H_ */

View file

@ -23,6 +23,5 @@ extern const int TIOCPKT_STOP;
#define TIOCPKT TIOCPKT #define TIOCPKT TIOCPKT
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PTY_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PTY_H_ */

View file

@ -26,6 +26,5 @@ extern const unsigned RB_NOSYNC;
#define RB_DISABLE_CAD RB_DISABLE_CAD #define RB_DISABLE_CAD RB_DISABLE_CAD
#define RB_NOSYNC RB_NOSYNC #define RB_NOSYNC RB_NOSYNC
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ */

View file

@ -12,6 +12,5 @@ extern const uint64_t RLIM_SAVED_MAX;
#define RLIM_SAVED_CUR RLIM_SAVED_CUR #define RLIM_SAVED_CUR RLIM_SAVED_CUR
#define RLIM_SAVED_MAX RLIM_SAVED_MAX #define RLIM_SAVED_MAX RLIM_SAVED_MAX
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_RLIM_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_RLIM_H_ */

View file

@ -22,6 +22,5 @@ extern const uint64_t SA_SIGINFO;
#define SA_RESTART SA_RESTART #define SA_RESTART SA_RESTART
#define SA_SIGINFO SA_SIGINFO #define SA_SIGINFO SA_SIGINFO
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SA_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SA_H_ */

View file

@ -19,6 +19,5 @@ extern const int SCHED_RR;
#define SCHED_RESET_ON_FORK SCHED_RESET_ON_FORK #define SCHED_RESET_ON_FORK SCHED_RESET_ON_FORK
#define SCHED_RR SCHED_RR #define SCHED_RR SCHED_RR
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCHED_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCHED_H_ */

View file

@ -17,5 +17,4 @@ COSMOPOLITAN_C_END_
#define SCM_TIMESTAMPNS SCM_TIMESTAMPNS #define SCM_TIMESTAMPNS SCM_TIMESTAMPNS
#define SCM_WIFI_STATUS SCM_WIFI_STATUS #define SCM_WIFI_STATUS SCM_WIFI_STATUS
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCM_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCM_H_ */

View file

@ -17,6 +17,5 @@ extern const int SF_SYNC;
#define SF_NODISKIO SF_NODISKIO #define SF_NODISKIO SF_NODISKIO
#define SF_SYNC SF_SYNC #define SF_SYNC SF_SYNC
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SF_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SF_H_ */

View file

@ -105,6 +105,5 @@ extern const int32_t SYS_USER_DISPATCH;
#define SYS_SECCOMP SYS_SECCOMP #define SYS_SECCOMP SYS_SECCOMP
#define SYS_USER_DISPATCH SYS_USER_DISPATCH #define SYS_USER_DISPATCH SYS_USER_DISPATCH
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SICODE_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SICODE_H_ */

View file

@ -28,6 +28,5 @@ extern const int ST_WRITE;
#define ST_SYNCHRONOUS ST_SYNCHRONOUS #define ST_SYNCHRONOUS ST_SYNCHRONOUS
#define ST_WRITE ST_WRITE #define ST_WRITE ST_WRITE
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_ST_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_ST_H_ */

View file

@ -66,6 +66,5 @@ extern const int TCP_WINDOW_CLAMP;
#define TCP_USER_TIMEOUT TCP_USER_TIMEOUT #define TCP_USER_TIMEOUT TCP_USER_TIMEOUT
#define TCP_WINDOW_CLAMP TCP_WINDOW_CLAMP #define TCP_WINDOW_CLAMP TCP_WINDOW_CLAMP
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_TCP_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_TCP_H_ */

View file

@ -10,5 +10,4 @@ COSMOPOLITAN_C_END_
#define UTIME_NOW UTIME_NOW #define UTIME_NOW UTIME_NOW
#define UTIME_OMIT UTIME_OMIT #define UTIME_OMIT UTIME_OMIT
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_UTIME_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_UTIME_H_ */

View file

@ -10,6 +10,5 @@ extern const int WCONTINUED;
#define WUNTRACED WUNTRACED #define WUNTRACED WUNTRACED
#define WCONTINUED WCONTINUED #define WCONTINUED WCONTINUED
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_W_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_W_H_ */

View file

@ -35,7 +35,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \ } while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \ (__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \ __testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" speculative"); \
Tries = 0; \ Tries = 0; \
do { \ do { \
__testlib_yield(); \ __testlib_yield(); \
@ -51,7 +52,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \ } while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \ (__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \ __testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport( \ __testlib_ezbenchreport( \
NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \ NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \
MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \ MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \
@ -76,7 +78,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \ } while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \ (__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \ __testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" speculative"); \
Tries = 0; \ Tries = 0; \
do { \ do { \
__testlib_yield(); \ __testlib_yield(); \
@ -92,7 +95,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \ } while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \ (__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \ __testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport( \ __testlib_ezbenchreport( \
NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \ NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \
MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \ MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \
@ -112,7 +116,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \ } while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \ (__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \ __testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" control"); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" control"); \
Tries = 0; \ Tries = 0; \
do { \ do { \
__testlib_yield(); \ __testlib_yield(); \
@ -124,7 +129,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \ } while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \ (__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \ __testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" speculative"); \
Tries = 0; \ Tries = 0; \
do { \ do { \
__testlib_yield(); \ __testlib_yield(); \
@ -136,7 +142,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \ } while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \ (__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \ __testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport(NAME, MAX(.001, Speculative - Control), \ __testlib_ezbenchreport(NAME, MAX(.001, Speculative - Control), \
MAX(.001, MemoryStrict - Control)); \ MAX(.001, MemoryStrict - Control)); \
} while (0) } while (0)
@ -156,7 +163,8 @@ COSMOPOLITAN_C_START_
EXPR; \ EXPR; \
Speculative = BENCHLOOPER(__startbench, __endbench, 32, (EXPR)); \ Speculative = BENCHLOOPER(__startbench, __endbench, 32, (EXPR)); \
} while (++Tries < EZBENCH_TRIES && !Speculative); \ } while (++Tries < EZBENCH_TRIES && !Speculative); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(""); \ if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(""); \
__testlib_ezbenchreport_n(NAME, 'n', N, Speculative); \ __testlib_ezbenchreport_n(NAME, 'n', N, Speculative); \
} while (0) } while (0)

View file

@ -420,8 +420,10 @@ forceinline void testlib_onfail2(bool isfatal) {
forceinline void assertNotEquals(FILIFU_ARGS intptr_t donotwant, intptr_t got, forceinline void assertNotEquals(FILIFU_ARGS intptr_t donotwant, intptr_t got,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (got != donotwant) return; if (got != donotwant)
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertNotEquals", "=", gotcode, testlib_showerror(file, line, func, "assertNotEquals", "=", gotcode,
testlib_formatint(got), testlib_formatint(donotwant)); testlib_formatint(got), testlib_formatint(donotwant));
testlib_onfail2(isfatal); testlib_onfail2(isfatal);
@ -455,8 +457,10 @@ forceinline void assertBetween(FILIFU_ARGS intptr_t beg, intptr_t end,
intptr_t got, const char *gotcode, intptr_t got, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (beg <= got && got <= end) return; if (beg <= got && got <= end)
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertBetween", "", gotcode, testlib_showerror(file, line, func, "assertBetween", "", gotcode,
testlib_formatint(got), testlib_formatrange(beg, end)); testlib_formatint(got), testlib_formatrange(beg, end));
testlib_onfail2(isfatal); testlib_onfail2(isfatal);
@ -466,8 +470,10 @@ forceinline void assertStringEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, const char *gotcode, const void *got, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_strequals(cw, want, got)) return; if (testlib_strequals(cw, want, got))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringEquals", "", gotcode, testlib_showerror(file, line, func, "assertStringEquals", "", gotcode,
testlib_formatstr(cw, want, -1), testlib_formatstr(cw, want, -1),
testlib_formatstr(cw, got, -1)); testlib_formatstr(cw, got, -1));
@ -478,8 +484,10 @@ forceinline void assertStringNotEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, const char *gotcode, const void *got, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (!testlib_strequals(cw, want, got)) return; if (!testlib_strequals(cw, want, got))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringNotEquals", "=", gotcode, testlib_showerror(file, line, func, "assertStringNotEquals", "=", gotcode,
testlib_formatstr(cw, want, -1), testlib_formatstr(cw, want, -1),
testlib_formatstr(cw, got, -1)); testlib_formatstr(cw, got, -1));
@ -490,8 +498,10 @@ forceinline void assertStrnEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, size_t n, const void *got, size_t n,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_strnequals(cw, want, got, n)) return; if (testlib_strnequals(cw, want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnEquals", "", gotcode, testlib_showerror(file, line, func, "assertStrnEquals", "", gotcode,
testlib_formatstr(cw, got, n), testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n)); testlib_formatstr(cw, want, n));
@ -502,8 +512,10 @@ forceinline void assertStrnNotEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, size_t n, const void *got, size_t n,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (!testlib_strnequals(cw, want, got, n)) return; if (!testlib_strnequals(cw, want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnNotEquals", "=", gotcode, testlib_showerror(file, line, func, "assertStrnNotEquals", "=", gotcode,
testlib_formatstr(cw, got, n), testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n)); testlib_formatstr(cw, want, n));
@ -514,8 +526,10 @@ forceinline void assertStringCaseEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, const char *gotcode, const void *got, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_strcaseequals(cw, want, got)) return; if (testlib_strcaseequals(cw, want, got))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringCaseEquals", "", gotcode, testlib_showerror(file, line, func, "assertStringCaseEquals", "", gotcode,
testlib_formatstr(cw, got, -1), testlib_formatstr(cw, got, -1),
testlib_formatstr(cw, want, -1)); testlib_formatstr(cw, want, -1));
@ -526,8 +540,10 @@ forceinline void assertStringCaseNotEquals(FILIFU_ARGS size_t cw,
const void *want, const void *got, const void *want, const void *got,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (!testlib_strcaseequals(cw, want, got)) return; if (!testlib_strcaseequals(cw, want, got))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringCaseNotEquals", "=", gotcode, testlib_showerror(file, line, func, "assertStringCaseNotEquals", "=", gotcode,
testlib_formatstr(cw, got, -1), testlib_formatstr(cw, got, -1),
testlib_formatstr(cw, want, -1)); testlib_formatstr(cw, want, -1));
@ -538,8 +554,10 @@ forceinline void assertStrnCaseEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, size_t n, const void *got, size_t n,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_strncaseequals(cw, want, got, n)) return; if (testlib_strncaseequals(cw, want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnCaseEquals", "", gotcode, testlib_showerror(file, line, func, "assertStrnCaseEquals", "", gotcode,
testlib_formatstr(cw, got, n), testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n)); testlib_formatstr(cw, want, n));
@ -551,8 +569,10 @@ forceinline void assertStrnCaseNotEquals(FILIFU_ARGS size_t cw,
size_t n, const char *gotcode, size_t n, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (!testlib_strncaseequals(cw, want, got, n)) return; if (!testlib_strncaseequals(cw, want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnCaseNotEquals", "=", gotcode, testlib_showerror(file, line, func, "assertStrnCaseNotEquals", "=", gotcode,
testlib_formatstr(cw, got, n), testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n)); testlib_formatstr(cw, want, n));
@ -563,8 +583,10 @@ forceinline void assertStartsWith(FILIFU_ARGS size_t cw, const char *prefix,
const char *s, const char *gotcode, const char *s, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_startswith(cw, s, prefix)) return; if (testlib_startswith(cw, s, prefix))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStartsWith", "", gotcode, testlib_showerror(file, line, func, "assertStartsWith", "", gotcode,
testlib_formatstr(1, prefix, -1), testlib_formatstr(1, prefix, -1),
testlib_formatstr(1, s, -1)); testlib_formatstr(1, s, -1));
@ -575,8 +597,10 @@ forceinline void assertEndsWith(FILIFU_ARGS size_t cw, const char *suffix,
const char *s, const char *gotcode, const char *s, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_endswith(cw, s, suffix)) return; if (testlib_endswith(cw, s, suffix))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertEndsWith", "", gotcode, testlib_showerror(file, line, func, "assertEndsWith", "", gotcode,
testlib_formatstr(1, s, -1), testlib_formatstr(1, s, -1),
testlib_formatstr(1, suffix, -1)); testlib_formatstr(1, suffix, -1));
@ -587,8 +611,10 @@ forceinline void assertContains(FILIFU_ARGS size_t cw, const char *needle,
const char *s, const char *gotcode, const char *s, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_contains(cw, s, needle)) return; if (testlib_contains(cw, s, needle))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertContains", "", gotcode, testlib_showerror(file, line, func, "assertContains", "", gotcode,
testlib_formatstr(1, s, -1), testlib_formatstr(1, s, -1),
testlib_formatstr(1, needle, -1)); testlib_formatstr(1, needle, -1));
@ -600,8 +626,10 @@ forceinline void assertBinaryEquals_cp437(FILIFU_ARGS const char16_t *want,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
char *v1, *v2; char *v1, *v2;
if (testlib_binequals(want, got, n)) return; if (testlib_binequals(want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryasglyphs(want, got, n, &v1, &v2); testlib_formatbinaryasglyphs(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryEquals", "", gotcode, v1, testlib_showerror(file, line, func, "assertBinaryEquals", "", gotcode, v1,
v2); v2);
@ -613,8 +641,10 @@ forceinline void assertBinaryEquals_hex(FILIFU_ARGS const char *want,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
char *v1, *v2; char *v1, *v2;
if (testlib_hexequals(want, got, n)) return; if (testlib_hexequals(want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryashex(want, got, n, &v1, &v2); testlib_formatbinaryashex(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryEquals", "", gotcode, v1, testlib_showerror(file, line, func, "assertBinaryEquals", "", gotcode, v1,
v2); v2);
@ -627,8 +657,10 @@ forceinline void assertBinaryNotEquals_cp437(FILIFU_ARGS const char16_t *want,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
char *v1, *v2; char *v1, *v2;
if (!testlib_binequals(want, got, n)) return; if (!testlib_binequals(want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryasglyphs(want, got, n, &v1, &v2); testlib_formatbinaryasglyphs(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1, testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1,
v2); v2);
@ -640,8 +672,10 @@ forceinline void assertBinaryNotEquals_hex(FILIFU_ARGS const char *want,
const char *gotcode, bool isfatal) { const char *gotcode, bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
char *v1, *v2; char *v1, *v2;
if (!testlib_hexequals(want, got, n)) return; if (!testlib_hexequals(want, got, n))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryashex(want, got, n, &v1, &v2); testlib_formatbinaryashex(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1, testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1,
v2); v2);
@ -652,8 +686,10 @@ forceinline void assertLongDoubleEquals(FILIFU_ARGS long double want,
long double got, const char *gotcode, long double got, const char *gotcode,
bool isfatal) { bool isfatal) {
++g_testlib_ran; ++g_testlib_ran;
if (testlib_almostequallongdouble(want, got)) return; if (testlib_almostequallongdouble(want, got))
if (g_testlib_shoulddebugbreak) DebugBreak(); return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertLongDoubleEquals", "", gotcode, testlib_showerror(file, line, func, "assertLongDoubleEquals", "", gotcode,
testlib_formatfloat(want), testlib_formatfloat(got)); testlib_formatfloat(want), testlib_formatfloat(got));
testlib_onfail2(isfatal); testlib_onfail2(isfatal);

View file

@ -48,7 +48,7 @@ static struct Semaphores {
char *path; char *path;
bool dead; bool dead;
int refs; int refs;
} * list; } *list;
} g_semaphores; } g_semaphores;
static void sem_open_lock(void) { static void sem_open_lock(void) {

View file

@ -44,7 +44,8 @@ COSMOPOLITAN_C_START_
#define PTHREAD_COND_INITIALIZER _PTHREAD_INIT #define PTHREAD_COND_INITIALIZER _PTHREAD_INIT
#define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_INIT #define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_INIT
#define PTHREAD_MUTEX_INITIALIZER _PTHREAD_INIT #define PTHREAD_MUTEX_INITIALIZER _PTHREAD_INIT
#define _PTHREAD_INIT {0} #define _PTHREAD_INIT \
{ 0 }
typedef uintptr_t pthread_t; typedef uintptr_t pthread_t;
typedef int pthread_id_np_t; typedef int pthread_id_np_t;

View file

@ -17,9 +17,9 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/serialize.h"
#include "libc/intrin/bswap.h" #include "libc/intrin/bswap.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/serialize.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/str/tab.internal.h" #include "libc/str/tab.internal.h"
#include "net/http/http.h" #include "net/http/http.h"

View file

@ -16,9 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/serialize.h"
#include "libc/intrin/bswap.h" #include "libc/intrin/bswap.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/serialize.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/str/tab.internal.h" #include "libc/str/tab.internal.h"
#include "net/http/http.h" #include "net/http/http.h"

View file

@ -18,9 +18,9 @@
*/ */
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/serialize.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/serialize.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h" #include "libc/sock/struct/sockaddr.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "dsp/core/core.h"
#include "dsp/core/illumination.h" #include "dsp/core/illumination.h"
#include "dsp/core/core.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/testlib/ezbench.h" #include "libc/testlib/ezbench.h"

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/calls.h"
#include "libc/calls/sigtimedwait.h" #include "libc/calls/sigtimedwait.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/siginfo.h" #include "libc/calls/struct/siginfo.h"
#include "libc/calls/struct/siginfo.internal.h" #include "libc/calls/struct/siginfo.internal.h"
#include "libc/calls/struct/sigset.h" #include "libc/calls/struct/sigset.h"

View file

@ -18,8 +18,8 @@
*/ */
#include "libc/fmt/leb128.h" #include "libc/fmt/leb128.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/mem/mem.h"
#include "libc/mem/gc.h" #include "libc/mem/gc.h"
#include "libc/mem/mem.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
TEST(zleb64, testZero) { TEST(zleb64, testZero) {

View file

@ -30,7 +30,7 @@
struct SharedMemory { struct SharedMemory {
pthread_mutex_t mutex; pthread_mutex_t mutex;
volatile long x; volatile long x;
} * shm; }* shm;
void Worker(void) { void Worker(void) {
long t; long t;

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/errno.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/errno.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/sock.h" #include "libc/sysv/consts/sock.h"

View file

@ -19,7 +19,6 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/mem/alg.h" #include "libc/mem/alg.h"
#include "libc/mem/gc.h" #include "libc/mem/gc.h"
#include "libc/mem/gc.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/rand.h" #include "libc/stdio/rand.h"

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/mem/gc.h" #include "libc/mem/gc.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/ezbench.h" #include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h" #include "libc/testlib/hyperion.h"

View file

@ -41,7 +41,7 @@ struct SharedMemory {
atomic_bool ready; atomic_bool ready;
atomic_bool got_signal; atomic_bool got_signal;
atomic_bool handler_returned; atomic_bool handler_returned;
} * shm; } *shm;
void OnSig(int sig) { void OnSig(int sig) {
signal(SIGUSR1, SIG_DFL); signal(SIGUSR1, SIG_DFL);

View file

@ -23,8 +23,8 @@
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/intrin/popcnt.h" #include "libc/intrin/popcnt.h"
#include "libc/intrin/safemacros.internal.h" #include "libc/intrin/safemacros.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/proc/posix_spawn.h" #include "libc/proc/posix_spawn.h"
#include "libc/runtime/runtime.h"
#include "libc/testlib/subprocess.h" #include "libc/testlib/subprocess.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/thread/thread.h" #include "libc/thread/thread.h"

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/testlib/testlib.h"
#include "third_party/musl/crypt.h" #include "third_party/musl/crypt.h"
#include "libc/testlib/testlib.h"
TEST(crypt, test) { TEST(crypt, test) {
// consistent with python crypt.crypt() // consistent with python crypt.crypt()

View file

@ -17,9 +17,9 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/mem/gc.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/stdio/rand.h" #include "libc/stdio/rand.h"
#include "libc/mem/gc.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/mem/mem.h"
#include "libc/mem/gc.h" #include "libc/mem/gc.h"
#include "libc/mem/mem.h"
#include "libc/stdio/hex.internal.h" #include "libc/stdio/hex.internal.h"
#include "libc/testlib/ezbench.h" #include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h" #include "libc/testlib/hyperion.h"

Some files were not shown because too many files have changed in this diff Show more