Browse Source

Add chibicc

This program popped up on Hacker News recently. It's the only modern
compiler I've ever seen that doesn't have dependencies and is easily
modified. So I added all of the missing GNU extensions I like to use
which means it might be possible soon to build on non-Linux and have
third party not vendor gcc binaries.
main
Justine Tunney 1 year ago
parent
commit
8da931a7f6
  1. 8
      Makefile
  2. 2
      ape/lib/apm.h
  3. 4
      ape/lib/pc.h
  4. 2
      build/config.mk
  5. 2
      dsp/mpeg/mp2.c
  6. 8
      dsp/mpeg/mpeg.h
  7. 1
      dsp/scale/gyarados.c
  8. 12
      dsp/tty/ttyraster.c
  9. 2
      examples/cp.c
  10. 2
      examples/examples.mk
  11. 13
      examples/invtsc.c
  12. 2
      examples/nesemu1.cc
  13. 34
      examples/now.c
  14. 30
      examples/unbourne.c
  15. 2
      libc/assert.h
  16. 2
      libc/bits/atomic.h
  17. 6
      libc/bits/avxintrin.internal.h
  18. 8
      libc/bits/emmintrin.internal.h
  19. 4
      libc/bits/xmmintrin.internal.h
  20. 19
      libc/calls/fileexists.c
  21. 2
      libc/calls/fstat-nt.c
  22. 4
      libc/calls/internal.h
  23. 2
      libc/calls/isatty.c
  24. 2
      libc/calls/struct/sigaction.h
  25. 2
      libc/calls/struct/siginfo.h
  26. 6
      libc/calls/xnutrampoline.c
  27. 2
      libc/conv/conv.h
  28. 2
      libc/conv/imaxabs.c
  29. 15
      libc/conv/imaxabs.thunk.S
  30. 12
      libc/conv/strtoimax.c
  31. 6
      libc/crypto/rijndael.h
  32. 15
      libc/fmt/pflink.h
  33. 42
      libc/integral/c.inc
  34. 57
      libc/integral/lp64arg.inc
  35. 2
      libc/intrin/macros.h
  36. 12
      libc/isystem/pthread.h
  37. 8
      libc/isystem/windows.h
  38. 2
      libc/linux/exit.h
  39. 8
      libc/log/asan.c
  40. 20
      libc/log/bsd.h
  41. 16
      libc/log/check.h
  42. 2
      libc/log/die.c
  43. 2
      libc/log/err.c
  44. 2
      libc/log/errx.c
  45. 12
      libc/log/log.h
  46. 8
      libc/log/oncrash.c
  47. 8
      libc/log/ubsan.internal.h
  48. 2
      libc/log/verr.c
  49. 2
      libc/log/verrx.c
  50. 2
      libc/nexgen32e/bsf.h
  51. 2
      libc/nexgen32e/bsr.h
  52. 24
      libc/nexgen32e/cescapec.S
  53. 16
      libc/nexgen32e/ctz.c
  54. 2
      libc/nexgen32e/ffs.S
  55. 2
      libc/nexgen32e/ffsl.S
  56. 64
      libc/nexgen32e/khalfcache3.S
  57. 2
      libc/nexgen32e/loadxmm.S
  58. 2
      libc/nexgen32e/memcpy.S
  59. 2
      libc/nexgen32e/savexmm.S
  60. 17
      libc/nexgen32e/strstr-sse42.S
  61. 2
      libc/nt/runtime.h
  62. 4
      libc/nt/struct/context.h
  63. 2
      libc/nt/thread.h
  64. 2
      libc/runtime/gc.h
  65. 8
      libc/runtime/internal.h
  66. 2
      libc/runtime/interruptiblecall.c
  67. 2
      libc/runtime/print.greg.c
  68. 64
      libc/runtime/runtime.h
  69. 51
      libc/runtime/valist.c
  70. 17
      libc/runtime/valist.h
  71. 2
      libc/runtime/winmain.greg.c
  72. 2
      libc/stdio/g_stderr.c
  73. 2
      libc/stdio/g_stdin.c
  74. 2
      libc/stdio/g_stdout.c
  75. 4
      libc/stdio/mkstemp.c
  76. 24
      libc/str/endswith16.c
  77. 24
      libc/str/startswith16.c
  78. 9
      libc/str/str.h
  79. 24
      libc/str/strncpy.thunk.S
  80. 2
      libc/str/strpbrk.c
  81. 26
      libc/str/strpbrk16.c
  82. 2
      libc/str/strspn.c
  83. 22
      libc/str/strspn16.c
  84. 29
      libc/str/strstr.c
  85. 24
      libc/str/wcsendswith.c
  86. 26
      libc/str/wcspbrk.c
  87. 22
      libc/str/wcsspn.c
  88. 24
      libc/str/wcsstartswith.c
  89. 4
      libc/testlib/benchrunner.c
  90. 7
      libc/testlib/formatfloat.c
  91. 2
      libc/testlib/testlib.h
  92. 2
      libc/testlib/testlib.mk
  93. 2
      libc/testlib/testrunner.c
  94. 4
      libc/x/x.h
  95. 2
      libc/x/x.mk
  96. 11
      libc/x/xdtoa.c
  97. 88
      test/dsp/core/dct_test.c
  98. 12
      test/dsp/core/illumination_test.c
  99. 6
      test/dsp/core/inv3_test.c
  100. 8
      test/dsp/tty/windex_test.c

8
Makefile

@ -115,7 +115,6 @@ include third_party/dlmalloc/dlmalloc.mk # │
include libc/mem/mem.mk # │
include libc/ohmyplus/ohmyplus.mk # │
include libc/zipos/zipos.mk # │
include third_party/dtoa/dtoa.mk # │
include third_party/gdtoa/gdtoa.mk # │
include libc/time/time.mk # │
include libc/alg/alg.mk # │
@ -140,6 +139,7 @@ include libc/dns/dns.mk # │
include libc/crypto/crypto.mk # │
include net/http/http.mk #─┘
include third_party/chibicc/chibicc.mk
include third_party/chibicc/test/test.mk
include third_party/lemon/lemon.mk
include third_party/linenoise/linenoise.mk
include third_party/editline/editline.mk
@ -160,13 +160,11 @@ include tool/build/emucrt/emucrt.mk
include tool/build/emubin/emubin.mk
include tool/build/build.mk
include tool/calc/calc.mk
include tool/tags/tags.mk
include tool/decode/lib/decodelib.mk
include tool/decode/decode.mk
include tool/hash/hash.mk
include tool/net/net.mk
include tool/viz/viz.mk
include tool/cc/cc.mk
include tool/tool.mk
include test/libc/alg/test.mk
include test/libc/tinymath/test.mk
@ -278,7 +276,7 @@ COSMOPOLITAN_OBJECTS = \
LIBC_ZIPOS \
THIRD_PARTY_COMPILER_RT \
THIRD_PARTY_DLMALLOC \
THIRD_PARTY_DTOA \
THIRD_PARTY_GDTOA \
THIRD_PARTY_GETOPT \
THIRD_PARTY_MUSL \
THIRD_PARTY_REGEX
@ -311,7 +309,7 @@ COSMOPOLITAN_HEADERS = \
LIBC_X \
LIBC_ZIPOS \
THIRD_PARTY_DLMALLOC \
THIRD_PARTY_DTOA \
THIRD_PARTY_GDTOA \
THIRD_PARTY_GETOPT \
THIRD_PARTY_MUSL \
THIRD_PARTY_REGEX

2
ape/lib/apm.h

@ -53,7 +53,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
void apmoff(void) noreturn;
void apmoff(void) wontreturn;
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* APE_LIB_APM_H_ */

4
ape/lib/pc.h

@ -197,7 +197,7 @@ struct IdtDescriptor {
struct thatispacked PageTable {
uint64_t p[512];
} aligned(PAGESIZE);
} forcealign(PAGESIZE);
extern struct PageTable g_pml4t;
extern struct GlobalDescriptorTable gdt;
@ -211,7 +211,7 @@ extern struct SmapEntry e820map_xlm[XLM_E820_SIZE / sizeof(struct SmapEntry)];
extern uint64_t g_ptsp;
extern uint64_t g_ptsp_xlm;
void bootdr(char drive) noreturn;
void bootdr(char drive) wontreturn;
void smapsort(struct SmapEntry *);
uint64_t *__getpagetableentry(int64_t, unsigned, struct PageTable *,

2
build/config.mk

@ -138,7 +138,7 @@ CONFIG_CCFLAGS += \
-fno-align-loops
TARGET_ARCH ?= \
-march=k8-sse3
-msse3
endif

2
dsp/mpeg/mp2.c

@ -266,7 +266,7 @@ struct plm_audio_t {
float D[1024];
float V[1024];
float U[32];
} aligned(64);
} forcealign(64);
typedef plm_audio_t plm_audio_t;

8
dsp/mpeg/mpeg.h

@ -77,12 +77,12 @@ struct plm_samples_t {
double time;
unsigned int count;
#ifdef PLM_AUDIO_SEPARATE_CHANNELS
float left[PLM_AUDIO_SAMPLES_PER_FRAME] aligned(32);
float right[PLM_AUDIO_SAMPLES_PER_FRAME] aligned(32);
float left[PLM_AUDIO_SAMPLES_PER_FRAME] forcealign(32);
float right[PLM_AUDIO_SAMPLES_PER_FRAME] forcealign(32);
#else
float interleaved[PLM_AUDIO_SAMPLES_PER_FRAME * 2] aligned(32);
float interleaved[PLM_AUDIO_SAMPLES_PER_FRAME * 2] forcealign(32);
#endif
} aligned(32);
} forcealign(32);
typedef struct plm_samples_t plm_samples_t;

1
dsp/scale/gyarados.c

@ -33,7 +33,6 @@
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
#include "third_party/dtoa/dtoa.h"
#include "tool/viz/lib/knobs.h"
/**

12
dsp/tty/ttyraster.c

@ -611,8 +611,8 @@ static struct Pick PickBlockUnicodeAnsi(struct TtyRgb tl, struct TtyRgb tr,
struct TtyRgb bl2 = GetQuant(bl);
struct TtyRgb br2 = GetQuant(br);
unsigned i, p1, p2;
uint16_t picks1[96] aligned(32);
uint16_t picks2[32] aligned(32);
uint16_t picks1[96] forcealign(32);
uint16_t picks2[32] forcealign(32);
memset(picks1, 0x79, sizeof(picks1));
memset(picks2, 0x79, sizeof(picks2));
PickUnicode(picks1, tl, tr, bl, br, tl2, tr2, bl2, br2);
@ -625,7 +625,7 @@ static struct Pick PickBlockUnicodeAnsi(struct TtyRgb tl, struct TtyRgb tr,
static struct Pick PickBlockUnicodeTrue(struct TtyRgb tl, struct TtyRgb tr,
struct TtyRgb bl, struct TtyRgb br) {
unsigned i;
uint16_t picks[96] aligned(32);
uint16_t picks[96] forcealign(32);
memset(picks, 0x79, sizeof(picks));
PickUnicode(picks, tl, tr, bl, br, tl, tr, bl, br);
i = windex(picks, 96);
@ -648,8 +648,8 @@ static struct Pick PickBlockCp437Ansi(struct TtyRgb tl, struct TtyRgb tr,
struct TtyRgb bl2 = GetQuant(bl);
struct TtyRgb br2 = GetQuant(br);
unsigned i, p1, p2;
uint16_t picks1[32] aligned(32);
uint16_t picks2[32] aligned(32);
uint16_t picks1[32] forcealign(32);
uint16_t picks2[32] forcealign(32);
memset(picks1, 0x79, sizeof(picks1));
memset(picks2, 0x79, sizeof(picks2));
PickCp437(picks1, tl, tr, bl, br, tl2, tr2, bl2, br2);
@ -662,7 +662,7 @@ static struct Pick PickBlockCp437Ansi(struct TtyRgb tl, struct TtyRgb tr,
static struct Pick PickBlockCp437True(struct TtyRgb tl, struct TtyRgb tr,
struct TtyRgb bl, struct TtyRgb br) {
unsigned i;
uint16_t picks[32] aligned(32);
uint16_t picks[32] forcealign(32);
memset(picks, 0x79, sizeof(picks));
PickCp437(picks, tl, tr, bl, br, tl, tr, bl, br);
return kPicksCp437[windex(picks, 32)];

2
examples/cp.c

@ -42,7 +42,7 @@ FLAGS\n\
int flags;
bool force;
noreturn void PrintUsage(int rc, FILE *f) {
wontreturn void PrintUsage(int rc, FILE *f) {
fprintf(f, "%s%s%s", "Usage: ", program_invocation_name, USAGE);
exit(rc);
}

2
examples/examples.mk

@ -72,7 +72,7 @@ EXAMPLES_DIRECTDEPS = \
LIBC_ZIPOS \
THIRD_PARTY_COMPILER_RT \
THIRD_PARTY_DLMALLOC \
THIRD_PARTY_DTOA \
THIRD_PARTY_GDTOA \
THIRD_PARTY_GETOPT \
THIRD_PARTY_MUSL \
THIRD_PARTY_STB \

13
examples/invtsc.c

@ -18,7 +18,7 @@
#include "libc/sysv/consts/sig.h"
#include "libc/time/time.h"
#include "libc/x/x.h"
#include "third_party/dtoa/dtoa.h"
#include "third_party/gdtoa/gdtoa.h"
/**
* @fileoverview Measure CPU clock mystery constants.
@ -52,15 +52,18 @@ long double GetSample(void) {
void MeasureNanosecondsPerAlwaysRunningTimerCycle(void) {
int i;
long double avg, samp;
long double avg, samp, elapsed;
start_ = now();
for (i = 1, avg = 1.0L; !isdone_; ++i) {
samp = GetSample();
avg += (samp - avg) / i;
dsleep(kInterval);
printf("1c = %sns (last=%sns spent=%ss)\n", g_fmt(dtoabuf_[0], (double)avg),
g_fmt(dtoabuf_[1], (double)samp),
g_fmt(dtoabuf_[2], (double)(now() - start_)));
elapsed = now() - start_;
g_xfmt_p(dtoabuf_[0], &avg, 15, 32, 0);
g_xfmt_p(dtoabuf_[1], &samp, 15, 32, 0);
g_xfmt_p(dtoabuf_[2], &elapsed, 15, 32, 0);
printf("1c = %sns (last=%sns spent=%ss)\n", dtoabuf_[0], dtoabuf_[1],
dtoabuf_[2]);
}
}

2
examples/nesemu1.cc

@ -1774,7 +1774,7 @@ Press enter to continue without sound: ",
for (;;) CPU::Op();
}
noreturn void PrintUsage(int rc, FILE* f) {
wontreturn void PrintUsage(int rc, FILE* f) {
fprintf(f, "%s%s%s", "Usage: ", program_invocation_name, USAGE);
exit(rc);
}

34
examples/now.c

@ -1,34 +0,0 @@
#if 0
/*─────────────────────────────────────────────────────────────────╗
To the extent possible under law, Justine Tunney has waived
all copyright and related or neighboring rights to this file,
as it is written in the following disclaimers:
http://unlicense.org/
http://creativecommons.org/publicdomain/zero/1.0/
*/
#endif
#include "libc/bits/bits.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/stdio/stdio.h"
#include "libc/sysv/consts/clock.h"
#include "libc/time/time.h"
#include "third_party/dtoa/dtoa.h"
char dtoabuf_[3][32];
static long double avg;
int main(int argc, char *argv[]) {
long double t2, t1 = nowl();
dsleep(0.3);
for (;;) {
t2 = nowl();
printf("%s %s avg=%s\n", g_fmt(dtoabuf_[0], t2),
g_fmt(dtoabuf_[1], t2 - t1), g_fmt(dtoabuf_[2], avg));
t1 = t2;
dsleep(0.3);
}
return 0;
}

30
examples/unbourne.c

@ -141,7 +141,7 @@
#include "libc/sysv/consts/rlim.h"
#include "libc/sysv/consts/sig.h"
#include "libc/sysv/consts/w.h"
#include "third_party/dtoa/dtoa.h"
#include "third_party/gdtoa/gdtoa.h"
#include "third_party/musl/passwd.h"
#undef CEOF
@ -1602,7 +1602,7 @@ static inline void sigclearmask(void) {
* just do a longjmp to the exception handler. The type of exception is
* stored in the global variable "exception".
*/
noreturn static void exraise(int e) {
wontreturn static void exraise(int e) {
if (vforked) _exit(exitstatus);
INTOFF;
exception = e;
@ -1617,7 +1617,7 @@ noreturn static void exraise(int e) {
* are held using the INTOFF macro. (The test for iflag is just
* defensive programming.)
*/
noreturn static void onint(void) {
wontreturn static void onint(void) {
intpending = 0;
sigclearmask();
if (!(rootshell && iflag)) {
@ -1896,20 +1896,20 @@ printfesque(1) static void sh_warnx(const char *fmt, ...) {
* is not NULL then error prints an error message using printf style
* formatting. It then raises the error exception.
*/
noreturn static void exverror(int cond, const char *msg, va_list ap) {
wontreturn static void exverror(int cond, const char *msg, va_list ap) {
exvwarning(msg, ap);
flushall();
exraise(cond);
}
noreturn static void exerror(int cond, const char *msg, ...) {
wontreturn static void exerror(int cond, const char *msg, ...) {
va_list ap;
va_start(ap, msg);
exverror(cond, msg, ap);
va_end(ap);
}
noreturn static void sh_error(const char *msg, ...) {
wontreturn static void sh_error(const char *msg, ...) {
va_list ap;
exitstatus = 2;
va_start(ap, msg);
@ -1917,16 +1917,16 @@ noreturn static void sh_error(const char *msg, ...) {
va_end(ap);
}
noreturn static void badnum(const char *s) {
wontreturn static void badnum(const char *s) {
sh_error(illnum, s);
}
noreturn static void synerror(const char *msg) {
wontreturn static void synerror(const char *msg) {
errlinno = plinno;
sh_error("Syntax error: %s", msg);
}
noreturn static void yyerror(const char *s) {
wontreturn static void yyerror(const char *s) {
sh_error("arithmetic expression: %s: \"%s\"", s, arith_startbuf);
}
@ -1935,7 +1935,7 @@ noreturn static void yyerror(const char *s) {
* argument is the token that is expected, or -1 if more than one type
* of token can occur at this point.
*/
noreturn static void synexpect(int token) {
wontreturn static void synexpect(int token) {
char msg[64];
if (token >= 0) {
fmtstr(msg, 64, "%s unexpected (expecting %s)", tokname[lasttoken], tokname[token]);
@ -1945,7 +1945,7 @@ noreturn static void synexpect(int token) {
synerror(msg);
}
noreturn static void varunset(const char *end, const char *var_, const char *umsg, int varflags) {
wontreturn static void varunset(const char *end, const char *var_, const char *umsg, int varflags) {
const char *msg;
const char *tail;
tail = nullstr;
@ -2096,7 +2096,7 @@ static char *nodesavestr(s) char *s;
return rtn;
}
noreturn static void shellexec(char **, const char *, int);
wontreturn static void shellexec(char **, const char *, int);
static char **listvars(int, int, char ***);
static char *argstr(char *p, int flag);
static char *conv_escape(char *, int *);
@ -3175,7 +3175,7 @@ out:
return exitstatus;
}
noreturn static void evaltreenr(union node *n, int flags) {
wontreturn static void evaltreenr(union node *n, int flags) {
evaltree(n, flags);
abort();
}
@ -3876,7 +3876,7 @@ static int eprintlist(struct output *out, struct strlist *sp, int sep) {
* Exec a program. Never returns. If you change this routine, you may
* have to change the find_command routine as well.
*/
noreturn static void shellexec(char **argv, const char *path, int idx) {
wontreturn static void shellexec(char **argv, const char *path, int idx) {
char *cmdname;
int e;
char **envp;
@ -9316,7 +9316,7 @@ static void setinteractive(int on) {
/*
* Called to exit the shell.
*/
noreturn static void exitshell(void) {
wontreturn static void exitshell(void) {
struct jmploc loc;
char *p;
savestatus = exitstatus;

2
libc/assert.h

@ -3,7 +3,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void __assert_fail(const char *, const char *, int) hidden noreturn relegated;
void __assert_fail(const char *, const char *, int) hidden wontreturn relegated;
#ifdef NDEBUG
#define __ASSERT_FAIL(EXPR, FILE, LINE)

2
libc/bits/atomic.h

@ -45,7 +45,7 @@ COSMOPOLITAN_C_START_
struct AtomicFlag {
uint32_t __cacheline[16]; /* Intel V.O §9.4.6 */
} aligned(64);
} forcealign(64);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

6
libc/bits/avxintrin.internal.h

@ -7,9 +7,9 @@ typedef float __m256 _Vector_size(32) mayalias;
typedef double __m256d _Vector_size(32) mayalias;
typedef long long __m256i _Vector_size(32) mayalias;
typedef float __m256_u _Vector_size(32) aligned(1) mayalias;
typedef double __m256d_u _Vector_size(32) aligned(1) mayalias;
typedef long long __m256i_u _Vector_size(32) aligned(1) mayalias;
typedef float __m256_u _Vector_size(32) forcealign(1) mayalias;
typedef double __m256d_u _Vector_size(32) forcealign(1) mayalias;
typedef long long __m256i_u _Vector_size(32) forcealign(1) mayalias;
typedef double __v4df _Vector_size(32);
typedef float __v8sf _Vector_size(32);

8
libc/bits/emmintrin.internal.h

@ -16,12 +16,12 @@ typedef short __v8hi _Vector_size(16);
typedef unsigned short __v8hu _Vector_size(16);
typedef double __v2df _Vector_size(16);
typedef double __m128d _Vector_size(16) aligned(16);
typedef double __m128d_u _Vector_size(16) aligned(1);
typedef double __m128d _Vector_size(16) forcealign(16);
typedef double __m128d_u _Vector_size(16) forcealign(1);
typedef long long __v2di _Vector_size(16);
typedef long long __m128i _Vector_size(16) aligned(16);
typedef long long __m128i_u _Vector_size(16) aligned(1);
typedef long long __m128i _Vector_size(16) forcealign(16);
typedef long long __m128i_u _Vector_size(16) forcealign(1);
typedef unsigned long long __v2du _Vector_size(16);
struct thatispacked mayalias __usi128ma {

4
libc/bits/xmmintrin.internal.h

@ -35,8 +35,8 @@
typedef int __v4si _Vector_size(16);
typedef unsigned int __v4su _Vector_size(16);
typedef float __v4sf _Vector_size(16);
typedef float __m128 _Vector_size(16) aligned(16) mayalias;
typedef float __m128_u _Vector_size(16) aligned(1) mayalias;
typedef float __m128 _Vector_size(16) forcealign(16) mayalias;
typedef float __m128_u _Vector_size(16) forcealign(1) mayalias;
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § it's a trap! » sse » simd ops

19
libc/calls/fileexists.c

@ -18,6 +18,7 @@
02110-1301 USA
*/
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/stat.h"
#include "libc/dce.h"
#include "libc/errno.h"
@ -33,12 +34,18 @@
* function. The stat() function may be used to differentiate them.
*/
bool fileexists(const char *path) {
/* TODO(jart): Use fast path on NT? */
int rc, olderr;
struct stat st;
int olderr = errno;
int rc = stat(path, &st);
if (rc == -1 && (errno == ENOENT || errno == ENOTDIR)) {
errno = olderr;
uint16_t path16[PATH_MAX];
if (!IsWindows()) {
olderr = errno;
rc = stat(path, &st);
if (rc == -1 && (errno == ENOENT || errno == ENOTDIR)) {
errno = olderr;
}
return rc != -1;
} else {
if (__mkntpath(path, path16) == -1) return -1;
return GetFileAttributes(path16) != -1u;
}
return rc != -1;
}

2
libc/calls/fstat-nt.c

@ -34,8 +34,8 @@
textwindows int fstat$nt(int64_t handle, struct stat *st) {
int filetype;
uint64_t actualsize;
struct NtByHandleFileInformation wst;
struct NtFileCompressionInfo fci;
struct NtByHandleFileInformation wst;
if (GetFileInformationByHandle(handle, &wst)) {
memset(st, 0, sizeof(*st));
filetype = GetFileType(handle);

4
libc/calls/internal.h

@ -198,12 +198,12 @@ i32 tunefd$sysv(i32, i32, i32, i32) hidden;
u32 fprot2nt(i32, i32) hidden;
u32 prot2nt(i32, i32) privileged;
void __restore_rt() hidden;
void __sigenter$xnu(void *, i32, i32, void *, void *) hidden noreturn;
void __sigenter$xnu(void *, i32, i32, void *, void *) hidden wontreturn;
int utimensat$xnu(int, const char *, const struct timespec *, int) hidden;
int nanosleep$xnu(const struct timespec *, struct timespec *) hidden;
void stat2linux(void *) hidden;
void xnutrampoline(void *, i32, i32, const struct __darwin_siginfo *,
const struct __darwin_ucontext *) hidden noreturn;
const struct __darwin_ucontext *) hidden wontreturn;
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § syscalls » windows nt » veneers

2
libc/calls/isatty.c

@ -27,7 +27,7 @@
* @asyncsignalsafe
*/
bool32 isatty(int fd) {
char buf[sizeof(uint16_t) * 4] aligned(2);
char buf[sizeof(uint16_t) * 4] forcealign(2);
if (!IsWindows()) {
return ioctl$sysv(fd, TIOCGWINSZ, &buf) != -1;
} else {

2
libc/calls/struct/sigaction.h

@ -14,7 +14,7 @@ struct sigaction { /* cosmo abi */
void (*sa_restorer)(void);
struct sigset sa_mask;
int64_t __pad;
} aligned(8);
} forcealign(8);
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGACTION_H_ */

2
libc/calls/struct/siginfo.h

@ -49,7 +49,7 @@ struct siginfo {
};
char __ignoreme[128 - 2 * sizeof(int32_t) - sizeof(int64_t)];
};
} aligned(8);
} forcealign(8);
typedef struct siginfo siginfo_t;

6
libc/calls/xnutrampoline.c

@ -425,9 +425,9 @@ static void xnussefpustate2linux(struct FpuState *fs,
memcpy(fs->st, &xnufs->__fpu_stmm0, (8 + 16) * sizeof(uint128_t));
}
noreturn void xnutrampoline(void *fn, int infostyle, int sig,
const struct __darwin_siginfo *xnuinfo,
const struct __darwin_ucontext *xnuctx) {
wontreturn void xnutrampoline(void *fn, int infostyle, int sig,
const struct __darwin_siginfo *xnuinfo,
const struct __darwin_ucontext *xnuctx) {
/* note: this function impl can't access static memory */
intptr_t ax;
struct Goodies {

2
libc/conv/conv.h

@ -97,7 +97,7 @@ double RoundDecimalPlaces(double, double, double (*)(double));
#endif
#ifndef __STRICT_ANSI__
intmax_t __imaxabs(intmax_t) asm("imaxabs") libcesque pureconst;
intmax_t __imaxabs(intmax_t) libcesque pureconst;
#define imaxabs(x) __imaxabs(x)
#endif /* !ANSI */

2
libc/conv/imaxabs.c

@ -20,6 +20,6 @@
#include "libc/conv/conv.h"
#include "libc/macros.h"
intmax_t imaxabs(intmax_t x) {
intmax_t(imaxabs)(intmax_t x) {
return ABS(x);
}

15
third_party/dtoa/divmax.S → libc/conv/imaxabs.thunk.S

@ -18,16 +18,7 @@
02110-1301 USA
*/
#include "libc/macros.h"
.source __FILE__
/ Avoid dtoa needing .data section.
.bss
.align 4
dtoa_divmax:
.zero 4
.endobj dtoa_divmax,globl
.previous
.init.start 202,_init_dtoa_divmax
movb $2,dtoa_divmax(%rip)
.init.end 202,_init_dtoa_divmax
__imaxabs:
jmp imaxabs
.endfn __imaxabs,globl

12
libc/conv/strtoimax.c

@ -37,10 +37,10 @@
* @see strtoumax
*/
intmax_t strtoimax(const char *s, char **endptr, int base) {
bool neg;
uintmax_t x;
intmax_t res;
unsigned diglet, bits;
bool neg, islong, isunsigned;
x = 0;
bits = 0;
@ -104,8 +104,6 @@ intmax_t strtoimax(const char *s, char **endptr, int base) {
}
}
if ((isunsigned = *s == 'u' || *s == 'U')) s++;
if ((islong = *s == 'l' || *s == 'L')) s++;
if (endptr) *endptr = s;
if (neg) {
@ -114,13 +112,5 @@ intmax_t strtoimax(const char *s, char **endptr, int base) {
res = x;
}
if (isunsigned) {
if (islong) {
res = (uint64_t)res;
} else {
res = (uint32_t)res;
}
}
return res;
}

6
libc/crypto/rijndael.h

@ -28,7 +28,7 @@ COSMOPOLITAN_C_START_
Performance (New Hardware) ~20 ns ~40 ns ~400 ns
Performance (Old Hardware) ~400 ns ~40 ns ~400 ns */
typedef uint32_t aes_block_t _Vector_size(16) aligned(16);
typedef uint32_t aes_block_t _Vector_size(16) forcealign(16);
struct Rijndael {
union {
@ -47,8 +47,8 @@ aes_block_t unrijndael(uint32_t, aes_block_t, const struct Rijndael *);
cosmopolitan § cryptography » implementation details
*/
extern const uint8_t kAesSbox[256] aligned(64);
extern const uint8_t kAesSboxInverse[256] aligned(64);
extern const uint8_t kAesSbox[256] forcealign(64);
extern const uint8_t kAesSboxInverse[256] forcealign(64);
aes_block_t InvMixColumns(aes_block_t) hidden;

15
libc/fmt/pflink.h

@ -2,7 +2,7 @@
#define COSMOPOLITAN_LIBC_FMT_PFLINK_H_
#include "libc/dce.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifndef __STRICT_ANSI__
#if !defined(__STRICT_ANSI__) && !defined(__chibicc__)
/**
* @fileoverview builtin+preprocessor+linker tricks for printf/scanf.
@ -65,6 +65,19 @@
#else
#define PFLINK(FMT) FMT
#define SFLINK(FMT) FMT
asm(".pushsection .yoink\n\t"
"nop\tntoa(%rip)\n\t"
"nop\tftoa(%rip)\n\t"
"nop\tkCp437(%rip)\n\t"
"nop\tstrerror(%rip)\n\t"
"nop\tstrnwidth(%rip)\n\t"
"nop\tstrnwidth16(%rip)\n\t"
"nop\twcsnwidth(%rip)\n\t"
"nop\tmalloc(%rip)\n\t"
"nop\tcalloc(%rip)\n\t"
"nop\tfree_s(%rip)\n\t"
"nop\t__grow(%rip)\n\t"
".popsection");
#endif /* __STRICT_ANSI__ */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_FMT_PFLINK_H_ */

42
libc/integral/c.inc

@ -2,6 +2,14 @@
#define __attribute__(x)
#endif
#ifndef __cplusplus
#define COSMOPOLITAN_C_START_
#define COSMOPOLITAN_C_END_
#define COSMOPOLITAN_CXX_START_
#define COSMOPOLITAN_CXX_END_
#define COSMOPOLITAN_CXX_USING_
#endif
#if defined(__STRICT_ANSI__) && __STDC_VERSION__ + 0 < 201112
#define asm __asm__
#endif
@ -67,18 +75,6 @@
} while (0)
#endif
#if defined(__STRICT_ANSI__) || \
(!defined(__GNUC__) && !__has_builtin(constant_p) && \
!defined(__builtin_constant_p))
#define __builtin_constant_p(x) 0
#endif
#if defined(__STRICT_ANSI__) || \
(!defined(__GNUC__) && !__has_builtin(choose_expr) && \
!defined(__builtin_choose_expr))
#define __builtin_choose_expr(x, a, b) ((x) ? (long)(a) : (long)(b))
#endif
#if __STDC_VERSION__ + 0 < 201112
#define ____Static_assert(x, y) A##B
#define ___Static_assert(x, y) ____Static_assert(x, y)
@ -195,7 +191,7 @@ typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
#endif
#ifdef __GNUC__
#ifndef __chibicc__
#define va_list __builtin_va_list
#define va_arg(ap, type) __builtin_va_arg(ap, type)
#define va_copy(dest, src) __builtin_va_copy(dest, src)
@ -230,11 +226,11 @@ typedef uint64_t uintmax_t;
/**
* Aligns automatic or static variable.
*/
#ifndef aligned
#ifndef forcealign
#ifndef __STRICT_ANSI__
#define aligned(bytes) __attribute__((__aligned__(bytes)))
#define forcealign(bytes) __attribute__((__aligned__(bytes)))
#else
#define aligned(bytes)
#define forcealign(bytes)
#endif
#endif
@ -291,13 +287,13 @@ typedef uint64_t uintmax_t;
#endif
#endif
#ifndef noreturn
#ifndef wontreturn
#if !defined(__STRICT_ANSI__) && \
(__has_attribute(__noreturn__) || \
(__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 208)
#define noreturn __attribute__((__noreturn__))
#define wontreturn __attribute__((__noreturn__))
#else
#define noreturn
#define wontreturn
#endif
#endif
@ -1067,13 +1063,5 @@ typedef uint64_t uintmax_t;
STATIC_YOINK_SOURCE(__BASE_FILE__);
#endif
#ifndef __cplusplus
#define COSMOPOLITAN_CXX_START_
#define COSMOPOLITAN_CXX_END_
#define COSMOPOLITAN_CXX_USING_
#define COSMOPOLITAN_C_START_
#define COSMOPOLITAN_C_END_
#endif
#define MACHINE_CODE_ANALYSIS_BEGIN_
#define MACHINE_CODE_ANALYSIS_END_

57
libc/integral/lp64arg.inc

@ -1,50 +1,17 @@
typedef struct {
unsigned int gp_offset;
unsigned int fp_offset;
void *overflow_arg_area;
void *reg_save_area;
} __va_elem;
#include "libc/runtime/valist.h"
typedef __va_elem va_list[1];
#define __GNUC_VA_LIST 1
#define __gnuc_va_list va_list
#define va_start(ap, last) \
do { \
*(ap) = *(__va_elem *)__va_area__; \
#define va_end(AP)
#define va_copy(DST, SRC) ((DST)[0] = (SRC)[0])
#define va_start(AP, LAST) \
do { \
*(AP) = *(struct __va *)__va_area__; \
} while (0)
#define va_end(ap)
static inline void *__va_arg_mem(__va_elem *ap, int sz, int align) {
void *p = ap->overflow_arg_area;
if (align > 8) p = (void *)(((unsigned long)p + 15) / 16 * 16);
ap->overflow_arg_area = (void *)(((unsigned long)p + sz + 7) / 8 * 8);
return p;
}
static inline void *__va_arg_gp(__va_elem *ap, int sz, int align) {
if (ap->gp_offset >= 48) return __va_arg_mem(ap, sz, align);
void *r = ap->reg_save_area + ap->gp_offset;
ap->gp_offset += 8;
return r;
}
static inline void *__va_arg_fp(__va_elem *ap, int sz, int align) {
if (ap->fp_offset >= 112) return __va_arg_mem(ap, sz, align);
void *r = ap->reg_save_area + ap->fp_offset;
ap->fp_offset += 8;
return r;
}
#define va_arg(AP, TYPE) \
(*(TYPE *)__va_arg(AP, sizeof(TYPE), _Alignof(TYPE), \
__builtin_reg_class(TYPE)))
#define va_arg(ap, ty) \
({ \
int klass = __builtin_reg_class(ty); \
*(ty *)(klass == 0 \
? __va_arg_gp(ap, sizeof(ty), _Alignof(ty)) \
: klass == 1 ? __va_arg_fp(ap, sizeof(ty), _Alignof(ty)) \
: __va_arg_mem(ap, sizeof(ty), _Alignof(ty))); \
})
#define va_copy(dest, src) ((dest)[0] = (src)[0])
#define __GNUC_VA_LIST 1
typedef va_list __gnuc_va_list;
typedef struct __va va_list[1];

2
libc/intrin/macros.h

@ -9,7 +9,7 @@
#if defined(__x86_64__) && !defined(__STRICT_ANSI__)
typedef char __intrin_xmm_t _Vector_size(16) aligned(16) mayalias;
typedef char __intrin_xmm_t _Vector_size(16) forcealign(16) mayalias;
#define INTRIN_SSEVEX_X_X_X_(PURE, ISA, OP, FLAGS, A, B, C) \
do { \

12
libc/isystem/pthread.h

@ -5,12 +5,12 @@
#define PTHREAD_ONCE_INIT 0
#define PTHREAD_MUTEX_NORMAL 0
#define PTHREAD_MUTEX_DEFAULT 0
#define PTHREAD_MUTEX_RECURSIVE 1
#define PTHREAD_MUTEX_NORMAL 0
#define PTHREAD_MUTEX_DEFAULT 0
#define PTHREAD_MUTEX_RECURSIVE 1
#define PTHREAD_MUTEX_ERRORCHECK 2
#define PTHREAD_MUTEX_STALLED 0
#define PTHREAD_MUTEX_ROBUST 1
#define PTHREAD_MUTEX_STALLED 0
#define PTHREAD_MUTEX_ROBUST 1
/* clang-format off */
#define PTHREAD_MUTEX_INITIALIZER {{{0}}}
@ -65,7 +65,7 @@ typedef struct {
} __u;
} pthread_rwlock_t;
noreturn void pthread_exit(void *);
wontreturn void pthread_exit(void *);
pureconst pthread_t pthread_self(void);
int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void *),
void *);

8
libc/isystem/windows.h

@ -110,13 +110,13 @@
#define PWSTR WCHAR*
#define PZPWSTR PWSTR*
#define PCZPWSTR CONST PWSTR*
#define LPUWSTR WCHAR aligned(1)*
#define PUWSTR WCHAR aligned(1)*
#define LPUWSTR WCHAR forcealign(1)*
#define PUWSTR WCHAR forcealign(1)*
#define LPCWSTR CONST WCHAR*
#define PCWSTR CONST WCHAR*
#define PZPCWSTR PCWSTR*
#define LPCUWSTR CONST WCHAR aligned(1)*
#define PCUWSTR CONST WCHAR aligned(1)*
#define LPCUWSTR CONST WCHAR forcealign(1)*
#define PCUWSTR CONST WCHAR forcealign(1)*
#define PCHAR CHAR*
#define LPCH CHAR*
#define PCH CHAR*

2
libc/linux/exit.h

@ -3,7 +3,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
forceinline noreturn long LinuxExit(long rc) {
forceinline wontreturn long LinuxExit(long rc) {
asm volatile("syscall"
: /* no outputs */
: "a"(0xE7), "D"(rc)

8
libc/log/asan.c

@ -147,7 +147,7 @@ static const char *__asan_describe_access_poison(int c) {
}
}
static noreturn void __asan_die(const char *msg, size_t size) {
static wontreturn void __asan_die(const char *msg, size_t size) {
write(STDERR_FILENO, msg, size);
__die();
}
@ -163,7 +163,7 @@ static char *__asan_report_start(char *p) {
return stpcpy(p, ": ");
}
static noreturn void __asan_report_deallocate_fault(void *addr, int c) {
static wontreturn void __asan_report_deallocate_fault(void *addr, int c) {
char *p, ibuf[21], buf[256];
p = __asan_report_start(buf);
p = stpcpy(p, __asan_dscribe_free_poison(c));
@ -175,8 +175,8 @@ static noreturn void __asan_report_deallocate_fault(void *addr, int c) {
__asan_die(buf, p - buf);
}
static noreturn void __asan_report_memory_fault(uint8_t *addr, int size,
const char *kind) {
static wontreturn void __asan_report_memory_fault(uint8_t *addr, int size,
const char *kind) {
char *p, ibuf[21], buf[256];
p = __asan_report_start(buf);
p = stpcpy(p, __asan_describe_access_poison(*(char *)SHADOW((intptr_t)addr)));

20
libc/log/bsd.h

@ -8,23 +8,23 @@ COSMOPOLITAN_C_START_
cosmopolitan § logging » berkeley logger
*/
void err(int, const char *, ...) printfesque(2) noreturn;
void errx(int, const char *, ...) printfesque(2) noreturn;
void verr(int, const char *, va_list) paramsnonnull((3)) noreturn;
void verrx(int, const char *, va_list) paramsnonnull((3)) noreturn;
void err(int, const char *, ...) printfesque(2) wontreturn;
void errx(int, const char *, ...) printfesque(2) wontreturn;
void verr(int, const char *, va_list) paramsnonnull((3)) wontreturn;
void verrx(int, const char *, va_list) paramsnonnull((3)) wontreturn;
void vwarn(const char *, va_list) paramsnonnull((2));
void vwarnx(const char *, va_list) paramsnonnull((2));
void warn(const char *, ...) printfesque(1);
void warnx(const char *, ...) printfesque(1);
#define err(EVAL, FMT, ...) (err)(EVAL, PFLINK(FMT), ##__VA_ARGS__)
#define err(EVAL, FMT, ...) (err)(EVAL, PFLINK(FMT), ##__VA_ARGS__)
#define errx(EVAL, FMT, ...) (errx)(EVAL, PFLINK(FMT), ##__VA_ARGS__)
#define verr(EVAL, FMT, VA) (verr)(EVAL, PFLINK(FMT), VA)
#define verr(EVAL, FMT, VA) (verr)(EVAL, PFLINK(FMT), VA)
#define verrx(EVAL, FMT, VA) (verrx)(EVAL, PFLINK(FMT), VA)
#define vwarn(FMT, VA) (vwarn)(PFLINK(FMT), VA)
#define vwarnx(FMT, VA) (vwarnx)(PFLINK(FMT), VA)
#define warn(FMT, ...) (warn)(PFLINK(FMT), ##__VA_ARGS__)
#define warnx(FMT, ...) (warn)(PFLINK(FMT), ##__VA_ARGS__)
#define vwarn(FMT, VA) (vwarn)(PFLINK(FMT), VA)
#define vwarnx(FMT, VA) (vwarnx)(PFLINK(FMT), VA)
#define warn(FMT, ...) (warn)(PFLINK(FMT), ##__VA_ARGS__)
#define warnx(FMT, ...) (warn)(PFLINK(FMT), ##__VA_ARGS__)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

16
libc/log/check.h

@ -84,15 +84,15 @@ COSMOPOLITAN_C_START_
void __check_fail(const char *, const char *, uint64_t, const char *, uint64_t,
const char *, const char *, int, const char *,
...) relegated noreturn;
...) relegated wontreturn;
void __check_fail_eq(uint64_t, uint64_t) relegated noreturn;
void __check_fail_ne(uint64_t, uint64_t) relegated noreturn;
void __check_fail_le(uint64_t, uint64_t) relegated noreturn;
void __check_fail_lt(uint64_t, uint64_t) relegated noreturn;
void __check_fail_ge(uint64_t, uint64_t) relegated noreturn;
void __check_fail_gt(uint64_t, uint64_t) relegated noreturn;
void __check_fail_aligned(unsigned, uint64_t) relegated noreturn;
void __check_fail_eq(uint64_t, uint64_t) relegated wontreturn;
void __check_fail_ne(uint64_t, uint64_t) relegated wontreturn;
void __check_fail_le(uint64_t, uint64_t) relegated wontreturn;
void __check_fail_lt(uint64_t, uint64_t) relegated wontreturn;
void __check_fail_ge(uint64_t, uint64_t) relegated wontreturn;
void __check_fail_gt(uint64_t, uint64_t) relegated wontreturn;
void __check_fail_aligned(unsigned, uint64_t) relegated wontreturn;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

2
libc/log/die.c

@ -28,7 +28,7 @@
/**
* Aborts process after printing details on its current state.
*/
relegated noreturn void __die(void) {
relegated wontreturn void __die(void) {
static bool once;
if (!once) {
once = true;

2
libc/log/err.c

@ -19,7 +19,7 @@
*/
#include "libc/log/bsd.h"
noreturn void(err)(int eval, const char *fmt, ...) {
wontreturn void(err)(int eval, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
(verr)(eval, fmt, va);

2
libc/log/errx.c

@ -19,7 +19,7 @@
*/
#include "libc/log/bsd.h"
noreturn void(errx)(int eval, const char *fmt, ...) {
wontreturn void(errx)(int eval, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
(verrx)(eval, fmt, va);

12
libc/log/log.h

@ -33,10 +33,10 @@ typedef struct FILE FILE;
extern FILE *g_logfile;
void perror(const char *) relegated; /* print the last system error */
void __die(void) relegated noreturn; /* print backtrace and abort() */
void meminfo(int); /* shows malloc statistics &c. */
void memsummary(int); /* light version of same thing */
void perror(const char *) relegated; /* print the last system error */
void __die(void) relegated wontreturn; /* print backtrace and abort() */
void meminfo(int); /* shows malloc statistics &c. */
void memsummary(int); /* light version of same thing */
uint16_t getttycols(uint16_t);
int getttysize(int, struct winsize *) paramsnonnull();
bool isterminalinarticulate(void) nosideeffect;
@ -218,8 +218,8 @@ void fverbosef(ARGS, ...) asm("flogf") ATTR relegated libcesque;
void vfverbosef(ARGS, va_list) asm("vflogf") ATTRV relegated libcesque;
void fdebugf(ARGS, ...) asm("flogf") ATTR relegated libcesque;
void vfdebugf(ARGS, va_list) asm("vflogf") ATTRV relegated libcesque;
void ffatalf(ARGS, ...) asm("flogf") ATTR relegated noreturn libcesque;
void vffatalf(ARGS, va_list) asm("vflogf") ATTRV relegated noreturn libcesque;
void ffatalf(ARGS, ...) asm("flogf") ATTR relegated wontreturn libcesque;
void vffatalf(ARGS, va_list) asm("vflogf") ATTRV relegated wontreturn libcesque;
#undef ARGS
#undef ATTR
#undef ATTRV

8
libc/log/oncrash.c

@ -51,17 +51,17 @@ STATIC_YOINK("stoa");
struct siginfo;
static const char kGregOrder[17] aligned(1) = {
static const char kGregOrder[17] forcealign(1) = {
13, 11, 8, 14, 12, 9, 10, 15, 16, 0, 1, 2, 3, 4, 5, 6, 7,
};
static const char kGregNames[17][4] aligned(1) = {
static const char kGregNames[17][4] forcealign(1) = {
"R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15", "RDI",
"RSI", "RBP", "RBX", "RDX", "RAX", "RCX", "RSP", "RIP",
};
static const char kGodHatesFlags[12] aligned(1) = "CVPRAKZSTIDO";
static const char kCrashSigNames[8][5] aligned(1) = {
static const char kGodHatesFlags[12] forcealign(1) = "CVPRAKZSTIDO";
static const char kCrashSigNames[8][5] forcealign(1) = {
"QUIT", "FPE", "ILL", "SEGV", "TRAP", "ABRT", "BUS"};
int kCrashSigs[8];

8
libc/log/ubsan.internal.h

@ -98,13 +98,13 @@ struct UbsanShiftOutOfBoundsData {
};
void __ubsan_abort(const struct UbsanSourceLocation *,
const char *) relegated hidden noreturn;
const char *) relegated hidden wontreturn;
void __ubsan_handle_type_mismatch(struct UbsanTypeMismatchInfo *,
uintptr_t) relegated hidden noreturn;
uintptr_t) relegated hidden wontreturn;
void ___ubsan_handle_type_mismatch_v1(struct UbsanTypeMismatchInfoClang *,
uintptr_t) relegated hidden noreturn;
uintptr_t) relegated hidden wontreturn;
void __ubsan_handle_float_cast_overflow(void *,
void *) relegated hidden noreturn;
void *) relegated hidden wontreturn;
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_UBSAN_H_ */

2
libc/log/verr.c

@ -23,7 +23,7 @@
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
noreturn void(verr)(int eval, const char *fmt, va_list va) {
wontreturn void(verr)(int eval, const char *fmt, va_list va) {
fprintf(stderr, "%s: %s%s%s[%m]: ", program_invocation_name, RED2, "ERROR",
RESET);
if (fmt) (vfprintf)(stderr, fmt, va);

2
libc/log/verrx.c

@ -23,7 +23,7 @@
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
noreturn void(verrx)(int eval, const char *fmt, va_list va) {
wontreturn void(verrx)(int eval, const char *fmt, va_list va) {
fprintf(stderr, "%s: %s%s%s: ", program_invocation_name, RED2, "ERROR",
RESET);
if (fmt) (vfprintf)(stderr, fmt, va);

2
libc/nexgen32e/bsf.h

@ -22,9 +22,11 @@ int bsfl(long);
int bsfll(long long);
int bsfmax(uintmax_t);
#ifdef __GNUC__
#define bsf(u) __builtin_ctz(u)
#define bsfl(u) __buil