aboutsummaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2021-01-03 08:56:47 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2021-01-03 08:56:47 +0000
commit39b2e46e72ad82ec2971b859eae75562751f8464 (patch)
treeb9e7a0ebefda5d9e485f4c779ddc3ee80c85ed17 /macros.h
parentmacros: add wrappers for more GCC/Clang attributes/pragmas/builtins (diff)
Use wrappers from macros.h instead of bare GCC attributes/pragmas
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h12
1 files changed, 12 insertions, 0 deletions
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)))