This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Add __need_offsetof to ginclude/stddef.h


With the cheaders=c model, libstdc++-v3/include/c/std_cstddef.h
defines __need_offsetof to get the macro offsetof.

ginclude/stddef.h, however, doesn't know about __need_offsetof.

This fixes the ginclude header:

2002-09-24  Danny Smith  <dannysmith@users.sourceforge.net>

	* ginclude/stddef.h: Use __need_offsetof to get definition
	of offsetof.
 
Index: stddef.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ginclude/stddef.h,v
retrieving revision 1.15
diff -c -3 -p -r1.15 stddef.h
*** stddef.h	2 Aug 2002 06:09:14 -0000	1.15
--- stddef.h	24 Sep 2002 22:23:49 -0000
*************** typedef __WINT_TYPE__ wint_t;
*** 380,390 ****
  #endif	/* NULL not defined and <stddef.h> or need NULL.  */
  #undef	__need_NULL
  
! #ifdef _STDDEF_H
  
  /* Offset of member MEMBER in a struct of type TYPE.  */
  
  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  
  #endif /* _STDDEF_H was defined this time */
  
--- 380,392 ----
  #endif	/* NULL not defined and <stddef.h> or need NULL.  */
  #undef	__need_NULL
  
! #if defined (_STDDEF_H) || defined (__need_offsetof)
  
  /* Offset of member MEMBER in a struct of type TYPE.  */
  
+ #undef offsetof
  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+ #undef __need_offsetof
  
  #endif /* _STDDEF_H was defined this time */
  

http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
- Always be connected to your Messenger Friends


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]