Use wrappers from macros.h instead of bare GCC attributes/pragmas

This commit is contained in:
Craig Barnes 2021-01-03 08:56:47 +00:00
parent 2559a9711c
commit 39b2e46e72
4 changed files with 17 additions and 15 deletions

View file

@ -1861,10 +1861,7 @@ draw_sextant(wchar_t wc, struct buf *buf)
static void static void
draw_glyph(wchar_t wc, struct buf *buf) draw_glyph(wchar_t wc, struct buf *buf)
{ {
#if defined(__GNUC__) IGNORE_WARNING("-Wpedantic")
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
switch (wc) { switch (wc) {
case 0x2500: draw_box_drawings_light_horizontal(buf); break; case 0x2500: draw_box_drawings_light_horizontal(buf); break;
@ -2037,9 +2034,7 @@ draw_glyph(wchar_t wc, struct buf *buf)
case 0x1fb00 ... 0x1fb3b: draw_sextant(wc, buf); break; case 0x1fb00 ... 0x1fb3b: draw_sextant(wc, buf); break;
} }
#if defined(__GNUC__) UNIGNORE_WARNINGS
#pragma GCC diagnostic pop
#endif
} }
struct fcft_glyph * COLD struct fcft_glyph * COLD

View file

@ -45,6 +45,18 @@
#define MALLOC #define MALLOC
#endif #endif
#if GNUC_AT_LEAST(3, 0) || HAS_ATTRIBUTE(constructor)
#define CONSTRUCTOR __attribute__((__constructor__))
#else
#define CONSTRUCTOR
#endif
#if GNUC_AT_LEAST(3, 0) || HAS_ATTRIBUTE(destructor)
#define DESTRUCTOR __attribute__((__destructor__))
#else
#define DESTRUCTOR
#endif
#if GNUC_AT_LEAST(3, 0) || HAS_ATTRIBUTE(format) #if GNUC_AT_LEAST(3, 0) || HAS_ATTRIBUTE(format)
#define PRINTF(x) __attribute__((__format__(__printf__, (x), (x + 1)))) #define PRINTF(x) __attribute__((__format__(__printf__, (x), (x + 1))))
#define VPRINTF(x) __attribute__((__format__(__printf__, (x), 0))) #define VPRINTF(x) __attribute__((__format__(__printf__, (x), 0)))

View file

@ -80,7 +80,7 @@ render_destroy(struct renderer *renderer)
free(renderer); free(renderer);
} }
static void __attribute__((destructor)) static void DESTRUCTOR
log_presentation_statistics(void) log_presentation_statistics(void)
{ {
if (presentation_statistics.total == 0) if (presentation_statistics.total == 0)

9
vt.c
View file

@ -750,10 +750,7 @@ action_utf8_44(struct terminal *term, uint8_t c)
action_utf8_print(term, term->vt.utf8); action_utf8_print(term, term->vt.utf8);
} }
#if defined(__GNUC__) IGNORE_WARNING("-Wpedantic")
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
static enum state static enum state
state_ground_switch(struct terminal *term, uint8_t data) state_ground_switch(struct terminal *term, uint8_t data)
@ -1277,9 +1274,7 @@ state_utf8_43_switch(struct terminal *term, uint8_t data)
} }
} }
#if defined(__GNUC__) UNIGNORE_WARNINGS
#pragma GCC diagnostic pop
#endif
void void
vt_from_slave(struct terminal *term, const uint8_t *data, size_t len) vt_from_slave(struct terminal *term, const uint8_t *data, size_t len)