diff options
author | Johnnie Chan <johnniec@chromium.org> | 2016-10-26 14:26:50 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-10-26 19:59:17 -0700 |
commit | 3337c17efd8e0be713676954faa24401d3b5bb3b (patch) | |
tree | ab9adee466330faa944685031f4ef2657345eacb | |
parent | f2c33b73b265c2229ffd6b94e86e5f8956ffab6f (diff) | |
download | chrome-ec-3337c17efd8e0be713676954faa24401d3b5bb3b.tar.gz |
Adding offsetof macro to stddef.h.
This duplicates the macro definition that exists in compile_time_macros.h.
Adding it is okay since they are both guarded by a #ifndef #endif check.
This is needed by code being pulled in from google3 which expects the
macro to be defined in the standard place.
BUG=none
BRANCH=none
TEST=make BOARD=haven_dev
Change-Id: Ibddefcd8bbfe0d121b3ce65950ce979e65778761
Reviewed-on: https://chromium-review.googlesource.com/403573
Commit-Ready: Johnnie Chan <johnniec@google.com>
Tested-by: Johnnie Chan <johnniec@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | builtin/stddef.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/stddef.h b/builtin/stddef.h index 505dd9f515..343b0f6adf 100644 --- a/builtin/stddef.h +++ b/builtin/stddef.h @@ -27,4 +27,13 @@ typedef __SIZE_TYPE__ ssize_t; #endif typedef __WCHAR_TYPE__ wchar_t; +/* This macro definition is duplicated in compile_time_macros.h. It still needs + * to be defined here to support code that expects offsetof to be defined in the + * standard location (this file). Both definitions are guarded by a #ifndef + * check for safety. + */ +#ifndef offsetof +#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) +#endif + #endif /* __CROS_EC_STDDEF_H__ */ |