patch to consolidate sys/wait.h and W* macro support
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Wed Nov 18 19:39:00 GMT 1998
Here's a patch to consolidate support for sys/wait.h and the
related W* macros. Note there are both gcc and libiberty directory
changes here. Okay to install?
--Kaveh
Wed Nov 18 22:26:00 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.in: Don't do AC_CHECK_HEADERS(wait.h sys/wait.h).
Instead call AC_HEADER_SYS_WAIT.
* collect2.c: Don't provide defaults for sys/wait.h macros.
* gcc.c: Likewise.
* protoize.c: Likewise. Also, don't include sys/wait.h.
* system.h: Include sys/wait.h and provide macro defaults.
diff -rup orig/egcs-CVS19981117/gcc/configure.in egcs-CVS19981117/gcc/configure.in
--- orig/egcs-CVS19981117/gcc/configure.in Tue Nov 17 11:34:44 1998
+++ egcs-CVS19981117/gcc/configure.in Tue Nov 17 14:36:18 1998
@@ -330,7 +330,8 @@ EGCS_PROG_INSTALL
AC_HEADER_STDC
AC_HEADER_TIME
GCC_HEADER_STRING
-AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h wait.h sys/wait.h)
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h)
# Check for thread headers.
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
diff -rup orig/egcs-CVS19981117/gcc/collect2.c egcs-CVS19981117/gcc/collect2.c
--- orig/egcs-CVS19981117/gcc/collect2.c Tue Nov 17 11:34:42 1998
+++ egcs-CVS19981117/gcc/collect2.c Tue Nov 17 14:35:18 1998
@@ -55,19 +55,6 @@ Boston, MA 02111-1307, USA. */
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(S) ((S) & 0x7f)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(S) (((S) & 0xff) == 0)
-#endif
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
-#endif
-
extern char *make_temp_file PROTO ((char *));
/* On certain systems, we have code that works by scanning the object file
diff -rup orig/egcs-CVS19981117/gcc/gcc.c egcs-CVS19981117/gcc/gcc.c
--- orig/egcs-CVS19981117/gcc/gcc.c Tue Nov 17 11:35:04 1998
+++ egcs-CVS19981117/gcc/gcc.c Tue Nov 17 16:00:00 1998
@@ -51,19 +51,6 @@ extern void set_std_prefix PROTO((char *
#define PEXECUTE_SEARCH 4
#define PEXECUTE_VERBOSE 8
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(S) ((S) & 0x7f)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(S) (((S) & 0xff) == 0)
-#endif
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
-#endif
-
#ifdef VMS
#define exit __posix_exit
#endif
diff -rup orig/egcs-CVS19981117/gcc/protoize.c egcs-CVS19981117/gcc/protoize.c
--- orig/egcs-CVS19981117/gcc/protoize.c Tue Nov 17 11:35:45 1998
+++ egcs-CVS19981117/gcc/protoize.c Tue Nov 17 16:00:30 1998
@@ -139,22 +139,8 @@ typedef char * const_pointer_type;
#if defined(POSIX)
#include <signal.h>
-#include <sys/wait.h>
#else /* !defined(POSIX) */
-
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(S) ((S) & 0x7f)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(S) (((S) & 0xff) == 0)
-#endif
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
-#endif
/* Declaring stat or __flsbuf with a prototype
causes conflicts with system headers on some systems. */
diff -rup orig/egcs-CVS19981117/gcc/system.h egcs-CVS19981117/gcc/system.h
--- orig/egcs-CVS19981117/gcc/system.h Tue Nov 17 11:35:44 1998
+++ egcs-CVS19981117/gcc/system.h Tue Nov 17 15:59:24 1998
@@ -156,6 +156,23 @@ extern int errno;
# define O_WRONLY 1
#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
+#endif
+#ifndef WTERMSIG
+#define WTERMSIG(S) ((S) & 0x7f)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(S) (((S) & 0xff) == 0)
+#endif
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
+#endif
+
#ifndef bcopy
Wed Nov 18 22:26:00 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.in: Call AC_HEADER_SYS_WAIT.
* pexecute.c: Include sys/wait.h when !IN_GCC.
diff -rup orig/egcs-CVS19981117/libiberty/configure.in egcs-CVS19981117/libiberty/configure.in
--- orig/egcs-CVS19981117/libiberty/configure.in Tue Nov 17 11:39:12 1998
+++ egcs-CVS19981117/libiberty/configure.in Tue Nov 17 14:33:43 1998
@@ -107,6 +107,7 @@ AC_SUBST_FILE(host_makefile_frag)
# able to link anything, it had better be able to at least compile
# something.
AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h)
+AC_HEADER_SYS_WAIT
# This is the list of functions which libiberty will provide if they
# are not available on the host.
diff -rup orig/egcs-CVS19981117/libiberty/pexecute.c egcs-CVS19981117/libiberty/pexecute.c
--- orig/egcs-CVS19981117/libiberty/pexecute.c Tue Nov 17 11:39:14 1998
+++ egcs-CVS19981117/libiberty/pexecute.c Tue Nov 17 16:04:18 1998
@@ -35,6 +35,9 @@ Boston, MA 02111-1307, USA. */
#include <unistd.h>
#endif
#define ISSPACE (x) isspace(x)
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
#endif
#ifdef vfork /* Autoconf may define this to fork for us. */
More information about the Gcc-patches
mailing list