Add dontthrow attribute to most libc functions

This will help C++ code that uses exceptions to be tinier. For example,
this change shaves away 1000 lines of assembly code from LLVM's libcxx,
which is 0.7% of all assembly instructions in the entire library.
This commit is contained in:
Justine Tunney 2024-01-09 01:26:03 -08:00
parent cb19e172da
commit eeb20775d2
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
103 changed files with 1455 additions and 1456 deletions

View file

@ -4,10 +4,10 @@
#include "libc/nt/struct/startupinfo.h"
COSMOPOLITAN_C_START_
bool __is_cloexec(const struct Fd *);
void __undescribe_fds(int64_t, int64_t *, uint32_t);
bool __is_cloexec(const struct Fd *) libcesque;
void __undescribe_fds(int64_t, int64_t *, uint32_t) libcesque;
char *__describe_fds(const struct Fd *, size_t, struct NtStartupInfo *, int64_t,
int64_t **, uint32_t *);
int64_t **, uint32_t *) libcesque;
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_PROC_DESCRIBEFDS_INTERNAL_H_ */

View file

@ -2,7 +2,7 @@
#define COSMOPOLITAN_LIBC_CALLS_EXECVE_SYSV_H_
COSMOPOLITAN_C_START_
bool IsApeLoadable(char[8]);
bool IsApeLoadable(char[8]) libcesque;
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_EXECVE_SYSV_H_ */

View file

@ -24,34 +24,41 @@ int posix_spawn(int *, const char *, const posix_spawn_file_actions_t *,
int posix_spawnp(int *, const char *, const posix_spawn_file_actions_t *,
const posix_spawnattr_t *, char *const[], char *const[]);
int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
int posix_spawn_file_actions_init(posix_spawn_file_actions_t *) libcesque;
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *) libcesque;
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *,
int) libcesque;
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int,
int) libcesque;
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *, int,
const char *, int, unsigned);
const char *, int, unsigned) libcesque;
int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *,
const char *);
int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
const char *) libcesque;
int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *,
int) libcesque;
int posix_spawnattr_init(posix_spawnattr_t *);
int posix_spawnattr_destroy(posix_spawnattr_t *);
int posix_spawnattr_getflags(const posix_spawnattr_t *, short *);
int posix_spawnattr_setflags(posix_spawnattr_t *, short);
int posix_spawnattr_getpgroup(const posix_spawnattr_t *, int *);
int posix_spawnattr_setpgroup(posix_spawnattr_t *, int);
int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *, int *);
int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
int posix_spawnattr_init(posix_spawnattr_t *) libcesque;
int posix_spawnattr_destroy(posix_spawnattr_t *) libcesque;
int posix_spawnattr_getflags(const posix_spawnattr_t *, short *) libcesque;
int posix_spawnattr_setflags(posix_spawnattr_t *, short) libcesque;
int posix_spawnattr_getpgroup(const posix_spawnattr_t *, int *) libcesque;
int posix_spawnattr_setpgroup(posix_spawnattr_t *, int) libcesque;
int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *, int *) libcesque;
int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int) libcesque;
int posix_spawnattr_getschedparam(const posix_spawnattr_t *,
struct sched_param *);
struct sched_param *) libcesque;
int posix_spawnattr_setschedparam(posix_spawnattr_t *,
const struct sched_param *);
int posix_spawnattr_getsigmask(const posix_spawnattr_t *, sigset_t *);
int posix_spawnattr_setsigmask(posix_spawnattr_t *, const sigset_t *);
int posix_spawnattr_getsigdefault(const posix_spawnattr_t *, sigset_t *);
int posix_spawnattr_setsigdefault(posix_spawnattr_t *, const sigset_t *);
int posix_spawnattr_getrlimit(const posix_spawnattr_t *, int, struct rlimit *);
int posix_spawnattr_setrlimit(posix_spawnattr_t *, int, const struct rlimit *);
const struct sched_param *) libcesque;
int posix_spawnattr_getsigmask(const posix_spawnattr_t *, sigset_t *) libcesque;
int posix_spawnattr_setsigmask(posix_spawnattr_t *, const sigset_t *) libcesque;
int posix_spawnattr_getsigdefault(const posix_spawnattr_t *,
sigset_t *) libcesque;
int posix_spawnattr_setsigdefault(posix_spawnattr_t *,
const sigset_t *) libcesque;
int posix_spawnattr_getrlimit(const posix_spawnattr_t *, int,
struct rlimit *) libcesque;
int posix_spawnattr_setrlimit(posix_spawnattr_t *, int,
const struct rlimit *) libcesque;
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_STDIO_SPAWN_H_ */

View file

@ -43,16 +43,16 @@ struct Procs {
extern struct Procs __proc;
void __proc_wipe(void);
void __proc_lock(void);
void __proc_unlock(void);
int64_t __proc_handle(int);
int64_t __proc_search(int);
struct Proc *__proc_new(void);
void __proc_add(struct Proc *);
void __proc_free(struct Proc *);
int __proc_harvest(struct Proc *, bool);
int sys_wait4_nt(int, int *, int, struct rusage *);
void __proc_wipe(void) libcesque;
void __proc_lock(void) libcesque;
void __proc_unlock(void) libcesque;
int64_t __proc_handle(int) libcesque;
int64_t __proc_search(int) libcesque;
struct Proc *__proc_new(void) libcesque;
void __proc_add(struct Proc *) libcesque;
void __proc_free(struct Proc *) libcesque;
int __proc_harvest(struct Proc *, bool) libcesque;
int sys_wait4_nt(int, int *, int, struct rusage *) libcesque;
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_PROC_H_ */