Remove more nonstandard stuff from cosmopolitan.h

Fixes #61
This commit is contained in:
Justine Tunney 2021-02-28 23:42:35 -08:00
parent 5e069a64d4
commit d932948fb4
954 changed files with 1095 additions and 1342 deletions

2
.vscode/vscode.h vendored
View file

@ -79,7 +79,7 @@
#define SWITCHEROO(...) 0 #define SWITCHEROO(...) 0
extern unsigned g_loglevel; extern unsigned __log_level;
typedef void * va_list; typedef void * va_list;

View file

@ -364,9 +364,10 @@ SECTIONS {
PROVIDE_HIDDEN(edata = .); PROVIDE_HIDDEN(edata = .);
} :Ram } :Ram
.zip : { .zip . : {
KEEP(*(SORT_BY_NAME(.zip.*))) KEEP(*(SORT_BY_NAME(.zip.*)))
. = ALIGN(PAGESIZE); . = ALIGN(PAGESIZE);
HIDDEN(_efile = .);
} }
.bss . : { .bss . : {
@ -540,7 +541,7 @@ HIDDEN(v_ape_highsectors =
ZIPCONST(v_zip_cdoffset, __zip_start - IMAGE_BASE_VIRTUAL); ZIPCONST(v_zip_cdoffset, __zip_start - IMAGE_BASE_VIRTUAL);
ZIPCONST(v_zip_cdirsize, __zip_end - __zip_start); ZIPCONST(v_zip_cdirsize, __zip_end - __zip_start);
ZIPCONST(v_zip_records, v_zip_cdirsize / kZipCdirHdrLinkableSize); ZIPCONST(v_zip_records, v_zip_cdirsize / kZipCdirHdrLinkableSize);
ZIPCONST(v_zip_commentsize, 0); ZIPCONST(v_zip_commentsize, _efile - __zip_end - kZipCdirHdrMinSize);
#if SupportsXnu() #if SupportsXnu()
/* Generates deterministic ID. */ /* Generates deterministic ID. */

View file

@ -18,7 +18,7 @@
*/ */
#ifndef APE_MACROS_H_ #ifndef APE_MACROS_H_
#define APE_MACROS_H_ #define APE_MACROS_H_
#include "libc/macros.h" #include "libc/macros.internal.h"
#ifdef __ASSEMBLER__ #ifdef __ASSEMBLER__
/* clang-format off */ /* clang-format off */

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_DSP_CORE_C161_H_ #ifndef COSMOPOLITAN_DSP_CORE_C161_H_
#define COSMOPOLITAN_DSP_CORE_C161_H_ #define COSMOPOLITAN_DSP_CORE_C161_H_
#include "libc/macros.h" #include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
#define EXTRA_SHARP 2 #define EXTRA_SHARP 2

View file

@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_DSP_CORE_C161S_H_ #ifndef COSMOPOLITAN_DSP_CORE_C161S_H_
#define COSMOPOLITAN_DSP_CORE_C161S_H_ #define COSMOPOLITAN_DSP_CORE_C161S_H_
#include "dsp/core/c161.h" #include "dsp/core/c161.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
forceinline pureconst artificial signed char C161S(signed char al, forceinline pureconst artificial signed char C161S(signed char al,

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "dsp/core/core.h" #include "dsp/core/core.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -20,7 +20,7 @@
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -19,7 +19,7 @@
#include "dsp/core/core.h" #include "dsp/core/core.h"
#include "dsp/core/q.h" #include "dsp/core/q.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_DSP_CORE_HALF_H_ #ifndef COSMOPOLITAN_DSP_CORE_HALF_H_
#define COSMOPOLITAN_DSP_CORE_HALF_H_ #define COSMOPOLITAN_DSP_CORE_HALF_H_
#include "libc/macros.h" #include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
/** /**

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_DSP_CORE_KS8_H_ #ifndef COSMOPOLITAN_DSP_CORE_KS8_H_
#define COSMOPOLITAN_DSP_CORE_KS8_H_ #define COSMOPOLITAN_DSP_CORE_KS8_H_
#include "libc/macros.h" #include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
/** /**

View file

@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_DSP_CORE_KSS8_H_ #ifndef COSMOPOLITAN_DSP_CORE_KSS8_H_
#define COSMOPOLITAN_DSP_CORE_KSS8_H_ #define COSMOPOLITAN_DSP_CORE_KSS8_H_
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
/** /**

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
#define BIAS 0x84 #define BIAS 0x84

View file

@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_DSP_CORE_Q_H_ #ifndef COSMOPOLITAN_DSP_CORE_Q_H_
#define COSMOPOLITAN_DSP_CORE_Q_H_ #define COSMOPOLITAN_DSP_CORE_Q_H_
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.align 16 .align 16
// Mixes audio. // Mixes audio.

View file

@ -18,7 +18,7 @@
*/ */
#include "dsp/core/core.h" #include "dsp/core/core.h"
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/limits.h" #include "libc/limits.h"
/** /**

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
clamp4int256$core: clamp4int256$core:

View file

@ -35,7 +35,7 @@
#include "libc/bits/initializer.internal.h" #include "libc/bits/initializer.internal.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -28,7 +28,7 @@
SOFTWARE. SOFTWARE.
*/ */
#include "dsp/mpeg/mpeg.h" #include "dsp/mpeg/mpeg.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
asm(".ident\t\"\\n\\n\ asm(".ident\t\"\\n\\n\
PL_MPEG (MIT License)\\n\ PL_MPEG (MIT License)\\n\

View file

@ -24,7 +24,7 @@
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/nexgen32e/bsr.h" #include "libc/nexgen32e/bsr.h"

View file

@ -20,7 +20,7 @@
#include "dsp/core/ks8.h" #include "dsp/core/ks8.h"
#include "dsp/core/kss8.h" #include "dsp/core/kss8.h"
#include "dsp/scale/cdecimate2xuint8x8.h" #include "dsp/scale/cdecimate2xuint8x8.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nexgen32e/x86feature.h" #include "libc/nexgen32e/x86feature.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/x/x.h" #include "libc/x/x.h"

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "dsp/tty/tty.h" #include "dsp/tty/tty.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/bits/weaken.h" #include "libc/bits/weaken.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/termios.h" #include "libc/calls/termios.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
// TODO(jart): write me // TODO(jart): write me

View file

@ -22,7 +22,7 @@
#include "libc/bits/initializer.internal.h" #include "libc/bits/initializer.internal.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -18,7 +18,7 @@
*/ */
#include "dsp/tty/quant.h" #include "dsp/tty/quant.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
struct TtyRgb rgb2ttyi2f_(int r, int g, int b) { struct TtyRgb rgb2ttyi2f_(int r, int g, int b) {
return rgb2ttyf((__m128){r, g, b} / 255); return rgb2ttyf((__m128){r, g, b} / 255);

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "dsp/tty/quant.h" #include "dsp/tty/quant.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
struct TtyRgb rgb2xterm24_(int r, int g, int b) { struct TtyRgb rgb2xterm24_(int r, int g, int b) {
return (struct TtyRgb){MAX(MIN(r, 255), 0), MAX(MIN(g, 255), 0), return (struct TtyRgb){MAX(MIN(r, 255), 0), MAX(MIN(g, 255), 0),

View file

@ -18,7 +18,7 @@
*/ */
#include "dsp/tty/itoa8.h" #include "dsp/tty/itoa8.h"
#include "dsp/tty/tty.h" #include "dsp/tty/tty.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/log/check.h" #include "libc/log/check.h"

View file

@ -23,11 +23,11 @@
#include "dsp/tty/windex.h" #include "dsp/tty/windex.h"
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/nexgen32e/x86feature.h" #include "libc/nexgen32e/x86feature.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"

View file

@ -26,7 +26,7 @@
#include "libc/calls/typedef/sigaction_f.h" #include "libc/calls/typedef/sigaction_f.h"
#include "libc/calls/ucontext.h" #include "libc/calls/ucontext.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/gc.h" #include "libc/runtime/gc.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
// Returns index of minimum uint16 in array. // Returns index of minimum uint16 in array.

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
// Returns index of minimum positive int16 in array. // Returns index of minimum positive int16 in array.

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/nexgen32e/x86feature.h" #include "libc/nexgen32e/x86feature.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
// Dispatches to fastest windex() implementation. // Dispatches to fastest windex() implementation.

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -7,13 +7,13 @@
http://creativecommons.org/publicdomain/zero/1.0/ │ http://creativecommons.org/publicdomain/zero/1.0/ │
*/ */
#endif #endif
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/dns/dns.h" #include "libc/dns/dns.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/gc.h" #include "libc/runtime/gc.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"

View file

@ -20,7 +20,7 @@
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/gc.h" #include "libc/runtime/gc.h"

View file

@ -8,7 +8,7 @@
*/ */
#endif #endif
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/e820.internal.h" #include "libc/runtime/e820.internal.h"
#include "libc/runtime/pc.internal.h" #include "libc/runtime/pc.internal.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"

View file

@ -15,7 +15,7 @@
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -9,7 +9,7 @@
#endif #endif
#include "libc/alg/alg.h" #include "libc/alg/alg.h"
#include "libc/alg/arraylist2.internal.h" #include "libc/alg/arraylist2.internal.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/dirent.h" #include "libc/calls/struct/dirent.h"
#include "libc/calls/struct/stat.h" #include "libc/calls/struct/stat.h"

View file

@ -9,7 +9,7 @@
#endif #endif
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/sysv/consts/map.h" #include "libc/sysv/consts/map.h"

View file

@ -13,7 +13,7 @@
#include "libc/alg/arraylist2.internal.h" #include "libc/alg/arraylist2.internal.h"
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/itimerval.h" #include "libc/calls/struct/itimerval.h"
#include "libc/calls/struct/winsize.h" #include "libc/calls/struct/winsize.h"
@ -23,7 +23,7 @@
#include "libc/inttypes.h" #include "libc/inttypes.h"
#include "libc/log/check.h" #include "libc/log/check.h"
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/ohmyplus/vector.h" #include "libc/ohmyplus/vector.h"

View file

@ -1,4 +1,4 @@
#include "libc/macros.h" #include "libc/macros.internal.h"
// Example assembly function. // Example assembly function.
// //

View file

@ -8,7 +8,7 @@
*/ */
#endif #endif
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/sysv/consts/fileno.h" #include "libc/sysv/consts/fileno.h"

View file

@ -8,7 +8,7 @@
*/ */
#endif #endif
#include "libc/log/log.h" #include "libc/log/log.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -1609,7 +1609,6 @@ wontreturn static void exraise(int e) {
INTOFF; INTOFF;
exception = e; exception = e;
longjmp(handler->loc, 1); longjmp(handler->loc, 1);
panic();
} }
/* /*

View file

@ -18,7 +18,7 @@
*/ */
#include "libc/alg/alg.h" #include "libc/alg/alg.h"
#include "libc/alg/arraylist2.internal.h" #include "libc/alg/arraylist2.internal.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_ALG_REVERSE_H_ #ifndef COSMOPOLITAN_LIBC_ALG_REVERSE_H_
#define COSMOPOLITAN_LIBC_ALG_REVERSE_H_ #define COSMOPOLITAN_LIBC_ALG_REVERSE_H_
#include "libc/bits/xchg.h" #include "libc/bits/xchg.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
/** /**
@ -11,7 +11,6 @@
* @return pointer to start of array * @return pointer to start of array
* @see ARRAYLEN() * @see ARRAYLEN()
*/ */
#ifndef reverse
#define reverse(ARRAY, COUNT) \ #define reverse(ARRAY, COUNT) \
({ \ ({ \
autotype(&(ARRAY)[0]) Array = (ARRAY); \ autotype(&(ARRAY)[0]) Array = (ARRAY); \
@ -27,7 +26,6 @@
} \ } \
Array; \ Array; \
}) })
#endif /* reverse */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_ALG_REVERSE_H_ */ #endif /* COSMOPOLITAN_LIBC_ALG_REVERSE_H_ */

View file

@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_RAND_SHUFFLE_H_ #ifndef COSMOPOLITAN_LIBC_RAND_SHUFFLE_H_
#define COSMOPOLITAN_LIBC_RAND_SHUFFLE_H_ #define COSMOPOLITAN_LIBC_RAND_SHUFFLE_H_
#include "libc/bits/xchg.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
#include "libc/bits/xchg.h"
/** /**
* Fisher-Yates shuffle. * Fisher-Yates shuffle.
@ -11,7 +11,6 @@
* @param n is the number of items in A * @param n is the number of items in A
* @see ARRAYLEN() * @see ARRAYLEN()
*/ */
#ifndef shuffle
#define shuffle(R, A, n) \ #define shuffle(R, A, n) \
do { \ do { \
autotype(A) Array = (A); \ autotype(A) Array = (A); \
@ -19,7 +18,6 @@
xchg(&Array[i], &Array[R() % (i + 1)]); \ xchg(&Array[i], &Array[R() % (i + 1)]); \
} \ } \
} while (0) } while (0)
#endif /* shuffle */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_RAND_SHUFFLE_H_ */ #endif /* COSMOPOLITAN_LIBC_RAND_SHUFFLE_H_ */

View file

@ -19,7 +19,7 @@
#include "libc/alg/alg.h" #include "libc/alg/alg.h"
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
/** /**

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
/** /**
* Returns absolute value of x. * Returns absolute value of x.

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
/** /**

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
/** /**

View file

@ -1,27 +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/bits/safemacros.h"
/**
* Returns string where empty string is made null.
* @see nulltoempty()
*/
const char *(emptytonull)(const char *s) {
return s && !*s ? 0 : s;
}

View file

@ -1,28 +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/runtime/runtime.h"
/**
* Returns a or b or aborts if both are null.
*/
const char *(firstnonnull)(const char *a, const char *b) {
if (a) return a;
if (b) return b;
abort();
}

View file

@ -1,25 +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.
*/
/**
* Returns true if s is empty string or null.
*/
bool isempty(const char *s) {
return !s || !*s;
}

View file

@ -1,27 +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/bits/safemacros.h"
/**
* Returns 𝑠 converting null to empty string.
* @see emptytonull()
*/
const char *(nulltoempty)(const char *s) {
return s ? s : "";
}

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_ #ifndef COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_
#define COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_ #define COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_
#include "libc/macros.h" #include "libc/macros.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
#if !defined(__GNUC__) || defined(__STRICT_ANSI__) #if !defined(__GNUC__) || defined(__STRICT_ANSI__)

View file

@ -1,26 +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/macros.h"
/**
* Rounds down 𝑤 to next two power 𝑘.
*/
long(rounddown)(long w, long k) {
return ROUNDDOWN(w, k);
}

View file

@ -1,26 +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/macros.h"
/**
* Rounds up 𝑤 to next two power 𝑘.
*/
long(roundup)(long w, long k) {
return ROUNDUP(w, k);
}

View file

@ -1,23 +1,10 @@
#ifndef COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_ #ifndef COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_
#define COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_ #define COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
long min(long, long);
long max(long, long);
long roundup(long, long);
long rounddown(long, long);
bool isempty(const char *);
const char *nulltoempty(const char *);
const char *emptytonull(const char *);
const char *firstnonnull(const char *, const char *);
uint64_t(unsignedsubtract)(uint64_t, uint64_t) pureconst;
#if !defined(__STRICT_ANSI__) && defined(__GNUC__) && \
!defined(__VSCODE_INTELLISENSE__)
#define min(x, y) \ #define min(x, y) \
({ \ ({ \
autotype(x) MinX = (x); \ autotype(x) MinX = (x); \
@ -79,8 +66,6 @@ uint64_t(unsignedsubtract)(uint64_t, uint64_t) pureconst;
UnsubA >= UnsubB ? UnsubA - UnsubB : ~UnsubB + UnsubA + 1; \ UnsubA >= UnsubB ? UnsubA - UnsubB : ~UnsubB + UnsubA + 1; \
}) })
#endif /* GNU && !ANSI */
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_ */ #endif /* COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_ */

View file

@ -1,26 +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/bits/safemacros.h"
/**
* Subtracts unsigned integers w/ wraparound.
*/
uint64_t(unsignedsubtract)(uint64_t x, uint64_t y) {
return unsignedsubtract(x, y);
}

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"

View file

@ -19,7 +19,7 @@
#include "libc/bits/weaken.h" #include "libc/bits/weaken.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/sock/internal.h" #include "libc/sock/internal.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#include "libc/zipos/zipos.internal.h" #include "libc/zipos/zipos.internal.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -18,7 +18,7 @@
*/ */
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
/** /**
* Copies data between file descriptors the slow way. * Copies data between file descriptors the slow way.

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/errno.h" #include "libc/errno.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/struct/stat.h" #include "libc/calls/struct/stat.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.init.start 302,_init_g_fds .init.start 302,_init_g_fds
push %rdi push %rdi

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/files.h" #include "libc/nt/files.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"

View file

@ -20,7 +20,7 @@
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/struct/utsname.h" #include "libc/calls/struct/utsname.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/enum/computernameformat.h" #include "libc/nt/enum/computernameformat.h"
#include "libc/nt/errors.h" #include "libc/nt/errors.h"
#include "libc/nt/runtime.h" #include "libc/nt/runtime.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
// Obtains WIN32 magic path, e.g. GetTempPathA. // Obtains WIN32 magic path, e.g. GetTempPathA.

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
// Calls GetTempPathA() w/ different API. // Calls GetTempPathA() w/ different API.

View file

@ -19,7 +19,7 @@
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/accounting.h" #include "libc/nt/accounting.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -9,7 +9,7 @@
#include "libc/calls/struct/timeval.h" #include "libc/calls/struct/timeval.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/struct/context.h" #include "libc/nt/struct/context.h"
#include "libc/nt/struct/ntexceptionpointers.h" #include "libc/nt/struct/ntexceptionpointers.h"
#include "libc/nt/struct/securityattributes.h" #include "libc/nt/struct/securityattributes.h"

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_IOCTL_H_ #ifndef COSMOPOLITAN_LIBC_CALLS_IOCTL_H_
#define COSMOPOLITAN_LIBC_CALLS_IOCTL_H_ #define COSMOPOLITAN_LIBC_CALLS_IOCTL_H_
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/sysv/consts/termios.h" #include "libc/sysv/consts/termios.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
@ -18,6 +18,7 @@ int ioctl(int, uint64_t, void *);
#define ioctl(FD, REQUEST, MEMORY) ioctl_dispatch(FD, REQUEST, MEMORY) #define ioctl(FD, REQUEST, MEMORY) ioctl_dispatch(FD, REQUEST, MEMORY)
#define __EQUIVALENT(X, Y) (__builtin_constant_p((X) == (Y)) && ((X) == (Y)))
#define __IOCTL_DISPATCH(CMP, FD, REQUEST, MEMORY) \ #define __IOCTL_DISPATCH(CMP, FD, REQUEST, MEMORY) \
do { \ do { \
if (CMP(request, TIOCGWINSZ)) return ioctl_tiocgwinsz(FD, MEMORY); \ if (CMP(request, TIOCGWINSZ)) return ioctl_tiocgwinsz(FD, MEMORY); \
@ -39,7 +40,7 @@ int ioctl_tiocswinsz_nt(int, void *);
int ioctl_default(int, uint64_t, void *); int ioctl_default(int, uint64_t, void *);
forceinline int ioctl_dispatch(int fd, uint64_t request, void *memory) { forceinline int ioctl_dispatch(int fd, uint64_t request, void *memory) {
__IOCTL_DISPATCH(EQUIVALENT, fd, request, memory); __IOCTL_DISPATCH(__EQUIVALENT, fd, request, memory);
return ioctl_default(fd, request, memory); return ioctl_default(fd, request, memory);
} }

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/alg/alg.h" #include "libc/alg/alg.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/dce.h" #include "libc/dce.h"

View file

@ -18,7 +18,7 @@
*/ */
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/console.h" #include "libc/nt/console.h"
#include "libc/nt/enum/ctrlevent.h" #include "libc/nt/enum/ctrlevent.h"
#include "libc/nt/process.h" #include "libc/nt/process.h"

View file

@ -19,7 +19,7 @@
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/calls/kntprioritycombos.internal.h" #include "libc/calls/kntprioritycombos.internal.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nexgen32e/ffs.h" #include "libc/nexgen32e/ffs.h"
#include "libc/nt/enum/processcreationflags.h" #include "libc/nt/enum/processcreationflags.h"
#include "libc/nt/enum/threadpriority.h" #include "libc/nt/enum/threadpriority.h"

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
#define BYTES 64 #define BYTES 64

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
#define BYTES 64 #define BYTES 64

View file

@ -18,7 +18,7 @@
*/ */
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#define kTmpPathMax 80 #define kTmpPathMax 80

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/enum/offerpriority.h" #include "libc/nt/enum/offerpriority.h"
#include "libc/nt/memory.h" #include "libc/nt/memory.h"
#include "libc/nt/runtime.h" #include "libc/nt/runtime.h"

View file

@ -19,7 +19,7 @@
#include "libc/alg/arraylist2.internal.h" #include "libc/alg/arraylist2.internal.h"
#include "libc/calls/ntspawn.h" #include "libc/calls/ntspawn.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/mem/alloca.h" #include "libc/mem/alloca.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/str/oldutf16.internal.h" #include "libc/str/oldutf16.internal.h"

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/files.h" #include "libc/nt/files.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/at.h" #include "libc/sysv/consts/at.h"

View file

@ -18,7 +18,7 @@
*/ */
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/timeval.h" #include "libc/calls/struct/timeval.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nexgen32e/nexgen32e.h" #include "libc/nexgen32e/nexgen32e.h"
#include "libc/sock/internal.h" #include "libc/sock/internal.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.privileged .privileged
__restore_rt_netbsd: __restore_rt_netbsd:

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/sysv/consts/prio.h" #include "libc/sysv/consts/prio.h"

View file

@ -18,9 +18,10 @@
*/ */
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/bits/initializer.internal.h" #include "libc/bits/initializer.internal.h"
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/rdtsc.h" #include "libc/nexgen32e/rdtsc.h"
#include "libc/nexgen32e/x86feature.h" #include "libc/nexgen32e/x86feature.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/nexgen32e/x86feature.h" #include "libc/nexgen32e/x86feature.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
// Returns timestamp without needing system calls. // Returns timestamp without needing system calls.
// //

View file

@ -19,7 +19,7 @@
#include "libc/bits/pushpop.h" #include "libc/bits/pushpop.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/ntspawn.h" #include "libc/calls/ntspawn.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/nt/enum/filemapflags.h" #include "libc/nt/enum/filemapflags.h"
#include "libc/nt/enum/pageflags.h" #include "libc/nt/enum/pageflags.h"
#include "libc/nt/enum/processcreationflags.h" #include "libc/nt/enum/processcreationflags.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.text.windows .text.windows
.source __FILE__ .source __FILE__

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.text.windows .text.windows
.source __FILE__ .source __FILE__

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/alg/reverse.h" #include "libc/alg/reverse.internal.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/nt/createfile.h" #include "libc/nt/createfile.h"
#include "libc/nt/enum/accessmask.h" #include "libc/nt/enum/accessmask.h"

View file

@ -22,7 +22,7 @@
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/struct/iovec.h" #include "libc/calls/struct/iovec.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
#include "libc/zipos/zipos.internal.h" #include "libc/zipos/zipos.internal.h"

View file

@ -22,7 +22,7 @@
#include "libc/calls/struct/iovec.h" #include "libc/calls/struct/iovec.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/sysv/consts/iov.h" #include "libc/sysv/consts/iov.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"

View file

@ -21,7 +21,7 @@
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/struct/iovec.h" #include "libc/calls/struct/iovec.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"
/** /**

View file

@ -21,7 +21,7 @@
#include "libc/calls/struct/iovec.h" #include "libc/calls/struct/iovec.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/sysv/consts/iov.h" #include "libc/sysv/consts/iov.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"

View file

@ -18,7 +18,7 @@
*/ */
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/metalfile.internal.h" #include "libc/calls/metalfile.internal.h"
#include "libc/macros.h" #include "libc/macros.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/bits/safemacros.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/dce.h" #include "libc/dce.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/macros.h" #include "libc/macros.internal.h"
.source __FILE__ .source __FILE__
// Sets effective group ID. // Sets effective group ID.

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