mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-22 19:22:05 +00:00
Cross-compiler noreturn support.
This commit is contained in:
9
include/extern/err.h
vendored
9
include/extern/err.h
vendored
@@ -29,6 +29,7 @@
|
||||
#else
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "extern/stdnoreturn.h"
|
||||
|
||||
#define warn rgbds_warn
|
||||
#define vwarn rgbds_vwarn
|
||||
@@ -49,10 +50,10 @@ void vwarn(const char *, va_list);
|
||||
void warnx(const char *, ...);
|
||||
void vwarnx(const char *, va_list);
|
||||
|
||||
_Noreturn void err(int, const char *, ...);
|
||||
_Noreturn void verr(int, const char *, va_list);
|
||||
_Noreturn void errx(int, const char *, ...);
|
||||
_Noreturn void verrx(int, const char *, va_list);
|
||||
noreturn void err(int, const char *, ...);
|
||||
noreturn void verr(int, const char *, va_list);
|
||||
noreturn void errx(int, const char *, ...);
|
||||
noreturn void verrx(int, const char *, va_list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
16
include/extern/stdnoreturn.h
vendored
Normal file
16
include/extern/stdnoreturn.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#if _MSC_VER >= 1310
|
||||
// MS Visual Studio 2003/.NET Framework 1.1 or newer
|
||||
#define noreturn _declspec( noreturn)
|
||||
#elif __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ >= 5))
|
||||
// GCC 2.5 or newer
|
||||
#define noreturn __attribute__ ((noreturn))
|
||||
#elif __cplusplus >= 201103L
|
||||
// C++11 or newer
|
||||
#define noreturn [[noreturn]]
|
||||
#elif __STDC_VERSION__ >= 201112L
|
||||
// C11 or newer
|
||||
#define noreturn _Noreturn
|
||||
#else
|
||||
// unsupported, but no need to throw a fit
|
||||
#define noreturn
|
||||
#endif
|
||||
Reference in New Issue
Block a user