Reduce header complexity

- Remove most __ASSEMBLER__ __LINKER__ ifdefs
- Rename libc/intrin/bits.h to libc/serialize.h
- Block pthread cancelation in fchmodat() polyfill
- Remove `clang-format off` statements in third_party
This commit is contained in:
Justine Tunney 2023-11-28 14:24:28 -08:00
parent 96f979dfc5
commit fa20edc44d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3057 changed files with 410 additions and 4398 deletions

View file

@ -24,7 +24,7 @@
#include "libc/errno.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/bits.h"
#include "libc/serialize.h"
#include "libc/intrin/cmpxchg.h"
#include "libc/intrin/describebacktrace.internal.h"
#include "libc/intrin/directmap.internal.h"

View file

@ -3,7 +3,6 @@
#include "libc/calls/struct/iovec.h"
#include "libc/intrin/asancodes.h"
#include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define SHADOW(x) ((signed char *)(((intptr_t)(x) >> kAsanScale) + kAsanMagic))
@ -43,5 +42,4 @@ void __asan_memset(void *, char, size_t);
void *__asan_memcpy(void *, const void *, size_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_ASAN_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_BITS_ASMFLAG_H_
#define COSMOPOLITAN_LIBC_BITS_ASMFLAG_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
/*
* Constraints for virtual machine flags.
@ -30,5 +29,4 @@
#define ABOVEFLAG_ASM(OP) OP "\n\tseta\t%b0"
#endif
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_ASMFLAG_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_BITS_ATOMIC_H_
#define COSMOPOLITAN_LIBC_BITS_ATOMIC_H_
#include "libc/atomic.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
/**
* @fileoverview Cosmopolitan C11 Atomics Library
@ -217,5 +216,4 @@ enum {
#error "atomic operations not supported with this compiler and/or architecture"
#endif
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_ATOMIC_H_ */

View file

@ -1,52 +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/intrin/bits.h"
static const unsigned char kReverseBits[256] = {
0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,
14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,
1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,
5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,
13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,
7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255,
};
/**
* Reverses bits in 8-bit word.
*/
int _bitreverse8(int x) {
return kReverseBits[x & 255];
}
/**
* Reverses bits in 16-bit word.
*/
int _bitreverse16(int x) {
return kReverseBits[x & 255] << 8 | kReverseBits[(0xFF00 & x) >> 8];
}

View file

@ -1,31 +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/intrin/bits.h"
#include "libc/intrin/bswap.h"
/**
* Reverses bits in 32-bit word.
*/
uint32_t _bitreverse32(uint32_t x) {
x = bswap_32(x);
x = (x & 0xaaaaaaaa) >> 1 | (x & 0x55555555) << 1;
x = (x & 0xcccccccc) >> 2 | (x & 0x33333333) << 2;
x = (x & 0xf0f0f0f0) >> 4 | (x & 0x0f0f0f0f) << 4;
return x;
}

View file

@ -1,31 +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/intrin/bits.h"
#include "libc/intrin/bswap.h"
/**
* Reverses bits in 64-bit word.
*/
uint64_t _bitreverse64(uint64_t x) {
x = bswap_64(x);
x = (x & 0xaaaaaaaaaaaaaaaa) >> 1 | (x & 0x5555555555555555) << 1;
x = (x & 0xcccccccccccccccc) >> 2 | (x & 0x3333333333333333) << 2;
x = (x & 0xf0f0f0f0f0f0f0f0) >> 4 | (x & 0x0f0f0f0f0f0f0f0f) << 4;
return x;
}

View file

@ -1,105 +0,0 @@
#ifndef COSMOPOLITAN_LIBC_BITS_H_
#define COSMOPOLITAN_LIBC_BITS_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_
int _bitreverse8(int) pureconst;
int _bitreverse16(int) pureconst;
uint32_t _bitreverse32(uint32_t) pureconst;
uint64_t _bitreverse64(uint64_t) pureconst;
#define READ16LE(P) \
(__extension__({ \
uint16_t __x; \
__builtin_memcpy(&__x, P, 16 / 8); \
__x; \
}))
#define READ16BE(P) \
(__extension__({ \
uint16_t __x; \
__builtin_memcpy(&__x, P, 16 / 8); \
__builtin_bswap16(__x); \
}))
#define READ32LE(P) \
(__extension__({ \
uint32_t __x; \
__builtin_memcpy(&__x, P, 32 / 8); \
__x; \
}))
#define READ32BE(P) \
(__extension__({ \
uint32_t __x; \
__builtin_memcpy(&__x, P, 32 / 8); \
__builtin_bswap32(__x); \
}))
#define READ64LE(P) \
(__extension__({ \
uint64_t __x; \
__builtin_memcpy(&__x, P, 64 / 8); \
__x; \
}))
#define READ64BE(P) \
(__extension__({ \
uint64_t __x; \
__builtin_memcpy(&__x, P, 64 / 8); \
__builtin_bswap64(__x); \
}))
#define WRITE16LE(P, X) \
(__extension__({ \
__typeof__(&(P)[0]) __p = (P); \
uint16_t __x = (X); \
__builtin_memcpy(__p, &__x, 16 / 8); \
__p + 16 / 8; \
}))
#define WRITE16BE(P, X) \
(__extension__({ \
__typeof__(&(P)[0]) __p = (P); \
uint16_t __x = __builtin_bswap16(X); \
__builtin_memcpy(__p, &__x, 16 / 8); \
__p + 16 / 8; \
}))
#define WRITE32LE(P, X) \
(__extension__({ \
__typeof__(&(P)[0]) __p = (P); \
uint32_t __x = (X); \
__builtin_memcpy(__p, &__x, 32 / 8); \
__p + 32 / 8; \
}))
#define WRITE32BE(P, X) \
(__extension__({ \
__typeof__(&(P)[0]) __p = (P); \
uint32_t __x = __builtin_bswap32(X); \
__builtin_memcpy(__p, &__x, 32 / 8); \
__p + 32 / 8; \
}))
#define WRITE64LE(P, X) \
(__extension__({ \
__typeof__(&(P)[0]) __p = (P); \
uint64_t __x = (X); \
__builtin_memcpy(__p, &__x, 64 / 8); \
__p + 64 / 8; \
}))
#define WRITE64BE(P, X) \
(__extension__({ \
__typeof__(&(P)[0]) __p = (P); \
uint64_t __x = __builtin_bswap64(X); \
__builtin_memcpy(__p, &__x, 64 / 8); \
__p + 64 / 8; \
}))
COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_BSF_H_
#define COSMOPOLITAN_LIBC_NEXGEN32E_BSF_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int _bsf(int) pureconst;
@ -14,5 +13,4 @@ int _bsfll(long long) pureconst;
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_BSF_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_BSR_H_
#define COSMOPOLITAN_LIBC_NEXGEN32E_BSR_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int _bsr(int) pureconst;
@ -14,5 +13,4 @@ int _bsrll(long long) pureconst;
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_BSR_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_BITS_BSWAP_H_
#define COSMOPOLITAN_LIBC_BITS_BSWAP_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
uint16_t bswap_16(uint16_t) pureconst;
@ -14,5 +13,4 @@ uint64_t bswap_64(uint64_t) pureconst;
#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_BSWAP_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_CMPXCHG_H_
#define COSMOPOLITAN_LIBC_INTRIN_CMPXCHG_H_
#include "libc/intrin/asmflag.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86__)
@ -23,5 +22,4 @@ COSMOPOLITAN_C_START_
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_CMPXCHG_H_ */

View file

@ -18,7 +18,6 @@
*/
#include "libc/assert.h"
#include "libc/dce.h"
#include "libc/intrin/bits.h"
#include "libc/nexgen32e/x86feature.h"
/**

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_RUNTIME_CXAATEXIT_H_
#include "libc/stdio/stdio.h"
#include "libc/thread/tls.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct CxaAtexitBlocks {
@ -26,5 +25,4 @@ void __cxa_printexits(FILE *, void *);
int __cxa_thread_atexit_impl(void *, void *, void *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_RUNTIME_CXAATEXIT_H_ */

View file

@ -2,12 +2,10 @@
#define COSMOPOLITAN_LIBC_INTRIN_DESCRIBEBACKTRACE_INTERNAL_H_
#include "libc/mem/alloca.h"
#include "libc/nexgen32e/stackframe.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
const char *DescribeBacktrace(char[160], struct StackFrame *);
#define DescribeBacktrace(x) DescribeBacktrace(alloca(160), x)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEBACKTRACE_INTERNAL_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_DESCRIBEFLAGS_INTERNAL_H_
#define COSMOPOLITAN_LIBC_INTRIN_DESCRIBEFLAGS_INTERNAL_H_
#include "libc/mem/alloca.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct thatispacked DescribeFlags {
@ -128,5 +127,4 @@ const char *DescribeWhichPrio(char[12], int);
#define DescribeWhichPrio(x) DescribeWhichPrio(alloca(12), x)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEFLAGS_INTERNAL_H_ */

View file

@ -2,12 +2,10 @@
#define COSMOPOLITAN_LIBC_INTRIN_DESCRIBENTOVERLAPPED_INTERNAL_H_
#include "libc/mem/alloca.h"
#include "libc/nt/struct/overlapped.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
const char *DescribeNtOverlapped(char[128], const struct NtOverlapped *);
#define DescribeNtOverlapped(x) DescribeNtOverlapped(alloca(128), x)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBENTOVERLAPPED_INTERNAL_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_DIRECTMAP_H_
#define COSMOPOLITAN_LIBC_INTRIN_DIRECTMAP_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct ProtectNt {
@ -20,5 +19,4 @@ int sys_munmap_metal(void *, size_t);
int __prot2nt(int, int);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DIRECTMAP_H_ */

View file

@ -5,7 +5,6 @@
#define dll_make_last __dll_make_last
#define dll_remove __dll_remove
#define dll_splice_after __dll_splice_after
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define DLL_CONTAINER(t, f, p) ((t *)(((char *)(p)) - offsetof(t, f)))
@ -56,6 +55,5 @@ void dll_make_first(struct Dll **, struct Dll *) paramsnonnull((1)) libcesque;
void dll_splice_after(struct Dll *, struct Dll *) paramsnonnull((1)) libcesque;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DLL_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_DOS2ERRNO_INTERNAL_H_
#define COSMOPOLITAN_LIBC_INTRIN_DOS2ERRNO_INTERNAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct thatispacked Dos2Errno {
@ -11,5 +10,4 @@ struct thatispacked Dos2Errno {
extern const struct Dos2Errno kDos2Errno[];
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DOS2ERRNO_INTERNAL_H_ */

View file

@ -1,10 +1,8 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_EXTEND_INTERNAL_H_
#define COSMOPOLITAN_LIBC_CALLS_EXTEND_INTERNAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void *_extend(void *, size_t, void *, int, intptr_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_EXTEND_INTERNAL_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_GETAUXVAL_H_
#define COSMOPOLITAN_LIBC_INTRIN_GETAUXVAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct AuxiliaryValue {
@ -11,5 +10,4 @@ struct AuxiliaryValue {
struct AuxiliaryValue __getauxval(unsigned long);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_GETAUXVAL_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_GETENV_H_
#define COSMOPOLITAN_LIBC_INTRIN_GETENV_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct Env {
@ -11,5 +10,4 @@ struct Env {
struct Env __getenv(char **, const char *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_GETENV_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_BITS_HILBERT_H_
#define COSMOPOLITAN_LIBC_BITS_HILBERT_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_
#define hilbert __hilbert
@ -11,5 +10,4 @@ axdx_t unhilbert(long, long) pureconst;
COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_HILBERT_H_ */

View file

@ -24,7 +24,7 @@
#include "libc/fmt/magnumstrs.internal.h"
#include "libc/intrin/asmflag.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/bits.h"
#include "libc/serialize.h"
#include "libc/intrin/getenv.internal.h"
#include "libc/intrin/likely.h"
#include "libc/intrin/nomultics.internal.h"

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_LEAKY_INTERNAL_H_
#define COSMOPOLITAN_LIBC_INTRIN_LEAKY_INTERNAL_H_
#include "libc/dce.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#if IsAsan()
@ -17,5 +16,4 @@ extern intptr_t _leaky_end[] __attribute__((__weak__));
extern intptr_t _leaky_start[] __attribute__((__weak__));
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_LEAKY_INTERNAL_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_BITS_LIKELY_H_
#define COSMOPOLITAN_LIBC_BITS_LIKELY_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef _COSMO_SOURCE
#define LIKELY(x) __builtin_expect(!!(x), 1)
@ -19,5 +18,4 @@
#endif
#endif /* _COSMO_SOURCE */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_LIKELY_H_ */

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_INTRIN_MACROS_H_
#include "libc/dce.h"
#include "libc/nexgen32e/x86feature.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#define INTRIN_COMMUTATIVE "%"
#define INTRIN_NONCOMMUTATIVE
@ -80,5 +79,4 @@ typedef char __intrin_xmm_t
#define INTRIN_SSEVEX_X_X_(PURE, ISA, OP, A, B) PURE(A, B)
#endif /* X86 && !ANSI */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_MACROS_H_ */

View file

@ -21,7 +21,6 @@
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/directmap.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/log/libfatal.internal.h"

View file

@ -8,7 +8,6 @@
#define kTtyNoIsigs 16 /* don't auto-raise signals on keys */
#define kTtyXtMouse 32 /* enables eXtreme Xterm mouse mode */
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct TtyConf {
@ -44,5 +43,4 @@ struct TtyConf {
extern struct TtyConf __ttyconf;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_NOMULTICS_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PACKSSWB_H_
#define COSMOPOLITAN_LIBC_INTRIN_PACKSSWB_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void packsswb(int8_t[16], const int16_t[8], const int16_t[8]);
@ -11,5 +10,4 @@ void packsswb(int8_t[16], const int16_t[8], const int16_t[8]);
B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PACKSSWB_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PACKUSWB_H_
#define COSMOPOLITAN_LIBC_INTRIN_PACKUSWB_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void packuswb(uint8_t[16], const int16_t[8], const int16_t[8]);
@ -11,5 +10,4 @@ void packuswb(uint8_t[16], const int16_t[8], const int16_t[8]);
B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PACKUSWB_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PADDW_H_
#define COSMOPOLITAN_LIBC_INTRIN_PADDW_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void paddw(int16_t[8], const int16_t[8], const int16_t[8]);
@ -10,5 +9,4 @@ void paddw(int16_t[8], const int16_t[8], const int16_t[8]);
INTRIN_SSEVEX_X_X_X_(paddw, SSE2, "paddw", INTRIN_COMMUTATIVE, A, B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PADDW_H_ */

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_INTRIN_PALIGNR_H_
#include "libc/intrin/macros.h"
#include "libc/str/str.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void palignr(void *, const void *, const void *, unsigned long);
@ -43,5 +42,4 @@ __intrin_xmm_t __palignrs(__intrin_xmm_t, __intrin_xmm_t);
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PALIGNR_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PANDN_H_
#define COSMOPOLITAN_LIBC_INTRIN_PANDN_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void pandn(uint64_t[2], const uint64_t[2], const uint64_t[2]);
@ -10,5 +9,4 @@ void pandn(uint64_t[2], const uint64_t[2], const uint64_t[2]);
INTRIN_SSEVEX_X_X_X_(pandn, SSE2, "pandn", INTRIN_NONCOMMUTATIVE, A, B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PANDN_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PCMPGTB_H_
#define COSMOPOLITAN_LIBC_INTRIN_PCMPGTB_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void pcmpgtb(int8_t[16], const int8_t[16], const int8_t[16]);
@ -10,5 +9,4 @@ void pcmpgtb(int8_t[16], const int8_t[16], const int8_t[16]);
INTRIN_SSEVEX_X_X_X_(pcmpgtb, SSE2, "pcmpgtb", INTRIN_NONCOMMUTATIVE, A, B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PCMPGTB_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PCMPGTW_H_
#define COSMOPOLITAN_LIBC_INTRIN_PCMPGTW_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void pcmpgtw(int16_t[8], const int16_t[8], const int16_t[8]);
@ -10,5 +9,4 @@ void pcmpgtw(int16_t[8], const int16_t[8], const int16_t[8]);
INTRIN_SSEVEX_X_X_X_(pcmpgtw, SSE2, "pcmpgtw", INTRIN_NONCOMMUTATIVE, A, B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PCMPGTW_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PMADDUBSW_H_
#define COSMOPOLITAN_LIBC_INTRIN_PMADDUBSW_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void pmaddubsw(int16_t[8], const uint8_t[16], const int8_t[16]);
@ -11,5 +10,4 @@ void pmaddubsw(int16_t[8], const uint8_t[16], const int8_t[16]);
W, B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PMADDUBSW_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PMOVMSKB_H_
#define COSMOPOLITAN_LIBC_INTRIN_PMOVMSKB_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
uint32_t pmovmskb(const uint8_t[16]);
@ -25,5 +24,4 @@ uint32_t pmovmskb(const uint8_t[16]);
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PMOVMSKB_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PMULHRSW_H_
#define COSMOPOLITAN_LIBC_INTRIN_PMULHRSW_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void pmulhrsw(int16_t a[8], const int16_t b[8], const int16_t c[8]);
@ -10,5 +9,4 @@ void pmulhrsw(int16_t a[8], const int16_t b[8], const int16_t c[8]);
INTRIN_SSEVEX_X_X_X_(pmulhrsw, SSSE3, "pmulhrsw", INTRIN_COMMUTATIVE, A, B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PMULHRSW_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_BITS_POPCNT_H_
#define COSMOPOLITAN_LIBC_BITS_POPCNT_H_
#include "libc/nexgen32e/x86feature.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
size_t _countbits(const void *, size_t);
@ -23,5 +22,4 @@ unsigned long popcnt(unsigned long) pureconst;
#endif /* GNUC && !ANSI */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_POPCNT_H_ */

View file

@ -28,12 +28,10 @@
#define PLEDGED(x) ((~__promises >> PROMISE_##x) & 1)
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern unsigned long __promises;
extern unsigned long __execpromises;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PROMISES_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PSRAW_H_
#define COSMOPOLITAN_LIBC_INTRIN_PSRAW_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void psraw(int16_t[8], const int16_t[8], unsigned char);
@ -12,5 +11,4 @@ void psrawv(int16_t[8], const int16_t[8], const uint64_t[2]);
INTRIN_SSEVEX_X_X_X_(psrawv, SSE2, "psraw", INTRIN_NONCOMMUTATIVE, A, B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PSRAW_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKHBW_H_
#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKHBW_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void punpckhbw(uint8_t[16], const uint8_t[16], const uint8_t[16]);
@ -11,5 +10,4 @@ void punpckhbw(uint8_t[16], const uint8_t[16], const uint8_t[16]);
B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKHBW_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKHWD_H_
#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKHWD_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void punpckhwd(uint16_t[8], const uint16_t[8], const uint16_t[8]);
@ -11,5 +10,4 @@ void punpckhwd(uint16_t[8], const uint16_t[8], const uint16_t[8]);
B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKHWD_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKLBW_H_
#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKLBW_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void punpcklbw(uint8_t[16], const uint8_t[16], const uint8_t[16]);
@ -11,5 +10,4 @@ void punpcklbw(uint8_t[16], const uint8_t[16], const uint8_t[16]);
B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKLBW_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKLWD_H_
#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKLWD_H_
#include "libc/intrin/macros.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void punpcklwd(uint16_t[8], const uint16_t[8], const uint16_t[8]);
@ -11,5 +10,4 @@ void punpcklwd(uint16_t[8], const uint16_t[8], const uint16_t[8]);
B, C)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKLWD_H_ */

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_
#ifdef _COSMO_SOURCE
#include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#if !defined(__GNUC__) || defined(__STRICT_ANSI__) || !defined(__x86_64__) || \
!defined(__MNO_RED_ZONE__)
@ -54,6 +53,5 @@
})
#endif
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_REPMOVSB_H_
#define COSMOPOLITAN_LIBC_INTRIN_REPMOVSB_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef _COSMO_SOURCE
forceinline void repmovsb(void **dest, const void **src, size_t cx) {
@ -24,5 +23,4 @@ forceinline void repmovsb(void **dest, const void **src, size_t cx) {
#endif
#endif /* _COSMO_SOURCE */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_REPMOVSB_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_REPSTOSB_H_
#define COSMOPOLITAN_LIBC_INTRIN_REPSTOSB_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef _COSMO_SOURCE
forceinline void *repstosb(void *dest, unsigned char al, size_t cx) {
@ -23,5 +22,4 @@ forceinline void *repstosb(void *dest, unsigned char al, size_t cx) {
#endif
#endif /* _COSMO_SOURCE */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_REPSTOSB_H_ */

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_
#include "libc/macros.internal.h"
#include "libc/runtime/runtime.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define min(x, y) \
@ -67,5 +66,4 @@ COSMOPOLITAN_C_START_
})
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_BITS_SEGMENTATION_H_
#define COSMOPOLITAN_LIBC_BITS_SEGMENTATION_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#ifdef _COSMO_SOURCE
@ -22,5 +21,4 @@
#endif /* _COSMO_SOURCE */
#endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_SEGMENTATION_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_SETJMP_INTERNAL_H_
#define COSMOPOLITAN_LIBC_INTRIN_SETJMP_INTERNAL_H_
#include "libc/limits.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/**
@ -25,5 +24,4 @@ static inline int DecodeSetjmp(int x) {
}
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_SETJMP_INTERNAL_H_ */

View file

@ -18,7 +18,6 @@
*/
#include "libc/assert.h"
#include "libc/dce.h"
#include "libc/intrin/bits.h"
#include "libc/str/str.h"
#ifndef __aarch64__

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_ULOCK_H_
#define COSMOPOLITAN_ULOCK_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/* both wake and wait take one of these */
@ -23,5 +22,4 @@ int ulock_wake(uint32_t, void *, uint64_t);
int ulock_wait(uint32_t, void *, uint64_t, uint32_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_ULOCK_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_BITS_WEAKEN_H_
#define COSMOPOLITAN_LIBC_BITS_WEAKEN_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifndef __chibicc__
#define _weaken(symbol) \
@ -12,5 +11,4 @@
#define _weaken(symbol) (&(symbol))
#endif
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_WEAKEN_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_BITS_XCHG_H_
#define COSMOPOLITAN_LIBC_BITS_XCHG_H_
#include "libc/str/str.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
/**
* Exchanges *MEMORY into *LOCALVAR.
@ -20,5 +19,4 @@
Temp; \
})
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_XCHG_H_ */