Make improvements

- Fix unused local variable errors
- Remove yoinks from sigaction() header
- Add nox87 and aarch64 to github actions
- Fix cosmocc -fportcosmo in linking mode
- It's now possible to build `make m=llvm o/llvm/libc`
This commit is contained in:
Justine Tunney 2023-07-10 04:29:46 -07:00
parent 3dc86ce154
commit f7ae50462a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
118 changed files with 342 additions and 392 deletions

View file

@ -2,15 +2,11 @@
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGACTION_H_
#include "libc/calls/struct/siginfo.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/ucontext.h"
#include "libc/dce.h"
#include "libc/sysv/consts/sig.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
typedef void (*sighandler_t)(int);
typedef void (*sigaction_f)(int, struct siginfo *,
void * /*struct ucontext **/);
typedef void (*sigaction_f)(int, struct siginfo *, void *);
struct sigaction { /* cosmo abi */
union {
@ -25,60 +21,6 @@ struct sigaction { /* cosmo abi */
sighandler_t signal(int, sighandler_t);
int sigaction(int, const struct sigaction *, struct sigaction *);
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(COSMO)
void _init_onntconsoleevent(void);
void _init_wincrash(void);
void _check_sigwinch();
#ifndef __SIGACTION_YOINK
#define __SIGACTION_YOINK(SIG) \
do { \
if (SupportsWindows()) { \
if (__builtin_constant_p(SIG)) { \
switch (SIG) { \
case SIGINT: \
case SIGQUIT: \
case SIGHUP: \
case SIGTERM: \
YOINK(_init_onntconsoleevent); \
break; \
case SIGTRAP: \
case SIGILL: \
case SIGSEGV: \
case SIGABRT: \
case SIGFPE: \
YOINK(_init_wincrash); \
break; \
case SIGWINCH: \
YOINK(_check_sigwinch); \
break; \
default: \
break; \
} \
} else { \
YOINK(_init_onntconsoleevent); \
YOINK(_init_wincrash); \
YOINK(_check_sigwinch); \
} \
} \
} while (0)
#endif
#define sigaction(SIG, ACT, OLD) \
({ \
__SIGACTION_YOINK(SIG); \
sigaction(SIG, (ACT), OLD); \
})
#define signal(SIG, HAND) \
({ \
__SIGACTION_YOINK(SIG); \
signal(SIG, HAND); \
})
#endif /* GNU && !ANSI */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGACTION_H_ */