--- gcc/ginclude/stddef.h 2018/04/24 18:23:46 1.1 +++ gcc/ginclude/stddef.h 2018/04/24 18:31:28 1.1.1.2 @@ -27,8 +27,9 @@ #endif /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are - defined if the corresponding type is *not* defined. */ -#ifdef _ANSI_H_ + defined if the corresponding type is *not* defined. + FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */ +#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_) #define _SIZE_T #endif @@ -55,7 +56,7 @@ #undef _WCHAR_T_ #undef _BSD_WCHAR_T_ #endif -#endif /* _ANSI_H_ */ +#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */ /* Sequent's header files use _PTRDIFF_T_ in some conflicting way. Just ignore it. */ @@ -63,6 +64,25 @@ #undef _PTRDIFF_T_ #endif +/* On VxWorks, may have defined macros like + _TYPE_size_t which will typedef size_t. fixincludes patched the + vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is + not defined, and so that defining this macro defines _GCC_SIZE_T. + If we find that the macros are still defined at this point, we must + invoke them so that the type is defined as expected. */ +#if defined (TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) +_TYPE_ptrdiff_t; +#undef _TYPE_ptrdiff_t +#endif +#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_)) +_TYPE_size_t; +#undef _TYPE_size_t +#endif +#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_)) +_TYPE_wchar_t; +#undef _TYPE_wchar_t +#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 @@ -121,6 +141,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #ifndef _SIZE_T_ #ifndef _BSD_SIZE_T_ #ifndef _SIZE_T_DEFINED_ +#ifndef _SIZE_T_DEFINED #ifndef ___int_size_t_h #ifndef _GCC_SIZE_T #ifndef _SIZET_ @@ -133,6 +154,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #define _SIZE_T_ #define _BSD_SIZE_T_ #define _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED #define ___int_size_t_h #define _GCC_SIZE_T #define _SIZET_ @@ -147,6 +169,7 @@ typedef __SIZE_TYPE__ size_t; #endif /* _SIZET_ */ #endif /* _GCC_SIZE_T */ #endif /* ___int_size_t_h */ +#endif /* _SIZE_T_DEFINED */ #endif /* _SIZE_T_DEFINED_ */ #endif /* _BSD_SIZE_T_ */ #endif /* _SIZE_T_ */ @@ -174,6 +197,7 @@ typedef __SIZE_TYPE__ size_t; #ifndef _WCHAR_T_ #ifndef _BSD_WCHAR_T_ #ifndef _WCHAR_T_DEFINED_ +#ifndef _WCHAR_T_DEFINED #ifndef _WCHAR_T_H #ifndef ___int_wchar_t_h #ifndef __INT_WCHAR_T_H @@ -185,6 +209,7 @@ typedef __SIZE_TYPE__ size_t; #define _WCHAR_T_ #define _BSD_WCHAR_T_ #define _WCHAR_T_DEFINED_ +#define _WCHAR_T_DEFINED #define _WCHAR_T_H #define ___int_wchar_t_h #define __INT_WCHAR_T_H @@ -212,6 +237,7 @@ typedef _BSD_RUNE_T_ rune_t; #ifndef __WCHAR_TYPE__ #define __WCHAR_TYPE__ int #endif +#ifndef __cplusplus typedef __WCHAR_TYPE__ wchar_t; #endif #endif @@ -224,6 +250,8 @@ typedef __WCHAR_TYPE__ wchar_t; #endif #endif #endif +#endif +#endif #undef __need_wchar_t #endif /* _STDDEF_H or __need_wchar_t. */ @@ -231,7 +259,7 @@ typedef __WCHAR_TYPE__ wchar_t; are already defined. */ #ifdef _ANSI_H_ /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ - are probably typos and should be removed before 2.7 is released. */ + are probably typos and should be removed before 2.8 is released. */ #ifdef _GCC_PTRDIFF_T_ #undef _PTRDIFF_T_ #undef _BSD_PTRDIFF_T_ @@ -247,12 +275,15 @@ typedef __WCHAR_TYPE__ wchar_t; /* The following ones are the real ones. */ #ifdef _GCC_PTRDIFF_T #undef _PTRDIFF_T_ +#undef _BSD_PTRDIFF_T_ #endif #ifdef _GCC_SIZE_T #undef _SIZE_T_ +#undef _BSD_SIZE_T_ #endif #ifdef _GCC_WCHAR_T #undef _WCHAR_T_ +#undef _BSD_WCHAR_T_ #endif #endif /* _ANSI_H_ */