Sender: bkorb AT sco DOT COM Message-ID: <3977366D.1DC9A971@sco.com> Date: Thu, 20 Jul 2000 10:27:09 -0700 From: Bruce Korb Organization: Santa Cruz Operations X-Mailer: Mozilla 4.7 [en] (X11; I; SCO_SV 3.2 i386) X-Accept-Language: en MIME-Version: 1.0 To: Zack Weinberg CC: Bruce Korb , DJ Delorie , djgpp-workers AT delorie DOT com, gcc AT gcc DOT gnu DOT org Subject: Re: GCC headers and DJGPP port References: <200007180918 DOT FAA06988 AT indy DOT delorie DOT com> <200007181913 DOT VAA01170 AT loewis DOT home DOT cs DOT tu-berlin DOT de> <200007191826 DOT OAA08693 AT indy DOT delorie DOT com> <200007200729 DOT JAA01060 AT loewis DOT home DOT cs DOT tu-berlin DOT de> <200007201024 DOT GAA09536 AT indy DOT delorie DOT com> <200007201205.OA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Note-from-DJ: This may be spam Reply-To: djgpp-workers AT delorie DOT com Zack Weinberg wrote: > > On Thu, Jul 20, 2000 at 08:25:40AM -0700, Bruce Korb wrote: > ... > > The amusing thing about that is that stddef.h is not platform > > specific, even though the SIZE_TYPE, PTRDIFF_TYPE and WCHAR_TYPE > > defines are. I'm thinking that fixincludes should do its thing > > on the GCC-supplied stddef.h since fixincludes replaces these > > typedefs with platform-specific changes (as of today :-). > > Our stddef.h uses the magic __SIZE_TYPE__, __PTRDIFF_TYPE__, and > __WCHAR_TYPE__ defines, which are set by cpp to the values of the > SIZE_TYPE, etc. defines in tm.h. And fixincludes should too. fixincludes did not ever do so, prior to today, that is. :-) I grepped the CVS source for stddef.h and found absolutely no reference to "__PTRDIFF_TYPE__", except the three below. Also, there was no reference to "PTRDIFF_TYPE" at all, period. > #ifndef _GCC_PTRDIFF_T > ... > #ifndef __PTRDIFF_TYPE__ > #define __PTRDIFF_TYPE__ long int > #endif > typedef __PTRDIFF_TYPE__ ptrdiff_t; > #endif /* _GCC_PTRDIFF_T */ Notice the hard-wired define to "long int". Not good. I would suggest the following: 1. If a target has a stddef.h, use it, filtered through fixincludes. 2. If not, provide one -- *ALSO* filtered through fixincludes 3. In the provided one, replace all the SIZE_T, WCHAR_T and PTRDIFF_T junk with: typedef DUMMY ptrdiff_t; typedef DUMMY size_t; typedef DUMMY wchar_t; allowing fixincludes to clean it up in a platform-specific manner. The fixed result would look like any other fixup of these typedefs that fixinc does. viz.: #ifndef __PTRDIFF_TYPE__ #define __PTRDIFF_TYPE__ XXX #endif #if !defined(_GCC_PTRDIFF_T) #define _GCC_PTRDIFF_T typedef __PTRDIFF_TYPE__ ptrdiff_t; #endif #ifndef __SIZE_TYPE__ #define __SIZE_TYPE__ YYY #endif #if !defined(_GCC_SIZE_T) #define _GCC_SIZE_T typedef __SIZE_TYPE__ size_t; #endif #ifndef __WCHAR_TYPE__ #define __WCHAR_TYPE__ ZZZ #endif #if !defined(_GCC_WCHAR_T) && ! defined(__cplusplus) #define _GCC_WCHAR_T typedef __WCHAR_TYPE__ wchar_t; #endif except that the `XXX', `YYY', and `ZZZ' would be the strings obtained from the "tm.h" header file inclusion. > I sent in a patch over a year ago that drastically simplified our > stddef.h, but no one ever reviewed it. > http://gcc.gnu.org/ml/gcc-patches/1999-01/msg00655.html. This should be simpler, still ;-)