* [PATCH] libiberty: pex-unix.c: Make pex_unix_cleanup signature always match body.
@ 2023-06-07 10:21 Costas Argyris
2023-06-07 12:59 ` Jeff Law
0 siblings, 1 reply; 3+ messages in thread
From: Costas Argyris @ 2023-06-07 10:21 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1.1: Type: text/plain, Size: 315 bytes --]
I saw this while working on something else:
pex_unix_cleanup signature doesn't always match the
body of the function in terms of ATTRIBUTE_UNUSED.
If the conditional code in the body is compiled, then
ATTRIBUTE_UNUSED isn't correct.
This change makes it always match, thereby making it
a bit cleaner IMO.
Costas
[-- Attachment #2: 0001-libiberty-pex-unix.c-Make-pex_unix_cleanup-signature.patch --]
[-- Type: text/x-patch, Size: 1117 bytes --]
From 4c84afd631ad09011b237790599e1c320852f82d Mon Sep 17 00:00:00 2001
From: Costas Argyris <costas.argyris@gmail.com>
Date: Wed, 7 Jun 2023 10:34:14 +0100
Subject: [PATCH] libiberty: pex-unix.c: Make pex_unix_cleanup signature always
match body.
Signed-off-by: Costas Argyris <costas.argyris@gmail.com>
---
libiberty/pex-unix.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
index 33b5bce31c2..10f8ddd2feb 100644
--- a/libiberty/pex-unix.c
+++ b/libiberty/pex-unix.c
@@ -814,9 +814,9 @@ pex_unix_fdopenw (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd,
}
static void
-pex_unix_cleanup (struct pex_obj *obj ATTRIBUTE_UNUSED)
-{
#if !defined (HAVE_WAIT4) && !defined (HAVE_WAITPID)
+pex_unix_cleanup (struct pex_obj *obj)
+{
while (obj->sysdep != NULL)
{
struct status_list *this;
@@ -827,5 +827,9 @@ pex_unix_cleanup (struct pex_obj *obj ATTRIBUTE_UNUSED)
free (this);
obj->sysdep = (void *) next;
}
-#endif
}
+#else
+pex_unix_cleanup (struct pex_obj *obj ATTRIBUTE_UNUSED)
+{
+}
+#endif
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libiberty: pex-unix.c: Make pex_unix_cleanup signature always match body.
2023-06-07 10:21 [PATCH] libiberty: pex-unix.c: Make pex_unix_cleanup signature always match body Costas Argyris
@ 2023-06-07 12:59 ` Jeff Law
2023-06-07 13:07 ` Costas Argyris
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2023-06-07 12:59 UTC (permalink / raw)
To: Costas Argyris, gcc-patches
On 6/7/23 04:21, Costas Argyris via Gcc-patches wrote:
> I saw this while working on something else:
>
> pex_unix_cleanup signature doesn't always match the
> body of the function in terms of ATTRIBUTE_UNUSED.
> If the conditional code in the body is compiled, then
> ATTRIBUTE_UNUSED isn't correct.
>
> This change makes it always match, thereby making it
> a bit cleaner IMO.
ATTRIBUTE_UNUSED is meant to be a "maybe unused" decoration. I'd just
leave it as-is.
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libiberty: pex-unix.c: Make pex_unix_cleanup signature always match body.
2023-06-07 12:59 ` Jeff Law
@ 2023-06-07 13:07 ` Costas Argyris
0 siblings, 0 replies; 3+ messages in thread
From: Costas Argyris @ 2023-06-07 13:07 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 621 bytes --]
Oh OK, thanks for the clarification.
Costas
On Wed, 7 Jun 2023 at 13:59, Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
> On 6/7/23 04:21, Costas Argyris via Gcc-patches wrote:
> > I saw this while working on something else:
> >
> > pex_unix_cleanup signature doesn't always match the
> > body of the function in terms of ATTRIBUTE_UNUSED.
> > If the conditional code in the body is compiled, then
> > ATTRIBUTE_UNUSED isn't correct.
> >
> > This change makes it always match, thereby making it
> > a bit cleaner IMO.
> ATTRIBUTE_UNUSED is meant to be a "maybe unused" decoration. I'd just
> leave it as-is.
>
> jeff
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-07 13:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 10:21 [PATCH] libiberty: pex-unix.c: Make pex_unix_cleanup signature always match body Costas Argyris
2023-06-07 12:59 ` Jeff Law
2023-06-07 13:07 ` Costas Argyris
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).