mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Add string format checking to err.h functions
And fix all problems this detected... oops
This commit is contained in:
16
include/extern/err.h
vendored
16
include/extern/err.h
vendored
@@ -29,15 +29,15 @@
|
||||
#define errx rgbds_errx
|
||||
#define verrx rgbds_verrx
|
||||
|
||||
void warn(const char *fmt, ...);
|
||||
void vwarn(const char *fmt, va_list ap);
|
||||
void warnx(const char *fmt, ...);
|
||||
void vwarnx(const char *fmt, va_list ap);
|
||||
void warn(const char *fmt, ...) format_(printf, 1, 2);
|
||||
void vwarn(const char *fmt, va_list ap) format_(printf, 1, 0);
|
||||
void warnx(const char *fmt, ...) format_(printf, 1, 2);
|
||||
void vwarnx(const char *fmt, va_list ap) format_(printf, 1, 0);
|
||||
|
||||
noreturn_ void err(int status, const char *fmt, ...);
|
||||
noreturn_ void verr(int status, const char *fmt, va_list ap);
|
||||
noreturn_ void errx(int status, const char *fmt, ...);
|
||||
noreturn_ void verrx(int status, const char *fmt, va_list ap);
|
||||
noreturn_ void err(int status, const char *fmt, ...) format_(printf, 2, 3);
|
||||
noreturn_ void verr(int status, const char *fmt, va_list ap) format_(printf, 2, 0);
|
||||
noreturn_ void errx(int status, const char *fmt, ...) format_(printf, 2, 3);
|
||||
noreturn_ void verrx(int status, const char *fmt, va_list ap) format_(printf, 2, 0);
|
||||
|
||||
#endif /* ERR_IN_LIBC */
|
||||
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* GCC or compatible */
|
||||
#define format_(archetype, str_index, first_arg) \
|
||||
__attribute__ ((format (archetype, str_index, first_arg)))
|
||||
#define noreturn_ __attribute__ ((noreturn))
|
||||
#define unused_ __attribute__ ((unused))
|
||||
#define trap_ __builtin_trap()
|
||||
#else
|
||||
/* Unsupported, but no need to throw a fit */
|
||||
#define format_(archetype, str_index, first_arg)
|
||||
#define noreturn_
|
||||
#define unused_
|
||||
#define trap_
|
||||
|
||||
Reference in New Issue
Block a user