about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-02-24 22:31:08 +0000
committerUlrich Drepper <drepper@redhat.com>2000-02-24 22:31:08 +0000
commitc3fb74d389db31b189fbaab2370bdbb3a8f2c652 (patch)
treeb416a868d939001c63c1c1d103798550d9302730
parent230232e5f8aec363bbbab90b52fd21e046fee0e9 (diff)
downloadglibc-c3fb74d389db31b189fbaab2370bdbb3a8f2c652.tar.gz
glibc-c3fb74d389db31b189fbaab2370bdbb3a8f2c652.tar.xz
glibc-c3fb74d389db31b189fbaab2370bdbb3a8f2c652.zip
Update.
	* posix/sys/wait.h: Handle definitions duplicated in stdlib.h
	correctly.
	* stdlib/stdlib.h: Handle definition of wait macros correctly.
-rw-r--r--ChangeLog4
-rw-r--r--posix/sys/wait.h44
-rw-r--r--stdlib/stdlib.h52
3 files changed, 51 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index e030744312..eed4534350 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-02-24  Ulrich Drepper  <drepper@redhat.com>
 
+	* posix/sys/wait.h: Handle definitions duplicated in stdlib.h
+	correctly.
+	* stdlib/stdlib.h: Handle definition of wait macros correctly.
+
 	* posix/sys/wait.h: Add missing #endif.
 
 	* stdlib/stdlib.h (setstate): Don't mark argument as const (yet).
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index cccbcb8931..81b0eb429d 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -34,61 +34,61 @@ typedef __pid_t pid_t;
 # define __pid_t_defined
 #endif
 
+/* These macros could also be defined int <stdlib.h>.  */
+#ifndef _STDLIB_H
 /* This will define the `W*' macros for the flag
    bits to `waitpid', `wait3', and `wait4'.  */
-#include <bits/waitflags.h>
+# include <bits/waitflags.h>
 
-#ifdef	__USE_BSD
+# ifdef	__USE_BSD
 
 /* Lots of hair to allow traditional BSD use of `union wait'
    as well as POSIX.1 use of `int' for the status word.  */
 
-# if defined __GNUC__ && !defined __cplusplus
-#  define __WAIT_INT(status)						      \
+#  if defined __GNUC__ && !defined __cplusplus
+#   define __WAIT_INT(status)						      \
   (__extension__ ({ union { __typeof(status) __in; int __i; } __u;	      \
 		    __u.__in = (status); __u.__i; }))
-# else
-#  define __WAIT_INT(status)	(*(int *) &(status))
-# endif
+#  else
+#   define __WAIT_INT(status)	(*(int *) &(status))
+#  endif
 
 /* This is the type of the argument to `wait'.  The funky union
    causes redeclarations with ether `int *' or `union wait *' to be
    allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
    the actual function definitions.  */
 
-# if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
-#  define __WAIT_STATUS		void *
-#  define __WAIT_STATUS_DEFN	void *
-# else
+#  if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
+#   define __WAIT_STATUS		void *
+#   define __WAIT_STATUS_DEFN	void *
+#  else
 /* This works in GCC 2.6.1 and later.  */
 typedef union
   {
     union wait *__uptr;
     int *__iptr;
   } __WAIT_STATUS __attribute__ ((__transparent_union__));
-#  define __WAIT_STATUS_DEFN	int *
-# endif
+#   define __WAIT_STATUS_DEFN	int *
+#  endif
 
-#else /* Don't use BSD.  */
+# else /* Don't use BSD.  */
 
-# define __WAIT_INT(status)	(status)
-# define __WAIT_STATUS		int *
-# define __WAIT_STATUS_DEFN	int *
+#  define __WAIT_INT(status)	(status)
+#  define __WAIT_STATUS		int *
+#  define __WAIT_STATUS_DEFN	int *
 
-#endif /* Use BSD.  */
+# endif /* Use BSD.  */
 
 /* This will define all the `__W*' macros.  */
-#include <bits/waitstatus.h>
+# include <bits/waitstatus.h>
 
-/* These macros could also be defined int <stdlib.h>.  */
-#ifndef WEXITSTATUS
 # define WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
 # define WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
 # define WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
 # define WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
 # define WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
 # define WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
-#endif
+#endif	/* <stdlib.h> not included.  */
 
 #ifdef	__USE_BSD
 # define WCOREFLAG		__WCOREFLAG
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 8857f35a20..604ab64f78 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -37,60 +37,58 @@ __BEGIN_DECLS
 #ifndef __need_malloc_and_calloc
 #define	_STDLIB_H	1
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && !defined _SYS_WAIT_H
 /* XPG requires a few symbols from <sys/wait.h> being defined.  */
 # include <bits/waitflags.h>
 # include <bits/waitstatus.h>
 
-# ifndef WEXITSTATUS
-#  ifdef __USE_BSD
+# ifdef __USE_BSD
 
 /* Lots of hair to allow traditional BSD use of `union wait'
    as well as POSIX.1 use of `int' for the status word.  */
 
-#   if defined __GNUC__ && !defined __cplusplus
-#    define __WAIT_INT(status)						      \
+#  if defined __GNUC__ && !defined __cplusplus
+#   define __WAIT_INT(status)						      \
   (__extension__ ({ union { __typeof(status) __in; int __i; } __u;	      \
 		    __u.__in = (status); __u.__i; }))
-#   else
-#    define __WAIT_INT(status)	(*(int *) &(status))
-#   endif
+#  else
+#   define __WAIT_INT(status)	(*(int *) &(status))
+#  endif
 
 /* This is the type of the argument to `wait'.  The funky union
    causes redeclarations with ether `int *' or `union wait *' to be
    allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
    the actual function definitions.  */
 
-#   if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
-#    define __WAIT_STATUS	void *
-#    define __WAIT_STATUS_DEFN	void *
-#   else
+#  if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
+#   define __WAIT_STATUS	void *
+#   define __WAIT_STATUS_DEFN	void *
+#  else
 /* This works in GCC 2.6.1 and later.  */
 typedef union
   {
     union wait *__uptr;
     int *__iptr;
   } __WAIT_STATUS __attribute__ ((__transparent_union__));
-#    define __WAIT_STATUS_DEFN	int *
-#   endif
+#   define __WAIT_STATUS_DEFN	int *
+#  endif
 
-#  else /* Don't use BSD.  */
+# else /* Don't use BSD.  */
 
-#   define __WAIT_INT(status)	(status)
-#   define __WAIT_STATUS	int *
-#   define __WAIT_STATUS_DEFN	int *
+#  define __WAIT_INT(status)	(status)
+#  define __WAIT_STATUS	int *
+#  define __WAIT_STATUS_DEFN	int *
 
-#  endif /* Use BSD.  */
+# endif /* Use BSD.  */
 
 /* Define the macros <sys/wait.h> also would define this way.  */
-#  define WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
-#  define WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
-#  define WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
-#  define WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
-#  define WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
-#  define WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
-# endif
-#endif
+# define WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
+# define WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
+# define WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
+# define WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
+# define WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
+# define WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
+#endif	/* X/Open and <sys/wait.h> not included.  */
 
 /* Returned by `div'.  */
 typedef struct