From bbff7fbd6433f4f6fe43a31ec3745f05d0d8c0d6 Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Wed, 9 Jan 2013 17:26:42 +0800 Subject: [PATCH] Sync stddef.h To be the same as bionic's. See ec37237d69289e2bb9836bfa0d071ab958234d00 The new one also no longer undef offsetof and replaces it with "((size_t) &((TYPE *)0)->MEMBER)" if __compiler_offsetof isn't defined. The problem with the old behavior are that 1. __compiler_offsetof isn't defined in linux/compiler.h even though all Android compilers support __builtin_offsetof 2. As as result, offsetof defined in stddef.h to use __builtin_offsetof is undefined and replaced here. Problem is, "((size_t) &((TYPE *)0)->MEMBER)" isn't considered a compile-time constant, and fails some code expect offsetof to be. Change-Id: I3ebb0de9e1d95305a0890a099360ff6936d24b2f --- .../android-3/include/linux/stddef.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ndk/platforms/android-3/include/linux/stddef.h b/ndk/platforms/android-3/include/linux/stddef.h index 5412f475d..cca408ca5 100644 --- a/ndk/platforms/android-3/include/linux/stddef.h +++ b/ndk/platforms/android-3/include/linux/stddef.h @@ -7,25 +7,24 @@ *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_STDDEF_H #define _LINUX_STDDEF_H - #include - #undef NULL +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif - -#undef offsetof -#ifdef __compiler_offsetof -#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) -#else -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - #endif