diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2012-02-02 02:27:14 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-04-11 16:56:53 -0400 |
commit | 9cf4afdd74a280e5aaaa700ffdcbe587631c85ae (patch) | |
tree | bf0765e392d96eda4d09a37479b0587e5d78d814 | |
parent | f7c1bd5f584aed14361979d5a536365a5ad35f8f (diff) | |
download | librambutan-9cf4afdd74a280e5aaaa700ffdcbe587631c85ae.tar.gz librambutan-9cf4afdd74a280e5aaaa700ffdcbe587631c85ae.zip |
libmaple_types.h: Add offsetof().
Rather than rely on newlib's stddef.h, define our own offsetof() in
terms of GCC's __builtin_offsetof(). Don't override an existing
offsetof() definition, in case the user already has one they prefer.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
-rw-r--r-- | libmaple/include/libmaple/libmaple_types.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libmaple/include/libmaple/libmaple_types.h b/libmaple/include/libmaple/libmaple_types.h index ae01691..19a5101 100644 --- a/libmaple/include/libmaple/libmaple_types.h +++ b/libmaple/include/libmaple/libmaple_types.h @@ -27,7 +27,7 @@ /** * @file libmaple_types.h * - * @brief libmaple types + * @brief libmaple's types, and operations on types. */ #ifndef _LIBMAPLE_LIBMAPLE_TYPES_H_ @@ -57,6 +57,10 @@ typedef void (*voidFuncPtr)(void); #define NULL 0 #endif +#ifndef offsetof +#define offsetof(type, member) __builtin_offsetof(type, member) +#endif + #ifdef __cplusplus } #endif |