diff --git a/makefile b/makefile index 334228e..de0064e 100644 --- a/makefile +++ b/makefile @@ -9,7 +9,7 @@ NAME := mcaselector-lite VERSION := 0.0.0 DEBUG ?= 0 CC ?= cc -CFLAGS += -c -std=c17 -Wall -Wextra -Wpedantic -Ilib -MMD -MP +CFLAGS += -c -std=gnu99 -Wall -Wextra -Wpedantic -Ilib -MMD -MP LDFLAGS += MARCH ?= $(shell uname -m) KERNEL ?= $(shell uname -s | tr '[:upper:]' '[:lower:]') diff --git a/src/error.h b/src/error.h index 9ca5140..a8ab993 100644 --- a/src/error.h +++ b/src/error.h @@ -4,7 +4,6 @@ #include #include #include -#include #include "util/atrb.h" @@ -14,7 +13,7 @@ atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void debug(char const*, atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void info(char const*, ...); atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void warn(char const*, ...); atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void error(char const*, ...); -atrb_nonnull(1) atrb_format(printf, 1, 2) noreturn static inline void fatal(char const*, ...); +atrb_nonnull(1) atrb_format(printf, 1, 2) atrb_noreturn static inline void fatal(char const*, ...); atrb_nonnull(2) static inline void error_callback(int err, char const* const msg); // macro to write fmt vardiac args to buf diff --git a/src/util/atrb.h b/src/util/atrb.h index 23fbb37..3124ff2 100644 --- a/src/util/atrb.h +++ b/src/util/atrb.h @@ -8,6 +8,7 @@ #define atrb_unused #define atrb_pure #define atrb_const +#define atrb_noreturn #define atrb_format() #define atrb_nonnull() @@ -34,6 +35,11 @@ #define atrb_const __attribute__((const)) #endif +#if __has_attribute(noreturn) +#undef atrb_noreturn +#define atrb_noreturn __attribute__((noreturn)) +#endif + #if __has_attribute(format) #undef atrb_format #define atrb_format(...) __attribute__((format(__VA_ARGS__)))