Make cosmo.h work a little better

This commit is contained in:
Justine Tunney 2024-02-21 16:40:09 -08:00
parent d9df41c4d5
commit 68b9479f0c
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
12 changed files with 22 additions and 26 deletions

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_DCE_H_ #ifndef COSMOPOLITAN_LIBC_DCE_H_
#define COSMOPOLITAN_LIBC_DCE_H_ #define COSMOPOLITAN_LIBC_DCE_H_
#ifdef _COSMO_SOURCE
/*─────────────────────────────────────────────────────────────────────────────╗ /*─────────────────────────────────────────────────────────────────────────────╗
cosmopolitan § autotune » dead code elimination cosmopolitan § autotune » dead code elimination
*/ */
@ -125,5 +125,5 @@ int IsQemuUser(void);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_DCE_H_ */ #endif /* COSMOPOLITAN_LIBC_DCE_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -16,13 +16,11 @@ void *dlopen(const char *, int) libcesque;
void *dlsym(void *, const char *) libcesque; void *dlsym(void *, const char *) libcesque;
int dlclose(void *) libcesque; int dlclose(void *) libcesque;
#ifdef _COSMO_SOURCE
char *cosmo_dlerror(void) libcesque; char *cosmo_dlerror(void) libcesque;
void *cosmo_dlopen(const char *, int) libcesque; void *cosmo_dlopen(const char *, int) libcesque;
void *cosmo_dlsym(void *, const char *) libcesque; void *cosmo_dlsym(void *, const char *) libcesque;
void *cosmo_dltramp(void *) libcesque; void *cosmo_dltramp(void *) libcesque;
int cosmo_dlclose(void *) libcesque; int cosmo_dlclose(void *) libcesque;
#endif
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_DLFCN_H_ */ #endif /* COSMOPOLITAN_LIBC_DLFCN_H_ */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_FMT_ITOA_H_ #ifndef COSMOPOLITAN_LIBC_FMT_ITOA_H_
#define COSMOPOLITAN_LIBC_FMT_ITOA_H_ #define COSMOPOLITAN_LIBC_FMT_ITOA_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
#define LengthInt64 __LengthInt64 #define LengthInt64 __LengthInt64
@ -42,5 +42,5 @@ libcesque size_t uint64toarray_fixed16(uint64_t, char[hasatleast 17], uint8_t);
libcesque size_t uint64toarray_radix8(uint64_t, char[hasatleast 24]); libcesque size_t uint64toarray_radix8(uint64_t, char[hasatleast 24]);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_FMT_ITOA_H_ */ #endif /* COSMOPOLITAN_LIBC_FMT_ITOA_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_FMT_LEB128_H_ #ifndef COSMOPOLITAN_LIBC_FMT_LEB128_H_
#define COSMOPOLITAN_LIBC_FMT_LEB128_H_ #define COSMOPOLITAN_LIBC_FMT_LEB128_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
#define sleb64 __sleb64 #define sleb64 __sleb64
@ -16,5 +16,5 @@ int unzleb64(const char *, size_t, int64_t *) libcesque;
int unuleb64(const char *, size_t, uint64_t *) libcesque; int unuleb64(const char *, size_t, uint64_t *) libcesque;
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_FMT_LEB128_H_ */ #endif /* COSMOPOLITAN_LIBC_FMT_LEB128_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_INTRIN_DLL_H_ #ifndef COSMOPOLITAN_LIBC_INTRIN_DLL_H_
#define COSMOPOLITAN_LIBC_INTRIN_DLL_H_ #define COSMOPOLITAN_LIBC_INTRIN_DLL_H_
#ifdef _COSMO_SOURCE
#define dll_make_first __dll_make_first #define dll_make_first __dll_make_first
#define dll_make_last __dll_make_last #define dll_make_last __dll_make_last
#define dll_remove __dll_remove #define dll_remove __dll_remove
@ -55,5 +55,5 @@ void dll_make_first(struct Dll **, struct Dll *) paramsnonnull((1)) libcesque;
void dll_splice_after(struct Dll *, struct Dll *) paramsnonnull((1)) libcesque; void dll_splice_after(struct Dll *, struct Dll *) paramsnonnull((1)) libcesque;
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DLL_H_ */ #endif /* COSMOPOLITAN_LIBC_INTRIN_DLL_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_ #ifndef COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
#define COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_ #define COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
#ifdef _COSMO_SOURCE
#define klog __klog #define klog __klog
#define kprintf __kprintf #define kprintf __kprintf
@ -54,5 +54,5 @@ void uvprintf(const char *, va_list) libcesque;
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_ */ #endif /* COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,7 +1,7 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_LOG_LOG_H_ #ifndef COSMOPOLITAN_LIBC_LOG_LOG_H_
#define COSMOPOLITAN_LIBC_LOG_LOG_H_ #define COSMOPOLITAN_LIBC_LOG_LOG_H_
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#ifdef _COSMO_SOURCE
#define kLogFatal 0 #define kLogFatal 0
#define kLogError 1 #define kLogError 1
@ -224,5 +224,5 @@ void vffatalf(ARGS, va_list) asm("vflogf") ATTRV relegated wontreturn libcesque;
#endif /* __STRICT_ANSI__ */ #endif /* __STRICT_ANSI__ */
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_LOG_LOG_H_ */ #endif /* COSMOPOLITAN_LIBC_LOG_LOG_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_MEM_GC_H_ #ifndef COSMOPOLITAN_LIBC_MEM_GC_H_
#define COSMOPOLITAN_LIBC_MEM_GC_H_ #define COSMOPOLITAN_LIBC_MEM_GC_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
libcesque void _gc_free(void *); libcesque void _gc_free(void *);
@ -19,5 +19,5 @@ libcesque void gclongjmp(void *, int) wontreturn;
}) })
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_MEM_GC_H_ */ #endif /* COSMOPOLITAN_LIBC_MEM_GC_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_ #ifndef COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_
#define COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_ #define COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
struct StackFrame { struct StackFrame {
@ -9,5 +9,5 @@ struct StackFrame {
}; };
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_ */ #endif /* COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_RUNTIME_STACK_H_ #ifndef COSMOPOLITAN_LIBC_RUNTIME_STACK_H_
#define COSMOPOLITAN_LIBC_RUNTIME_STACK_H_ #define COSMOPOLITAN_LIBC_RUNTIME_STACK_H_
#ifdef _COSMO_SOURCE
/** /**
* Returns preferred size and alignment of thread stack. * Returns preferred size and alignment of thread stack.
@ -156,5 +156,5 @@ int FreeCosmoStack(void *) libcesque;
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* GNU ELF */ #endif /* GNU ELF */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_RUNTIME_STACK_H_ */ #endif /* COSMOPOLITAN_LIBC_RUNTIME_STACK_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_STDIO_APPEND_H_ #ifndef COSMOPOLITAN_LIBC_STDIO_APPEND_H_
#define COSMOPOLITAN_LIBC_STDIO_APPEND_H_ #define COSMOPOLITAN_LIBC_STDIO_APPEND_H_
#ifdef _COSMO_SOURCE
#define APPEND_COOKIE 21578 #define APPEND_COOKIE 21578
@ -32,5 +32,5 @@ ssize_t kappendf(char **, const char *, ...) libcesque;
ssize_t kvappendf(char **, const char *, va_list) libcesque; ssize_t kvappendf(char **, const char *, va_list) libcesque;
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_STDIO_APPEND_H_ */ #endif /* COSMOPOLITAN_LIBC_STDIO_APPEND_H_ */
#endif /* _COSMO_SOURCE */

View file

@ -1,7 +1,7 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_X_H_ #ifndef COSMOPOLITAN_LIBC_X_H_
#define COSMOPOLITAN_LIBC_X_H_ #define COSMOPOLITAN_LIBC_X_H_
#ifdef _COSMO_SOURCE
#define xwrite __xwrite #define xwrite __xwrite
#define xdie __xdie #define xdie __xdie
#define xmalloc __xmalloc #define xmalloc __xmalloc
@ -32,9 +32,7 @@
#define xfixpath __xfixpath #define xfixpath __xfixpath
#define xslurp __xslurp #define xslurp __xslurp
#define xbarf __xbarf #define xbarf __xbarf
#endif /* _COSMO_SOURCE */
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
int xwrite(int, const void *, uint64_t); int xwrite(int, const void *, uint64_t);
@ -97,5 +95,5 @@ void *xslurp(const char *, size_t *)
int xbarf(const char *, const void *, size_t); int xbarf(const char *, const void *, size_t);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_X_H_ */ #endif /* COSMOPOLITAN_LIBC_X_H_ */
#endif /* _COSMO_SOURCE */