mirror of
https://github.com/fluencelabs/musl
synced 2025-06-17 08:51:44 +00:00
add _Noreturn function attribute, with fallback for pre-C11 GNUC
This commit is contained in:
@ -5,6 +5,13 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __STDC_VERSION__ >= 201112L
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define _Noreturn __attribute__((__noreturn__))
|
||||||
|
#else
|
||||||
|
#define _Noreturn
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <bits/setjmp.h>
|
#include <bits/setjmp.h>
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +36,7 @@ void _longjmp (jmp_buf, int);
|
|||||||
|
|
||||||
|
|
||||||
int setjmp (jmp_buf);
|
int setjmp (jmp_buf);
|
||||||
void longjmp (jmp_buf, int);
|
_Noreturn void longjmp (jmp_buf, int);
|
||||||
|
|
||||||
#define setjmp setjmp
|
#define setjmp setjmp
|
||||||
#define longjmp longjmp
|
#define longjmp longjmp
|
||||||
|
@ -11,6 +11,13 @@ extern "C" {
|
|||||||
#define __restrict
|
#define __restrict
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __STDC_VERSION__ >= 201112L
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define _Noreturn __attribute__((__noreturn__))
|
||||||
|
#else
|
||||||
|
#define _Noreturn
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef NULL
|
#undef NULL
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
@ -46,12 +53,12 @@ void *realloc (void *, size_t);
|
|||||||
void free (void *);
|
void free (void *);
|
||||||
void *aligned_alloc(size_t alignment, size_t size);
|
void *aligned_alloc(size_t alignment, size_t size);
|
||||||
|
|
||||||
void abort (void);
|
_Noreturn void abort (void);
|
||||||
int atexit (void (*) (void));
|
int atexit (void (*) (void));
|
||||||
void exit (int);
|
_Noreturn void exit (int);
|
||||||
void _Exit (int);
|
_Noreturn void _Exit (int);
|
||||||
int at_quick_exit (void (*) (void));
|
int at_quick_exit (void (*) (void));
|
||||||
void quick_exit (int);
|
_Noreturn void quick_exit (int);
|
||||||
|
|
||||||
char *getenv (const char *);
|
char *getenv (const char *);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
void _Exit(int ec)
|
_Noreturn void _Exit(int ec)
|
||||||
{
|
{
|
||||||
__syscall(SYS_exit_group, ec);
|
__syscall(SYS_exit_group, ec);
|
||||||
__syscall(SYS_exit, ec);
|
__syscall(SYS_exit, ec);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
void abort(void)
|
_Noreturn void abort(void)
|
||||||
{
|
{
|
||||||
raise(SIGABRT);
|
raise(SIGABRT);
|
||||||
raise(SIGKILL);
|
raise(SIGKILL);
|
||||||
|
@ -14,7 +14,7 @@ weak_alias(dummy, __funcs_on_exit);
|
|||||||
weak_alias(dummy, __flush_on_exit);
|
weak_alias(dummy, __flush_on_exit);
|
||||||
weak_alias(dummy, __seek_on_exit);
|
weak_alias(dummy, __seek_on_exit);
|
||||||
|
|
||||||
void exit(int code)
|
_Noreturn void exit(int code)
|
||||||
{
|
{
|
||||||
static int lock;
|
static int lock;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
static void dummy() { }
|
static void dummy() { }
|
||||||
weak_alias(dummy, __funcs_on_quick_exit);
|
weak_alias(dummy, __funcs_on_quick_exit);
|
||||||
|
|
||||||
void quick_exit(int code)
|
_Noreturn void quick_exit(int code)
|
||||||
{
|
{
|
||||||
static int lock;
|
static int lock;
|
||||||
while (a_swap(&lock, 1)) __syscall(SYS_pause);
|
while (a_swap(&lock, 1)) __syscall(SYS_pause);
|
||||||
|
Reference in New Issue
Block a user