switch from c17 to gnu99

I am choosing gnu99 over c99, since I am planning to use GNU extensions,
like bswap. (in a future commit)
Why I choose c99 over c17, is because this'll produce more portable
code.

c99 does not implement noreturn.h, thus I added it to the compiler
attributes header.
This commit is contained in:
2025-06-02 12:15:49 +02:00
parent 42646baa1a
commit fc2cbd9924
3 changed files with 8 additions and 3 deletions

View File

@@ -4,7 +4,6 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#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

View File

@@ -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__)))