From 691858d279335eeeeed3afafdf872b1c5f8f4201 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 5 Dec 2023 11:04:06 +0100 Subject: [PATCH] libiberty: Fix pex_unix_wait return type The recent warning patches broke Solaris bootstrap: /vol/gcc/src/hg/master/local/libiberty/pex-unix.c:326:3: error: initialization of 'pid_t (*)(struct pex_obj *, pid_t, int *, struct pex_time *, int, const char **, int *)' {aka 'long int (*)(struct pex_obj *, long int, int *, struct pex_time *, int, const char **, int *)'} from incompatible pointer type 'int (*)(struct pex_obj *, pid_t, int *, struct pex_time *, int, const char **, int *)' {aka 'int (*)(struct pex_obj *, long int, int *, struct pex_time *, int, const char **, int *)'} [-Wincompatible-pointer-types] 326 | pex_unix_wait, | ^~~~~~~~~~~~~ /vol/gcc/src/hg/master/local/libiberty/pex-unix.c:326:3: note: (near initialization for 'funcs.wait') While pex_funcs.wait expects a function returning pid_t, pex_unix_wait currently returns int. However, on Solaris pid_t is long for 32-bit, but int for 64-bit. This patches fixes this by having pex_unix_wait return pid_t as expected, and like every other variant already does. Bootstrapped without regressions on i386-pc-solaris2.11, sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and x86_64-apple-darwin23.1.0. 2023-12-03 Rainer Orth libiberty: * pex-unix.c (pex_unix_wait): Change return type to pid_t. --- libiberty/pex-unix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c index ee52789d264..a27483a3c54 100644 --- a/libiberty/pex-unix.c +++ b/libiberty/pex-unix.c @@ -308,8 +308,8 @@ static pid_t pex_unix_exec_child (struct pex_obj *, int, const char *, int, int, int, int, const char **, int *); static int pex_unix_close (struct pex_obj *, int); -static int pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *, - int, const char **, int *); +static pid_t pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *, + int, const char **, int *); static int pex_unix_pipe (struct pex_obj *, int *, int); static FILE *pex_unix_fdopenr (struct pex_obj *, int, int); static FILE *pex_unix_fdopenw (struct pex_obj *, int, int); @@ -934,7 +934,7 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable, /* Wait for a child process to complete. */ -static int +static pid_t pex_unix_wait (struct pex_obj *obj, pid_t pid, int *status, struct pex_time *time, int done, const char **errmsg, int *err)