Files
RedBear-OS/include/stdnoreturn.h
T
Josh Megnauth 96de114be8 Add stdnoreturn.h
This header is more or less the same across libc implementations.

`musl` uses its `_Noreturn` macro to detect which `noreturn`
should be used: C11 or GCC's extension as a fallback.

`glibc` simply defines `noreturn` as `_Noreturn`.

This implementation is based off of `musl`'s.

`_Noreturn` is deprecated as of C23.
2024-11-27 01:25:53 -05:00

20 lines
387 B
C

/* Spec:
* The <stdnoreturn.h> header shall define the macro noreturn which shall
* expand to _Noreturn */
#ifndef _STDNORETURN_H
#define _STDNORETURN_H
#ifndef __cplusplus
/* Borrowed from musl */
#if __STDC_VERSION__ >= 201112L
#elif defined(__GNUC__)
#define _Noreturn __attribute__((__noreturn__))
#else
#define _Noreturn
#endif
#define noreturn _Noreturn
#endif
#endif