Get GCC to mostly build with Cosmo

This commit is contained in:
Justine Tunney 2023-06-09 06:41:34 -07:00
parent 2eb7148474
commit 9b55dbe417
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
54 changed files with 113 additions and 132 deletions

View file

@ -78,10 +78,12 @@ libcesque nosideeffect;
cosmopolitan § conversion » manipulation
*/
#ifdef COSMO
char *dirname(char *);
char *basename(char *);
char *stripext(char *);
char *stripexts(char *);
#endif
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § conversion » computation

View file

@ -35,7 +35,7 @@ char *gcvt(double, int, char *);
cosmopolitan § string formatting » optimizations
*/
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(__cplusplus)
#if defined(COSMO) && !defined(__cplusplus)
#define sprintf(BUF, FMT, ...) (sprintf)(BUF, PFLINK(FMT), ##__VA_ARGS__)
#define vsprintf(BUF, FMT, VA) (vsprintf)(BUF, PFLINK(FMT), VA)
#define snprintf(B, Z, F, ...) (snprintf)(B, Z, PFLINK(F), ##__VA_ARGS__)

View file

@ -1,6 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_FMT_PFLINK_H_
#define COSMOPOLITAN_LIBC_FMT_PFLINK_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef COSMO
/**
* @fileoverview builtin+preprocessor+linker tricks for printf/scanf.
@ -59,5 +60,12 @@
#pragma GCC diagnostic ignored "-Wformat-security"
#endif /* __GNUC__ + 0 < 6 */
#else
STATIC_YOINK("strerror");
STATIC_YOINK("strnwidth");
STATIC_YOINK("__fmt_dtoa");
STATIC_YOINK("strnwidth16");
STATIC_YOINK("wcsnwidth");
#endif /* COSMO */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_FMT_PFLINK_H_ */