diff --git a/dsp/tty/describe.c b/dsp/tty/describe.c index 06a2944fe..3ffe2f10c 100644 --- a/dsp/tty/describe.c +++ b/dsp/tty/describe.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/tty/tty.h" -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/examples/dlopen.c b/examples/dlopen.c index 0808d8128..3b7543d5a 100644 --- a/examples/dlopen.c +++ b/examples/dlopen.c @@ -10,7 +10,6 @@ #include "libc/calls/calls.h" #include "libc/dlopen/dlfcn.h" #include "libc/fmt/itoa.h" -#include "libc/intrin/kprintf.h" #include "libc/nt/thunk/msabi.h" #include "libc/runtime/runtime.h" @@ -24,6 +23,7 @@ * - x86-64 FreeBSD * - x86-64 Windows * - aarch64 Linux w/ Glibc + * - aarch64 Linux w/ Musl Libc * - aarch64 MacOS * */ diff --git a/examples/hiredis.c b/examples/hiredis.c index 5f4954bb0..749cc61db 100644 --- a/examples/hiredis.c +++ b/examples/hiredis.c @@ -9,7 +9,6 @@ #endif #include "libc/runtime/runtime.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "third_party/hiredis/hiredis.h" diff --git a/examples/kilo.c b/examples/kilo.c index 0aca8475b..5a4eb37fe 100644 --- a/examples/kilo.c +++ b/examples/kilo.c @@ -62,7 +62,6 @@ Contact: antirez@gmail.com\"\n\ #include "libc/calls/termios.h" #include "libc/calls/weirdtypes.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/mem/alg.h" #include "libc/mem/arraylist2.internal.h" diff --git a/examples/nesemu1.cc b/examples/nesemu1.cc index ea9a987a1..e521c5739 100644 --- a/examples/nesemu1.cc +++ b/examples/nesemu1.cc @@ -19,7 +19,6 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/intrin/safemacros.internal.h" #include "libc/inttypes.h" diff --git a/examples/picol.c b/examples/picol.c index 11e0b4460..fe32ba9fd 100644 --- a/examples/picol.c +++ b/examples/picol.c @@ -33,7 +33,6 @@ */ #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/examples/portscan.c b/examples/portscan.c index 11f330a3e..091cd79fa 100644 --- a/examples/portscan.c +++ b/examples/portscan.c @@ -12,7 +12,6 @@ #include "libc/calls/struct/timeval.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/mem/alloca.h" #include "libc/runtime/runtime.h" diff --git a/examples/stat.c b/examples/stat.c index 080e2d3be..987020ca0 100644 --- a/examples/stat.c +++ b/examples/stat.c @@ -11,7 +11,6 @@ #include "libc/calls/calls.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/log/check.h" #include "libc/log/log.h" #include "libc/mem/gc.h" diff --git a/examples/stringbuffer.c b/examples/stringbuffer.c index 282fcab01..4f965be2f 100644 --- a/examples/stringbuffer.c +++ b/examples/stringbuffer.c @@ -8,7 +8,6 @@ ╚─────────────────────────────────────────────────────────────────*/ #endif #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "libc/log/check.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" diff --git a/examples/ttyinfo.c b/examples/ttyinfo.c index 98b30f978..2febd7a1f 100644 --- a/examples/ttyinfo.c +++ b/examples/ttyinfo.c @@ -15,7 +15,6 @@ #include "libc/calls/struct/sigset.h" #include "libc/calls/termios.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/log/check.h" #include "libc/log/log.h" #include "libc/runtime/runtime.h" diff --git a/examples/unbourne.c b/examples/unbourne.c index a643f3c68..0707ca478 100644 --- a/examples/unbourne.c +++ b/examples/unbourne.c @@ -122,7 +122,6 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/safemacros.internal.h" #include "libc/limits.h" #include "libc/log/log.h" diff --git a/examples/wall.c b/examples/wall.c index f4da6315b..6b6eeddc2 100644 --- a/examples/wall.c +++ b/examples/wall.c @@ -11,7 +11,6 @@ #include "libc/calls/struct/timespec.h" #include "libc/calls/termios.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/runtime/runtime.h" #include "libc/stdio/append.h" #include "libc/stdio/stdio.h" diff --git a/libc/calls/ntaccesscheck.c b/libc/calls/ntaccesscheck.c index 895d4a357..dc1d5109f 100644 --- a/libc/calls/ntaccesscheck.c +++ b/libc/calls/ntaccesscheck.c @@ -24,7 +24,6 @@ #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/strace.internal.h" #include "libc/intrin/weaken.h" #include "libc/mem/mem.h" diff --git a/libc/calls/ttyname_r.c b/libc/calls/ttyname_r.c index be049136c..0f505264c 100644 --- a/libc/calls/ttyname_r.c +++ b/libc/calls/ttyname_r.c @@ -24,7 +24,6 @@ #include "libc/calls/syscall-sysv.internal.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/intrin/strace.internal.h" diff --git a/libc/dlopen/dlopen.c b/libc/dlopen/dlopen.c index 6f0ff4c31..0636ac23d 100644 --- a/libc/dlopen/dlopen.c +++ b/libc/dlopen/dlopen.c @@ -16,6 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/assert.h" #include "libc/atomic.h" #include "libc/calls/calls.h" #include "libc/calls/struct/sigset.internal.h" @@ -34,8 +35,8 @@ #include "libc/elf/struct/phdr.h" #include "libc/errno.h" #include "libc/fmt/itoa.h" +#include "libc/intrin/atomic.h" #include "libc/intrin/bits.h" -#include "libc/intrin/kprintf.h" #include "libc/intrin/strace.internal.h" #include "libc/limits.h" #include "libc/nt/dll.h" @@ -69,11 +70,6 @@ * @kudos jacereda for figuring out how to do this */ -#define XNU_RTLD_LAZY 1 -#define XNU_RTLD_NOW 2 -#define XNU_RTLD_LOCAL 4 -#define XNU_RTLD_GLOBAL 8 - #define AMD_REXB 0x41 #define AMD_REXW 0x48 #define AMD_MOV_IMM 0xb8 @@ -83,11 +79,16 @@ #define ARM_IDX_OFF 21 #define ARM_MOV_NEX 0xf2800000u +#define XNU_RTLD_LAZY 1 +#define XNU_RTLD_NOW 2 +#define XNU_RTLD_LOCAL 4 +#define XNU_RTLD_GLOBAL 8 + #define HELPER \ "#include \n\ #include \n\ #include \n\ -int main(int argc, char *argv[]) {\n\ +int main(int argc, char **argv, char **envp) {\n\ char *ep;\n\ long addr;\n\ if (argc != 2) {\n\ @@ -201,7 +202,7 @@ static char *elf_map(int fd, Elf64_Ehdr *ehdr, Elf64_Phdr *phdr, long pagesz, char *interp_path, size_t interp_size) { Elf64_Addr maxva = 0; Elf64_Addr minva = -1; - for (Elf64_Phdr *p = phdr; p < &phdr[ehdr->e_phnum]; p++) { + for (Elf64_Phdr *p = phdr; p < phdr + ehdr->e_phnum; p++) { if (p->p_type != PT_LOAD) { continue; } @@ -227,18 +228,31 @@ static char *elf_map(int fd, Elf64_Ehdr *ehdr, Elf64_Phdr *phdr, long pagesz, } continue; } - int prot = elf2prot(p->p_flags); Elf64_Addr skew = p->p_vaddr & (pagesz - 1); Elf64_Off off = p->p_offset - skew; - if (__sys_mmap(base + p->p_vaddr - skew, skew + p->p_filesz, prot, + Elf64_Addr a = p->p_vaddr + p->p_filesz; + Elf64_Addr b = (a + (pagesz - 1)) & -pagesz; + Elf64_Addr c = p->p_vaddr + p->p_memsz; + int prot2 = elf2prot(p->p_flags); + int prot1 = prot2; + if (b > a) { + prot1 |= PROT_WRITE; + prot1 &= ~PROT_EXEC; + } + if (__sys_mmap(base + p->p_vaddr - skew, skew + p->p_filesz, prot1, MAP_FIXED | MAP_PRIVATE, fd, off, off) == MAP_FAILED) { return MAP_FAILED; } - Elf64_Addr fend = (p->p_vaddr + p->p_filesz + (pagesz - 1)) & -pagesz; - Elf64_Addr mend = p->p_vaddr + p->p_memsz; - if (mend > fend && __sys_mmap(base + fend, mend - fend, prot, - MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, - 0, 0) == MAP_FAILED) { + if (b > a) { + bzero(base + a, b - a); + } + if (c > b && __sys_mmap(base + b, c - b, prot2, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0, + 0) == MAP_FAILED) { + return MAP_FAILED; + } + if (prot1 != prot2 && + sys_mprotect(base + p->p_vaddr - skew, skew + p->p_filesz, prot2)) { return MAP_FAILED; } } @@ -302,14 +316,14 @@ static dontinline void elf_exec(const char *file, char **envp) { // get microprocessor page size long pagesz = getauxval(AT_PAGESZ); - // load executable + // load helper executable into address space struct Loaded prog; char interp_path[256] = {0}; if (!elf_load(&prog, file, pagesz, interp_path, sizeof(interp_path))) { return; } - // load platform libc + // load platform c library into address space struct Loaded interp; if (!elf_load(&interp, interp_path, pagesz, 0, 0)) { return; @@ -343,6 +357,7 @@ static dontinline void elf_exec(const char *file, char **envp) { FormatInt64(address_argument, (uintptr_t)foreign_helper); // push auxiliary values + // these tell the platform libc how to load the executable *--sp = 0; unsigned long key, val; for (av = (Elf64_auxv_t *)__auxv; (key = av->a_type); ++av) { @@ -508,7 +523,8 @@ static void *foreign_thunk_sysv(void *func) { if (!(p = code = foreign_alloc(36))) return 0; // 16 + 16 + 4 = 36 p = movimm(p, 5, (uintptr_t)func); p = movimm(p, 10, (uintptr_t)foreign_tramp); - *(uint32_t *)p = 0xd63f0140; // blr x10 + *(uint32_t *)p = 0xd61f0140; // br x10 + __clear_cache(code, p + 4); #else #error "unsupported architecture" #endif diff --git a/libc/dlopen/dlopen.mk b/libc/dlopen/dlopen.mk index c69421946..cdd4998f7 100644 --- a/libc/dlopen/dlopen.mk +++ b/libc/dlopen/dlopen.mk @@ -34,6 +34,7 @@ LIBC_DLOPEN_A_DIRECTDEPS = \ LIBC_SYSV \ LIBC_SYSV_CALLS \ LIBC_STR \ + THIRD_PARTY_COMPILER_RT LIBC_DLOPEN_A_DEPS := \ $(call uniq,$(foreach x,$(LIBC_DLOPEN_A_DIRECTDEPS),$($(x)))) diff --git a/libc/dns/gethoststxt.c b/libc/dns/gethoststxt.c index ace4947db..d61d650ae 100644 --- a/libc/dns/gethoststxt.c +++ b/libc/dns/gethoststxt.c @@ -21,7 +21,6 @@ #include "libc/dce.h" #include "libc/dns/hoststxt.h" #include "libc/dns/servicestxt.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/intrin/pushpop.internal.h" #include "libc/intrin/safemacros.internal.h" diff --git a/libc/dns/getnameinfo.c b/libc/dns/getnameinfo.c index a610eeea4..483226d75 100644 --- a/libc/dns/getnameinfo.c +++ b/libc/dns/getnameinfo.c @@ -31,7 +31,6 @@ #include "libc/dns/resolvconf.h" #include "libc/dns/servicestxt.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/safemacros.internal.h" #include "libc/mem/mem.h" diff --git a/libc/dns/getresolvconf.c b/libc/dns/getresolvconf.c index b46d31e52..b985c839e 100644 --- a/libc/dns/getresolvconf.c +++ b/libc/dns/getresolvconf.c @@ -19,7 +19,6 @@ #include "libc/cxxabi.h" #include "libc/dce.h" #include "libc/dns/resolvconf.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/pushpop.internal.h" #include "libc/macros.internal.h" #include "libc/mem/mem.h" diff --git a/libc/dns/resolvehostsreverse.c b/libc/dns/resolvehostsreverse.c index 7e8a803a6..cdd76cf02 100644 --- a/libc/dns/resolvehostsreverse.c +++ b/libc/dns/resolvehostsreverse.c @@ -19,7 +19,6 @@ #include "libc/dns/consts.h" #include "libc/dns/dns.h" #include "libc/dns/hoststxt.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/mem/alg.h" #include "libc/sock/sock.h" diff --git a/libc/fmt/__xpg_strerror_r.c b/libc/fmt/__xpg_strerror_r.c index 80153c5ca..d313e97d9 100644 --- a/libc/fmt/__xpg_strerror_r.c +++ b/libc/fmt/__xpg_strerror_r.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/str/str.h" -int __xpg_strerror_r(int a, char *b, size_t c) { - return strerror_r(a, b, c); +char *__xpg_strerror_r(int a, char *b, size_t c) { + strerror_r(a, b, c); + return b; } diff --git a/libc/fmt/atoi.c b/libc/fmt/atoi.c index 89747d6ca..245925981 100644 --- a/libc/fmt/atoi.c +++ b/libc/fmt/atoi.c @@ -41,9 +41,8 @@ */ int atoi(const char *s) { int x, c, d; - do { - c = *s++; - } while (c == ' ' || c == '\t'); + do c = *s++; + while (c == ' ' || c == '\t'); d = c == '-' ? -1 : 1; if (c == '-' || c == '+') c = *s++; for (x = 0; isdigit(c); c = *s++) { diff --git a/libc/fmt/atol.c b/libc/fmt/atol.c index b45790dc7..c039e556d 100644 --- a/libc/fmt/atol.c +++ b/libc/fmt/atol.c @@ -31,9 +31,8 @@ long atol(const char *s) { long x; int c, d; - do { - c = *s++; - } while (c == ' ' || c == '\t'); + do c = *s++; + while (c == ' ' || c == '\t'); d = c == '-' ? -1 : 1; if (c == '-' || c == '+') c = *s++; for (x = 0; isdigit(c); c = *s++) { diff --git a/libc/fmt/conv.h b/libc/fmt/conv.h index a2941b715..df240dd75 100644 --- a/libc/fmt/conv.h +++ b/libc/fmt/conv.h @@ -72,17 +72,6 @@ imaxdiv_t imaxdiv(intmax_t, intmax_t) pureconst; #define lldiv(num, den) ((lldiv_t){(num) / (den), (num) % (den)}) #endif -#if (__GNUC__ * 100 + __GNUC_MINOR__ >= 406 || defined(__llvm__)) && \ - !defined(__STRICT_ANSI__) && defined(_COSMO_SOURCE) && \ - !defined(__COSMOCC__) -int128_t i128abs(int128_t) -libcesque pureconst; -int128_t strtoi128(const char *, char **, int) paramsnonnull((1)); -uint128_t strtou128(const char *, char **, int) paramsnonnull((1)); -int128_t wcstoi128(const wchar_t *, wchar_t **, int); -uint128_t wcstou128(const wchar_t *, wchar_t **, int); -#endif /* gcc 4.6+ */ - COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* COSMOPOLITAN_LIBC_FMT_CONV_H_ */ diff --git a/libc/fmt/divmod10.internal.h b/libc/fmt/divmod10.internal.h index 3f3542991..46b09574b 100644 --- a/libc/fmt/divmod10.internal.h +++ b/libc/fmt/divmod10.internal.h @@ -8,7 +8,7 @@ forceinline uint64_t __divmod10(uint64_t __x, unsigned *__r) { *__r = __x % 10; return __x / 10; #else - uint128_t __dw; + unsigned __int128 __dw; unsigned long long __hi, __rm; __dw = __x; __dw *= 0xcccccccccccccccdull; diff --git a/libc/fmt/fmt.h b/libc/fmt/fmt.h deleted file mode 100644 index 704e5d27a..000000000 --- a/libc/fmt/fmt.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_FMT_FMT_H_ -#define COSMOPOLITAN_LIBC_FMT_FMT_H_ - -#if __SIZEOF_POINTER__ == 8 -#define POINTER_XDIGITS 12 /* math.log(2**48-1,16) */ -#else -#define POINTER_XDIGITS 8 -#endif - -#if !(__ASSEMBLER__ + __LINKER__ + 0) -COSMOPOLITAN_C_START_ - -char *fcvt(double, int, int *, int *); -char *ecvt(double, int, int *, int *); -char *gcvt(double, int, char *); - -#ifdef _COSMO_SOURCE -int __vcscanf(int (*)(void *), int (*)(int, void *), void *, const char *, - va_list); -int __fmt(void *, void *, const char *, va_list); -#endif - -COSMOPOLITAN_C_END_ -#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -#endif /* COSMOPOLITAN_LIBC_FMT_FMT_H_ */ diff --git a/libc/fmt/fmt.mk b/libc/fmt/fmt.mk index 77106ecb4..8570cd145 100644 --- a/libc/fmt/fmt.mk +++ b/libc/fmt/fmt.mk @@ -76,17 +76,6 @@ o/$(MODE)/libc/fmt/wcstoumax.o: private \ CFLAGS += \ -Os -# we can't use compiler magic because: -# kprintf() depends on these functions -o/$(MODE)/libc/fmt/strerrno.greg.o \ -o/$(MODE)/libc/fmt/strerrdoc.greg.o \ -o/$(MODE)/libc/fmt/strerror_wr.greg.o: private \ - COPTS += \ - -fpie \ - -fno-sanitize=all \ - -fno-stack-protector \ - -fpatchable-function-entry=0,0 - LIBC_FMT_LIBS = $(foreach x,$(LIBC_FMT_ARTIFACTS),$($(x))) LIBC_FMT_SRCS = $(foreach x,$(LIBC_FMT_ARTIFACTS),$($(x)_SRCS)) LIBC_FMT_HDRS = $(foreach x,$(LIBC_FMT_ARTIFACTS),$($(x)_HDRS)) diff --git a/libc/fmt/strtol.internal.h b/libc/fmt/internal.h similarity index 94% rename from libc/fmt/strtol.internal.h rename to libc/fmt/internal.h index 129216ddd..7ea0ca33a 100644 --- a/libc/fmt/strtol.internal.h +++ b/libc/fmt/internal.h @@ -41,4 +41,8 @@ } \ } +int __vcscanf(int (*)(void *), int (*)(int, void *), void *, const char *, + va_list); +int __fmt(void *, void *, const char *, va_list); + #endif /* COSMOPOLITAN_LIBC_FMT_STRTOL_H_ */ diff --git a/libc/fmt/itoa64radix8.c b/libc/fmt/itoa64radix8.c deleted file mode 100644 index ffd4e94c6..000000000 --- a/libc/fmt/itoa64radix8.c +++ /dev/null @@ -1,39 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/conv.h" -#include "libc/fmt/itoa.h" -#include "libc/limits.h" -#include "libc/mem/reverse.internal.h" - -/** - * Converts unsigned 64-bit integer to octal string. - * @param a needs at least 24 bytes - * @return bytes written w/o nul - */ -dontinline size_t uint64toarray_radix8(uint64_t i, char a[hasatleast 24]) { - size_t j; - j = 0; - do { - a[j++] = i % 8 + '0'; - i /= 8; - } while (i > 0); - a[j] = '\0'; - reverse(a, j); - return j; -} diff --git a/libc/fmt/sizetol.c b/libc/fmt/sizetol.c index 962457819..9257cfe41 100644 --- a/libc/fmt/sizetol.c +++ b/libc/fmt/sizetol.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/stdckdint.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" diff --git a/libc/fmt/stripext.c b/libc/fmt/stripext.c index 4bfeabc0e..6fd8c9f73 100644 --- a/libc/fmt/stripext.c +++ b/libc/fmt/stripext.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/str/str.h" /** diff --git a/libc/fmt/stripexts.c b/libc/fmt/stripexts.c index ed0163bd0..0848d56ba 100644 --- a/libc/fmt/stripexts.c +++ b/libc/fmt/stripexts.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/str/str.h" /** diff --git a/libc/fmt/strtol.c b/libc/fmt/strtol.c index 3cd2c40d9..9a50b49be 100644 --- a/libc/fmt/strtol.c +++ b/libc/fmt/strtol.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/strtol.internal.h" +#include "libc/fmt/internal.h" #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" diff --git a/libc/fmt/strtoul.c b/libc/fmt/strtoul.c index af0aaf26e..bf2cbf79e 100644 --- a/libc/fmt/strtoul.c +++ b/libc/fmt/strtoul.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/strtol.internal.h" +#include "libc/fmt/internal.h" #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" diff --git a/libc/fmt/wcstol.c b/libc/fmt/wcstol.c index 7e2571c88..aac4baeab 100644 --- a/libc/fmt/wcstol.c +++ b/libc/fmt/wcstol.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/strtol.internal.h" +#include "libc/fmt/internal.h" #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" diff --git a/libc/fmt/wcstoul.c b/libc/fmt/wcstoul.c index 6c3865ccb..723a7d041 100644 --- a/libc/fmt/wcstoul.c +++ b/libc/fmt/wcstoul.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/strtol.internal.h" +#include "libc/fmt/internal.h" #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" diff --git a/libc/fmt/itoa64.c b/libc/intrin/__clear_cache.c similarity index 71% rename from libc/fmt/itoa64.c rename to libc/intrin/__clear_cache.c index 1905b2520..b44e314eb 100644 --- a/libc/fmt/itoa64.c +++ b/libc/intrin/__clear_cache.c @@ -1,7 +1,7 @@ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ +│ Copyright 2023 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ @@ -16,26 +16,22 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/conv.h" -#include "libc/fmt/itoa.h" -#include "libc/mem/reverse.internal.h" -dontinline size_t uint64toarray(uint64_t i, char *a, int r) { - size_t j; - j = 0; - do { - a[j++] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i % r]; - i /= r; - } while (i > 0); - a[j] = '\0'; - reverse(a, j); - return j; -} - -size_t int64toarray(int64_t i, char *a, int r) { - if (i < 0) { - *a++ = '-'; - i = -(uint64_t)i; +void __clear_cache2(const void *base, const void *end) { +#ifdef __aarch64__ + int icache, dcache; + const char *p, *pe = end; + static unsigned int ctr_el0 = 0; + if (!ctr_el0) asm volatile("mrs\t%0,ctr_el0" : "=r"(ctr_el0)); + icache = 4 << (ctr_el0 & 15); + dcache = 4 << ((ctr_el0 >> 16) & 15); + for (p = (const char *)((uintptr_t)base & -dcache); p < pe; p += dcache) { + asm volatile("dc\tcvau,%0" : : "r"(p) : "memory"); } - return uint64toarray(i, a, r); + asm volatile("dsb\tish" ::: "memory"); + for (p = (const char *)((uintptr_t)base & -icache); p < pe; p += icache) { + asm volatile("ic\tivau,%0" : : "r"(p) : "memory"); + } + asm volatile("dsb\tish\nisb" ::: "memory"); +#endif } diff --git a/libc/intrin/formatint32.c b/libc/intrin/formatint32.c index 0e13f13e1..9afc72f50 100644 --- a/libc/intrin/formatint32.c +++ b/libc/intrin/formatint32.c @@ -24,7 +24,7 @@ * @param p needs at least 12 bytes * @return pointer to nul byte */ -privileged dontinline char *FormatUint32(char p[hasatleast 12], uint32_t x) { +dontinline char *FormatUint32(char p[hasatleast 12], uint32_t x) { char t; size_t i, a, b; i = 0; @@ -49,7 +49,7 @@ privileged dontinline char *FormatUint32(char p[hasatleast 12], uint32_t x) { * @param p needs at least 12 bytes * @return pointer to nul byte */ -privileged char *FormatInt32(char p[hasatleast 12], int32_t x) { +char *FormatInt32(char p[hasatleast 12], int32_t x) { if (x < 0) *p++ = '-', x = -(uint32_t)x; return FormatUint32(p, x); } diff --git a/libc/intrin/kprintf.greg.c b/libc/intrin/kprintf.greg.c index 3b583bfcd..317318949 100644 --- a/libc/intrin/kprintf.greg.c +++ b/libc/intrin/kprintf.greg.c @@ -18,32 +18,18 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/kprintf.h" #include "ape/sections.internal.h" -#include "libc/calls/calls.h" -#include "libc/calls/state.internal.h" -#include "libc/calls/syscall-sysv.internal.h" #include "libc/dce.h" #include "libc/errno.h" #include "libc/fmt/divmod10.internal.h" -#include "libc/fmt/fmt.h" -#include "libc/fmt/itoa.h" #include "libc/fmt/magnumstrs.internal.h" -#include "libc/intrin/asan.internal.h" -#include "libc/intrin/asancodes.h" #include "libc/intrin/asmflag.h" #include "libc/intrin/atomic.h" #include "libc/intrin/bits.h" -#include "libc/intrin/cmpxchg.h" #include "libc/intrin/getenv.internal.h" -#include "libc/intrin/kprintf.h" #include "libc/intrin/likely.h" #include "libc/intrin/nomultics.internal.h" -#include "libc/intrin/safemacros.internal.h" -#include "libc/intrin/strace.internal.h" #include "libc/intrin/weaken.h" -#include "libc/limits.h" #include "libc/log/internal.h" -#include "libc/macros.internal.h" -#include "libc/mem/alloca.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/nexgen32e/uart.internal.h" #include "libc/nt/createfile.h" @@ -56,25 +42,21 @@ #include "libc/nt/process.h" #include "libc/nt/runtime.h" #include "libc/nt/thunk/msabi.h" -#include "libc/nt/winsock.h" #include "libc/runtime/internal.h" #include "libc/runtime/memtrack.internal.h" #include "libc/runtime/runtime.h" -#include "libc/runtime/stack.h" #include "libc/runtime/symbols.internal.h" #include "libc/stdckdint.h" #include "libc/str/str.h" #include "libc/str/tab.internal.h" #include "libc/str/utf16.h" #include "libc/sysv/consts/at.h" -#include "libc/sysv/consts/auxv.h" #include "libc/sysv/consts/f.h" #include "libc/sysv/consts/fd.h" #include "libc/sysv/consts/fileno.h" #include "libc/sysv/consts/nr.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" -#include "libc/thread/posixthread.internal.h" #include "libc/thread/tls.h" #include "libc/thread/tls2.internal.h" #include "libc/vga/vga.internal.h" @@ -766,16 +748,9 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt, break; } else { type = 0; -#if defined(SYSDEBUG) && _NTTRACE - strerror_r(e, z, sizeof(z)); - s = z; -#else - s = _strerrno(e); - if (!s) { - FormatInt32(z, e); - s = z; + if (!(s = _strerrno(e))) { + s = "EUNKNOWN"; } -#endif goto FormatString; } } @@ -1145,8 +1120,7 @@ privileged void kvprintf(const char *fmt, va_list v) { * * Error numbers: * - * - `%m` formats error (if strerror_wr if is linked) - * - `%m` formats errno number (if strerror_wr isn't linked) + * - `%m` formats errno as string * - `% m` formats error with leading space if errno isn't zero * - `%lm` means favor WSAGetLastError() over GetLastError() if linked * diff --git a/libc/intrin/strerror.c b/libc/intrin/strerror.c index a09660205..ce8451c8d 100644 --- a/libc/intrin/strerror.c +++ b/libc/intrin/strerror.c @@ -17,21 +17,20 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/magnumstrs.internal.h" -#include "libc/intrin/safemacros.internal.h" #include "libc/str/str.h" +_Alignas(1) static char strerror_buf[128]; + /** - * Converts errno value to string non-reentrantly. + * Returns string describing `err`. + * + * The application shall not modify the string returned. + * * @see strerror_r() + * @threadunsafe */ char *strerror(int err) { - if (IsTiny()) { - return (char *)firstnonnull(_strerrno(err), "EUNKNOWN"); - } else { - _Alignas(1) static char buf[512]; - strerror_r(err, buf, sizeof(buf)); - return buf; - } + strerror_r(err, strerror_buf, sizeof(strerror_buf)); + return strerror_buf; } diff --git a/libc/intrin/strerror_r.c b/libc/intrin/strerror_r.c index 0a22a8d6e..f534570b7 100644 --- a/libc/intrin/strerror_r.c +++ b/libc/intrin/strerror_r.c @@ -16,25 +16,61 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#define ShouldUseMsabiAttribute() 1 #include "libc/dce.h" -#include "libc/intrin/strace.internal.h" +#include "libc/errno.h" +#include "libc/fmt/itoa.h" +#include "libc/fmt/magnumstrs.internal.h" #include "libc/nt/runtime.h" -#include "libc/nt/thunk/msabi.h" #include "libc/str/str.h" -// clang-format off - -#if defined(SYSDEBUG) && _NTTRACE -privileged -#endif /** * Converts errno value to string. * * @param err is error number or zero if unknown - * @return 0 on success, or error code + * @return 0 on success, or errno on error + * @raise ERANGE if insufficient buffer was available, in which case a + * nul-terminated string is still copied to `buf` */ -int strerror_r(int err, char *buf, size_t size) { - int winerr = IsWindows() ? __imp_GetLastError() : 0; - return strerror_wr(err, winerr, buf, size); +errno_t strerror_r(int err, char *buf, size_t size) { + + int c; + char tmp[32]; + char *p = buf; + char *pe = p + size; + + // copy unix error information + const char *msg; + if (!err) { + msg = "No error information"; + } else if (!(msg = _strerdoc(err))) { + FormatInt32(stpcpy(tmp, "Error "), err); + msg = tmp; + } + while ((c = *msg++) && p + 1 < pe) { + *p++ = c; + } + + // copy windows error information + if (IsWindows()) { + uint32_t winerr; + if ((winerr = GetLastError()) != err) { + stpcpy(FormatUint32(stpcpy(tmp, " (win32 error "), winerr), ")"); + msg = tmp; + while ((c = *msg++) && p + 1 < pe) { + *p++ = c; + } + } + } + + // force nul terminator + if (p < pe) { + *p++ = 0; + } + + // return result code + if (p < pe) { + return 0; + } else { + return ERANGE; + } } diff --git a/libc/intrin/strerror_wr.greg.c b/libc/intrin/strerror_wr.greg.c deleted file mode 100644 index df65d2f9f..000000000 --- a/libc/intrin/strerror_wr.greg.c +++ /dev/null @@ -1,76 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2022 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#define ShouldUseMsabiAttribute() 1 -#include "libc/dce.h" -#include "libc/fmt/fmt.h" -#include "libc/fmt/magnumstrs.internal.h" -#include "libc/intrin/kprintf.h" -#include "libc/intrin/strace.internal.h" -#include "libc/macros.internal.h" -#include "libc/nt/enum/formatmessageflags.h" -#include "libc/nt/enum/lang.h" -#include "libc/nt/process.h" -#include "libc/str/str.h" -// clang-format off - -#if defined(SYSDEBUG) && _NTTRACE -privileged -#endif - -/** - * Converts errno value to string with explicit windows errno too. - * - * @param err is error number or zero if unknown - * @return 0 on success, or error code - */ -int strerror_wr(int err, uint32_t winerr, char *buf, size_t size) { - /* kprintf() weakly depends on this function */ - int c, n; - char16_t winmsg[256]; - const char *sym, *msg; - /* wanting = false; */ - if (!(sym = _strerrno(err))) { - sym = "EUNKNOWN"; - /* wanting = true; */ - } - if (!(msg = _strerdoc(err))) { - msg = "No error information"; - /* wanting = true; */ - } - if (IsTiny()) { - if (!sym) sym = "EUNKNOWN"; - for (; (c = *sym++); --size) - if (size > 1) *buf++ = c; - if (size) *buf = 0; - } else if (!IsWindows() /* || ((err == winerr || !winerr) && !wanting) */) { - ksnprintf(buf, size, "%s/%d/%s", sym, err, msg); - } else { - if ((n = __imp_FormatMessageW( - kNtFormatMessageFromSystem | kNtFormatMessageIgnoreInserts, 0, - winerr, MAKELANGID(kNtLangNeutral, kNtSublangDefault), winmsg, - ARRAYLEN(winmsg), 0))) { - while ((n && winmsg[n - 1] <= ' ') || winmsg[n - 1] == '.') --n; - ksnprintf(buf, size, "%s/%d/%s/%d/%.*hs", sym, err, msg, winerr, n, - winmsg); - } else { - ksnprintf(buf, size, "%s/%d/%s/%d", sym, err, msg, winerr); - } - } - return 0; -} diff --git a/libc/intrin/strsignal.c b/libc/intrin/strsignal.c index c4d34f21f..2daab1ad6 100644 --- a/libc/intrin/strsignal.c +++ b/libc/intrin/strsignal.c @@ -38,5 +38,5 @@ static char g_strsignal[21]; * @threadunsafe */ char *strsignal(int sig) { - return strsignal_r(sig, g_strsignal); + return (char *)strsignal_r(sig, g_strsignal); } diff --git a/libc/intrin/strsignal_r.c b/libc/intrin/strsignal_r.c index 9d8c3ae5f..c8a6e9a6d 100644 --- a/libc/intrin/strsignal_r.c +++ b/libc/intrin/strsignal_r.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/itoa.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/str/str.h" #include "libc/sysv/consts/sig.h" @@ -26,8 +25,7 @@ * * This returns `"0"` for 0 which is the empty value. Symbolic names * should be available for signals 1 through 32. If the system supports - * real-time signals, they're returned as `SIGRTMIN+%d`. For all other - * 32-bit signed integer, a plain integer representation is returned. + * real-time signals, they're returned as `SIGRTMIN+%d`. * * @param sig is signal number which should be in range 1 through 128 * @param buf may be used to store output having at least 15 bytes @@ -35,13 +33,14 @@ * @see sigaction() * @asyncsignalsafe */ -privileged char *strsignal_r(int sig, char buf[21]) { +privileged const char *strsignal_r(int sig, char buf[21]) { + char *p; const char *s; if (!sig) { return "0"; } if ((s = GetMagnumStr(kSignalNames, sig))) { - return (char *)s; + return s; } if (SIGRTMIN <= sig && sig <= SIGRTMAX) { sig -= SIGRTMIN; @@ -54,9 +53,13 @@ privileged char *strsignal_r(int sig, char buf[21]) { buf[6] = 'I'; buf[7] = 'N'; buf[8] = '+'; - FormatInt32(buf + 9, sig); + p = buf + 9; } else { - FormatInt32(buf, sig); + p = buf; } + if (sig >= 100) *p++ = '0' + (unsigned char)sig / 100 % 10; + if (sig >= 10) *p++ = '0' + (unsigned char)sig / 10 % 10; + *p++ = '0' + (unsigned char)sig % 10; + *p = 0; return buf; } diff --git a/libc/intrin/ubsan.c b/libc/intrin/ubsan.c index 7b7c3186f..4a0adc832 100644 --- a/libc/intrin/ubsan.c +++ b/libc/intrin/ubsan.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/pushpop.internal.h" #include "libc/intrin/strace.internal.h" diff --git a/libc/isystem/stdio.h b/libc/isystem/stdio.h index 44626f4fd..2e50acbc4 100644 --- a/libc/isystem/stdio.h +++ b/libc/isystem/stdio.h @@ -2,7 +2,6 @@ #define _STDIO_H #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/libc/isystem/stdlib.h b/libc/isystem/stdlib.h index dd331a30e..422888746 100644 --- a/libc/isystem/stdlib.h +++ b/libc/isystem/stdlib.h @@ -10,6 +10,7 @@ #include "libc/runtime/runtime.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/rand.h" +#include "libc/stdlib.h" #include "libc/str/str.h" #include "libc/sysv/consts/exit.h" #include "libc/temp.h" diff --git a/libc/log/attachdebugger.c b/libc/log/attachdebugger.c index 9068766de..3e7a916aa 100644 --- a/libc/log/attachdebugger.c +++ b/libc/log/attachdebugger.c @@ -19,7 +19,6 @@ #include "libc/calls/calls.h" #include "libc/calls/syscall-sysv.internal.h" #include "libc/dce.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/safemacros.internal.h" #include "libc/log/color.internal.h" diff --git a/libc/log/backtrace3.c b/libc/log/backtrace3.c index e49f6f78c..ff9dab21b 100644 --- a/libc/log/backtrace3.c +++ b/libc/log/backtrace3.c @@ -18,7 +18,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/weaken.h" diff --git a/libc/log/checkfail.c b/libc/log/checkfail.c index 29be8f882..102a1f9a0 100644 --- a/libc/log/checkfail.c +++ b/libc/log/checkfail.c @@ -18,7 +18,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/safemacros.internal.h" #include "libc/intrin/strace.internal.h" @@ -32,8 +31,6 @@ #include "libc/stdio/stdio.h" #include "libc/str/str.h" -__static_yoink("strerror_wr"); - /** * Handles failure of CHECK_xx() macros. */ diff --git a/libc/log/cxaprintexits.c b/libc/log/cxaprintexits.c index cf042e434..07fee066d 100644 --- a/libc/log/cxaprintexits.c +++ b/libc/log/cxaprintexits.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/intrin/bsf.h" #include "libc/intrin/cxaatexit.internal.h" #include "libc/log/log.h" diff --git a/libc/log/gdbexec.c b/libc/log/gdbexec.c index 00ba480a8..a179253be 100644 --- a/libc/log/gdbexec.c +++ b/libc/log/gdbexec.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/safemacros.internal.h" #include "libc/log/gdb.h" #include "libc/log/log.h" diff --git a/libc/log/logerrno.c b/libc/log/logerrno.c index 69be9d43b..da9dbc539 100644 --- a/libc/log/logerrno.c +++ b/libc/log/logerrno.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/libc/log/meminfo.c b/libc/log/meminfo.c index ed39d5e19..e219dac00 100644 --- a/libc/log/meminfo.c +++ b/libc/log/meminfo.c @@ -17,14 +17,13 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/stdio/dprintf.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/mem/mem.h" +#include "libc/stdio/dprintf.h" static void onmemchunk(void *start, void *end, size_t used_bytes, void *arg) { - (dprintf)(*(int *)arg, "%p - %p : %08zx / %08lx\n", start, end, used_bytes, - (intptr_t)end - (intptr_t)start); + dprintf(*(int *)arg, "%p - %p : %08zx / %08lx\n", start, end, used_bytes, + (intptr_t)end - (intptr_t)start); } /** @@ -32,7 +31,6 @@ static void onmemchunk(void *start, void *end, size_t used_bytes, void *arg) { */ void _meminfo(int fd) { _memsummary(fd); - (dprintf)(fd, "%*s %*s %*s %*s\n", POINTER_XDIGITS, "start", - POINTER_XDIGITS, "end", 8, "used", 8, "size"); + dprintf(fd, "%12s %12s %8s %8s\n", "start", "end", "used", "size"); malloc_inspect_all(onmemchunk, &fd); } diff --git a/libc/log/oncrash_amd64.c b/libc/log/oncrash_amd64.c index c93409ebd..eab3c58a1 100644 --- a/libc/log/oncrash_amd64.c +++ b/libc/log/oncrash_amd64.c @@ -58,9 +58,6 @@ #include "libc/thread/tls.h" #ifdef __x86_64__ -__static_yoink("strerror_wr"); // for kprintf %m -__static_yoink("strsignal_r"); // for kprintf %G - #define STACK_ERROR "error: not enough room on stack to print crash report\n" static const char kGregOrder[17] forcealign(1) = { diff --git a/libc/log/oncrash_arm64.c b/libc/log/oncrash_arm64.c index a92e7cbb2..eceeb654c 100644 --- a/libc/log/oncrash_arm64.c +++ b/libc/log/oncrash_arm64.c @@ -51,9 +51,6 @@ #include "libc/thread/thread.h" #ifdef __aarch64__ -__static_yoink("strerror_wr"); // for kprintf %m -__static_yoink("strsignal_r"); // for kprintf %G - #define STACK_ERROR "error: not enough room on stack to print crash report\n" #define RESET "\e[0m" diff --git a/libc/log/vflogf.c b/libc/log/vflogf.c index cd49350d4..bc30362b4 100644 --- a/libc/log/vflogf.c +++ b/libc/log/vflogf.c @@ -24,7 +24,6 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/libgen.h" #include "libc/intrin/bits.h" #include "libc/intrin/safemacros.internal.h" diff --git a/libc/nt/kernel32/FormatMessageA.S b/libc/nt/kernel32/FormatMessageA.S new file mode 100644 index 000000000..606d454e1 --- /dev/null +++ b/libc/nt/kernel32/FormatMessageA.S @@ -0,0 +1,18 @@ +#include "libc/nt/codegen.h" +.imp kernel32,__imp_FormatMessageA,FormatMessageA + + .text.windows + .ftrace1 +FormatMessageA: + .ftrace2 +#ifdef __x86_64__ + push %rbp + mov %rsp,%rbp + mov __imp_FormatMessageA(%rip),%rax + jmp __sysv2nt8 +#elif defined(__aarch64__) + mov x0,#0 + ret +#endif + .endfn FormatMessageA,globl + .previous diff --git a/libc/nt/master.sh b/libc/nt/master.sh index 471f24695..39c6e9c8d 100755 --- a/libc/nt/master.sh +++ b/libc/nt/master.sh @@ -87,6 +87,7 @@ imp 'FindNextVolume' FindNextVolumeW kernel32 3 imp 'FindVolumeClose' FindVolumeClose kernel32 1 imp 'FlushConsoleInputBuffer' FlushConsoleInputBuffer kernel32 1 imp 'FormatMessage' FormatMessageW kernel32 7 +imp 'FormatMessageA' FormatMessageA kernel32 7 imp 'FreeConsole' FreeConsole kernel32 0 imp 'FreeEnvironmentStrings' FreeEnvironmentStringsW kernel32 1 imp 'FreeLibrary' FreeLibrary kernel32 1 diff --git a/libc/nt/process.h b/libc/nt/process.h index 7f2127535..1d2ce2e02 100644 --- a/libc/nt/process.h +++ b/libc/nt/process.h @@ -51,6 +51,9 @@ void SetLastError(uint32_t dwErrCode); uint32_t FormatMessage(uint32_t dwFlags, const void *lpSource, uint32_t dwMessageId, uint32_t dwLanguageId, char16_t *lpBuffer, uint32_t nSize, va_list *Arguments); +uint32_t FormatMessageA(uint32_t dwFlags, const void *lpSource, + uint32_t dwMessageId, uint32_t dwLanguageId, + char *lpBuffer, uint32_t nSize, va_list *Arguments); int64_t OpenProcess(uint32_t dwDesiredAccess, bool32 bInheritHandle, uint32_t dwProcessId); uint32_t GetCurrentProcessId(void); /* %gs:0x40 */ diff --git a/libc/runtime/printgarbage.c b/libc/runtime/printgarbage.c index 9f79267e7..e55e69f65 100644 --- a/libc/runtime/printgarbage.c +++ b/libc/runtime/printgarbage.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/intrin/kprintf.h" #include "libc/log/log.h" #include "libc/nexgen32e/gc.internal.h" diff --git a/libc/runtime/runtime.h b/libc/runtime/runtime.h index 6421b7ea2..6e798063b 100644 --- a/libc/runtime/runtime.h +++ b/libc/runtime/runtime.h @@ -115,6 +115,7 @@ bool32 _isheap(void *); /* code morphing */ void __morph_begin(void); void __morph_end(void); +void __clear_cache(void *, void *); /* portability */ int NtGetVersion(void) pureconst; bool32 IsGenuineBlink(void); diff --git a/libc/sock/inet_pton.c b/libc/sock/inet_pton.c index 2dc67e3d8..289f05a59 100644 --- a/libc/sock/inet_pton.c +++ b/libc/sock/inet_pton.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/macros.internal.h" #include "libc/sock/internal.h" #include "libc/sock/sock.h" diff --git a/libc/sock/syslog.c b/libc/sock/syslog.c index 802acc628..5d2afdfa2 100644 --- a/libc/sock/syslog.c +++ b/libc/sock/syslog.c @@ -23,7 +23,6 @@ #include "libc/calls/weirdtypes.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/safemacros.internal.h" #include "libc/log/internal.h" #include "libc/macros.internal.h" diff --git a/libc/stdio/demangle.c b/libc/stdio/demangle.c index 08ea6d6b6..344ad432f 100644 --- a/libc/stdio/demangle.c +++ b/libc/stdio/demangle.c @@ -30,7 +30,6 @@ #include "libc/cxxabi.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/libc/stdio/ecvt.c b/libc/stdio/ecvt.c index 2eba91728..11a76b7d3 100644 --- a/libc/stdio/ecvt.c +++ b/libc/stdio/ecvt.c @@ -22,7 +22,6 @@ │ Materiel Command, USAF, under agreement number F39502-99-1-0512. │ │ SUCH DAMAGE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/libc/stdio/fmt.c b/libc/stdio/fmt.c index d208a008f..d9d0f9bde 100644 --- a/libc/stdio/fmt.c +++ b/libc/stdio/fmt.c @@ -38,7 +38,6 @@ │ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF │ │ THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/assert.h" #include "libc/errno.h" #include "libc/fmt/conv.h" diff --git a/libc/stdio/fscanf.c b/libc/stdio/fscanf.c index c5bb44d72..e586ca170 100644 --- a/libc/stdio/fscanf.c +++ b/libc/stdio/fscanf.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/stdio/stdio.h" /** diff --git a/libc/stdio/gcvt.c b/libc/stdio/gcvt.c index 662b0df13..941164c66 100644 --- a/libc/stdio/gcvt.c +++ b/libc/stdio/gcvt.c @@ -22,7 +22,6 @@ │ Materiel Command, USAF, under agreement number F39502-99-1-0512. │ │ SUCH DAMAGE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index 5f91b5093..332979a9a 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/fd.internal.h" -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/stdio/stdio.h" /** diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c index d819f9f2a..4514fb91f 100644 --- a/libc/stdio/sprintf.c +++ b/libc/stdio/sprintf.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/log/log.h" diff --git a/libc/stdio/sscanf.c b/libc/stdio/sscanf.c index 0e688e327..3199b3fe1 100644 --- a/libc/stdio/sscanf.c +++ b/libc/stdio/sscanf.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" /** diff --git a/libc/stdio/vcscanf.c b/libc/stdio/vcscanf.c index c77220582..f67d1bcc3 100644 --- a/libc/stdio/vcscanf.c +++ b/libc/stdio/vcscanf.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/limits.h" #include "libc/mem/internal.h" #include "libc/mem/mem.h" diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c index 7e2471772..ec198018b 100644 --- a/libc/stdio/vdprintf.c +++ b/libc/stdio/vdprintf.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/iovec.internal.h" #include "libc/dce.h" -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/limits.h" #include "libc/macros.internal.h" #include "libc/nt/files.h" diff --git a/libc/stdio/vfprintf_unlocked.c b/libc/stdio/vfprintf_unlocked.c index 2dce1045e..3f7c8b645 100644 --- a/libc/stdio/vfprintf_unlocked.c +++ b/libc/stdio/vfprintf_unlocked.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/stdckdint.h" #include "libc/stdio/internal.h" #include "libc/stdio/stdio.h" diff --git a/libc/stdio/vfscanf.c b/libc/stdio/vfscanf.c index e61acd9e1..923b73b79 100644 --- a/libc/stdio/vfscanf.c +++ b/libc/stdio/vfscanf.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/stdio/stdio.h" /** diff --git a/libc/stdio/vscanf.c b/libc/stdio/vscanf.c index 09230df2f..4cace74f0 100644 --- a/libc/stdio/vscanf.c +++ b/libc/stdio/vscanf.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/stdio/stdio.h" /** diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c index dfed1ed20..62887c0f6 100644 --- a/libc/stdio/vsnprintf.c +++ b/libc/stdio/vsnprintf.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/dce.h" -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" #include "libc/limits.h" #include "libc/macros.internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/stdio/vsscanf.c b/libc/stdio/vsscanf.c index 570750b18..e2aea7618 100644 --- a/libc/stdio/vsscanf.c +++ b/libc/stdio/vsscanf.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/fmt/fmt.h" +#include "libc/fmt/internal.h" struct StringScannerState { const unsigned char *s; diff --git a/libc/stdlib.h b/libc/stdlib.h new file mode 100644 index 000000000..c69f90e05 --- /dev/null +++ b/libc/stdlib.h @@ -0,0 +1,12 @@ +#ifndef COSMOPOLITAN_LIBC_STDLIB_H_ +#define COSMOPOLITAN_LIBC_STDLIB_H_ +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +char *fcvt(double, int, int *, int *); +char *ecvt(double, int, int *, int *); +char *gcvt(double, int, char *); + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ +#endif /* COSMOPOLITAN_LIBC_STDLIB_H_ */ diff --git a/libc/str/mbstowcs.c b/libc/str/mbstowcs.c index 7a2b56ddc..e95df30ae 100644 --- a/libc/str/mbstowcs.c +++ b/libc/str/mbstowcs.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/str/str.h" size_t mbstowcs(wchar_t *pwc, const char *s, size_t wn) { diff --git a/libc/str/str.h b/libc/str/str.h index aa3f9f58e..e5c81bc7c 100644 --- a/libc/str/str.h +++ b/libc/str/str.h @@ -168,10 +168,8 @@ wint_t towctrans(wint_t, wctrans_t); int getsubopt(char **, char *const *, char **) paramsnonnull(); char *strsignal(int) returnsnonnull libcesque; char *strerror(int) returnsnonnull dontthrow nocallback; -int strerror_r(int, char *, size_t) -dontthrow nocallback; -int __xpg_strerror_r(int, char *, size_t) -dontthrow nocallback; +errno_t strerror_r(int, char *, size_t) libcesque; +char *__xpg_strerror_r(int, char *, size_t) libcesque; #ifdef _COSMO_SOURCE uint64_t tpenc(uint32_t) pureconst; @@ -183,9 +181,7 @@ bool32 startswithi(const char *, const char *) strlenesque; bool32 endswith(const char *, const char *) strlenesque; bool32 istext(const void *, size_t) libcesque; bool32 isutf8(const void *, size_t) libcesque; -char *strsignal_r(int, char[21]) returnsnonnull libcesque __wur; -int strerror_wr(int, uint32_t, char *, size_t) -dontthrow nocallback; +const char *strsignal_r(int, char[21]) returnsnonnull libcesque __wur; char16_t *chomp16(char16_t *) libcesque; size_t strlen16(const char16_t *) strlenesque; size_t strnlen16(const char16_t *, size_t) strlenesque; diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index e100d4da3..55bfad42a 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -469,7 +469,7 @@ syscon rlimit RLIMIT_RSS 5 5 5 5 5 5 5 127 # max physical mem syscon rlimit RLIMIT_NPROC 6 6 7 7 7 7 7 127 # max number of processes; see fork()→EAGAIN; bsd consensus syscon rlimit RLIMIT_NOFILE 7 7 8 8 8 8 8 127 # max number of open files; see accept()→EMFILE/ENFILE; bsd consensus syscon rlimit RLIMIT_MEMLOCK 8 8 6 6 6 6 6 127 # max locked-in-memory address space; bsd consensus -syscon rlimit RLIMIT_AS 9 9 5 5 10 2 10 0 # max virtual memory size in bytes; this one actually works; fudged as RLIMIT_DATA on OpenBSD +syscon rlimit RLIMIT_AS 9\ 9 5 5 10 2 10 0 # max virtual memory size in bytes; this one actually works; fudged as RLIMIT_DATA on OpenBSD syscon rlimit RLIMIT_LOCKS 10 10 127 127 127 127 127 127 # max flock() / fcntl() locks; bsd consensus syscon rlimit RLIMIT_SIGPENDING 11 11 127 127 127 127 127 127 # max sigqueue() can enqueue; bsd consensus syscon rlimit RLIMIT_MSGQUEUE 12 12 127 127 127 127 127 127 # meh posix message queues; bsd consensus diff --git a/libc/sysv/consts/sig.h b/libc/sysv/consts/sig.h index ecd768248..21e4d683b 100644 --- a/libc/sysv/consts/sig.h +++ b/libc/sysv/consts/sig.h @@ -80,21 +80,22 @@ COSMOPOLITAN_C_END_ * hasn't fleshed them out yet. * * - SIGTHR doesn't have a macro since it's internal to posix threads. + * + * - SIGSTKFLT is Linux-only so no macro is defined. */ -#define SIGBUS SIGBUS -#define SIGCHLD SIGCHLD -#define SIGCONT SIGCONT -#define SIGEMT SIGEMT -#define SIGINFO SIGINFO -#define SIGPWR SIGPWR -#define SIGSTKFLT SIGSTKFLT -#define SIGSTOP SIGSTOP -#define SIGSYS SIGSYS -#define SIGTSTP SIGTSTP -#define SIGURG SIGURG -#define SIGUSR1 SIGUSR1 -#define SIGUSR2 SIGUSR2 +#define SIGBUS SIGBUS +#define SIGCHLD SIGCHLD +#define SIGCONT SIGCONT +#define SIGEMT SIGEMT +#define SIGINFO SIGINFO +#define SIGPWR SIGPWR +#define SIGSTOP SIGSTOP +#define SIGSYS SIGSYS +#define SIGTSTP SIGTSTP +#define SIGURG SIGURG +#define SIGUSR1 SIGUSR1 +#define SIGUSR2 SIGUSR2 #define SIG_BLOCK SIG_BLOCK #define SIG_SETMASK SIG_SETMASK diff --git a/libc/testlib/showerror.c b/libc/testlib/showerror.c index 737a94661..4def3ce33 100644 --- a/libc/testlib/showerror.c +++ b/libc/testlib/showerror.c @@ -20,7 +20,6 @@ #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/atomic.h" #include "libc/intrin/kprintf.h" diff --git a/libc/time/asctime.c b/libc/time/asctime.c index a5350228b..1762165e7 100644 --- a/libc/time/asctime.c +++ b/libc/time/asctime.c @@ -1,4 +1,3 @@ -#include "libc/fmt/fmt.h" #include "libc/str/str.h" #include "libc/time/struct/tm.h" #include "libc/time/time.h" diff --git a/libc/time/strftime.c b/libc/time/strftime.c index 46e4cf69b..33a7d07f9 100644 --- a/libc/time/strftime.c +++ b/libc/time/strftime.c @@ -16,7 +16,6 @@ │ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/inttypes.h" #include "libc/stdio/stdio.h" #include "libc/str/locale.h" diff --git a/test/libc/calls/fcntl_test.c b/test/libc/calls/fcntl_test.c index 1dd17eab7..600d0097c 100644 --- a/test/libc/calls/fcntl_test.c +++ b/test/libc/calls/fcntl_test.c @@ -21,7 +21,6 @@ #include "libc/calls/struct/sigaction.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/log/check.h" #include "libc/macros.internal.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/calls/lseek_test.c b/test/libc/calls/lseek_test.c index 04146c83b..c64e7d6fc 100644 --- a/test/libc/calls/lseek_test.c +++ b/test/libc/calls/lseek_test.c @@ -20,7 +20,6 @@ #include "libc/calls/internal.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/log/check.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/calls/mkdir_test.c b/test/libc/calls/mkdir_test.c index fb8029ddb..27d94e5d6 100644 --- a/test/libc/calls/mkdir_test.c +++ b/test/libc/calls/mkdir_test.c @@ -19,7 +19,6 @@ #include "libc/calls/calls.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/log/check.h" #include "libc/mem/gc.internal.h" #include "libc/mem/mem.h" diff --git a/test/libc/fmt/formatbinary64_test.c b/test/libc/fmt/formatbinary64_test.c index 3a42b1d16..5fb26d90e 100644 --- a/test/libc/fmt/formatbinary64_test.c +++ b/test/libc/fmt/formatbinary64_test.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" diff --git a/test/libc/fmt/formatflex64_test.c b/test/libc/fmt/formatflex64_test.c index 1e2db887c..b5340d38e 100644 --- a/test/libc/fmt/formatflex64_test.c +++ b/test/libc/fmt/formatflex64_test.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/str/str.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/fmt/formathex64_test.c b/test/libc/fmt/formathex64_test.c index 9240de080..9cfb89d2d 100644 --- a/test/libc/fmt/formathex64_test.c +++ b/test/libc/fmt/formathex64_test.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" diff --git a/test/libc/fmt/itoa64radix16_test.c b/test/libc/fmt/itoa64radix16_test.c deleted file mode 100644 index 97c4af923..000000000 --- a/test/libc/fmt/itoa64radix16_test.c +++ /dev/null @@ -1,36 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/itoa.h" -#include "libc/testlib/testlib.h" - -TEST(itoa64radix16, test) { - char buf[21]; - EXPECT_EQ(5, uint64toarray_radix16(0x31337, buf)); - EXPECT_STREQ("31337", buf); - EXPECT_EQ(2, uint64toarray_radix16(0x13, buf)); - EXPECT_STREQ("13", buf); - EXPECT_EQ(3, uint64toarray_radix16(0x113, buf)); - EXPECT_STREQ("113", buf); -} - -TEST(itoa64fixed16, test) { - char buf[21]; - EXPECT_EQ(8, uint64toarray_fixed16(0x31337, buf, 32)); - EXPECT_STREQ("00031337", buf); -} diff --git a/test/libc/fmt/strerror_r_test.c b/test/libc/fmt/strerror_r_test.c index 1fe1c8634..6dcba8de2 100644 --- a/test/libc/fmt/strerror_r_test.c +++ b/test/libc/fmt/strerror_r_test.c @@ -16,10 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/bits.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" +#include "libc/intrin/bits.h" #include "libc/str/str.h" #include "libc/testlib/testlib.h" @@ -30,25 +29,25 @@ */ TEST(strerror, e2big) { - EXPECT_STARTSWITH("E2BIG", strerror(E2BIG)); + EXPECT_STARTSWITH("Arg list too long", strerror(E2BIG)); } TEST(strerror, enosys) { - EXPECT_STARTSWITH("ENOSYS", strerror(ENOSYS)); + EXPECT_STARTSWITH("Function not implemented", strerror(ENOSYS)); } TEST(strerror, einval) { - EXPECT_STARTSWITH("EINVAL", strerror(EINVAL)); + EXPECT_STARTSWITH("Invalid argument", strerror(EINVAL)); } TEST(strerror, symbolizingTheseNumbersAsErrorsIsHeresyInUnixStyle) { - EXPECT_STARTSWITH("EUNKNOWN", strerror(0)); + EXPECT_STARTSWITH("No error information", strerror(0)); } TEST(strerror, enotconn_orLinkerIsntUsingLocaleC_orCodeIsOutOfSync) { - EXPECT_STARTSWITH("ENOTCONN", strerror(ENOTCONN)); + EXPECT_STARTSWITH("Transport endpoint is not connected", strerror(ENOTCONN)); } TEST(strerror, exfull_orLinkerIsntUsingLocaleC_orCodeIsOutOfSync) { - EXPECT_STARTSWITH("ETXTBSY", strerror(ETXTBSY)); + EXPECT_STARTSWITH("Text file busy", strerror(ETXTBSY)); } diff --git a/test/libc/fmt/stripexts_test.c b/test/libc/fmt/stripexts_test.c index b5e05b966..69ee3701f 100644 --- a/test/libc/fmt/stripexts_test.c +++ b/test/libc/fmt/stripexts_test.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/libgen.h" #include "libc/mem/gc.internal.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/intrin/strsignal_r_test.c b/test/libc/intrin/strsignal_r_test.c index 412a89c91..fa346875d 100644 --- a/test/libc/intrin/strsignal_r_test.c +++ b/test/libc/intrin/strsignal_r_test.c @@ -27,9 +27,7 @@ TEST(strsignal, test) { EXPECT_STREQ("SIGALRM", strsignal(SIGALRM)); EXPECT_STREQ("SIGUSR1", strsignal(SIGUSR1)); EXPECT_STREQ("SIGSTOP", strsignal(SIGSTOP)); - EXPECT_STREQ("666", strsignal(666)); - EXPECT_STREQ("-1", strsignal(-1)); - EXPECT_STREQ("9001", strsignal(9001)); + EXPECT_STREQ("150", strsignal(150)); } TEST(strsignal, realtime) { diff --git a/test/libc/runtime/mmap_test.c b/test/libc/runtime/mmap_test.c index a3278aee3..23fbb675a 100644 --- a/test/libc/runtime/mmap_test.c +++ b/test/libc/runtime/mmap_test.c @@ -21,7 +21,6 @@ #include "libc/calls/ucontext.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/asan.internal.h" #include "libc/intrin/atomic.h" #include "libc/intrin/bits.h" diff --git a/test/libc/runtime/mprotect_test.c b/test/libc/runtime/mprotect_test.c index c32c8dc15..ad74aa2f7 100644 --- a/test/libc/runtime/mprotect_test.c +++ b/test/libc/runtime/mprotect_test.c @@ -21,7 +21,6 @@ #include "libc/calls/ucontext.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/describeflags.internal.h" #include "libc/log/log.h" #include "libc/mem/gc.internal.h" diff --git a/test/libc/stdio/dtoa_test.c b/test/libc/stdio/dtoa_test.c index fb42dbfb5..492de1350 100644 --- a/test/libc/stdio/dtoa_test.c +++ b/test/libc/stdio/dtoa_test.c @@ -19,7 +19,6 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/sched_param.h" #include "libc/dce.h" -#include "libc/fmt/fmt.h" #include "libc/macros.internal.h" #include "libc/math.h" #include "libc/mem/gc.internal.h" diff --git a/test/libc/stdio/ecvt_test.c b/test/libc/stdio/ecvt_test.c index dc6e9cd02..11dacb24e 100644 --- a/test/libc/stdio/ecvt_test.c +++ b/test/libc/stdio/ecvt_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/mem/gc.h" +#include "libc/stdlib.h" #include "libc/testlib/testlib.h" #include "libc/x/x.h" #include "libc/x/xasprintf.h" diff --git a/test/libc/stdio/fmt_test.c b/test/libc/stdio/fmt_test.c index 7382b877e..bb3a1781e 100644 --- a/test/libc/stdio/fmt_test.c +++ b/test/libc/stdio/fmt_test.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/log/log.h" #include "libc/math.h" diff --git a/test/libc/stdio/palandprintf_test.c b/test/libc/stdio/palandprintf_test.c index 456036b1d..9e2621088 100644 --- a/test/libc/stdio/palandprintf_test.c +++ b/test/libc/stdio/palandprintf_test.c @@ -657,8 +657,6 @@ BENCH(palandprintf, bench) { EZBENCH2("LONG_MIN %ld", donothing, Format("%ld", __veil("r", LONG_MIN))); EZBENCH2("INT128_MIN %jjd", donothing, Format("%jjd", INT128_MIN)); EZBENCH2("INT128_MIN %jjx", donothing, Format("%jjx", INT128_MIN)); - EZBENCH2("int64toarray 23", donothing, FormatInt64(buffer, 23)); - EZBENCH2("int64toarray min", donothing, FormatInt64(buffer, INT_MIN)); #ifdef __x86__ EZBENCH2("%Lf M_PI", donothing, Format("%Lf", __veil("t", M_PI))); EZBENCH2("%Lg M_PI", donothing, Format("%Lg", __veil("t", M_PI))); diff --git a/test/libc/stdio/popen_test.c b/test/libc/stdio/popen_test.c index d54ee6f3f..40c31aaef 100644 --- a/test/libc/stdio/popen_test.c +++ b/test/libc/stdio/popen_test.c @@ -20,7 +20,6 @@ #include "libc/calls/struct/sigaction.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/kprintf.h" #include "libc/limits.h" diff --git a/test/libc/stdio/sprintf_s_test.c b/test/libc/stdio/sprintf_s_test.c index 94637efa2..6e6ee611c 100644 --- a/test/libc/stdio/sprintf_s_test.c +++ b/test/libc/stdio/sprintf_s_test.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/intrin/safemacros.internal.h" #include "libc/mem/gc.h" diff --git a/test/libc/stdio/sscanf_test.c b/test/libc/stdio/sscanf_test.c index e1408c09a..42ce7b60c 100644 --- a/test/libc/stdio/sscanf_test.c +++ b/test/libc/stdio/sscanf_test.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/inttypes.h" #include "libc/limits.h" diff --git a/test/libc/tinymath/powl_test.c b/test/libc/tinymath/powl_test.c index fdf0f6584..2d33cab88 100644 --- a/test/libc/tinymath/powl_test.c +++ b/test/libc/tinymath/powl_test.c @@ -20,7 +20,6 @@ #include "libc/calls/struct/siginfo.h" #include "libc/calls/ucontext.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/macros.internal.h" #include "libc/math.h" #include "libc/mem/gc.h" diff --git a/third_party/argon2/encoding.c b/third_party/argon2/encoding.c index 64d3bb3ed..ade7edbc2 100644 --- a/third_party/argon2/encoding.c +++ b/third_party/argon2/encoding.c @@ -16,7 +16,6 @@ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/argon2/encoding.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/third_party/awk/awkgram.y b/third_party/awk/awkgram.y index a1f1b64fe..8fc170906 100644 --- a/third_party/awk/awkgram.y +++ b/third_party/awk/awkgram.y @@ -23,13 +23,9 @@ THIS SOFTWARE. ****************************************************************/ %{ -#include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" -#include "libc/stdio/stdio.h" -#include "libc/temp.h" -#include "libc/mem/alg.h" -#include "libc/str/str.h" -#include "third_party/awk/awk.h" +#include +#include +#include "awk.h" void checkdup(Node *list, Cell *item); int yywrap(void) { return(1); } diff --git a/third_party/awk/lex.c b/third_party/awk/lex.c index 7ce8db900..e9af4b42b 100644 --- a/third_party/awk/lex.c +++ b/third_party/awk/lex.c @@ -27,7 +27,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" diff --git a/third_party/awk/lib.c b/third_party/awk/lib.c index a7e1b2718..62f9f506f 100644 --- a/third_party/awk/lib.c +++ b/third_party/awk/lib.c @@ -29,7 +29,6 @@ #include "libc/calls/calls.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/math.h" #include "libc/mem/mem.h" diff --git a/third_party/awk/maketab.c b/third_party/awk/maketab.c index 4f30c0064..b91232dc2 100644 --- a/third_party/awk/maketab.c +++ b/third_party/awk/maketab.c @@ -25,7 +25,6 @@ │ THIS SOFTWARE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" @@ -126,13 +125,9 @@ int main(int argc, char *argv[]) char buf[200], name[200], def[200]; enum { TOK_UNKNOWN, TOK_ENUM, TOK_DEFINE } tokentype = TOK_UNKNOWN; - printf("#include \"libc/calls/calls.h\"\n"); - printf("#include \"libc/fmt/fmt.h\"\n"); - printf("#include \"libc/stdio/lock.h\"\n"); - printf("#include \"libc/stdio/stdio.h\"\n"); - printf("#include \"libc/stdio/temp.h\"\n"); - printf("#include \"third_party/awk/awk.h\"\n"); - printf("#include \"third_party/awk/awkgram.tab.h\"\n\n"); + printf("#include \n"); + printf("#include \"awk.h\"\n"); + printf("#include \"awkgram.tab.h\"\n\n"); if (argc != 2) { fprintf(stderr, "usage: maketab YTAB_H\n"); diff --git a/third_party/awk/proctab.c b/third_party/awk/proctab.c index 59c98241d..40ebb509c 100644 --- a/third_party/awk/proctab.c +++ b/third_party/awk/proctab.c @@ -25,7 +25,6 @@ │ THIS SOFTWARE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "third_party/awk/awk.h" #include "third_party/awk/awkgram.tab.h" // clang-format off diff --git a/third_party/awk/run.c b/third_party/awk/run.c index 725892f1b..e4daf9411 100644 --- a/third_party/awk/run.c +++ b/third_party/awk/run.c @@ -30,7 +30,6 @@ #include "libc/calls/weirdtypes.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/third_party/awk/tran.c b/third_party/awk/tran.c index 335cfa402..266a7077c 100644 --- a/third_party/awk/tran.c +++ b/third_party/awk/tran.c @@ -27,7 +27,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #define DEBUG #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/str/str.h" diff --git a/third_party/bzip2/bzip2recover.c b/third_party/bzip2/bzip2recover.c index c54dcec88..917be8360 100644 --- a/third_party/bzip2/bzip2recover.c +++ b/third_party/bzip2/bzip2recover.c @@ -1,6 +1,5 @@ #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/third_party/chibicc/chibicc.h b/third_party/chibicc/chibicc.h index f0ae7f862..46e79cef3 100644 --- a/third_party/chibicc/chibicc.h +++ b/third_party/chibicc/chibicc.h @@ -6,7 +6,6 @@ #include "libc/calls/weirdtypes.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/popcnt.h" #include "libc/limits.h" diff --git a/third_party/chibicc/test/test.h b/third_party/chibicc/test/test.h index ac73acb07..1dc87b292 100644 --- a/third_party/chibicc/test/test.h +++ b/third_party/chibicc/test/test.h @@ -1,4 +1,3 @@ -#include "libc/fmt/fmt.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/third_party/compiler_rt/clear_cache.c b/third_party/compiler_rt/clear_cache.c new file mode 100644 index 000000000..565e8152e --- /dev/null +++ b/third_party/compiler_rt/clear_cache.c @@ -0,0 +1,148 @@ +//===-- clear_cache.c - Implement __clear_cache ---------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include +#include "int_lib.h" + +#if __APPLE__ +#include +#endif + +#if defined(_WIN32) +// Forward declare Win32 APIs since the GCC mode driver does not handle the +// newer SDKs as well as needed. +uint32_t FlushInstructionCache(uintptr_t hProcess, void *lpBaseAddress, + uintptr_t dwSize); +uintptr_t GetCurrentProcess(void); +#endif + +#if defined(__FreeBSD__) && defined(__arm__) +// clang-format off +#include +#include +// clang-format on +#endif + +#if defined(__NetBSD__) && defined(__arm__) +#include +#endif + +#if defined(__OpenBSD__) && defined(__mips__) +// clang-format off +#include +#include +// clang-format on +#endif + +#if defined(__linux__) && defined(__mips__) +#include +#include +#include +#endif + +// The compiler generates calls to __clear_cache() when creating +// trampoline functions on the stack for use with nested functions. +// It is expected to invalidate the instruction cache for the +// specified range. + +void __clear_cache(void *start, void *end) { +#if __i386__ || __x86_64__ || defined(_M_IX86) || defined(_M_X64) +// Intel processors have a unified instruction and data cache +// so there is nothing to do +#elif defined(_WIN32) && (defined(__arm__) || defined(__aarch64__)) + FlushInstructionCache(GetCurrentProcess(), start, end - start); +#elif defined(__arm__) && !defined(__APPLE__) +#if defined(__FreeBSD__) || defined(__NetBSD__) + struct arm_sync_icache_args arg; + + arg.addr = (uintptr_t)start; + arg.len = (uintptr_t)end - (uintptr_t)start; + + sysarch(ARM_SYNC_ICACHE, &arg); +#elif defined(__linux__) +// We used to include asm/unistd.h for the __ARM_NR_cacheflush define, but +// it also brought many other unused defines, as well as a dependency on +// kernel headers to be installed. +// +// This value is stable at least since Linux 3.13 and should remain so for +// compatibility reasons, warranting it's re-definition here. +#define __ARM_NR_cacheflush 0x0f0002 + register int start_reg __asm("r0") = (int)(intptr_t)start; + const register int end_reg __asm("r1") = (int)(intptr_t)end; + const register int flags __asm("r2") = 0; + const register int syscall_nr __asm("r7") = __ARM_NR_cacheflush; + __asm __volatile("svc 0x0" + : "=r"(start_reg) + : "r"(syscall_nr), "r"(start_reg), "r"(end_reg), "r"(flags)); + assert(start_reg == 0 && "Cache flush syscall failed."); +#else + compilerrt_abort(); +#endif +#elif defined(__linux__) && defined(__mips__) + const uintptr_t start_int = (uintptr_t)start; + const uintptr_t end_int = (uintptr_t)end; + syscall(__NR_cacheflush, start, (end_int - start_int), BCACHE); +#elif defined(__mips__) && defined(__OpenBSD__) + cacheflush(start, (uintptr_t)end - (uintptr_t)start, BCACHE); +#elif defined(__aarch64__) && !defined(__APPLE__) + uint64_t xstart = (uint64_t)(uintptr_t)start; + uint64_t xend = (uint64_t)(uintptr_t)end; + uint64_t addr; + + // Get Cache Type Info + uint64_t ctr_el0; + __asm __volatile("mrs %0, ctr_el0" : "=r"(ctr_el0)); + + // dc & ic instructions must use 64bit registers so we don't use + // uintptr_t in case this runs in an IPL32 environment. + const size_t dcache_line_size = 4 << ((ctr_el0 >> 16) & 15); + for (addr = xstart & ~(dcache_line_size - 1); addr < xend; + addr += dcache_line_size) + __asm __volatile("dc cvau, %0" ::"r"(addr)); + __asm __volatile("dsb ish"); + + const size_t icache_line_size = 4 << ((ctr_el0 >> 0) & 15); + for (addr = xstart & ~(icache_line_size - 1); addr < xend; + addr += icache_line_size) + __asm __volatile("ic ivau, %0" ::"r"(addr)); + __asm __volatile("isb sy"); +#elif defined(__powerpc64__) + const size_t line_size = 32; + const size_t len = (uintptr_t)end - (uintptr_t)start; + + const uintptr_t mask = ~(line_size - 1); + const uintptr_t start_line = ((uintptr_t)start) & mask; + const uintptr_t end_line = ((uintptr_t)start + len + line_size - 1) & mask; + + for (uintptr_t line = start_line; line < end_line; line += line_size) + __asm__ volatile("dcbf 0, %0" : : "r"(line)); + __asm__ volatile("sync"); + + for (uintptr_t line = start_line; line < end_line; line += line_size) + __asm__ volatile("icbi 0, %0" : : "r"(line)); + __asm__ volatile("isync"); +#elif defined(__sparc__) + const size_t dword_size = 8; + const size_t len = (uintptr_t)end - (uintptr_t)start; + + const uintptr_t mask = ~(dword_size - 1); + const uintptr_t start_dword = ((uintptr_t)start) & mask; + const uintptr_t end_dword = ((uintptr_t)start + len + dword_size - 1) & mask; + + for (uintptr_t dword = start_dword; dword < end_dword; dword += dword_size) + __asm__ volatile("flush %0" : : "r"(dword)); +#else +#if __APPLE__ + // On Darwin, sys_icache_invalidate() provides this functionality + sys_icache_invalidate(start, end - start); +#else + compilerrt_abort(); +#endif +#endif +} diff --git a/third_party/ctags/args.h b/third_party/ctags/args.h index 5ff862cee..436e11ff8 100644 --- a/third_party/ctags/args.h +++ b/third_party/ctags/args.h @@ -20,7 +20,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/eiffel.c b/third_party/ctags/eiffel.c index 42aa3295d..1b6f56bb9 100644 --- a/third_party/ctags/eiffel.c +++ b/third_party/ctags/eiffel.c @@ -21,7 +21,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/entry.h b/third_party/ctags/entry.h index ab8d0a0e4..413ba3516 100644 --- a/third_party/ctags/entry.h +++ b/third_party/ctags/entry.h @@ -20,7 +20,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/flex.c b/third_party/ctags/flex.c index 72762e113..cc2a27acd 100644 --- a/third_party/ctags/flex.c +++ b/third_party/ctags/flex.c @@ -27,7 +27,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/jscript.c b/third_party/ctags/jscript.c index c199ddff5..719aeb98e 100644 --- a/third_party/ctags/jscript.c +++ b/third_party/ctags/jscript.c @@ -26,7 +26,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/main.h b/third_party/ctags/main.h index 4728a2643..eb8e96658 100644 --- a/third_party/ctags/main.h +++ b/third_party/ctags/main.h @@ -20,7 +20,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/options.c b/third_party/ctags/options.c index 631a2584e..0f259ac67 100644 --- a/third_party/ctags/options.c +++ b/third_party/ctags/options.c @@ -36,7 +36,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/read.h b/third_party/ctags/read.h index b1b07231d..88ad04697 100644 --- a/third_party/ctags/read.h +++ b/third_party/ctags/read.h @@ -26,7 +26,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/sort.c b/third_party/ctags/sort.c index 64c7c54c9..ff70e1afc 100644 --- a/third_party/ctags/sort.c +++ b/third_party/ctags/sort.c @@ -39,7 +39,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/sql.c b/third_party/ctags/sql.c index 1593a6a25..150d5c919 100644 --- a/third_party/ctags/sql.c +++ b/third_party/ctags/sql.c @@ -22,7 +22,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/tex.c b/third_party/ctags/tex.c index 55e8875fe..b41e8f6de 100644 --- a/third_party/ctags/tex.c +++ b/third_party/ctags/tex.c @@ -23,7 +23,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/ctags/vim.c b/third_party/ctags/vim.c index b7b2a6be4..60a632a57 100644 --- a/third_party/ctags/vim.c +++ b/third_party/ctags/vim.c @@ -25,7 +25,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/finger/display.c b/third_party/finger/display.c index f1f48c18e..78faecad4 100644 --- a/third_party/finger/display.c +++ b/third_party/finger/display.c @@ -37,7 +37,6 @@ #include "libc/calls/struct/termios.h" #include "libc/calls/struct/winsize.h" #include "libc/calls/termios.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/sysv/consts/fileno.h" diff --git a/third_party/finger/finger.c b/third_party/finger/finger.c index 39c1e0dc8..0972414ae 100644 --- a/third_party/finger/finger.c +++ b/third_party/finger/finger.c @@ -37,7 +37,6 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/stat.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/mem/mem.h" #include "libc/nt/struct/msg.h" diff --git a/third_party/finger/lprint.c b/third_party/finger/lprint.c index 897f9deb2..3a9220028 100644 --- a/third_party/finger/lprint.c +++ b/third_party/finger/lprint.c @@ -35,7 +35,6 @@ */ #include "libc/calls/calls.h" #include "libc/calls/struct/stat.h" -#include "libc/fmt/fmt.h" #include "libc/paths.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/third_party/ggml/ggml.c b/third_party/ggml/ggml.c index ae5cba95d..80f1b8af5 100644 --- a/third_party/ggml/ggml.c +++ b/third_party/ggml/ggml.c @@ -30,7 +30,6 @@ #include "libc/atomic.h" #include "libc/calls/calls.h" #include "libc/calls/struct/timespec.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/atomic.h" #include "libc/inttypes.h" #include "libc/literal.h" diff --git a/third_party/ggml/llama_util.h b/third_party/ggml/llama_util.h index c0f6f9746..533b1f26f 100755 --- a/third_party/ggml/llama_util.h +++ b/third_party/ggml/llama_util.h @@ -3,7 +3,6 @@ #define LLAMA_UTIL_H #include "libc/calls/struct/rlimit.h" #include "libc/dce.h" -#include "libc/fmt/fmt.h" #include "libc/runtime/sysconf.h" #include "libc/str/str.h" #include "libc/sysv/consts/madv.h" diff --git a/third_party/ggml/main.cc b/third_party/ggml/main.cc index 969cdb559..37d17d36f 100644 --- a/third_party/ggml/main.cc +++ b/third_party/ggml/main.cc @@ -31,7 +31,6 @@ #include "libc/calls/struct/sched_param.h" #include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/stat.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/log/log.h" #include "libc/macros.internal.h" diff --git a/third_party/hiredis/net.c b/third_party/hiredis/net.c index 79b487ae5..e4309b20e 100644 --- a/third_party/hiredis/net.c +++ b/third_party/hiredis/net.c @@ -68,7 +68,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/hiredis/read.h b/third_party/hiredis/read.h index 2cca2d312..d2010edfc 100644 --- a/third_party/hiredis/read.h +++ b/third_party/hiredis/read.h @@ -36,7 +36,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" /* for size_t */ diff --git a/third_party/hiredis/sds.c b/third_party/hiredis/sds.c index b2e8bcdcc..8b0036cc6 100644 --- a/third_party/hiredis/sds.c +++ b/third_party/hiredis/sds.c @@ -34,7 +34,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" @@ -1145,7 +1144,6 @@ void sds_free(void *ptr) { s_free(ptr); } #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/libcxx/__bsd_locale_fallbacks.h b/third_party/libcxx/__bsd_locale_fallbacks.h index 6faca54bb..69217accf 100644 --- a/third_party/libcxx/__bsd_locale_fallbacks.h +++ b/third_party/libcxx/__bsd_locale_fallbacks.h @@ -15,7 +15,6 @@ #include "third_party/libcxx/stdlib.h" #include "libc/str/unicode.h" -#include "libc/fmt/fmt.h" #include "libc/str/locale.h" #include "third_party/libcxx/memory" #include "third_party/libcxx/__locale" diff --git a/third_party/libcxx/stdio.h b/third_party/libcxx/stdio.h index 6169adaf9..c16c2d66e 100644 --- a/third_party/libcxx/stdio.h +++ b/third_party/libcxx/stdio.h @@ -102,10 +102,8 @@ void perror(const char* s); #pragma GCC system_header #endif -#include "libc/fmt/fmt.h" #include "libc/calls/calls.h" #include "libc/temp.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #ifdef __cplusplus diff --git a/third_party/lua/lunix.c b/third_party/lua/lunix.c index c7b85e110..a16b92c1f 100644 --- a/third_party/lua/lunix.c +++ b/third_party/lua/lunix.c @@ -43,7 +43,6 @@ #include "libc/dns/dns.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/intrin/atomic.h" @@ -53,6 +52,7 @@ #include "libc/log/log.h" #include "libc/macros.internal.h" #include "libc/mem/mem.h" +#include "libc/nt/process.h" #include "libc/nt/runtime.h" #include "libc/nt/synchronization.h" #include "libc/runtime/clktck.h" @@ -2628,7 +2628,8 @@ static int LuaUnixErrnoToString(lua_State *L) { struct UnixErrno *e; e = GetUnixErrno(L); if (e->call) { - strerror_wr(e->errno_, e->winerr, msg, sizeof(msg)); + if (IsWindows()) SetLastError(e->winerr); + strerror_r(e->errno_, msg, sizeof(msg)); lua_pushfstring(L, "%s() failed: %s", e->call, msg); } else { lua_pushstring(L, _strerrno(e->errno_)); diff --git a/third_party/lz4cli/util.h b/third_party/lz4cli/util.h index 3526c91cd..c1997568b 100644 --- a/third_party/lz4cli/util.h +++ b/third_party/lz4cli/util.h @@ -38,7 +38,6 @@ extern "C" { #include "libc/calls/calls.h" #include "libc/time/time.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/time/struct/utimbuf.h" #include "libc/calls/struct/stat.h" #include "libc/calls/struct/dirent.h" diff --git a/third_party/make/error.c b/third_party/make/error.c index a2aac18b8..edcf84228 100644 --- a/third_party/make/error.c +++ b/third_party/make/error.c @@ -23,8 +23,6 @@ #include "third_party/make/config.h" #include "third_party/make/error.h" #include "libc/stdio/stdio.h" -#include "libc/fmt/fmt.h" -#include "libc/fmt/fmt.h" #include "libc/str/str.h" #include "libc/runtime/runtime.h" #include "third_party/make/stdio.h" diff --git a/third_party/make/job.c b/third_party/make/job.c index 198648209..688393068 100644 --- a/third_party/make/job.c +++ b/third_party/make/job.c @@ -35,7 +35,6 @@ this program. If not, see . */ #include "libc/elf/struct/ehdr.h" #include "libc/elf/struct/phdr.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/fmt/libgen.h" #include "libc/intrin/bits.h" diff --git a/third_party/make/makeint.inc b/third_party/make/makeint.inc index d3d9e02a4..e8d9f0a1f 100644 --- a/third_party/make/makeint.inc +++ b/third_party/make/makeint.inc @@ -26,7 +26,6 @@ this program. If not, see . */ #include "libc/calls/weirdtypes.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/log/log.h" #include "libc/macros.internal.h" @@ -35,7 +34,6 @@ this program. If not, see . */ #include "libc/mem/mem.h" #include "libc/runtime/stack.h" #include "libc/stdio/stdio.h" -#include "libc/temp.h" #include "libc/str/locale.h" #include "libc/str/str.h" #include "libc/sysv/consts/f.h" @@ -48,6 +46,7 @@ this program. If not, see . */ #include "libc/sysv/consts/sa.h" #include "libc/sysv/consts/sicode.h" #include "libc/sysv/consts/w.h" +#include "libc/temp.h" #include "libc/time/struct/tm.h" #include "libc/time/time.h" #include "third_party/gdtoa/gdtoa.h" diff --git a/third_party/maxmind/maxminddb.c b/third_party/maxmind/maxminddb.c index c212acd4b..d20fc0f6d 100644 --- a/third_party/maxmind/maxminddb.c +++ b/third_party/maxmind/maxminddb.c @@ -22,7 +22,6 @@ #include "libc/calls/weirdtypes.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/inttypes.h" #include "libc/limits.h" diff --git a/third_party/mbedtls/error.c b/third_party/mbedtls/error.c index 21d91c2d3..69a372b35 100644 --- a/third_party/mbedtls/error.c +++ b/third_party/mbedtls/error.c @@ -16,7 +16,6 @@ │ limitations under the License. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/mbedtls/error.h" -#include "libc/fmt/fmt.h" #include "libc/str/str.h" #include "third_party/mbedtls/aes.h" #include "third_party/mbedtls/asn1.h" diff --git a/third_party/mbedtls/oid.c b/third_party/mbedtls/oid.c index d31d7b9d9..204b40e23 100644 --- a/third_party/mbedtls/oid.c +++ b/third_party/mbedtls/oid.c @@ -15,7 +15,6 @@ │ See the License for the specific language governing permissions and │ │ limitations under the License. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/str/str.h" #include "third_party/mbedtls/common.h" #include "third_party/mbedtls/error.h" diff --git a/third_party/mbedtls/platform.h b/third_party/mbedtls/platform.h index f2b2cdae9..63ac793df 100644 --- a/third_party/mbedtls/platform.h +++ b/third_party/mbedtls/platform.h @@ -2,7 +2,6 @@ #define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_PLATFORM_H_ #include "libc/assert.h" #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/likely.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/third_party/mbedtls/test/lib.c b/third_party/mbedtls/test/lib.c index 3d11599bd..63b70449c 100644 --- a/third_party/mbedtls/test/lib.c +++ b/third_party/mbedtls/test/lib.c @@ -22,7 +22,6 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/intrin/describebacktrace.internal.h" #include "libc/intrin/safemacros.internal.h" diff --git a/third_party/mbedtls/x509.c b/third_party/mbedtls/x509.c index a9e4fa9cc..ff5b99faa 100644 --- a/third_party/mbedtls/x509.c +++ b/third_party/mbedtls/x509.c @@ -15,7 +15,6 @@ │ See the License for the specific language governing permissions and │ │ limitations under the License. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/time/struct/tm.h" diff --git a/third_party/mbedtls/x509_crt.c b/third_party/mbedtls/x509_crt.c index 26e8e502b..62620e998 100644 --- a/third_party/mbedtls/x509_crt.c +++ b/third_party/mbedtls/x509_crt.c @@ -18,7 +18,6 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/dirent.h" #include "libc/calls/struct/stat.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/bits.h" #include "libc/limits.h" #include "libc/log/log.h" diff --git a/third_party/musl/crypt_sha256.c b/third_party/musl/crypt_sha256.c index 6777a2084..6e254d270 100644 --- a/third_party/musl/crypt_sha256.c +++ b/third_party/musl/crypt_sha256.c @@ -28,7 +28,6 @@ #include "libc/mem/alg.h" #include "libc/calls/calls.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/literal.h" #include "libc/mem/mem.h" diff --git a/third_party/musl/crypt_sha512.c b/third_party/musl/crypt_sha512.c index 55f4d3078..6d25ccef8 100644 --- a/third_party/musl/crypt_sha512.c +++ b/third_party/musl/crypt_sha512.c @@ -28,7 +28,6 @@ #include "libc/mem/alg.h" #include "libc/calls/calls.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/literal.h" #include "libc/mem/mem.h" diff --git a/third_party/musl/mntent.c b/third_party/musl/mntent.c index 4770c1cf6..271c3c963 100644 --- a/third_party/musl/mntent.c +++ b/third_party/musl/mntent.c @@ -27,7 +27,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/third_party/python/Lib/test/test_doctest.py b/third_party/python/Lib/test/test_doctest.py index d20718c4b..8214fa15a 100644 --- a/third_party/python/Lib/test/test_doctest.py +++ b/third_party/python/Lib/test/test_doctest.py @@ -2921,7 +2921,7 @@ Invalid file name: >>> print(normalize(err)) # doctest: +ELLIPSIS Traceback (most recent call last): ... - FileNotFoundError: [Errno 2] ENOENT... + FileNotFoundError: [Errno 2] No such file or directory... Invalid doctest option: diff --git a/third_party/python/Modules/_datetimemodule.c b/third_party/python/Modules/_datetimemodule.c index 7e61bf5b7..d449af4d4 100644 --- a/third_party/python/Modules/_datetimemodule.c +++ b/third_party/python/Modules/_datetimemodule.c @@ -6,7 +6,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/math.h" #include "libc/time/struct/tm.h" #include "third_party/python/Include/abstract.h" diff --git a/third_party/python/Modules/_decimal/_decimal.c b/third_party/python/Modules/_decimal/_decimal.c index cab874903..2a6e182b2 100644 --- a/third_party/python/Modules/_decimal/_decimal.c +++ b/third_party/python/Modules/_decimal/_decimal.c @@ -27,7 +27,6 @@ │ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, │ │ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "third_party/python/Include/abstract.h" #include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/complexobject.h" diff --git a/third_party/python/Modules/_decimal/libmpdec/io.c b/third_party/python/Modules/_decimal/libmpdec/io.c index 7672c85eb..ee1e5d8e1 100644 --- a/third_party/python/Modules/_decimal/libmpdec/io.c +++ b/third_party/python/Modules/_decimal/libmpdec/io.c @@ -28,7 +28,6 @@ │ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/str/locale.h" #include "libc/str/unicode.h" #include "third_party/python/Modules/_decimal/libmpdec/bits.h" diff --git a/third_party/python/Modules/_testcapimodule.c b/third_party/python/Modules/_testcapimodule.c index 1e14beb61..f1ae03586 100644 --- a/third_party/python/Modules/_testcapimodule.c +++ b/third_party/python/Modules/_testcapimodule.c @@ -9,7 +9,6 @@ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/math.h" #include "libc/mem/mem.h" diff --git a/third_party/python/Modules/pyexpat.c b/third_party/python/Modules/pyexpat.c index a3a8dab2d..85628b5d0 100644 --- a/third_party/python/Modules/pyexpat.c +++ b/third_party/python/Modules/pyexpat.c @@ -5,7 +5,6 @@ │ https://docs.python.org/3/license.html │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/python/Include/pyexpat.h" -#include "libc/fmt/fmt.h" #include "third_party/python/Include/abstract.h" #include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/bytearrayobject.h" diff --git a/third_party/python/Modules/unicodedata.c b/third_party/python/Modules/unicodedata.c index 279c7d273..a380a4f9f 100644 --- a/third_party/python/Modules/unicodedata.c +++ b/third_party/python/Modules/unicodedata.c @@ -6,7 +6,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #define PY_SSIZE_T_CLEAN #include "third_party/python/Modules/unicodedata.h" -#include "libc/fmt/fmt.h" #include "libc/nexgen32e/kompressor.h" #include "third_party/python/Include/floatobject.h" #include "third_party/python/Include/import.h" diff --git a/third_party/python/Modules/unicodedata_getcode.c b/third_party/python/Modules/unicodedata_getcode.c index 187de8ee7..31adedc68 100644 --- a/third_party/python/Modules/unicodedata_getcode.c +++ b/third_party/python/Modules/unicodedata_getcode.c @@ -4,7 +4,6 @@ │ Python 3 │ │ https://docs.python.org/3/license.html │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "third_party/python/Include/pyctype.h" #include "third_party/python/Include/pyerrors.h" #include "third_party/python/Include/pymacro.h" diff --git a/third_party/python/Objects/bytesobject.c b/third_party/python/Objects/bytesobject.c index 38bdbbbc6..32a76d996 100644 --- a/third_party/python/Objects/bytesobject.c +++ b/third_party/python/Objects/bytesobject.c @@ -6,7 +6,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #define PY_SSIZE_T_CLEAN #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "third_party/python/Include/abstract.h" #include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/bytearrayobject.h" diff --git a/third_party/python/Objects/obmalloc.c b/third_party/python/Objects/obmalloc.c index e9166b5b8..a473d65c4 100644 --- a/third_party/python/Objects/obmalloc.c +++ b/third_party/python/Objects/obmalloc.c @@ -7,7 +7,6 @@ #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/dce.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/asan.internal.h" #include "libc/intrin/bits.h" #include "libc/mem/mem.h" diff --git a/third_party/python/Objects/typeobject.c b/third_party/python/Objects/typeobject.c index 7b3603f41..f3231c164 100644 --- a/third_party/python/Objects/typeobject.c +++ b/third_party/python/Objects/typeobject.c @@ -6,7 +6,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/intrin/likely.h" -#include "libc/fmt/fmt.h" #include "libc/log/countbranch.h" #include "third_party/python/Include/abstract.h" #include "third_party/python/Include/boolobject.h" diff --git a/third_party/python/Objects/unicodeobject.c b/third_party/python/Objects/unicodeobject.c index 7731b97c7..a784133d1 100644 --- a/third_party/python/Objects/unicodeobject.c +++ b/third_party/python/Objects/unicodeobject.c @@ -8,7 +8,6 @@ #include "third_party/python/Include/unicodeobject.h" #include "libc/assert.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/likely.h" #include "libc/intrin/weaken.h" #include "libc/log/countbranch.h" diff --git a/third_party/python/Python/ast.c b/third_party/python/Python/ast.c index 303328153..df287cd85 100644 --- a/third_party/python/Python/ast.c +++ b/third_party/python/Python/ast.c @@ -7,7 +7,6 @@ #include "third_party/python/Include/ast.h" #include "libc/assert.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "third_party/python/Include/Python-ast.h" #include "third_party/python/Include/abstract.h" #include "third_party/python/Include/boolobject.h" diff --git a/third_party/python/Python/mysnprintf.c b/third_party/python/Python/mysnprintf.c index 9dcc8fb62..58c6f2df4 100644 --- a/third_party/python/Python/mysnprintf.c +++ b/third_party/python/Python/mysnprintf.c @@ -5,7 +5,6 @@ │ https://docs.python.org/3/license.html │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "third_party/python/Include/pyerrors.h" /* clang-format off */ diff --git a/third_party/python/Python/pystrtod.c b/third_party/python/Python/pystrtod.c index 3038fdf6a..9071fd3e9 100644 --- a/third_party/python/Python/pystrtod.c +++ b/third_party/python/Python/pystrtod.c @@ -6,7 +6,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/str/locale.h" #include "third_party/python/Include/dtoa.h" #include "third_party/python/Include/object.h" diff --git a/third_party/quickjs/atom.c b/third_party/quickjs/atom.c index 0eaad8979..d5ffafb63 100644 --- a/third_party/quickjs/atom.c +++ b/third_party/quickjs/atom.c @@ -23,7 +23,6 @@ * THE SOFTWARE. */ #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "libc/str/str.h" #include "third_party/quickjs/internal.h" #include "third_party/quickjs/libregexp.h" diff --git a/third_party/quickjs/cutils.c b/third_party/quickjs/cutils.c index 7d2483381..c4044bb99 100644 --- a/third_party/quickjs/cutils.c +++ b/third_party/quickjs/cutils.c @@ -22,7 +22,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "third_party/quickjs/cutils.h" diff --git a/third_party/quickjs/date.c b/third_party/quickjs/date.c index a5b0716df..58700a170 100644 --- a/third_party/quickjs/date.c +++ b/third_party/quickjs/date.c @@ -24,7 +24,6 @@ */ #include "libc/calls/struct/timeval.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/time/struct/tm.h" #include "libc/time/time.h" #include "third_party/quickjs/internal.h" diff --git a/third_party/quickjs/dbuf.c b/third_party/quickjs/dbuf.c index f57502827..ede819ab0 100644 --- a/third_party/quickjs/dbuf.c +++ b/third_party/quickjs/dbuf.c @@ -22,7 +22,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "libc/fmt/fmt.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "third_party/quickjs/internal.h" diff --git a/third_party/quickjs/err.c b/third_party/quickjs/err.c index 57cda4e96..8a4507a67 100644 --- a/third_party/quickjs/err.c +++ b/third_party/quickjs/err.c @@ -22,7 +22,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "libc/fmt/fmt.h" #include "third_party/quickjs/internal.h" #include "third_party/quickjs/leb128.h" #include "third_party/quickjs/libregexp.h" diff --git a/third_party/quickjs/json.c b/third_party/quickjs/json.c index dfceceaf2..87ad290a7 100644 --- a/third_party/quickjs/json.c +++ b/third_party/quickjs/json.c @@ -23,7 +23,6 @@ * THE SOFTWARE. */ #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "libc/str/str.h" #include "third_party/quickjs/internal.h" #include "third_party/quickjs/libregexp.h" diff --git a/third_party/quickjs/libregexp.c b/third_party/quickjs/libregexp.c index b390548e1..54475c52c 100644 --- a/third_party/quickjs/libregexp.c +++ b/third_party/quickjs/libregexp.c @@ -23,7 +23,6 @@ */ #include "libc/assert.h" #include "libc/intrin/likely.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/mem/alloca.h" #include "libc/runtime/runtime.h" diff --git a/third_party/quickjs/parse.c b/third_party/quickjs/parse.c index 4532fc754..13e9929d2 100644 --- a/third_party/quickjs/parse.c +++ b/third_party/quickjs/parse.c @@ -23,7 +23,6 @@ * THE SOFTWARE. */ #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" #include "third_party/quickjs/internal.h" diff --git a/third_party/quickjs/qjsc.c b/third_party/quickjs/qjsc.c index d2dc01070..b6fbb7b10 100644 --- a/third_party/quickjs/qjsc.c +++ b/third_party/quickjs/qjsc.c @@ -25,7 +25,6 @@ #include "libc/calls/calls.h" #include "libc/dce.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/third_party/quickjs/quickjs-libc.c b/third_party/quickjs/quickjs-libc.c index fc30f9584..c1e43fa47 100644 --- a/third_party/quickjs/quickjs-libc.c +++ b/third_party/quickjs/quickjs-libc.c @@ -33,7 +33,6 @@ #include "libc/calls/termios.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/mem/mem.h" #include "libc/nt/synchronization.h" diff --git a/third_party/quickjs/quickjs.c b/third_party/quickjs/quickjs.c index 97e26f409..1ecabea6e 100644 --- a/third_party/quickjs/quickjs.c +++ b/third_party/quickjs/quickjs.c @@ -27,8 +27,6 @@ #include "third_party/quickjs/list.h" #include "third_party/quickjs/quickjs.h" #include "libc/assert.h" -#include "libc/fmt/fmt.h" -#include "libc/fmt/fmt.h" #include "libc/inttypes.h" #include "libc/mem/alloca.h" #include "third_party/gdtoa/gdtoa.h" diff --git a/third_party/quickjs/run-test262.c b/third_party/quickjs/run-test262.c index 3d453ec6e..1d01d2585 100644 --- a/third_party/quickjs/run-test262.c +++ b/third_party/quickjs/run-test262.c @@ -26,7 +26,6 @@ #include "libc/calls/struct/stat.h" #include "libc/calls/weirdtypes.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/mem/alg.h" #include "libc/mem/mem.h" diff --git a/third_party/quickjs/str.c b/third_party/quickjs/str.c index d658d4eb1..542f629cf 100644 --- a/third_party/quickjs/str.c +++ b/third_party/quickjs/str.c @@ -25,7 +25,6 @@ #include "libc/str/str.h" #include "libc/assert.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/runtime/fenv.h" #include "third_party/gdtoa/gdtoa.h" #include "third_party/quickjs/internal.h" diff --git a/third_party/quickjs/unicode_gen.c b/third_party/quickjs/unicode_gen.c index 6d0b4a37c..47aa908ec 100644 --- a/third_party/quickjs/unicode_gen.c +++ b/third_party/quickjs/unicode_gen.c @@ -24,7 +24,6 @@ */ #include "libc/assert.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/mem/alg.h" #include "libc/mem/mem.h" diff --git a/third_party/sed/compile.c b/third_party/sed/compile.c index bddc8d870..7cf416571 100644 --- a/third_party/sed/compile.c +++ b/third_party/sed/compile.c @@ -62,7 +62,6 @@ #include "libc/sysv/consts/_posix.h" #include "third_party/regex/regex.h" #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "libc/mem/alg.h" diff --git a/third_party/sed/main.c b/third_party/sed/main.c index 39a132136..f500969fc 100644 --- a/third_party/sed/main.c +++ b/third_party/sed/main.c @@ -35,7 +35,6 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/stat.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/libgen.h" #include "libc/log/bsd.h" #include "libc/runtime/runtime.h" diff --git a/third_party/sqlite3/shell.c b/third_party/sqlite3/shell.c index 670e17fae..8bed834c1 100644 --- a/third_party/sqlite3/shell.c +++ b/third_party/sqlite3/shell.c @@ -117,7 +117,6 @@ typedef unsigned short int u16; #include "libc/assert.h" #include "libc/errno.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/conv.h" #include "libc/mem/mem.h" #include "libc/str/str.h" diff --git a/third_party/stb/stb_image_write.c b/third_party/stb/stb_image_write.c index 000ebe7c4..63187511d 100644 --- a/third_party/stb/stb_image_write.c +++ b/third_party/stb/stb_image_write.c @@ -122,7 +122,6 @@ #include "dsp/core/core.h" #include "libc/assert.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/macros.internal.h" #include "libc/math.h" diff --git a/third_party/tidy/attrs.c b/third_party/tidy/attrs.c index c6d90ea9b..576fba320 100644 --- a/third_party/tidy/attrs.c +++ b/third_party/tidy/attrs.c @@ -11,7 +11,6 @@ #include "third_party/tidy/message.h" #include "third_party/tidy/tmbstr.h" #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "third_party/tidy/utf8.h" #if __GNUC__ >= 11 /* [jart] this one looks legit */ diff --git a/third_party/tidy/entities.c b/third_party/tidy/entities.c index 0f96ab44c..bec420ea0 100644 --- a/third_party/tidy/entities.c +++ b/third_party/tidy/entities.c @@ -13,7 +13,6 @@ #include "third_party/tidy/entities.h" #include "third_party/tidy/tidy-int.h" #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "third_party/tidy/tmbstr.h" struct _entity; diff --git a/third_party/tidy/lexer.c b/third_party/tidy/lexer.c index 1d5143918..821a530df 100644 --- a/third_party/tidy/lexer.c +++ b/third_party/tidy/lexer.c @@ -41,7 +41,6 @@ #include "third_party/tidy/utf8.h" #include "third_party/tidy/streamio.h" #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "third_party/tidy/sprtf.h" #if defined(ENABLE_DEBUG_LOG) diff --git a/third_party/tidy/tidy.c b/third_party/tidy/tidy.c index d445a90ec..f241aae6a 100644 --- a/third_party/tidy/tidy.c +++ b/third_party/tidy/tidy.c @@ -23,7 +23,6 @@ #include "third_party/tidy/tidy.h" #include "third_party/tidy/tidybuffio.h" #include "libc/assert.h" -#include "libc/fmt/fmt.h" #include "libc/mem/alg.h" #include "libc/str/str.h" #include "libc/runtime/runtime.h" diff --git a/third_party/tidy/tmbstr.c b/third_party/tidy/tmbstr.c index bc5565c67..24ea7eb3f 100644 --- a/third_party/tidy/tmbstr.c +++ b/third_party/tidy/tmbstr.c @@ -8,7 +8,6 @@ #include "third_party/tidy/forward.h" #include "third_party/tidy/tmbstr.h" -#include "libc/fmt/fmt.h" #include "third_party/tidy/lexer.h" /* like strdup but using an allocator */ diff --git a/third_party/unzip/unzpriv.h b/third_party/unzip/unzpriv.h index 4cbc79356..2d16250a4 100644 --- a/third_party/unzip/unzpriv.h +++ b/third_party/unzip/unzpriv.h @@ -30,7 +30,6 @@ #include "libc/errno.h" #include "third_party/unzip/unzpriv.h" #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "third_party/zip/crypt.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/third_party/xxhash/cli/xsum_os_specific.c b/third_party/xxhash/cli/xsum_os_specific.c index 567c6151f..767545184 100644 --- a/third_party/xxhash/cli/xsum_os_specific.c +++ b/third_party/xxhash/cli/xsum_os_specific.c @@ -91,7 +91,6 @@ #include "libc/nt/winsock.h" /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/cli/xsum_os_specific.h b/third_party/xxhash/cli/xsum_os_specific.h index 902e38abf..e03aded7d 100644 --- a/third_party/xxhash/cli/xsum_os_specific.h +++ b/third_party/xxhash/cli/xsum_os_specific.h @@ -30,7 +30,6 @@ #include "third_party/xxhash/cli/xsum_config.h" #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/bench/benchfn.c b/third_party/xxhash/tests/bench/benchfn.c index 0965e3a89..ea13ef6d0 100644 --- a/third_party/xxhash/tests/bench/benchfn.c +++ b/third_party/xxhash/tests/bench/benchfn.c @@ -56,7 +56,6 @@ #if defined(DEBUG) && (DEBUG >= 1) #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/bench/bhDisplay.c b/third_party/xxhash/tests/bench/bhDisplay.c index cc85643ed..8d244aea0 100644 --- a/third_party/xxhash/tests/bench/bhDisplay.c +++ b/third_party/xxhash/tests/bench/bhDisplay.c @@ -45,7 +45,6 @@ #include "third_party/musl/rand48.h" /* rand */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/bench/main.c b/third_party/xxhash/tests/bench/main.c index a468e1b88..04128291c 100644 --- a/third_party/xxhash/tests/bench/main.c +++ b/third_party/xxhash/tests/bench/main.c @@ -29,7 +29,6 @@ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/bench/timefn.c b/third_party/xxhash/tests/bench/timefn.c index 82fb05a80..fa7158a9a 100644 --- a/third_party/xxhash/tests/bench/timefn.c +++ b/third_party/xxhash/tests/bench/timefn.c @@ -38,7 +38,6 @@ #include "third_party/musl/rand48.h" /* abort */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" @@ -125,7 +124,6 @@ PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) #include "third_party/musl/rand48.h" /* abort */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/collisions/main.c b/third_party/xxhash/tests/collisions/main.c index 6f151364b..4cbfa75e1 100644 --- a/third_party/xxhash/tests/collisions/main.c +++ b/third_party/xxhash/tests/collisions/main.c @@ -65,7 +65,6 @@ #include "libc/str/str.h" /* memset */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/collisions/threading.h b/third_party/xxhash/tests/collisions/threading.h index d984357db..90f849bfb 100644 --- a/third_party/xxhash/tests/collisions/threading.h +++ b/third_party/xxhash/tests/collisions/threading.h @@ -63,7 +63,6 @@ extern "C" { #include "libc/nt/winsock.h" #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/generate_unicode_test.c b/third_party/xxhash/tests/generate_unicode_test.c index 3476be2d2..fb25de935 100644 --- a/third_party/xxhash/tests/generate_unicode_test.c +++ b/third_party/xxhash/tests/generate_unicode_test.c @@ -42,7 +42,6 @@ #define _CRT_SECURE_NO_WARNINGS /* Silence warnings on MSVC */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/tests/multiInclude.c b/third_party/xxhash/tests/multiInclude.c index dd875fc66..bf15cf353 100644 --- a/third_party/xxhash/tests/multiInclude.c +++ b/third_party/xxhash/tests/multiInclude.c @@ -28,7 +28,6 @@ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/xxh_x86dispatch.c b/third_party/xxhash/xxh_x86dispatch.c index a349ca63c..04fc36c7c 100644 --- a/third_party/xxhash/xxh_x86dispatch.c +++ b/third_party/xxhash/xxh_x86dispatch.c @@ -200,7 +200,6 @@ extern "C" { /* debug logging */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/xxhash/xxhash.h b/third_party/xxhash/xxhash.h index 15e5c7a0c..5351be459 100644 --- a/third_party/xxhash/xxhash.h +++ b/third_party/xxhash/xxhash.h @@ -144,7 +144,6 @@ * @code{.c} * #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" @@ -1360,7 +1359,6 @@ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128(XXH_NOESCAPE const void* data, siz * @code{.c} * #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zip/tailor.h b/third_party/zip/tailor.h index 604f07bbe..73a6c79b4 100644 --- a/third_party/zip/tailor.h +++ b/third_party/zip/tailor.h @@ -223,7 +223,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/zip/zip.c b/third_party/zip/zip.c index eb349a993..3b66255de 100644 --- a/third_party/zip/zip.c +++ b/third_party/zip/zip.c @@ -88,7 +88,6 @@ #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/zlib/inflate.c b/third_party/zlib/inflate.c index 2cec2b3bc..c809f60eb 100644 --- a/third_party/zlib/inflate.c +++ b/third_party/zlib/inflate.c @@ -330,7 +330,6 @@ struct inflate_state FAR *state; #include "libc/calls/calls.h" #include "libc/stdio/dprintf.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "third_party/musl/tempnam.h" diff --git a/third_party/zlib/trees.c b/third_party/zlib/trees.c index 84564458b..5ba990198 100644 --- a/third_party/zlib/trees.c +++ b/third_party/zlib/trees.c @@ -7,7 +7,6 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ #include "libc/calls/calls.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" #include "libc/str/str.h" diff --git a/third_party/zstd/lib/common/xxhash.h b/third_party/zstd/lib/common/xxhash.h index b7894a9e2..f31e8b3aa 100644 --- a/third_party/zstd/lib/common/xxhash.h +++ b/third_party/zstd/lib/common/xxhash.h @@ -437,7 +437,6 @@ XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_ * @code{.c} * #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/lib/common/zstd_deps.h b/third_party/zstd/lib/common/zstd_deps.h index b27353306..bde8505f4 100644 --- a/third_party/zstd/lib/common/zstd_deps.h +++ b/third_party/zstd/lib/common/zstd_deps.h @@ -115,7 +115,6 @@ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/lib/compress/zstdmt_compress.c b/third_party/zstd/lib/compress/zstdmt_compress.c index 20907af27..51632d108 100644 --- a/third_party/zstd/lib/compress/zstdmt_compress.c +++ b/third_party/zstd/lib/compress/zstdmt_compress.c @@ -43,7 +43,6 @@ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/lib/dictBuilder/cover.c b/third_party/zstd/lib/dictBuilder/cover.c index ddd966723..43582c85a 100644 --- a/third_party/zstd/lib/dictBuilder/cover.c +++ b/third_party/zstd/lib/dictBuilder/cover.c @@ -24,7 +24,6 @@ ***************************************/ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/lib/dictBuilder/cover.h b/third_party/zstd/lib/dictBuilder/cover.h index 0a620442b..512d216c7 100644 --- a/third_party/zstd/lib/dictBuilder/cover.h +++ b/third_party/zstd/lib/dictBuilder/cover.h @@ -15,7 +15,6 @@ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/lib/dictBuilder/divsufsort.c b/third_party/zstd/lib/dictBuilder/divsufsort.c index 1f87fe606..390f1a5fd 100644 --- a/third_party/zstd/lib/dictBuilder/divsufsort.c +++ b/third_party/zstd/lib/dictBuilder/divsufsort.c @@ -40,7 +40,6 @@ #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/lib/dictBuilder/fastcover.c b/third_party/zstd/lib/dictBuilder/fastcover.c index c4c8860b5..1d29d1f56 100644 --- a/third_party/zstd/lib/dictBuilder/fastcover.c +++ b/third_party/zstd/lib/dictBuilder/fastcover.c @@ -14,7 +14,6 @@ ***************************************/ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/lib/dictBuilder/zdict.c b/third_party/zstd/lib/dictBuilder/zdict.c index 314f1d435..68a2e9eda 100644 --- a/third_party/zstd/lib/dictBuilder/zdict.c +++ b/third_party/zstd/lib/dictBuilder/zdict.c @@ -57,7 +57,6 @@ #include "libc/str/str.h" /* memset */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/benchfn.c b/third_party/zstd/programs/benchfn.c index 66fe542ac..2e39df3fa 100644 --- a/third_party/zstd/programs/benchfn.c +++ b/third_party/zstd/programs/benchfn.c @@ -55,7 +55,6 @@ #if defined(DEBUG) && (DEBUG >= 1) #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/benchzstd.c b/third_party/zstd/programs/benchzstd.c index dab5f1643..d40f94cb8 100644 --- a/third_party/zstd/programs/benchzstd.c +++ b/third_party/zstd/programs/benchzstd.c @@ -43,7 +43,6 @@ #include "libc/str/str.h" /* memset, strerror */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/datagen.c b/third_party/zstd/programs/datagen.c index e3351a214..a8aac7a38 100644 --- a/third_party/zstd/programs/datagen.c +++ b/third_party/zstd/programs/datagen.c @@ -33,7 +33,6 @@ #include "third_party/musl/rand48.h" /* malloc, free */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/dibio.c b/third_party/zstd/programs/dibio.c index bec85476b..1adf66b41 100644 --- a/third_party/zstd/programs/dibio.c +++ b/third_party/zstd/programs/dibio.c @@ -45,7 +45,6 @@ #include "libc/str/str.h" /* memset */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/fileio.c b/third_party/zstd/programs/fileio.c index c01177392..dc47ad54a 100644 --- a/third_party/zstd/programs/fileio.c +++ b/third_party/zstd/programs/fileio.c @@ -28,7 +28,6 @@ #include "third_party/zstd/programs/util.h" /* UTIL_getFileSize, UTIL_isRegularFile, UTIL_isSameFile */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/fileio_asyncio.c b/third_party/zstd/programs/fileio_asyncio.c index 542a7666a..5296c6948 100644 --- a/third_party/zstd/programs/fileio_asyncio.c +++ b/third_party/zstd/programs/fileio_asyncio.c @@ -12,7 +12,6 @@ #include "third_party/zstd/programs/platform.h" #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/platform.h b/third_party/zstd/programs/platform.h index 94c21ad66..3a570034e 100644 --- a/third_party/zstd/programs/platform.h +++ b/third_party/zstd/programs/platform.h @@ -186,7 +186,6 @@ extern "C" { #include "third_party/musl/lockf.h" /* isatty */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" @@ -218,7 +217,6 @@ extern "C" { #include "libc/nt/winsock.h" /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/timefn.c b/third_party/zstd/programs/timefn.c index d50b0535e..b64c53750 100644 --- a/third_party/zstd/programs/timefn.c +++ b/third_party/zstd/programs/timefn.c @@ -66,7 +66,6 @@ #include "third_party/musl/rand48.h" /* abort */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" @@ -131,7 +130,6 @@ UTIL_time_t UTIL_getTime(void) #include "third_party/musl/rand48.h" /* abort */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" @@ -179,7 +177,6 @@ UTIL_time_t UTIL_getTime(void) #include "third_party/musl/rand48.h" /* abort */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/util.c b/third_party/zstd/programs/util.c index 04e070d7b..a77944505 100644 --- a/third_party/zstd/programs/util.c +++ b/third_party/zstd/programs/util.c @@ -35,7 +35,6 @@ extern "C" { #include "third_party/musl/rand48.h" /* malloc, realloc, free */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/zstdcli.c b/third_party/zstd/programs/zstdcli.c index 7fe0ae8ea..e6dbfd095 100644 --- a/third_party/zstd/programs/zstdcli.c +++ b/third_party/zstd/programs/zstdcli.c @@ -50,7 +50,6 @@ #include "libc/str/str.h" /* strcmp, strlen */ #include "libc/calls/calls.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/third_party/zstd/programs/zstdcli_trace.c b/third_party/zstd/programs/zstdcli_trace.c index 62fc924d2..ec9ccfb41 100644 --- a/third_party/zstd/programs/zstdcli_trace.c +++ b/third_party/zstd/programs/zstdcli_trace.c @@ -14,7 +14,6 @@ #include "libc/calls/calls.h" #include "libc/assert.h" #include "libc/calls/weirdtypes.h" -#include "libc/fmt/fmt.h" #include "libc/stdio/dprintf.h" #include "libc/stdio/stdio.h" #include "libc/temp.h" diff --git a/tool/build/cp.c b/tool/build/cp.c index eb09fb4ba..f1b99d8c2 100644 --- a/tool/build/cp.c +++ b/tool/build/cp.c @@ -20,7 +20,6 @@ #include "libc/calls/struct/stat.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/libgen.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/limits.h" diff --git a/tool/build/killall.c b/tool/build/killall.c index 1d5f9ea8a..f33493085 100644 --- a/tool/build/killall.c +++ b/tool/build/killall.c @@ -176,7 +176,7 @@ int main(int argc, char *argv[]) { // get pids of all processes on system uint32_t n; if (!EnumProcesses(pids, sizeof(pids), &n)) { - fprintf(stderr, "%s: EnumProcesses() failed: %s\n", prog, + fprintf(stderr, "%s: EnumProcesses() failed: %hs\n", prog, DescribeError(GetLastError())); exit(1); } diff --git a/tool/build/mv.c b/tool/build/mv.c index 300b7d3ac..d361b5f8d 100644 --- a/tool/build/mv.c +++ b/tool/build/mv.c @@ -20,7 +20,6 @@ #include "libc/calls/struct/stat.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/libgen.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/limits.h" diff --git a/tool/build/pledge.c b/tool/build/pledge.c index 05c90eee1..58f0968f7 100644 --- a/tool/build/pledge.c +++ b/tool/build/pledge.c @@ -73,7 +73,6 @@ // test/tool/build/pledge_test.sh // -__static_yoink("strerror_wr"); __static_yoink("zipos"); #define USAGE \ diff --git a/tool/decode/lib/asmcodegen.c b/tool/decode/lib/asmcodegen.c index 67120c539..5d92c910f 100644 --- a/tool/decode/lib/asmcodegen.c +++ b/tool/decode/lib/asmcodegen.c @@ -17,7 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "tool/decode/lib/asmcodegen.h" -#include "libc/fmt/fmt.h" #include "libc/intrin/safemacros.internal.h" #include "libc/mem/gc.internal.h" #include "libc/mem/mem.h" diff --git a/tool/decode/lib/titlegen.c b/tool/decode/lib/titlegen.c index f26807596..fe266904e 100644 --- a/tool/decode/lib/titlegen.c +++ b/tool/decode/lib/titlegen.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "tool/decode/lib/titlegen.h" diff --git a/tool/viz/basicidea.c b/tool/viz/basicidea.c index c983db860..2b5063ff8 100644 --- a/tool/viz/basicidea.c +++ b/tool/viz/basicidea.c @@ -21,7 +21,6 @@ #include "libc/calls/struct/stat.h" #include "libc/calls/struct/winsize.h" #include "libc/calls/termios.h" -#include "libc/fmt/fmt.h" #include "libc/log/log.h" #include "libc/macros.internal.h" #include "libc/mem/mem.h" diff --git a/tool/viz/derasterize.c b/tool/viz/derasterize.c index 4326117c5..48bf9e6e5 100644 --- a/tool/viz/derasterize.c +++ b/tool/viz/derasterize.c @@ -22,7 +22,6 @@ #include "libc/calls/struct/stat.h" #include "libc/calls/termios.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/limits.h" #include "libc/log/check.h" #include "libc/log/log.h" diff --git a/tool/viz/dumphexc.c b/tool/viz/dumphexc.c index 7e429b7a6..948d1e85f 100644 --- a/tool/viz/dumphexc.c +++ b/tool/viz/dumphexc.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/macros.internal.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" diff --git a/tool/viz/life.c b/tool/viz/life.c index cad2edbdb..b08ed50dd 100644 --- a/tool/viz/life.c +++ b/tool/viz/life.c @@ -24,7 +24,6 @@ #include "libc/calls/termios.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/popcnt.h" #include "libc/intrin/safemacros.internal.h" diff --git a/tool/viz/od16.c b/tool/viz/od16.c index c5effae93..938a1a062 100644 --- a/tool/viz/od16.c +++ b/tool/viz/od16.c @@ -18,7 +18,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/log/check.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/tool/viz/printdos2errno.c b/tool/viz/printdos2errno.c index 6586fbcb3..c0661ed1d 100644 --- a/tool/viz/printdos2errno.c +++ b/tool/viz/printdos2errno.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/fmt/fmt.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/intrin/dos2errno.internal.h" #include "libc/intrin/kprintf.h" diff --git a/tool/viz/printvideo.c b/tool/viz/printvideo.c index 87088649b..d72b5a767 100644 --- a/tool/viz/printvideo.c +++ b/tool/viz/printvideo.c @@ -41,7 +41,6 @@ #include "libc/dns/dns.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/fmt/fmt.h" #include "libc/fmt/itoa.h" #include "libc/intrin/bits.h" #include "libc/intrin/kprintf.h"