Message ID | 20180204073846.GA17915@SDF.ORG |
---|---|
State | New |
Headers | show |
Series | [1/2] Untangle stddef.h a little | expand |
ping, let me know if there is anything wrong with it.
ping they're good patches. ask questions. I have more.
hi gcc-patches, as part of pinging, i'll explain the story of this patch. I want to make sure all netbsd archs work with upstream gcc. in this case, netbsd/arm's EABI support. I try to break up my changes into digestible chunks that are rational, which is why this change came first. building netbsd/arm gcc-trunk, I had a build error in libstdc++, because this stddef.h relies on include guards: #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) In theory I could have just added: || _ARM_ANSI_H_ this felt gross, so I tried a better solution. the file even comes with comments like: /* Why is this file so hard to maintain properly? so I try my best to help. Please let me upstream local changes. there are a lot of them. and I feel unable to get them across. I have so many changes that it feels inappropriate to ask for help with hard problems like internal compiler errors because upstream GCC hit a different problem. I'm not familiar with stuff so this is hard :-(
On 01.03.2018 03:43, coypu@sdf.org wrote: > hi gcc-patches, > > as part of pinging, i'll explain the story of this patch. > > I want to make sure all netbsd archs work with upstream gcc. > in this case, netbsd/arm's EABI support. > I try to break up my changes into digestible chunks that are rational, > which is why this change came first. > > building netbsd/arm gcc-trunk, I had a build error in libstdc++, because > this stddef.h relies on include guards: > > #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) > > In theory I could have just added: > || _ARM_ANSI_H_ > > this felt gross, so I tried a better solution. > the file even comes with comments like: > /* Why is this file so hard to maintain properly? > so I try my best to help. > > Please let me upstream local changes. there are a lot of them. and I > feel unable to get them across. > I have so many changes that it feels inappropriate to ask for help with > hard problems like internal compiler errors because upstream GCC hit a > different problem. I'm not familiar with stuff so this is hard :-( > Looks good, ping from my point of view for maintainers. Adding defined(_*_ANSI_H) for each CPU and flavor of headers on NetBSD does not scale even for the existing set of supported architectures. NetBSD/hpcsh uses _HPCSH_ANSI_H_, NetBSD/dreamcast _DREAMCAST_ANSI_H_ etc.
On Sun, 4 Feb 2018, Maya Rashish wrote: > Of the currently supported BSDs: > - FreeBSD, doesn't have ansi.h or define _MACHINE_ANSI_H anywhere > in its other headers since the long-gone 5.x release. > - OpenBSD, DragonflyBSD don't have ansi.h either. > - NetBSD, sole remaining with ansi.h > > Replace all the ifdef macros to be ifdef __NetBSD__ as it's the > sole remaining user. > > Whether it is appropriate to make per-OS choices here is debatable, > but this change allows for further future cleanup. > > This enables using the headers on netbsd archs that use different > include guards for ansi.h, like ARM. These two patches are OK, please commit. (GCC officially removed support for FreeBSD versions before FreeBSD 5 with r260852 | gerald | 2018-05-28 23:20:15 +0000 (Mon, 28 May 2018) | 5 lines * config.gcc: Identify FreeBSD 3.x and 4.x as unsupported. * config/freebsd-spec.h (FBSD_LIB_SPEC): Only consider FreeBSD 5 and later. <https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01409.html>.)
On Tue, Jun 19, 2018 at 03:31:55PM +0000, Joseph Myers wrote: > On Sun, 4 Feb 2018, Maya Rashish wrote: > > > Of the currently supported BSDs: > > - FreeBSD, doesn't have ansi.h or define _MACHINE_ANSI_H anywhere > > in its other headers since the long-gone 5.x release. > > - OpenBSD, DragonflyBSD don't have ansi.h either. > > - NetBSD, sole remaining with ansi.h > > > > Replace all the ifdef macros to be ifdef __NetBSD__ as it's the > > sole remaining user. > > > > Whether it is appropriate to make per-OS choices here is debatable, > > but this change allows for further future cleanup. > > > > This enables using the headers on netbsd archs that use different > > include guards for ansi.h, like ARM. > > These two patches are OK, please commit. > > (GCC officially removed support for FreeBSD versions before FreeBSD 5 with > > r260852 | gerald | 2018-05-28 23:20:15 +0000 (Mon, 28 May 2018) | 5 lines > > * config.gcc: Identify FreeBSD 3.x and 4.x as unsupported. > > * config/freebsd-spec.h (FBSD_LIB_SPEC): Only consider FreeBSD 5 > and later. > > <https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01409.html>.) > Hi! I have no commit access. Can someone commit it? Thanks :-)
On Tue, 19 Jun 2018, coypu@sdf.org wrote: > Hi! I have no commit access. > Can someone commit it? I'll take care. Gerald
On Tue, 19 Jun 2018, Joseph Myers wrote: > These two patches are OK, please commit. I created ChangeLog entries and committed both patches (one a few days ago, the second just now). Thank you, Maya! If you have any further clean-ups, I'll be happy to help by committing them (once approved). > (GCC officially removed support for FreeBSD versions before FreeBSD 5 with > > r260852 | gerald | 2018-05-28 23:20:15 +0000 (Mon, 28 May 2018) | 5 lines > > * config.gcc: Identify FreeBSD 3.x and 4.x as unsupported. > > * config/freebsd-spec.h (FBSD_LIB_SPEC): Only consider FreeBSD 5 > and later. > > <https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01409.html>.) I took this as a hint to further simplify ginclude/stddef.h. ;-) Thanks for pointing this out, Joseph! Okay to apply the following? Tested on x86_64-unknown-freebsd11.2. Gerald 2018-06-24 Gerald Pfeifer <gerald@pfeifer.com> * ginclude/stddef.h: Remove an obsolete comment on FreeBSD 5. Simplify logic for FreeBSD (twice). Index: ginclude/stddef.h =================================================================== --- ginclude/stddef.h (revision 261998) +++ ginclude/stddef.h (working copy) @@ -49,8 +49,8 @@ #if defined(__NetBSD__) #include <machine/ansi.h> #endif -/* On FreeBSD 5, machine/ansi.h does not exist anymore... */ -#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) + +#if defined (__FreeBSD__) #include <sys/_types.h> #endif @@ -194,7 +194,7 @@ #define ___int_size_t_h #define _GCC_SIZE_T #define _SIZET_ -#if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ +#if defined (__FreeBSD__) \ || defined(__DragonFly__) \ || defined(__FreeBSD_kernel__) \ || defined(__VMS__)
On 06/24/2018 05:19 PM, Gerald Pfeifer wrote: > On Tue, 19 Jun 2018, Joseph Myers wrote: >> These two patches are OK, please commit. > > I created ChangeLog entries and committed both patches (one a few > days ago, the second just now). > > Thank you, Maya! If you have any further clean-ups, I'll be happy > to help by committing them (once approved). > >> (GCC officially removed support for FreeBSD versions before FreeBSD 5 with >> >> r260852 | gerald | 2018-05-28 23:20:15 +0000 (Mon, 28 May 2018) | 5 lines >> >> * config.gcc: Identify FreeBSD 3.x and 4.x as unsupported. >> >> * config/freebsd-spec.h (FBSD_LIB_SPEC): Only consider FreeBSD 5 >> and later. >> >> <https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01409.html>.) > > I took this as a hint to further simplify ginclude/stddef.h. ;-) > Thanks for pointing this out, Joseph! > > Okay to apply the following? Tested on x86_64-unknown-freebsd11.2. > > Gerald > > 2018-06-24 Gerald Pfeifer <gerald@pfeifer.com> > > * ginclude/stddef.h: Remove an obsolete comment on FreeBSD 5. > Simplify logic for FreeBSD (twice). OK. jeff
diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h index 31b96a7e5..15a99e7da 100644 --- a/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h @@ -46,9 +46,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* This avoids lossage on SunOS but only if stdtypes.h comes first. There's no way to win with the other order! Sun lossage. */ -/* On 4.3bsd-net2, make sure ansi.h is included, so we have - one less case to deal with in the following. */ -#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__) +#if defined(__NetBSD__) #include <machine/ansi.h> #endif /* On FreeBSD 5, machine/ansi.h does not exist anymore... */ @@ -56,11 +54,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <sys/_types.h> #endif -/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are - defined if the corresponding type is *not* defined. - FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_. - NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_ */ -#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) +#if defined(__NetBSD__) #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_) #define _SIZE_T #endif @@ -87,7 +81,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #undef _WCHAR_T_ #undef _BSD_WCHAR_T_ #endif -#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) */ +#endif /* defined(__NetBSD__) */ /* Sequent's header files use _PTRDIFF_T_ in some conflicting way. Just ignore it. */ @@ -359,11 +353,7 @@ typedef __WINT_TYPE__ wint_t; #undef __need_wint_t #endif -/* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. - are already defined. */ -/* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */ -/* NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here. */ -#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) +#if defined(__NetBSD__) /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ are probably typos and should be removed before 2.8 is released. */ #ifdef _GCC_PTRDIFF_T_ @@ -391,7 +381,7 @@ typedef __WINT_TYPE__ wint_t; #undef _WCHAR_T_ #undef _BSD_WCHAR_T_ #endif -#endif /* _ANSI_H_ || _MACHINE_ANSI_H_ || _X86_64_ANSI_H_ || _I386_ANSI_H_ */ +#endif /* __NetBSD__ */ #endif /* __sys_stdtypes_h */