diff options
| author | Craig Barnes <craigbarnes@protonmail.com> | 2021-01-03 08:56:47 +0000 |
|---|---|---|
| committer | Craig Barnes <craigbarnes@protonmail.com> | 2021-01-03 08:56:47 +0000 |
| commit | 39b2e46e72ad82ec2971b859eae75562751f8464 (patch) | |
| tree | b9e7a0ebefda5d9e485f4c779ddc3ee80c85ed17 | |
| parent | macros: add wrappers for more GCC/Clang attributes/pragmas/builtins (diff) | |
Use wrappers from macros.h instead of bare GCC attributes/pragmas
| -rw-r--r-- | box-drawing.c | 9 | ||||
| -rw-r--r-- | macros.h | 12 | ||||
| -rw-r--r-- | render.c | 2 | ||||
| -rw-r--r-- | vt.c | 9 |
4 files changed, 17 insertions, 15 deletions
diff --git a/box-drawing.c b/box-drawing.c index e655bfdc..8640fc4c 100644 --- a/box-drawing.c +++ b/box-drawing.c @@ -1861,10 +1861,7 @@ draw_sextant(wchar_t wc, struct buf *buf) static void draw_glyph(wchar_t wc, struct buf *buf) { -#if defined(__GNUC__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wpedantic" -#endif + IGNORE_WARNING("-Wpedantic") switch (wc) { 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; } -#if defined(__GNUC__) - #pragma GCC diagnostic pop -#endif + UNIGNORE_WARNINGS } struct fcft_glyph * COLD @@ -45,6 +45,18 @@ #define MALLOC #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) #define PRINTF(x) __attribute__((__format__(__printf__, (x), (x + 1)))) #define VPRINTF(x) __attribute__((__format__(__printf__, (x), 0))) @@ -80,7 +80,7 @@ render_destroy(struct renderer *renderer) free(renderer); } -static void __attribute__((destructor)) +static void DESTRUCTOR log_presentation_statistics(void) { if (presentation_statistics.total == 0) @@ -750,10 +750,7 @@ action_utf8_44(struct terminal *term, uint8_t c) action_utf8_print(term, term->vt.utf8); } -#if defined(__GNUC__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wpedantic" -#endif +IGNORE_WARNING("-Wpedantic") static enum state 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__) - #pragma GCC diagnostic pop -#endif +UNIGNORE_WARNINGS void vt_from_slave(struct terminal *term, const uint8_t *data, size_t len) |
