public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed
@ 2021-09-29 16:26 Luís Ferreira
  2021-10-04  7:33 ` ibuclaw
  2021-10-04  8:40 ` Andreas Schwab
  0 siblings, 2 replies; 5+ messages in thread
From: Luís Ferreira @ 2021-09-29 16:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Luís Ferreira

Those parenthesis doesn't increase readability at all and this patch makes the
source code a bit more consistent with the rest of the dereferencing
assignments.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
---
 libiberty/d-demangle.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 3adf7b562d1..a05e72d8efe 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -253,15 +253,15 @@ dlang_hexdigit (const char *mangled, char *ret)
 
   c = mangled[0];
   if (!ISDIGIT (c))
-    (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+    *ret = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
   else
-    (*ret) = (c - '0');
+    *ret = c - '0';
 
   c = mangled[1];
   if (!ISDIGIT (c))
-    (*ret) = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+    *ret = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
   else
-    (*ret) = (*ret << 4) | (c - '0');
+    *ret = (*ret << 4) | (c - '0');
 
   mangled += 2;
 
@@ -338,7 +338,7 @@ dlang_decode_backref (const char *mangled, long *ret)
 static const char *
 dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
 {
-  (*ret) = NULL;
+  *ret = NULL;
 
   if (mangled == NULL || *mangled != 'Q')
     return NULL;
@@ -356,7 +356,7 @@ dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
     return NULL;
 
   /* Set the position of the back reference.  */
-  (*ret) = qpos - refpos;
+  *ret = qpos - refpos;
 
   return mangled;
 }
-- 
2.33.0


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

* Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed
  2021-09-29 16:26 [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed Luís Ferreira
@ 2021-10-04  7:33 ` ibuclaw
  2021-10-12 14:10   ` Luís Ferreira
  2021-10-04  8:40 ` Andreas Schwab
  1 sibling, 1 reply; 5+ messages in thread
From: ibuclaw @ 2021-10-04  7:33 UTC (permalink / raw)
  To: Luís Ferreira, gcc-patches

> On 29/09/2021 18:26 Luís Ferreira <contact@lsferreira.net> wrote:
> 
>  
> Those parenthesis doesn't increase readability at all and this patch makes the
> source code a bit more consistent with the rest of the dereferencing
> assignments.
> 

OK, but can you write up a changelog entry for it?

Thanks,
Iain.

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

* Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed
  2021-09-29 16:26 [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed Luís Ferreira
  2021-10-04  7:33 ` ibuclaw
@ 2021-10-04  8:40 ` Andreas Schwab
  2021-10-12 14:07   ` Luís Ferreira
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2021-10-04  8:40 UTC (permalink / raw)
  To: Luís Ferreira; +Cc: gcc-patches

On Sep 29 2021, Luís Ferreira wrote:

> diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
> index 3adf7b562d1..a05e72d8efe 100644
> --- a/libiberty/d-demangle.c
> +++ b/libiberty/d-demangle.c
> @@ -253,15 +253,15 @@ dlang_hexdigit (const char *mangled, char *ret)
>  
>    c = mangled[0];
>    if (!ISDIGIT (c))
> -    (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
> +    *ret = (c - (ISUPPER (c) ? 'A' : 'a') + 10);

The outer pair of parens around rhs is also redundant.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed
  2021-10-04  8:40 ` Andreas Schwab
@ 2021-10-12 14:07   ` Luís Ferreira
  0 siblings, 0 replies; 5+ messages in thread
From: Luís Ferreira @ 2021-10-12 14:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

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

On Mon, 2021-10-04 at 10:40 +0200, Andreas Schwab wrote:
> On Sep 29 2021, Luís Ferreira wrote:
> 
> > diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
> > index 3adf7b562d1..a05e72d8efe 100644
> > --- a/libiberty/d-demangle.c
> > +++ b/libiberty/d-demangle.c
> > @@ -253,15 +253,15 @@ dlang_hexdigit (const char *mangled, char
> > *ret)
> >  
> >    c = mangled[0];
> >    if (!ISDIGIT (c))
> > -    (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
> > +    *ret = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
> 
> The outer pair of parens around rhs is also redundant.
> 
> Andreas.
> 

Resent the patch with the requested change.

-- 
Sincerely,
Luís Ferreira @ lsferreira.net


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed
  2021-10-04  7:33 ` ibuclaw
@ 2021-10-12 14:10   ` Luís Ferreira
  0 siblings, 0 replies; 5+ messages in thread
From: Luís Ferreira @ 2021-10-12 14:10 UTC (permalink / raw)
  To: ibuclaw, gcc-patches

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

On Mon, 2021-10-04 at 09:33 +0200, ibuclaw@gdcproject.org wrote:
> > On 29/09/2021 18:26 Luís Ferreira <contact@lsferreira.net> wrote:
> > 
> >  
> > Those parenthesis doesn't increase readability at all and this
> > patch makes the
> > source code a bit more consistent with the rest of the
> > dereferencing
> > assignments.
> > 
> 
> OK, but can you write up a changelog entry for it?
> 
> Thanks,
> Iain.

Added on a PATCH v2.

-- 
Sincerely,
Luís Ferreira @ lsferreira.net


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-10-12 14:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 16:26 [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed Luís Ferreira
2021-10-04  7:33 ` ibuclaw
2021-10-12 14:10   ` Luís Ferreira
2021-10-04  8:40 ` Andreas Schwab
2021-10-12 14:07   ` Luís Ferreira

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