cosmopolitan/libc/x/x.h
Justine Tunney 7ba9a73840
Remove more _Atomic keywords from public headers
It's been thirteen years and C++ still hasn't implemented this wonderful
simple builtin keyword. In C++23 a solution was provided for making this
work in C++ which is libcxx's stdatomic.h. Including that header schleps
in literally 253 unique header files!! Many of the header files it needs
are libc header files like pthread.h where we need to have the _Atomic()
keyword, but since <atomic> depends on pthreads we can't have it include
the <stdatomic.h> header that defines _Atomic for C++ users, and instead
we simply make the type non-atomic, hoping and praying only C code shall
use those internal data structures. This just shows how STL clowns can't
be trusted to define the innermost primitives of a language. They should
instead be focusing on being the best at algorithms and data structures.
2024-07-24 13:56:03 -07:00

99 lines
4.4 KiB
C

#ifdef _COSMO_SOURCE
#ifndef COSMOPOLITAN_LIBC_X_H_
#define COSMOPOLITAN_LIBC_X_H_
#define xwrite __xwrite
#define xdie __xdie
#define xmalloc __xmalloc
#define xrealloc __xrealloc
#define xcalloc __xcalloc
#define xvalloc __xvalloc
#define xmemalign __xmemalign
#define xmemalignzero __xmemalignzero
#define xstrdup __xstrdup
#define xstrndup __xstrndup
#define xstrmul __xstrmul
#define xinet_ntop __xinet_ntop
#define xunbinga __xunbinga
#define xunbing __xunbing
#define utf8to16 __utf8to16
#define utf16to8 __utf16to8
#define utf8to32 __utf8to32
#define utf16to32 __utf16to32
#define utf32to8 __utf32to8
#define xhomedir __xhomedir
#define xstripext __xstripext
#define xstripexts __xstripexts
#define xload __xload
#define rmrf __rmrf
#define xbasename __xbasename
#define xdirname __xdirname
#define xjoinpaths __xjoinpaths
#define xfixpath __xfixpath
#define xslurp __xslurp
#define xbarf __xbarf
COSMOPOLITAN_C_START_
int xwrite(int, const void *, uint64_t);
void xdie(void) wontreturn;
char *xdtoa(double)
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xdtoaf(float)
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xdtoal(long double)
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
void *xmalloc(size_t) attributeallocsize((1))
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
void *xrealloc(void *, size_t)
attributeallocsize((2)) dontthrow dontcallback __wur;
void *xcalloc(size_t, size_t) attributeallocsize((1, 2))
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
void *xvalloc(size_t) attributeallocsize((1)) returnsaligned((65536))
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
void *xmemalign(size_t, size_t) attributeallocalign((1)) attributeallocsize((2))
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
void *xmemalignzero(size_t, size_t) attributeallocalign((1))
attributeallocsize((2))
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xstrdup(const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xstrndup(const char *, size_t) paramsnonnull()
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xstrcat(const char *, ...) paramsnonnull((1)) nullterminated()
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
#define xstrcat(...) (xstrcat)(__VA_ARGS__, NULL)
char *xstrmul(const char *, size_t) paramsnonnull((1))
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xinet_ntop(int, const void *) paramsnonnull()
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
void *xunbinga(size_t, const char16_t *)
attributeallocalign((1)) returnspointerwithnoaliases dontthrow dontcallback
__wur returnsnonnull dontthrow dontcallback __wur returnsnonnull;
void *xunbing(const char16_t *)
returnspointerwithnoaliases dontthrow dontcallback __wur
returnsnonnull dontthrow dontcallback __wur returnsnonnull;
char16_t *utf8to16(const char *, size_t, size_t *) __wur;
char *utf16to8(const char16_t *, size_t, size_t *) __wur;
wchar_t *utf8to32(const char *, size_t, size_t *) __wur;
wchar_t *utf16to32(const char16_t *, size_t, size_t *) __wur;
char *utf32to8(const wchar_t *, size_t, size_t *) __wur;
char *xhomedir(void) __wur;
char *xstripext(const char *) __wur;
char *xstripexts(const char *) __wur;
void *xload(void *, const void *, size_t, size_t);
int rmrf(const char *);
char *xbasename(const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xdirname(const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
char *xjoinpaths(const char *, const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow dontcallback __wur returnsnonnull;
void xfixpath(void);
void *xslurp(const char *, size_t *)
paramsnonnull((1)) returnspointerwithnoaliases returnsaligned((4096)) __wur;
int xbarf(const char *, const void *, size_t);
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_X_H_ */
#endif /* _COSMO_SOURCE */