summaryrefslogtreecommitdiff
path: root/compiler.h
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-02-17 13:33:28 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-02-17 13:33:28 +0100
commit4bcd6157b2b44e700dd824d58248f4a98b2c536e (patch)
tree1761be18ddf79ec7cd93d171dc566e7f1c7771be /compiler.h
parentdb991f91447e16f6ad22974a6c599ae9e47a95eb (diff)
compiler: Protect against redefinition of offsetof()
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'compiler.h')
-rw-r--r--compiler.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler.h b/compiler.h
index 0921edd..a6bf3a6 100644
--- a/compiler.h
+++ b/compiler.h
@@ -20,10 +20,12 @@
#define COMPILER_H
#ifdef __GNUC__
-# define __noreturn __attribute__((noreturn))
-# define __packed __attribute__((packed))
-# define __unused __attribute__((unused))
-# define offsetof(a, b) __builtin_offsetof(a, b)
+# define __noreturn __attribute__((noreturn))
+# define __packed __attribute__((packed))
+# define __unused __attribute__((unused))
+# ifndef offsetof
+# define offsetof(a, b) __builtin_offsetof(a, b)
+# endif
#else
# define __noreturn
# define __packed