public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] bfd: Remove return with expression in void function
@ 2022-02-10 23:10 Michael Forney
  2022-02-11 12:47 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Forney @ 2022-02-10 23:10 UTC (permalink / raw)
  To: binutils

This is not allowed in ISO C (C11 6.8.6.4p1):

> A return statement with an expression shall not appear in a
> function whose return type is void.

2022-02-10  Michael Forney  <mforney@mforney.org>

        * bfd.c (bfd_set_gp_value): Remove return with expression
        in void function.
---
 bfd/bfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/bfd.c b/bfd/bfd.c
index a2f294da983..d83371333fe 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1876,7 +1876,7 @@ DESCRIPTION
 void
 bfd_set_gp_value (bfd *abfd, bfd_vma v)
 {
-  return _bfd_set_gp_value (abfd, v);
+  _bfd_set_gp_value (abfd, v);
 }
 
 /*
-- 
2.34.1


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

* Re: [PATCH] bfd: Remove return with expression in void function
  2022-02-10 23:10 [PATCH] bfd: Remove return with expression in void function Michael Forney
@ 2022-02-11 12:47 ` Nick Clifton
  2022-02-11 23:26   ` Michael Forney
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2022-02-11 12:47 UTC (permalink / raw)
  To: Michael Forney, binutils

Hi Michael,

> 2022-02-10  Michael Forney  <mforney@mforney.org>
> 
>          * bfd.c (bfd_set_gp_value): Remove return with expression
>          in void function.

Approved and applied.

I am actually surprised that this was not reported by the compiler during normal builds.

Cheers
   Nick


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

* Re: [PATCH] bfd: Remove return with expression in void function
  2022-02-11 12:47 ` Nick Clifton
@ 2022-02-11 23:26   ` Michael Forney
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Forney @ 2022-02-11 23:26 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On 2022-02-11, Nick Clifton <nickc@redhat.com> wrote:
> I am actually surprised that this was not reported by the compiler during
> normal builds.

gcc accepts it as an extension and only warns about it with -Wpedantic.

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

end of thread, other threads:[~2022-02-11 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 23:10 [PATCH] bfd: Remove return with expression in void function Michael Forney
2022-02-11 12:47 ` Nick Clifton
2022-02-11 23:26   ` Michael Forney

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