public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
@ 2005-03-26 14:21 Mark Kettenis
  2005-03-26 14:27 ` Andrew Haley
  2005-03-27 18:48 ` Ian Lance Taylor
  0 siblings, 2 replies; 9+ messages in thread
From: Mark Kettenis @ 2005-03-26 14:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: binutils, gdb

One really shouldn't include <sys/stat.h> without <sys/types.h> on
BSD-derived systems.  On most modern BSD's it is brought in by
<unistd.h> but vax-dec-ultrix4.0 doesn't have one, so things break.
The attached patch fixes that.

ok?

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* unlink-if-ordinary.c: Include <sys/types.h>.

Index: unlink-if-ordinary.c
===================================================================
RCS file: /cvs/src/src/libiberty/unlink-if-ordinary.c,v
retrieving revision 1.1
diff -u -p -r1.1 unlink-if-ordinary.c
--- unlink-if-ordinary.c 1 Mar 2005 14:33:00 -0000 1.1
+++ unlink-if-ordinary.c 26 Mar 2005 14:18:20 -0000
@@ -39,6 +39,8 @@ was made to unlink the file because it i
 #include "config.h"
 #endif
 
+#include <sys/types.h>
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif

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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-26 14:21 [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c Mark Kettenis
@ 2005-03-26 14:27 ` Andrew Haley
  2005-03-26 14:38   ` Mark Kettenis
  2005-03-27 18:48 ` Ian Lance Taylor
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Haley @ 2005-03-26 14:27 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gcc-patches, binutils, gdb

Mark Kettenis writes:
 > One really shouldn't include <sys/stat.h> without <sys/types.h> on
 > BSD-derived systems.  On most modern BSD's it is brought in by
 > <unistd.h> but vax-dec-ultrix4.0 doesn't have one, so things break.
 > The attached patch fixes that.
 > 

You must wrap this in #ifdef HAVE_SYS_TYPES_H

Andrew.


 > 
 > Index: ChangeLog
 > from  Mark Kettenis  <kettenis@gnu.org>
 > 
 > 	* unlink-if-ordinary.c: Include <sys/types.h>.
 > 
 > Index: unlink-if-ordinary.c
 > ===================================================================
 > RCS file: /cvs/src/src/libiberty/unlink-if-ordinary.c,v
 > retrieving revision 1.1
 > diff -u -p -r1.1 unlink-if-ordinary.c
 > --- unlink-if-ordinary.c 1 Mar 2005 14:33:00 -0000 1.1
 > +++ unlink-if-ordinary.c 26 Mar 2005 14:18:20 -0000
 > @@ -39,6 +39,8 @@ was made to unlink the file because it i
 >  #include "config.h"
 >  #endif
 >  
 > +#include <sys/types.h>
 > +
 >  #ifdef HAVE_UNISTD_H
 >  #include <unistd.h>
 >  #endif

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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-26 14:27 ` Andrew Haley
@ 2005-03-26 14:38   ` Mark Kettenis
  2005-03-28  2:08     ` DJ Delorie
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Kettenis @ 2005-03-26 14:38 UTC (permalink / raw)
  To: aph; +Cc: gcc-patches, binutils, gdb

   Date: Sat, 26 Mar 2005 14:27:09 +0000
   From: Andrew Haley <aph@redhat.com>

   Mark Kettenis writes:
    > One really shouldn't include <sys/stat.h> without <sys/types.h> on
    > BSD-derived systems.  On most modern BSD's it is brought in by
    > <unistd.h> but vax-dec-ultrix4.0 doesn't have one, so things break.
    > The attached patch fixes that.
    > 

   You must wrap this in #ifdef HAVE_SYS_TYPES_H

Really?  All the other files in libiberty include this file unconditionally.

Mark

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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-26 14:21 [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c Mark Kettenis
  2005-03-26 14:27 ` Andrew Haley
@ 2005-03-27 18:48 ` Ian Lance Taylor
  1 sibling, 0 replies; 9+ messages in thread
From: Ian Lance Taylor @ 2005-03-27 18:48 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gcc-patches, binutils, gdb

Mark Kettenis <mark.kettenis@xs4all.nl> writes:

> from  Mark Kettenis  <kettenis@gnu.org>
> 
> 	* unlink-if-ordinary.c: Include <sys/types.h>.

This is OK.  Thanks.

Ian

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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-26 14:38   ` Mark Kettenis
@ 2005-03-28  2:08     ` DJ Delorie
  2005-03-28  2:19       ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: DJ Delorie @ 2005-03-28  2:08 UTC (permalink / raw)
  To: mark.kettenis; +Cc: gcc-patches, binutils, gdb


>    You must wrap this in #ifdef HAVE_SYS_TYPES_H
> 
> Really?  All the other files in libiberty include this file unconditionally.

Normally I would say "that means they're all broken" but the ongoing
ansification means we probably don't need to check for that any more.

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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-28  2:08     ` DJ Delorie
@ 2005-03-28  2:19       ` Ian Lance Taylor
  2005-03-28  2:35         ` DJ Delorie
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 2005-03-28  2:19 UTC (permalink / raw)
  To: DJ Delorie; +Cc: mark.kettenis, gcc-patches, binutils, gdb

DJ Delorie <dj@redhat.com> writes:

> >    You must wrap this in #ifdef HAVE_SYS_TYPES_H
> > 
> > Really?  All the other files in libiberty include this file unconditionally.
> 
> Normally I would say "that means they're all broken" but the ongoing
> ansification means we probably don't need to check for that any more.

<sys/types.h> is not an ISO C header file.  But it is in POSIX.1.  And
it is available on every Unix system.  Because of that, it is
available on every Unix workalike system.

Ian

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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-28  2:19       ` Ian Lance Taylor
@ 2005-03-28  2:35         ` DJ Delorie
  2005-03-28 14:43           ` Mark Kettenis
  0 siblings, 1 reply; 9+ messages in thread
From: DJ Delorie @ 2005-03-28  2:35 UTC (permalink / raw)
  To: ian; +Cc: gcc-patches, binutils, gdb


> <sys/types.h> is not an ISO C header file.  But it is in POSIX.1.
> And it is available on every Unix system.  Because of that, it is
> available on every Unix workalike system.

Right, but the machines that wouldn't have it, probably would have K&R
compilers anyway.  We haven't had a problem using it unprotected so
far, and there's even less reason to worry about it now.

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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-28  2:35         ` DJ Delorie
@ 2005-03-28 14:43           ` Mark Kettenis
  2005-03-28 17:17             ` DJ Delorie
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Kettenis @ 2005-03-28 14:43 UTC (permalink / raw)
  To: dj; +Cc: ian, gcc-patches, binutils, gdb

   Date: Sun, 27 Mar 2005 21:35:04 -0500
   From: DJ Delorie <dj@redhat.com>

   > <sys/types.h> is not an ISO C header file.  But it is in POSIX.1.
   > And it is available on every Unix system.  Because of that, it is
   > available on every Unix workalike system.

At least since 7th Edition Unix.

   Right, but the machines that wouldn't have it, probably would have K&R
   compilers anyway.  We haven't had a problem using it unprotected so
   far, and there's even less reason to worry about it now.

Could on of you do me the favor of checking this in on the gcc side?
Looks like I don't have write permission there anymore.  Attached is
an updated patch that also updates the copyright year.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* unlink-if-ordinary.c: Include <sys/types.h>.

Index: unlink-if-ordinary.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/unlink-if-ordinary.c,v
retrieving revision 1.2
diff -u -p -r1.2 unlink-if-ordinary.c
--- unlink-if-ordinary.c 28 Mar 2005 01:28:01 -0000 1.2
+++ unlink-if-ordinary.c 28 Mar 2005 14:42:16 -0000
@@ -1,5 +1,5 @@
 /* unlink-if-ordinary.c - remove link to a file unless it is special
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of the libiberty library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -39,6 +39,8 @@ was made to unlink the file because it i
 #include "config.h"
 #endif
 
+#include <sys/types.h>
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif


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

* Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
  2005-03-28 14:43           ` Mark Kettenis
@ 2005-03-28 17:17             ` DJ Delorie
  0 siblings, 0 replies; 9+ messages in thread
From: DJ Delorie @ 2005-03-28 17:17 UTC (permalink / raw)
  To: mark.kettenis; +Cc: ian, gcc-patches, binutils, gdb


> Could on of you do me the favor of checking this in on the gcc side?

Done.

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

end of thread, other threads:[~2005-03-28 17:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-26 14:21 [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c Mark Kettenis
2005-03-26 14:27 ` Andrew Haley
2005-03-26 14:38   ` Mark Kettenis
2005-03-28  2:08     ` DJ Delorie
2005-03-28  2:19       ` Ian Lance Taylor
2005-03-28  2:35         ` DJ Delorie
2005-03-28 14:43           ` Mark Kettenis
2005-03-28 17:17             ` DJ Delorie
2005-03-27 18:48 ` Ian Lance Taylor

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