Remove bool from public headers

This commit is contained in:
Justine Tunney 2023-11-15 20:57:18 -08:00
parent dffee606cf
commit 1351d3cede
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
55 changed files with 105 additions and 98 deletions

View file

@ -19,6 +19,7 @@
#include "dsp/tty/tty.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/mem/gc.internal.h"
#include "libc/mem/mem.h"
#include "libc/x/x.h"
/* TODO(jart): DELETE */

View file

@ -5,6 +5,7 @@
#include "libc/calls/struct/sigval.h"
#include "libc/dce.h"
#include "libc/macros.internal.h"
#include "libc/stdbool.h"
#define kSigactionMinRva 8 /* >SIG_{ERR,DFL,IGN,...} */
@ -46,6 +47,12 @@ int _park_norestart(uint32_t, uint64_t);
int _park_restartable(uint32_t, uint64_t);
int sys_openat_metal(int, const char *, int, unsigned);
#ifdef __x86_64__
bool __iswsl1(void);
#else
#define __iswsl1() false
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_INTERNAL_H_ */

View file

@ -119,12 +119,6 @@ COSMOPOLITAN_C_START_
extern const int __hostos;
#ifdef __x86_64__
bool __iswsl1(void);
#else
#define __iswsl1() false
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* _COSMO_SOURCE */

View file

@ -20,6 +20,7 @@
#include "libc/dns/hoststxt.h"
#include "libc/errno.h"
#include "libc/mem/arraylist.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/stdio/stdio.h"

View file

@ -12,8 +12,8 @@ COSMOPOLITAN_C_START_
*/
/* clang-format off */
bool IsElfSymbolContent(const Elf64_Sym *);
bool IsElf64Binary(const Elf64_Ehdr *, size_t);
bool32 IsElfSymbolContent(const Elf64_Sym *);
bool32 IsElf64Binary(const Elf64_Ehdr *, size_t);
char *GetElfStringTable(const Elf64_Ehdr *, size_t, const char *);
Elf64_Sym *GetElfSymbols(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);
Elf64_Shdr *GetElfSymbolTable(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);

View file

@ -28,7 +28,7 @@
* @param mapsize is the number of bytes past `elf` we can access
* @return true if elf header looks legit
*/
bool IsElf64Binary(const Elf64_Ehdr *elf, size_t mapsize) {
bool32 IsElf64Binary(const Elf64_Ehdr *elf, size_t mapsize) {
if (mapsize < sizeof(Elf64_Ehdr)) return false;
if (READ32LE(elf->e_ident) != READ32LE(ELFMAG)) return false;
return elf->e_ident[EI_CLASS] != ELFCLASS32;

View file

@ -19,7 +19,7 @@
#include "libc/elf/def.h"
#include "libc/elf/elf.h"
bool IsElfSymbolContent(const Elf64_Sym *sym) {
bool32 IsElfSymbolContent(const Elf64_Sym *sym) {
return sym->st_size > 0 && (ELF64_ST_TYPE(sym->st_info) == STT_FUNC ||
ELF64_ST_TYPE(sym->st_info) == STT_OBJECT);
}

View file

@ -25,7 +25,7 @@
* @param z ensures it starts with zero
* @return pointer to nul byte
*/
char *FormatOctal64(char p[hasatleast 24], uint64_t x, bool z) {
char *FormatOctal64(char p[hasatleast 24], uint64_t x, bool32 z) {
char t;
size_t i, a, b;
i = 0;

View file

@ -33,8 +33,8 @@ char *FormatInt64(char[hasatleast 21], int64_t);
char *FormatUint64(char[hasatleast 21], uint64_t);
char *FormatInt64Thousands(char[hasatleast 27], int64_t);
char *FormatUint64Thousands(char[hasatleast 27], uint64_t);
char *FormatOctal32(char[hasatleast 13], uint32_t, bool);
char *FormatOctal64(char[hasatleast 24], uint64_t, bool);
char *FormatOctal32(char[hasatleast 13], uint32_t, bool32);
char *FormatOctal64(char[hasatleast 24], uint64_t, bool32);
char *FormatBinary64(char[hasatleast 67], uint64_t, char);
char *FormatHex64(char[hasatleast 19], uint64_t, char);
char *FormatFlex64(char[hasatleast 24], int64_t, char);

View file

@ -7,7 +7,7 @@ COSMOPOLITAN_C_START_
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86__)
#define _cmpxchg(IFTHING, ISEQUALTOME, REPLACEITWITHME) \
({ \
bool DidIt; \
bool32 DidIt; \
autotype(IFTHING) IfThing = (IFTHING); \
typeof(*IfThing) IsEqualToMe = (ISEQUALTOME); \
typeof(*IfThing) ReplaceItWithMe = (REPLACEITWITHME); \

View file

@ -25,7 +25,7 @@
* @param z ensures it starts with zero
* @return pointer to nul byte
*/
char *FormatOctal32(char p[hasatleast 13], uint32_t x, bool z) {
char *FormatOctal32(char p[hasatleast 13], uint32_t x, bool32 z) {
char t;
size_t i, a, b;
i = 0;

View file

@ -18,7 +18,7 @@
*/
#include "libc/nt/version.h"
bool(IsAtLeastWindows10)(void) {
bool32(IsAtLeastWindows10)(void) {
#ifdef __x86_64__
return IsAtLeastWindows10();
#else

View file

@ -19,6 +19,6 @@
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
bool IsCygwin(void) {
bool32 IsCygwin(void) {
return IsGenuineBlink() && !strcmp(GetCpuidOs(), "Cygwin");
}

View file

@ -44,7 +44,7 @@ static textwindows bool IsBeingDebugged(void) {
* Determines if gdb, strace, windbg, etc. is controlling process.
* @return non-zero if attached, otherwise 0
*/
int IsDebuggerPresent(bool force) {
bool32 IsDebuggerPresent(bool32 force) {
/* asan runtime depends on this function */
ssize_t got;
int e, fd, res;

View file

@ -20,6 +20,6 @@
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
bool IsGenuineBlink(void) {
bool32 IsGenuineBlink(void) {
return X86_HAVE(HYPERVISOR) && !strcmp(GetCpuidEmulator(), "GenuineBlink");
}

View file

@ -21,12 +21,12 @@
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
bool g_isrunningundermake;
bool32 g_isrunningundermake;
/**
* Returns true if current process was spawned by GNU Make.
*/
bool IsRunningUnderMake(void) {
bool32 IsRunningUnderMake(void) {
return g_isrunningundermake;
}

View file

@ -25,4 +25,4 @@
* server is a good idea since it'll ask the C runtime to not pull
* magical stunts like attaching GDB to the process on crash.
*/
bool __isworker;
bool32 __isworker;

View file

@ -204,7 +204,7 @@ privileged static bool kismapped(int x) {
}
}
privileged bool kisdangerous(const void *p) {
privileged bool32 kisdangerous(const void *p) {
int frame;
if (kisimagepointer(p)) return false;
if (kiskernelpointer(p)) return false;

View file

@ -21,7 +21,7 @@ size_t ksnprintf(char *, size_t, const char *, ...);
void kvprintf(const char *, va_list);
size_t kvsnprintf(char *, size_t, const char *, va_list);
bool kisdangerous(const void *);
bool32 kisdangerous(const void *);
void klog(const char *, size_t);
void _klog_serial(const char *, size_t);
@ -31,26 +31,26 @@ void uprintf(const char *, ...);
void uvprintf(const char *, va_list);
#ifndef TINY
#define KINFOF(FMT, ...) \
do { \
uprintf("\r\e[35m%s:%d: " FMT "\e[0m\n", \
__FILE__, __LINE__, ## __VA_ARGS__); \
} while (0)
#define KWARNF(FMT, ...) \
do { \
uprintf("\r\e[94;49mwarn: %s:%d: " FMT "\e[0m\n", \
__FILE__, __LINE__, ## __VA_ARGS__); \
} while (0)
#define KINFOF(FMT, ...) \
do { \
uprintf("\r\e[35m%s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
##__VA_ARGS__); \
} while (0)
#define KWARNF(FMT, ...) \
do { \
uprintf("\r\e[94;49mwarn: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
##__VA_ARGS__); \
} while (0)
#else
#define KINFOF(FMT, ...) ((void)0)
#define KWARNF(FMT, ...) ((void)0)
#endif
#define KDIEF(FMT, ...) \
do { \
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", \
__FILE__, __LINE__, ## __VA_ARGS__); \
for (;;) asm volatile("cli\n\thlt"); \
} while (0)
#define KDIEF(FMT, ...) \
do { \
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
##__VA_ARGS__); \
for (;;) asm volatile("cli\n\thlt"); \
} while (0)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -1,6 +1,5 @@
#ifndef _COSMO_H
#define _COSMO_H
#include "libc/stdbool.h"
#ifdef _COSMO_SOURCE
#define COSMO_ALREADY_DEFINED
@ -24,7 +23,7 @@
* includes core runtime services, third party libraries we've curated,
* as well as internal libraries we made that are good enough to share.
*
* @see tool/script/cosmocc
* @see tool/cosmocc
*/
#include "libc/calls/calls.h"

View file

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

View file

@ -5,7 +5,7 @@
COSMOPOLITAN_C_START_
extern bool __nocolor;
extern bool g_isrunningundermake;
extern bool32 g_isrunningundermake;
void __start_fatal(const char *, int);
void __restore_tty(void);

View file

@ -39,12 +39,11 @@ int __watch(void *, size_t);
void __die(void) relegated wontreturn; /* print backtrace and abort() */
void _meminfo(int); /* shows malloc statistics &c. */
void _memsummary(int); /* light version of same thing */
bool IsTerminalInarticulate(void) nosideeffect;
const char *commandvenv(const char *, const char *);
const char *GetAddr2linePath(void);
const char *GetGdbPath(void);
bool32 IsDebuggerPresent(bool);
bool IsRunningUnderMake(void);
bool32 IsDebuggerPresent(bool32);
bool32 IsRunningUnderMake(void);
char *GetSymbolByAddr(int64_t);
void PrintGarbage(void);
void PrintGarbageNumeric(FILE *);

View file

@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_ALG_ARRAYLIST_H_
#define COSMOPOLITAN_LIBC_ALG_ARRAYLIST_H_
#include "libc/intrin/bits.h"
#include "libc/mem/mem.h"
#include "libc/mem/internal.h"
#include "libc/str/str.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_ALG_ARRAYLIST2_H_
#define COSMOPOLITAN_LIBC_ALG_ARRAYLIST2_H_
#include "libc/mem/mem.h"
#include "libc/mem/internal.h"
#include "libc/str/str.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_ALG_CRITBIT0_H_
#define COSMOPOLITAN_LIBC_ALG_CRITBIT0_H_
#include "libc/stdbool.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/*───────────────────────────────────────────────────────────────────────────│─╗

View file

@ -10,6 +10,7 @@ struct CritbitNode {
};
int __putenv(char *, bool);
bool __grow(void *, size_t *, size_t, size_t) paramsnonnull((1, 2)) libcesque;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -57,10 +57,6 @@ size_t malloc_footprint_limit(void);
size_t malloc_set_footprint_limit(size_t);
void malloc_inspect_all(void (*)(void *, void *, size_t, void *), void *);
#ifdef _COSMO_SOURCE
bool __grow(void *, size_t *, size_t, size_t) paramsnonnull((1, 2)) libcesque;
#endif
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_MEM_MEM_H_ */

View file

@ -35,8 +35,8 @@ COSMOPOLITAN_C_START_
*/
#define rdpid() \
({ \
bool Ok; \
long Msr; \
bool32 Ok; \
Ok = false; \
if (X86_HAVE(RDPID)) { \
asm volatile("rdpid\t%0" : "=r"(Msr) : /* no inputs */ : "memory"); \

View file

@ -24,7 +24,7 @@
int __threaded;
#ifdef __x86_64__
bool __tls_enabled;
char __tls_enabled;
#endif
unsigned __tls_index;

View file

@ -176,7 +176,7 @@ typedef enum {
typedef struct {
uint32_t Resolution;
uint32_t Accuracy;
bool SetsToZero;
bool32 SetsToZero;
} EFI_TIME_CAPABILITIES;
typedef struct {
@ -231,7 +231,7 @@ typedef struct {
int32_t Attribute;
int32_t CursorColumn;
int32_t CursorRow;
bool CursorVisible;
bool32 CursorVisible;
} EFI_SIMPLE_TEXT_OUTPUT_MODE;
typedef enum {
@ -359,10 +359,10 @@ typedef EFI_STATUS(EFIAPI *EFI_UPDATE_CAPSULE)(
typedef EFI_STATUS(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(
EFI_CAPSULE_HEADER **CapsuleHeaderArray, uintptr_t CapsuleCount,
uint64_t *out_MaximumCapsuleSize, EFI_RESET_TYPE *out_ResetType);
typedef EFI_STATUS(EFIAPI *EFI_GET_WAKEUP_TIME)(bool *out_Enabled,
bool *out_Pending,
typedef EFI_STATUS(EFIAPI *EFI_GET_WAKEUP_TIME)(bool32 *out_Enabled,
bool32 *out_Pending,
EFI_TIME *out_Time);
typedef EFI_STATUS(EFIAPI *EFI_SET_WAKEUP_TIME)(bool Enable,
typedef EFI_STATUS(EFIAPI *EFI_SET_WAKEUP_TIME)(bool32 Enable,
EFI_TIME *opt_Time);
typedef EFI_STATUS(EFIAPI *EFI_SET_WATCHDOG_TIMER)(uintptr_t Timeout,
uint64_t WatchdogCode,
@ -390,12 +390,12 @@ typedef EFI_STATUS(EFIAPI *EFI_CONVERT_POINTER)(uintptr_t DebugDisposition,
void **inout_Address);
typedef EFI_STATUS(EFIAPI *EFI_INPUT_RESET)(
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, bool ExtendedVerification);
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, bool32 ExtendedVerification);
typedef EFI_STATUS(EFIAPI *EFI_INPUT_READ_KEY)(
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, EFI_INPUT_KEY *out_Key);
typedef EFI_STATUS(EFIAPI *EFI_TEXT_RESET)(
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool ExtendedVerification);
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool32 ExtendedVerification);
typedef EFI_STATUS(EFIAPI *EFI_TEXT_STRING)(
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, char16_t *String);
typedef EFI_STATUS(EFIAPI *EFI_TEXT_TEST_STRING)(
@ -412,7 +412,7 @@ typedef EFI_STATUS(EFIAPI *EFI_TEXT_CLEAR_SCREEN)(
typedef EFI_STATUS(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, uint64_t Column, uint64_t Row);
typedef EFI_STATUS(EFIAPI *EFI_TEXT_ENABLE_CURSOR)(
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool Visible);
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool32 Visible);
typedef EFI_STATUS(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(
EFI_GRAPHICS_OUTPUT_PROTOCOL *This, uint32_t ModeNumber,
@ -430,7 +430,7 @@ typedef EFI_STATUS(EFIAPI *EFI_HANDLE_PROTOCOL)(EFI_HANDLE Handle,
EFI_GUID *Protocol,
void *out_Interface);
typedef EFI_STATUS(EFIAPI *EFI_IMAGE_LOAD)(bool BootPolicy,
typedef EFI_STATUS(EFIAPI *EFI_IMAGE_LOAD)(bool32 BootPolicy,
EFI_HANDLE ParentImageHandle,
EFI_DEVICE_PATH_PROTOCOL *DevicePath,
void *opt_SourceBuffer,

View file

@ -4,7 +4,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
bool IsAtLeastWindows10(void) pureconst;
bool32 IsAtLeastWindows10(void) pureconst;
bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86_64__)

View file

@ -29,7 +29,7 @@
* @assume stack memory isn't stored beneath %rsp (-mno-red-zone)
* @deprecated
*/
optimizesize bool _isheap(void *p) {
optimizesize bool32 _isheap(void *p) {
intptr_t x, y;
x = kAutomapStart;
y = x + kAutomapSize;

View file

@ -81,7 +81,7 @@ extern const char kNtSystemDirectory[];
extern const char kNtWindowsDirectory[];
extern size_t __virtualmax;
extern size_t __stackmax;
extern bool __isworker;
extern bool32 __isworker;
/* utilities */
void _intsort(int *, size_t);
void _longsort(long *, size_t);
@ -111,14 +111,14 @@ void CheckForMemoryLeaks(void);
void CheckForFileLeaks(void);
void __enable_threads(void);
void __oom_hook(size_t);
bool _isheap(void *);
bool32 _isheap(void *);
/* code morphing */
void __morph_begin(void);
void __morph_end(void);
/* portability */
int NtGetVersion(void) pureconst;
bool IsGenuineBlink(void);
bool IsCygwin(void);
bool32 IsGenuineBlink(void);
bool32 IsCygwin(void);
const char *GetCpuidOs(void);
const char *GetCpuidEmulator(void);
void GetCpuidBrand(char[13], uint32_t);

View file

@ -19,6 +19,7 @@
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
#include "libc/mem/internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param suffix is also NUL-terminated
*/
bool endswith(const char *s, const char *suffix) {
bool32 endswith(const char *s, const char *suffix) {
size_t n, m;
n = strlen(s);
m = strlen(suffix);

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param suffix is also NUL-terminated
*/
bool endswith16(const char16_t *s, const char16_t *suffix) {
bool32 endswith16(const char16_t *s, const char16_t *suffix) {
size_t n, m;
n = strlen16(s);
m = strlen16(suffix);

View file

@ -21,7 +21,7 @@
/**
* Returns true if buffer is most likely plaintext.
*/
bool istext(const void *data, size_t size) {
bool32 istext(const void *data, size_t size) {
const unsigned char *p, *pe;
for (p = data, pe = p + size; p < pe; ++p) {
if (*p <= 3) {

View file

@ -49,7 +49,7 @@ static const char kUtf8Dispatch[] = {
*
* @param size if -1 implies strlen
*/
bool isutf8(const void *data, size_t size) {
bool32 isutf8(const void *data, size_t size) {
long c;
const char *p, *e;
if (size == -1) size = data ? strlen(data) : 0;

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_STR_SLICE_H_
#define COSMOPOLITAN_LIBC_STR_SLICE_H_
#include "libc/stdbool.h"
#include "libc/str/str.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -18,7 +19,6 @@ COSMOPOLITAN_C_START_
int CompareSlices(const char *, size_t, const char *, size_t);
int CompareSlicesCase(const char *, size_t, const char *, size_t);
bool StartsWithIgnoreCase(const char *, const char *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param prefix is also NUL-terminated
*/
bool startswith(const char *s, const char *prefix) {
bool32 startswith(const char *s, const char *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param prefix is also NUL-terminated
*/
bool startswith16(const char16_t *s, const char16_t *prefix) {
bool32 startswith16(const char16_t *s, const char16_t *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;

View file

@ -22,7 +22,7 @@
/**
* Checks if string starts with prefix, case insensitively.
*/
bool startswithi(const char *s, const char *prefix) {
bool32 startswithi(const char *s, const char *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;

View file

@ -178,11 +178,11 @@ uint64_t tpenc(uint32_t) pureconst;
char *chomp(char *) libcesque;
wchar_t *wchomp(wchar_t *) libcesque;
uint64_t __fnv(const void *, size_t) strlenesque;
bool startswith(const char *, const char *) strlenesque;
bool startswithi(const char *, const char *) strlenesque;
bool endswith(const char *, const char *) strlenesque;
bool istext(const void *, size_t) libcesque;
bool isutf8(const void *, size_t) libcesque;
bool32 startswith(const char *, const char *) strlenesque;
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;
@ -207,12 +207,12 @@ char16_t *strcat16(char16_t *, const char16_t *) memcpyesque;
char16_t *strcpy16(char16_t *, const char16_t *) memcpyesque;
char16_t *strncat16(char16_t *, const char16_t *, size_t) memcpyesque;
char16_t *memset16(char16_t *, char16_t, size_t) memcpyesque;
bool startswith16(const char16_t *, const char16_t *) strlenesque;
bool endswith16(const char16_t *, const char16_t *) strlenesque;
bool32 startswith16(const char16_t *, const char16_t *) strlenesque;
bool32 endswith16(const char16_t *, const char16_t *) strlenesque;
axdx_t tprecode8to16(char16_t *, size_t, const char *);
axdx_t tprecode16to8(char *, size_t, const char16_t *);
bool wcsstartswith(const wchar_t *, const wchar_t *) strlenesque;
bool wcsendswith(const wchar_t *, const wchar_t *) strlenesque;
bool32 wcsstartswith(const wchar_t *, const wchar_t *) strlenesque;
bool32 wcsendswith(const wchar_t *, const wchar_t *) strlenesque;
char *__join_paths(char *, size_t, const char *, const char *) __wur;
#endif /* _COSMO_SOURCE */

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param suffix is also NUL-terminated
*/
bool wcsendswith(const wchar_t *s, const wchar_t *suffix) {
bool32 wcsendswith(const wchar_t *s, const wchar_t *suffix) {
size_t n, m;
n = wcslen(s);
m = wcslen(suffix);

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param prefix is also NUL-terminated
*/
bool _wcsstartswith(const wchar_t *s, const wchar_t *prefix) {
bool32 wcsstartswith(const wchar_t *s, const wchar_t *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_TESTLIB_H_
#define COSMOPOLITAN_LIBC_TESTLIB_H_
#include "libc/stdbool.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/*───────────────────────────────────────────────────────────────────────────│─╗

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_SEMAPHORE_H_
#define COSMOPOLITAN_LIBC_CALLS_SEMAPHORE_H_
#include "libc/calls/struct/timespec.h"
#include "libc/stdbool.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -20,8 +19,8 @@ typedef struct {
int64_t sem_dev; /* named only */
int64_t sem_ino; /* named only */
int sem_pid; /* unnamed only */
bool sem_lazydelete; /* named only */
bool sem_pshared;
char sem_lazydelete; /* named only */
char sem_pshared;
int *sem_kernel;
};
void *sem_space[32];

View file

@ -9,8 +9,8 @@
COSMOPOLITAN_C_START_
struct CosmoFtrace { /* 16 */
bool ft_once; /* 0 */
bool ft_noreentry; /* 1 */
char ft_once; /* 0 */
char ft_noreentry; /* 1 */
int ft_skew; /* 4 */
int64_t ft_lastaddr; /* 8 */
};
@ -48,7 +48,7 @@ char *_mktls(struct CosmoTib **);
void __bootstrap_tls(struct CosmoTib *, char *);
#ifdef __x86_64__
extern bool __tls_enabled;
extern char __tls_enabled;
#define __tls_enabled_set(x) __tls_enabled = x
#elif defined(__aarch64__)
#define __tls_enabled true

View file

@ -24,7 +24,7 @@ forceinline uint32_t __magicu_div(uint32_t x, struct magicu d) {
/**
* Checks if 𝑑 contains a valid initialized divisor.
*/
static inline bool __magicu_valid(struct magicu d) {
static inline bool32 __magicu_valid(struct magicu d) {
if (!d.M && !d.s) return false; /* uninitialized */
if (d.s & ~(64 | 63)) return false; /* corrupted */
return true;

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/pledge.h"
#include "libc/calls/struct/rusage.h"
#include "libc/calls/struct/sigaction.h"

View file

@ -19,6 +19,7 @@
#include "libc/intrin/pushpop.internal.h"
#include "libc/limits.h"
#include "libc/macros.internal.h"
#include "libc/mem/internal.h"
#include "libc/mem/mem.h"
#include "libc/nt/enum/version.h"
#include "libc/runtime/runtime.h"

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/dce.h"
#include "libc/errno.h"

View file

@ -23,6 +23,7 @@
#include "libc/log/check.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/mem/gc.h"
#include "libc/mem/mem.h"
#include "libc/runtime/memtrack.internal.h"
#include "libc/stdalign.internal.h"
#include "libc/str/str.h"

View file

@ -242,9 +242,6 @@ CPPFLAGS_X86_64="$CPPFLAGS -mno-red-zone"
CFLAGS_X86_64="$CFLAGS -mno-tls-direct-seg-refs"
LDFLAGS_X86_64="$LDFLAGS -L$BIN/../x86_64-linux-cosmo/lib -Wl,-T,$BIN/../x86_64-linux-cosmo/lib/ape.lds -Wl,-z,common-page-size=4096 -Wl,-z,max-page-size=16384"
LDLIBS_X86_64="-lcosmo"
if [ $MCOSMO -eq 1 ]; then
CPPFLAGS_X86_64="${CPPFLAGS_X86_64} -D_COSMO_SOURCE"
fi
CRT_AARCH64="$BIN/../aarch64-linux-cosmo/lib/crt.o"
CPPFLAGS_AARCH64="$CPPFLAGS"
@ -262,6 +259,11 @@ if [ x"$PROG" != x"${PROG%++}" ]; then
LDLIBS_AARCH64="-lcxx ${LDLIBS_AARCH64}"
fi
if [ $MCOSMO -eq 1 ]; then
CPPFLAGS_X86_64="${CPPFLAGS_X86_64} -D_COSMO_SOURCE"
CPPFLAGS_AARCH64="${CPPFLAGS_AARCH64} -D_COSMO_SOURCE"
fi
log_original
if [ $INTENT = cpp ]; then