GLK: ADRIFT: Unconditionally use GCC_PRINTF()

There's no need to check for old GCC versions anymore, and our
GCC_PRINTF macro will just be a no-op if the current compiler doesn't
support this.
This commit is contained in:
Donovan Watteau 2022-05-18 12:47:26 +02:00 committed by Filippos Karapetis
parent 4ac33a72c2
commit 05121fac02
2 changed files with 8 additions and 30 deletions

View File

@ -61,22 +61,11 @@ typedef sc_int(*sc_read_callbackref_t)(void *, sc_byte *, sc_int);
typedef void (*sc_write_callbackref_t)(void *, const sc_byte *, sc_int);
/*
* Small utility and wrapper functions. For printf wrappers, try to apply
* gcc printf argument checking; this code is cautious about applying the
* checks.
* Small utility and wrapper functions.
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
extern void sc_trace(const sc_char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
extern void sc_error(const sc_char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
extern void sc_fatal(const sc_char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
#else
extern void sc_trace(const sc_char *format, ...);
extern void sc_error(const sc_char *format, ...);
extern void sc_fatal(const sc_char *format, ...);
#endif
extern void sc_trace(const sc_char *format, ...) GCC_PRINTF(1, 2);
extern void sc_error(const sc_char *format, ...) GCC_PRINTF(1, 2);
extern void sc_fatal(const sc_char *format, ...) GCC_PRINTF(1, 2);
extern void *sc_malloc(size_t size);
extern void *sc_realloc(void *pointer, size_t size);
extern void sc_free(void *pointer);

View File

@ -47,22 +47,11 @@ typedef struct sx_test_descriptor_s {
} sx_test_descriptor_t;
/*
* Small utility and wrapper functions. For printf wrappers, try to apply
* gcc printf argument checking; this code is cautious about applying the
* checks.
* Small utility and wrapper functions.
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
extern void sx_trace(const sc_char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
extern void sx_error(const sc_char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
extern void sx_fatal(const sc_char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
#else
extern void sx_trace(const sc_char *format, ...);
extern void sx_error(const sc_char *format, ...);
extern void sx_fatal(const sc_char *format, ...);
#endif
extern void sx_trace(const sc_char *format, ...) GCC_PRINTF(1, 2);
extern void sx_error(const sc_char *format, ...) GCC_PRINTF(1, 2);
extern void sx_fatal(const sc_char *format, ...) GCC_PRINTF(1, 2);
extern void *sx_malloc(size_t size);
extern void *sx_realloc(void *pointer, size_t size);
extern void sx_free(void *pointer);