Skip to content

Commit

Permalink
Make cosmo.h work a little better
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Feb 22, 2024
1 parent d9df41c commit 68b9479
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 26 deletions.
4 changes: 2 additions & 2 deletions libc/dce.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_DCE_H_
#define COSMOPOLITAN_LIBC_DCE_H_
#ifdef _COSMO_SOURCE
/*─────────────────────────────────────────────────────────────────────────────╗
│ cosmopolitan § autotune » dead code elimination │
╚─────────────────────────────────────────────────────────────────────────────*/
Expand Down Expand Up @@ -125,5 +125,5 @@ int IsQemuUser(void);

COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_DCE_H_ */
#endif /* _COSMO_SOURCE */
2 changes: 0 additions & 2 deletions libc/dlopen/dlfcn.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ void *dlopen(const char *, int) libcesque;
void *dlsym(void *, const char *) libcesque;
int dlclose(void *) libcesque;

#ifdef _COSMO_SOURCE
char *cosmo_dlerror(void) libcesque;
void *cosmo_dlopen(const char *, int) libcesque;
void *cosmo_dlsym(void *, const char *) libcesque;
void *cosmo_dltramp(void *) libcesque;
int cosmo_dlclose(void *) libcesque;
#endif

COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_DLFCN_H_ */
4 changes: 2 additions & 2 deletions libc/fmt/itoa.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_FMT_ITOA_H_
#define COSMOPOLITAN_LIBC_FMT_ITOA_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_

#define LengthInt64 __LengthInt64
Expand Down Expand Up @@ -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]);

COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_FMT_ITOA_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/fmt/leb128.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_FMT_LEB128_H_
#define COSMOPOLITAN_LIBC_FMT_LEB128_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_

#define sleb64 __sleb64
Expand All @@ -16,5 +16,5 @@ int unzleb64(const char *, size_t, int64_t *) libcesque;
int unuleb64(const char *, size_t, uint64_t *) libcesque;

COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_FMT_LEB128_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/intrin/dll.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_INTRIN_DLL_H_
#define COSMOPOLITAN_LIBC_INTRIN_DLL_H_
#ifdef _COSMO_SOURCE
#define dll_make_first __dll_make_first
#define dll_make_last __dll_make_last
#define dll_remove __dll_remove
Expand Down Expand Up @@ -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;

COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_INTRIN_DLL_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/intrin/kprintf.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
#define COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
#ifdef _COSMO_SOURCE

#define klog __klog
#define kprintf __kprintf
Expand Down Expand Up @@ -54,5 +54,5 @@ void uvprintf(const char *, va_list) libcesque;

COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/log/log.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_LOG_LOG_H_
#define COSMOPOLITAN_LIBC_LOG_LOG_H_
#include "libc/stdio/stdio.h"
#ifdef _COSMO_SOURCE

#define kLogFatal 0
#define kLogError 1
Expand Down Expand Up @@ -224,5 +224,5 @@ void vffatalf(ARGS, va_list) asm("vflogf") ATTRV relegated wontreturn libcesque;

#endif /* __STRICT_ANSI__ */
COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_LOG_LOG_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/mem/gc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_MEM_GC_H_
#define COSMOPOLITAN_LIBC_MEM_GC_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_

libcesque void _gc_free(void *);
Expand All @@ -19,5 +19,5 @@ libcesque void gclongjmp(void *, int) wontreturn;
})

COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_MEM_GC_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/nexgen32e/stackframe.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_
#define COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_

struct StackFrame {
Expand All @@ -9,5 +9,5 @@ struct StackFrame {
};

COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_STACKFRAME_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/runtime/stack.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_RUNTIME_STACK_H_
#define COSMOPOLITAN_LIBC_RUNTIME_STACK_H_
#ifdef _COSMO_SOURCE

/**
* Returns preferred size and alignment of thread stack.
Expand Down Expand Up @@ -156,5 +156,5 @@ int FreeCosmoStack(void *) libcesque;

COSMOPOLITAN_C_END_
#endif /* GNU ELF */
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_RUNTIME_STACK_H_ */
#endif /* _COSMO_SOURCE */
4 changes: 2 additions & 2 deletions libc/stdio/append.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_STDIO_APPEND_H_
#define COSMOPOLITAN_LIBC_STDIO_APPEND_H_
#ifdef _COSMO_SOURCE

#define APPEND_COOKIE 21578

Expand Down Expand Up @@ -32,5 +32,5 @@ ssize_t kappendf(char **, const char *, ...) libcesque;
ssize_t kvappendf(char **, const char *, va_list) libcesque;

COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_STDIO_APPEND_H_ */
#endif /* _COSMO_SOURCE */
6 changes: 2 additions & 4 deletions libc/x/x.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_X_H_
#define COSMOPOLITAN_LIBC_X_H_

#ifdef _COSMO_SOURCE
#define xwrite __xwrite
#define xdie __xdie
#define xmalloc __xmalloc
Expand Down Expand Up @@ -32,9 +32,7 @@
#define xfixpath __xfixpath
#define xslurp __xslurp
#define xbarf __xbarf
#endif /* _COSMO_SOURCE */

#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_

int xwrite(int, const void *, uint64_t);
Expand Down Expand Up @@ -97,5 +95,5 @@ void *xslurp(const char *, size_t *)
int xbarf(const char *, const void *, size_t);

COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* COSMOPOLITAN_LIBC_X_H_ */
#endif /* _COSMO_SOURCE */

0 comments on commit 68b9479

Please sign in to comment.