[v3] add c_compatibility headers, gcc bits
Benjamin Kosnik
bkoz@redhat.com
Fri Jun 21 13:35:00 GMT 2002
2002-06-21 Benjamin Kosnik <bkoz@redhat.com>
* ginclude/stddef.h: Use namespace std.
* ginclude/stdarg.h: Same.
Index: stdarg.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ginclude/stdarg.h,v
retrieving revision 1.15
diff -c -p -r1.15 stdarg.h
*** stdarg.h 30 Mar 2000 00:03:14 -0000 1.15
--- stdarg.h 21 Jun 2002 20:25:03 -0000
***************
*** 1,4 ****
! /* Copyright (C) 1989, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
--- 1,5 ----
! /* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002
! Free Software Foundation, Inc.
This file is part of GNU CC.
*************** typedef __builtin_va_list __gnuc_va_list
*** 46,51 ****
--- 47,58 ----
/* Define the standard macros for the user,
if this invocation was from the user program. */
#ifdef _STDARG_H
+ #if __cplusplus
+ namespace std
+ {
+ extern "C"
+ {
+ #endif
/* Note that the type used in va_arg is supposed to match the
actual type **after default promotions**.
*************** typedef __gnuc_va_list va_list;
*** 132,138 ****
--- 139,152 ----
#endif /* not __svr4__ */
+ #if __cplusplus
+ }
+ }
+ #endif
+
#endif /* _STDARG_H */
#endif /* not _ANSI_STDARG_H_ */
#endif /* not _STDARG_H */
+
+
Index: stddef.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ginclude/stddef.h,v
retrieving revision 1.14
diff -c -p -r1.14 stddef.h
*** stddef.h 9 Jan 2002 04:56:25 -0000 1.14
--- stddef.h 21 Jun 2002 20:25:04 -0000
*************** _TYPE_wchar_t;
*** 114,119 ****
--- 114,126 ----
#undef _TYPE_wchar_t
#endif
+ #if __cplusplus
+ namespace std
+ {
+ extern "C"
+ {
+ #endif
+
/* In case nobody has defined these types, but we aren't running under
GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
__WCHAR_TYPE__ have reasonable values. This can happen if the
*************** typedef long ssize_t;
*** 221,226 ****
--- 228,237 ----
#undef __need_size_t
#endif /* _STDDEF_H or __need_size_t. */
+ #if __cplusplus
+ }
+ }
+ #endif
/* Wide character type.
Locale-writers should change this as necessary to
*************** typedef __WINT_TYPE__ wint_t;
*** 374,386 ****
#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 */
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
|| __need_XXX was not defined before */
--- 385,401 ----
#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. */
+ #if __cplusplus
+ #define offsetof(TYPE, MEMBER) ((std::size_t) &((TYPE *)0)->MEMBER)
+ #else
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+ #endif
! #endif /* _STDDEF_H or need offsetof was defined this time */
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
|| __need_XXX was not defined before */
More information about the Gcc-patches
mailing list