public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Untangle stddef.h a little
@ 2018-02-04  7:38 Maya Rashish
  2018-02-04  7:41 ` [PATCH 2/2] Simplify: combine cases for dfly+fbsd with vms coypu
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Maya Rashish @ 2018-02-04  7:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: coypu

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.

(Note that netbsd's copy of GCC avoids this header entirely.)
Built tested on NetBSD-8.99.12/amd64.
---
 gcc/ginclude/stddef.h | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

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 */
 
-- 
2.15.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/2] Simplify: combine cases for dfly+fbsd with vms.
  2018-02-04  7:38 [PATCH 1/2] Untangle stddef.h a little Maya Rashish
@ 2018-02-04  7:41 ` coypu
  2018-02-13  0:41 ` [PATCH 1/2] Untangle stddef.h a little coypu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: coypu @ 2018-02-04  7:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: coypu

No need to have VMS in a separate elif case and a separate comment
for it saying the same thing.

No functional change intended.
---
 gcc/ginclude/stddef.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 15a99e7da..8d5a73ab5 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -196,10 +196,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 #define _SIZET_
 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
   || defined(__DragonFly__) \
-  || defined(__FreeBSD_kernel__)
-/* __size_t is a typedef on FreeBSD 5, must not trash it. */
-#elif defined (__VMS__)
-/* __size_t is also a typedef on VMS.  */
+  || defined(__FreeBSD_kernel__) \
+  || defined(__VMS__)
+/* __size_t is a typedef, must not trash it.  */
 #else
 #define __size_t
 #endif
-- 
2.15.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-02-04  7:38 [PATCH 1/2] Untangle stddef.h a little Maya Rashish
  2018-02-04  7:41 ` [PATCH 2/2] Simplify: combine cases for dfly+fbsd with vms coypu
@ 2018-02-13  0:41 ` coypu
  2018-02-19 22:12 ` coypu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: coypu @ 2018-02-13  0:41 UTC (permalink / raw)
  To: gcc-patches

ping, let me know if there is anything wrong with it.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-02-04  7:38 [PATCH 1/2] Untangle stddef.h a little Maya Rashish
  2018-02-04  7:41 ` [PATCH 2/2] Simplify: combine cases for dfly+fbsd with vms coypu
  2018-02-13  0:41 ` [PATCH 1/2] Untangle stddef.h a little coypu
@ 2018-02-19 22:12 ` coypu
  2018-03-01  2:43 ` coypu
  2018-06-19 15:32 ` Joseph Myers
  4 siblings, 0 replies; 11+ messages in thread
From: coypu @ 2018-02-19 22:12 UTC (permalink / raw)
  To: gcc-patches

ping
they're good patches. ask questions. I have more.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-02-04  7:38 [PATCH 1/2] Untangle stddef.h a little Maya Rashish
                   ` (2 preceding siblings ...)
  2018-02-19 22:12 ` coypu
@ 2018-03-01  2:43 ` coypu
  2018-03-01  6:02   ` Kamil Rytarowski
  2018-06-19 15:32 ` Joseph Myers
  4 siblings, 1 reply; 11+ messages in thread
From: coypu @ 2018-03-01  2:43 UTC (permalink / raw)
  To: gcc-patches

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 :-(

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-03-01  2:43 ` coypu
@ 2018-03-01  6:02   ` Kamil Rytarowski
  0 siblings, 0 replies; 11+ messages in thread
From: Kamil Rytarowski @ 2018-03-01  6:02 UTC (permalink / raw)
  To: coypu, gcc-patches


[-- Attachment #1.1: Type: text/plain, Size: 1449 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 850 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-02-04  7:38 [PATCH 1/2] Untangle stddef.h a little Maya Rashish
                   ` (3 preceding siblings ...)
  2018-03-01  2:43 ` coypu
@ 2018-06-19 15:32 ` Joseph Myers
  2018-06-19 22:08   ` coypu
  2018-06-24 23:19   ` Gerald Pfeifer
  4 siblings, 2 replies; 11+ messages in thread
From: Joseph Myers @ 2018-06-19 15:32 UTC (permalink / raw)
  To: Maya Rashish; +Cc: gcc-patches, gerald

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>.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-06-19 15:32 ` Joseph Myers
@ 2018-06-19 22:08   ` coypu
  2018-06-19 22:43     ` Gerald Pfeifer
  2018-06-24 23:19   ` Gerald Pfeifer
  1 sibling, 1 reply; 11+ messages in thread
From: coypu @ 2018-06-19 22:08 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc-patches, gerald

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 :-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-06-19 22:08   ` coypu
@ 2018-06-19 22:43     ` Gerald Pfeifer
  0 siblings, 0 replies; 11+ messages in thread
From: Gerald Pfeifer @ 2018-06-19 22:43 UTC (permalink / raw)
  To: coypu; +Cc: Joseph Myers, gcc-patches

On Tue, 19 Jun 2018, coypu@sdf.org wrote:
> Hi! I have no commit access. 
> Can someone commit it?

I'll take care.

Gerald

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-06-19 15:32 ` Joseph Myers
  2018-06-19 22:08   ` coypu
@ 2018-06-24 23:19   ` Gerald Pfeifer
  2018-06-25 21:37     ` Jeff Law
  1 sibling, 1 reply; 11+ messages in thread
From: Gerald Pfeifer @ 2018-06-24 23:19 UTC (permalink / raw)
  To: Joseph Myers, Andreas Tobler, Maya Rashish; +Cc: gcc-patches

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__)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] Untangle stddef.h a little
  2018-06-24 23:19   ` Gerald Pfeifer
@ 2018-06-25 21:37     ` Jeff Law
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff Law @ 2018-06-25 21:37 UTC (permalink / raw)
  To: Gerald Pfeifer, Joseph Myers, Andreas Tobler, Maya Rashish; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-06-25 21:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04  7:38 [PATCH 1/2] Untangle stddef.h a little Maya Rashish
2018-02-04  7:41 ` [PATCH 2/2] Simplify: combine cases for dfly+fbsd with vms coypu
2018-02-13  0:41 ` [PATCH 1/2] Untangle stddef.h a little coypu
2018-02-19 22:12 ` coypu
2018-03-01  2:43 ` coypu
2018-03-01  6:02   ` Kamil Rytarowski
2018-06-19 15:32 ` Joseph Myers
2018-06-19 22:08   ` coypu
2018-06-19 22:43     ` Gerald Pfeifer
2018-06-24 23:19   ` Gerald Pfeifer
2018-06-25 21:37     ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).