From 39b2e46e72ad82ec2971b859eae75562751f8464 Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Sun, 3 Jan 2021 08:56:47 +0000 Subject: Use wrappers from macros.h instead of bare GCC attributes/pragmas --- macros.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'macros.h') diff --git a/macros.h b/macros.h index 0a355ceb..1fd82b77 100644 --- a/macros.h +++ b/macros.h @@ -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))) -- cgit v1.3