mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-14 06:59:10 +00:00
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few breaking changes needed to be made to help this go smoothly. - Rename nothrow to dontthrow - Rename nodiscard to dontdiscard - Add some libm functions, e.g. lgamma, nan, etc. - Change intmax_t from int128 to int64 like everything else - Introduce %jjd formatting directive for int128_t - Introduce strtoi128(), strtou128(), etc. - Rename bsrmax() to bsr128() Some of the templates that should be working currently are std::vector, std::string, std::map, std::set, std::deque, etc.
This commit is contained in:
parent
5022f9e920
commit
868af3f950
286 changed files with 123987 additions and 507 deletions
|
@ -66,8 +66,8 @@ COSMOPOLITAN_C_START_
|
|||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
DIR *fdopendir(int) nodiscard;
|
||||
DIR *opendir(const char *) nodiscard;
|
||||
DIR *fdopendir(int) dontdiscard;
|
||||
DIR *opendir(const char *) dontdiscard;
|
||||
bool fileexists(const char *);
|
||||
bool isdirectory(const char *);
|
||||
bool isexecutable(const char *);
|
||||
|
@ -76,12 +76,12 @@ bool issymlink(const char *);
|
|||
bool32 isatty(int) nosideeffect;
|
||||
bool32 ischardev(int) nosideeffect;
|
||||
char *commandv(const char *, char[hasatleast PATH_MAX]);
|
||||
char *get_current_dir_name(void) nodiscard;
|
||||
char *get_current_dir_name(void) dontdiscard;
|
||||
char *getcwd(char *, size_t);
|
||||
char *realpath(const char *, char *);
|
||||
char *replaceuser(const char *) nodiscard;
|
||||
char *replaceuser(const char *) dontdiscard;
|
||||
char *ttyname(int);
|
||||
int access(const char *, int) nothrow;
|
||||
int access(const char *, int) dontthrow;
|
||||
int arch_prctl();
|
||||
int chdir(const char *);
|
||||
int chmod(const char *, uint32_t);
|
||||
|
@ -105,7 +105,7 @@ int execvpe(const char *, char *const[], char *const[]);
|
|||
int faccessat(int, const char *, int, uint32_t);
|
||||
int fadvise(int, uint64_t, uint64_t, int);
|
||||
int fchdir(int);
|
||||
int fchmod(int, uint32_t) nothrow;
|
||||
int fchmod(int, uint32_t) dontthrow;
|
||||
int fchmodat(int, const char *, uint32_t, int);
|
||||
int fchown(int, uint32_t, uint32_t);
|
||||
int fchownat(int, const char *, uint32_t, uint32_t, int);
|
||||
|
@ -129,7 +129,7 @@ int getrlimit(int, struct rlimit *);
|
|||
int getrusage(int, struct rusage *);
|
||||
int kill(int, int);
|
||||
int killpg(int, int);
|
||||
int link(const char *, const char *) nothrow;
|
||||
int link(const char *, const char *) dontthrow;
|
||||
int linkat(int, const char *, int, const char *, int);
|
||||
int lstat(const char *, struct stat *);
|
||||
int lutimes(const char *, const struct timeval[2]);
|
||||
|
|
|
@ -35,6 +35,6 @@
|
|||
* @see open(), touch()
|
||||
* @asyncsignalsafe
|
||||
*/
|
||||
nodiscard int creat(const char *file, uint32_t mode) {
|
||||
dontdiscard int creat(const char *file, uint32_t mode) {
|
||||
return openat(AT_FDCWD, file, O_CREAT | O_WRONLY | O_TRUNC, mode);
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ int sys_truncate_nt(const char *, u64) hidden;
|
|||
int sys_unlinkat_nt(int, const char *, int) hidden;
|
||||
int sys_utimensat_nt(int, const char *, const struct timespec *, int) hidden;
|
||||
int sys_utimes_nt(const char *, const struct timeval[2]) hidden;
|
||||
ssize_t sys_open_nt(int, const char *, u32, i32) nodiscard hidden;
|
||||
ssize_t sys_open_nt(int, const char *, u32, i32) dontdiscard hidden;
|
||||
ssize_t sys_read_nt(struct Fd *, const struct iovec *, size_t, ssize_t) hidden;
|
||||
ssize_t sys_readlinkat_nt(int, const char *, char *, size_t) hidden;
|
||||
ssize_t sys_write_nt(int, const struct iovec *, size_t, ssize_t) hidden;
|
||||
|
|
|
@ -17,14 +17,14 @@ int tcsetpgrp(int, int32_t);
|
|||
int32_t tcgetpgrp(int);
|
||||
|
||||
int openpty(int *, int *, char *, const struct termios *,
|
||||
const struct winsize *) paramsnonnull((1, 2)) nodiscard;
|
||||
const struct winsize *) paramsnonnull((1, 2)) dontdiscard;
|
||||
int forkpty(int *, char *, const struct termios *, const struct winsize *)
|
||||
paramsnonnull((1, 2)) nodiscard;
|
||||
paramsnonnull((1, 2)) dontdiscard;
|
||||
errno_t ptsname_r(int, char *, size_t);
|
||||
|
||||
int grantpt(int);
|
||||
int unlockpt(int);
|
||||
int posix_openpt(int) nodiscard;
|
||||
int posix_openpt(int) dontdiscard;
|
||||
|
||||
int tcdrain(int);
|
||||
int tcgetsid(int);
|
||||
|
|
|
@ -39,14 +39,14 @@
|
|||
#define uid_t uint32_t
|
||||
#define rlim_t uint64_t /* int64_t on bsd */
|
||||
|
||||
#define int_fast8_t __INT_FAST8_TYPE__
|
||||
#define uint_fast8_t __UINT_FAST8_TYPE__
|
||||
#define int_fast16_t __INT_FAST16_TYPE__
|
||||
#define uint_fast16_t __UINT_FAST16_TYPE__
|
||||
#define int_fast32_t __INT_FAST32_TYPE__
|
||||
#define uint_fast32_t __UINT_FAST32_TYPE__
|
||||
#define int_fast64_t __INT_FAST64_TYPE__
|
||||
#define uint_fast64_t __UINT_FAST64_TYPE__
|
||||
typedef __INT_FAST8_TYPE__ int_fast8_t;
|
||||
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
|
||||
typedef __INT_FAST16_TYPE__ int_fast16_t;
|
||||
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
|
||||
typedef __INT_FAST32_TYPE__ int_fast32_t;
|
||||
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
|
||||
typedef __INT_FAST64_TYPE__ int_fast64_t;
|
||||
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
|
||||
|
||||
#define atomic_bool _Atomic(_Bool)
|
||||
#define atomic_bool32 atomic_int_fast32_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue