Files
OpenCellular/builtin/stddef.h
Johnnie Chan 3337c17efd 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>
2016-10-26 19:59:17 -07:00

40 lines
1.0 KiB
C

/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __CROS_EC_STDDEF_H__
#define __CROS_EC_STDDEF_H__
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ unsigned long
#endif
typedef __SIZE_TYPE__ size_t;
/* There is a GCC macro for a size_t type, but not for a ssize_t type.
* The following construct convinces GCC to make __SIZE_TYPE__ signed.
*/
#define unsigned signed
typedef __SIZE_TYPE__ ssize_t;
#undef unsigned
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ int
#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__ */