mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
Remove union wait [BZ #19613]
The overloading approach in the W* macros was incompatible with integer expressions of a type different from int. Applications using union wait and these macros will have to migrate to the POSIX-specified int status type.
This commit is contained in:
@ -41,54 +41,15 @@ __BEGIN_DECLS
|
||||
# include <bits/waitflags.h>
|
||||
# include <bits/waitstatus.h>
|
||||
|
||||
# ifdef __USE_MISC
|
||||
|
||||
/* 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) \
|
||||
(__extension__ (((union { __typeof(status) __in; int __i; }) \
|
||||
{ .__in = (status) }).__i))
|
||||
# else
|
||||
# define __WAIT_INT(status) (*(int *) &(status))
|
||||
# endif
|
||||
|
||||
/* This is the type of the argument to `wait'. The funky union
|
||||
causes redeclarations with either `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
|
||||
/* 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
|
||||
|
||||
# else /* Don't use misc. */
|
||||
|
||||
# define __WAIT_INT(status) (status)
|
||||
# define __WAIT_STATUS int *
|
||||
# define __WAIT_STATUS_DEFN int *
|
||||
|
||||
# endif /* Use misc. */
|
||||
|
||||
/* 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))
|
||||
# define WEXITSTATUS(status) __WEXITSTATUS (status)
|
||||
# define WTERMSIG(status) __WTERMSIG (status)
|
||||
# define WSTOPSIG(status) __WSTOPSIG (status)
|
||||
# define WIFEXITED(status) __WIFEXITED (status)
|
||||
# define WIFSIGNALED(status) __WIFSIGNALED (status)
|
||||
# define WIFSTOPPED(status) __WIFSTOPPED (status)
|
||||
# ifdef __WIFCONTINUED
|
||||
# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status))
|
||||
# define WIFCONTINUED(status) __WIFCONTINUED (status)
|
||||
# endif
|
||||
#endif /* X/Open or XPG7 and <sys/wait.h> not included. */
|
||||
|
||||
|
Reference in New Issue
Block a user