Date: Thu, 20 Jul 2000 12:01:44 -0700 From: Zack Weinberg To: Bruce Korb Cc: DJ Delorie , djgpp-workers AT delorie DOT com, gcc AT gcc DOT gnu DOT org Subject: Re: GCC headers and DJGPP port Message-ID: <20000720120144.R7661@wolery.cumb.org> 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 <3977366D DOT 1DC9A971 AT sco DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <3977366D.1DC9A971@sco.com>; from bkorb@sco.COM on Thu, Jul 20, 2000 at 10:27:09AM -0700 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, Jul 20, 2000 at 10:27:09AM -0700, Bruce Korb wrote: > 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. As I said, __SIZE_TYPE__ et al are magic defines, built into cpp. You must have missed this chunk of cppinit.c: static const struct builtin builtin_array[] = { /* ... */ #ifndef NO_BUILTIN_SIZE_TYPE C("__SIZE_TYPE__", SIZE_TYPE), #endif #ifndef NO_BUILTIN_PTRDIFF_TYPE C("__PTRDIFF_TYPE__", PTRDIFF_TYPE), #endif #ifndef NO_BUILTIN_WCHAR_TYPE C("__WCHAR_TYPE__", WCHAR_TYPE), #endif }; SIZE_TYPE, WCHAR_TYPE, and PTRDIFF_TYPE come from tm.h. If a port defines one of the NO_BUILTIN_* macros, then it is required to set the corresponding __*_TYPE__ macro in its specs. This is done for e.g. powerpc, where the correct values depend on -m switches. I do not know why stddef.h has default definitions of these macros; perhaps in case a non-GCC compiler ever used our stddef.h. The vast majority of the complexity of stddef.h has to do with how it interacts with system-provided headers. Not on the actual definition of size_t, etc. but on the interlock mechanism which prevents duplicate typedefs. And I don't think fixincludes is prepared to help with that. It would need a huge table recording the appropriate interlock to use for each platform. I might also add that some modern C libraries, such as glibc, know exactly which headers are provided by gcc and do not have their own copies. zw