public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libiberty: Fix pex_unix_wait return type
@ 2023-12-04 10:21 Rainer Orth
  2023-12-04 17:01 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer Orth @ 2023-12-04 10:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ian Lance Taylor

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

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.

Ok for trunk?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-03  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libiberty:
	* pex-unix.c (pex_unix_wait): Change return type to pid_t.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libiberty-pex_unix_wait.patch --]
[-- Type: text/x-patch, Size: 1078 bytes --]

# HG changeset patch
# Parent  2e3efea7d8370094e0472added4d944ecf1e0270
libiberty: Fix pex_unix_wait signature

diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
--- a/libiberty/pex-unix.c
+++ b/libiberty/pex-unix.c
@@ -308,8 +308,8 @@ static pid_t pex_unix_exec_child (struct
 				 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
 
 /* 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)

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

* Re: [PATCH] libiberty: Fix pex_unix_wait return type
  2023-12-04 10:21 [PATCH] libiberty: Fix pex_unix_wait return type Rainer Orth
@ 2023-12-04 17:01 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2023-12-04 17:01 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Ian Lance Taylor

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> 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.
>
> Ok for trunk?
>
> 	Rainer

OK, thanks.

Richard

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

end of thread, other threads:[~2023-12-04 17:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-04 10:21 [PATCH] libiberty: Fix pex_unix_wait return type Rainer Orth
2023-12-04 17:01 ` Richard Sandiford

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