diff mbox series

[Demangler] Fix for complex values

Message ID CA+pbi+69n7yb0pqrF3A7WcEQb-r1nqsp3SBA0qWSbMFUNoS3aw@mail.gmail.com
State New
Headers show
Series [Demangler] Fix for complex values | expand

Commit Message

Miguel Saldivar Oct. 18, 2019, 5:20 a.m. UTC
This is a small fix for Bug 67299, where symbol: `Z1fCf` which would become
`f(float complex)` instead of `f(floatcomplex )`.
I thought this would be the preferred way of printing, because both
`llvm-cxxfilt` and `cpp_filt` both print the the mangled name in this
fashion.

Thanks,
Miguel Saldivar

From 4ca98c0749bae1389594b31ee7f6ef575aafcd8f Mon Sep 17 00:00:00 2001
From: Miguel Saldivar <saldivarcher@gmail.com>
Date: Thu, 17 Oct 2019 16:36:19 -0700
Subject: [PATCH][Demangler] Small fix for complex values

gcc/libiberty/
* cp-demangle.c (d_print_mod): Add a space before printing `complex`
and `imaginary`, as opposed to after.

gcc/libiberty/
* testsuite/demangle-expected: Adjust test.
---
 libiberty/ChangeLog                   | 5 +++++
 libiberty/cp-demangle.c               | 4 ++--
 libiberty/testsuite/demangle-expected | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

 _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
--
2.23.0

Comments

Li, Pan2 via Gcc-patches Oct. 18, 2019, 4:04 p.m. UTC | #1
On Thu, Oct 17, 2019 at 10:20 PM Miguel Saldivar <saldivarcher@gmail.com> wrote:
>
> This is a small fix for Bug 67299, where symbol: `Z1fCf` which would become
> `f(float complex)` instead of `f(floatcomplex )`.
> I thought this would be the preferred way of printing, because both
> `llvm-cxxfilt` and `cpp_filt` both print the the mangled name in this
> fashion.

Thanks.  Personally I think it would be better to change the strings
to " _Complex" and " _Imaginary".  I'm open to discussion on this.

Ian

> From 4ca98c0749bae1389594b31ee7f6ef575aafcd8f Mon Sep 17 00:00:00 2001
> From: Miguel Saldivar <saldivarcher@gmail.com>
> Date: Thu, 17 Oct 2019 16:36:19 -0700
> Subject: [PATCH][Demangler] Small fix for complex values
>
> gcc/libiberty/
> * cp-demangle.c (d_print_mod): Add a space before printing `complex`
> and `imaginary`, as opposed to after.
>
> gcc/libiberty/
> * testsuite/demangle-expected: Adjust test.
> ---
>  libiberty/ChangeLog                   | 5 +++++
>  libiberty/cp-demangle.c               | 4 ++--
>  libiberty/testsuite/demangle-expected | 2 +-
>  3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
> index 97d9767c2ea..62d5527b95b 100644
> --- a/libiberty/ChangeLog
> +++ b/libiberty/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-10-17  Miguel Saldivar  <saldivarcher@gmail.com>
> + * cp-demangle.c (d_print_mod): Add a space before printing `complex`
> + and `imaginary`, as opposed to after.
> + * testsuite/demangle-expected: Adjust test.
> +
>  2019-10-03  Eduard-Mihai Burtescu  <eddyb@lyken.rs>
>
>   * rust-demangle.c (looks_like_rust): Remove.
> diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
> index aa78c86dd44..bd4dfb785a9 100644
> --- a/libiberty/cp-demangle.c
> +++ b/libiberty/cp-demangle.c
> @@ -5977,10 +5977,10 @@ d_print_mod (struct d_print_info *dpi, int options,
>        d_append_string (dpi, "&&");
>        return;
>      case DEMANGLE_COMPONENT_COMPLEX:
> -      d_append_string (dpi, "complex ");
> +      d_append_string (dpi, " complex");
>        return;
>      case DEMANGLE_COMPONENT_IMAGINARY:
> -      d_append_string (dpi, "imaginary ");
> +      d_append_string (dpi, " imaginary");
>        return;
>      case DEMANGLE_COMPONENT_PTRMEM_TYPE:
>        if (d_last_char (dpi) != '(')
> diff --git a/libiberty/testsuite/demangle-expected
> b/libiberty/testsuite/demangle-expected
> index f21ed00e559..43f003655b2 100644
> --- a/libiberty/testsuite/demangle-expected
> +++ b/libiberty/testsuite/demangle-expected
> @@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof
> ((*((Y*)(0)))+(*((Y*)(0))))>*)
>  #
>  --format=gnu-v3
>  _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
> -void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
> +void baz<int>(A<sizeof (foo((int)(), (float complex)00000000_00000000))>*)
>  #
>  --format=gnu-v3
>  _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
> --
> 2.23.0
Miguel Saldivar Oct. 18, 2019, 6:30 p.m. UTC | #2
The only reason  I wanted `float complex` was for interoperability
between the two other demanglers. Although the go demangler
does use `_Complex` and `_Imaginary`, so I guess it's sort of split.
But I agree, `_Complex` and `_Imaginary` is probably the
better option.

Thanks,
Miguel Saldivar

On Fri, Oct 18, 2019 at 9:04 AM Ian Lance Taylor <iant@google.com> wrote:

> On Thu, Oct 17, 2019 at 10:20 PM Miguel Saldivar <saldivarcher@gmail.com>
> wrote:
> >
> > This is a small fix for Bug 67299, where symbol: `Z1fCf` which would
> become
> > `f(float complex)` instead of `f(floatcomplex )`.
> > I thought this would be the preferred way of printing, because both
> > `llvm-cxxfilt` and `cpp_filt` both print the the mangled name in this
> > fashion.
>
> Thanks.  Personally I think it would be better to change the strings
> to " _Complex" and " _Imaginary".  I'm open to discussion on this.
>
> Ian
>
> > From 4ca98c0749bae1389594b31ee7f6ef575aafcd8f Mon Sep 17 00:00:00 2001
> > From: Miguel Saldivar <saldivarcher@gmail.com>
> > Date: Thu, 17 Oct 2019 16:36:19 -0700
> > Subject: [PATCH][Demangler] Small fix for complex values
> >
> > gcc/libiberty/
> > * cp-demangle.c (d_print_mod): Add a space before printing `complex`
> > and `imaginary`, as opposed to after.
> >
> > gcc/libiberty/
> > * testsuite/demangle-expected: Adjust test.
> > ---
> >  libiberty/ChangeLog                   | 5 +++++
> >  libiberty/cp-demangle.c               | 4 ++--
> >  libiberty/testsuite/demangle-expected | 2 +-
> >  3 files changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
> > index 97d9767c2ea..62d5527b95b 100644
> > --- a/libiberty/ChangeLog
> > +++ b/libiberty/ChangeLog
> > @@ -1,3 +1,8 @@
> > +2019-10-17  Miguel Saldivar  <saldivarcher@gmail.com>
> > + * cp-demangle.c (d_print_mod): Add a space before printing `complex`
> > + and `imaginary`, as opposed to after.
> > + * testsuite/demangle-expected: Adjust test.
> > +
> >  2019-10-03  Eduard-Mihai Burtescu  <eddyb@lyken.rs>
> >
> >   * rust-demangle.c (looks_like_rust): Remove.
> > diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
> > index aa78c86dd44..bd4dfb785a9 100644
> > --- a/libiberty/cp-demangle.c
> > +++ b/libiberty/cp-demangle.c
> > @@ -5977,10 +5977,10 @@ d_print_mod (struct d_print_info *dpi, int
> options,
> >        d_append_string (dpi, "&&");
> >        return;
> >      case DEMANGLE_COMPONENT_COMPLEX:
> > -      d_append_string (dpi, "complex ");
> > +      d_append_string (dpi, " complex");
> >        return;
> >      case DEMANGLE_COMPONENT_IMAGINARY:
> > -      d_append_string (dpi, "imaginary ");
> > +      d_append_string (dpi, " imaginary");
> >        return;
> >      case DEMANGLE_COMPONENT_PTRMEM_TYPE:
> >        if (d_last_char (dpi) != '(')
> > diff --git a/libiberty/testsuite/demangle-expected
> > b/libiberty/testsuite/demangle-expected
> > index f21ed00e559..43f003655b2 100644
> > --- a/libiberty/testsuite/demangle-expected
> > +++ b/libiberty/testsuite/demangle-expected
> > @@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof
> > ((*((Y*)(0)))+(*((Y*)(0))))>*)
> >  #
> >  --format=gnu-v3
> >  _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
> > -void baz<int>(A<sizeof (foo((int)(), (floatcomplex
> )00000000_00000000))>*)
> > +void baz<int>(A<sizeof (foo((int)(), (float
> complex)00000000_00000000))>*)
> >  #
> >  --format=gnu-v3
> >  _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
> > --
> > 2.23.0
>
Miguel Saldivar Oct. 20, 2019, 4:11 a.m. UTC | #3
Updated patch that uses `_Complex` and `_Imaginary`

Thanks,
Miguel Saldivar

From 742b37c88bea0118046ac359cabe5f250d69ee30 Mon Sep 17 00:00:00 2001
From: Miguel Saldivar <saldivarcher@gmail.com>
Date: Sat, 19 Oct 2019 21:06:07 -0700
Subject: [PATCH] Fix for complex and imaginary values

gcc/libiberty/
* cp-demangle.c (d_print_mod): Print " _Complex" and " _Imaginary",
as opposed to "complex " and "imaginary "

gcc/libiberty/
* testsuite/demangle-expected: Adjust test.
---
 libiberty/ChangeLog                   | 5 +++++
 libiberty/cp-demangle.c               | 4 ++--
 libiberty/testsuite/demangle-expected | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 97d9767c2ea..62d5527b95b 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-17  Miguel Saldivar  <saldivarcher@gmail.com>
+       * cp-demangle.c (d_print_mod): Add a space before printing `complex`
+       and `imaginary`, as opposed to after.
+       * testsuite/demangle-expected: Adjust test.
+
 2019-10-03  Eduard-Mihai Burtescu  <eddyb@lyken.rs>

        * rust-demangle.c (looks_like_rust): Remove.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index aa78c86dd44..877ad359be1 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -5977,10 +5977,10 @@ d_print_mod (struct d_print_info *dpi, int options,
       d_append_string (dpi, "&&");
       return;
     case DEMANGLE_COMPONENT_COMPLEX:
-      d_append_string (dpi, "complex ");
+      d_append_string (dpi, " _Complex");
       return;
     case DEMANGLE_COMPONENT_IMAGINARY:
-      d_append_string (dpi, "imaginary ");
+      d_append_string (dpi, " _Imaginary");
       return;
     case DEMANGLE_COMPONENT_PTRMEM_TYPE:
       if (d_last_char (dpi) != '(')
diff --git a/libiberty/testsuite/demangle-expected
b/libiberty/testsuite/demangle-expected
index f21ed00e559..bdeb69ae487 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof
((*((Y*)(0)))+(*((Y*)(0))))>*)
 #
 --format=gnu-v3
 _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
-void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
+void baz<int>(A<sizeof (foo((int)(), (float _Complex)00000000_00000000))>*)
 #
 --format=gnu-v3
 _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
--
2.23.0


On Fri, Oct 18, 2019 at 11:30 AM Miguel Saldivar <saldivarcher@gmail.com>
wrote:

> The only reason  I wanted `float complex` was for interoperability
> between the two other demanglers. Although the go demangler
> does use `_Complex` and `_Imaginary`, so I guess it's sort of split.
> But I agree, `_Complex` and `_Imaginary` is probably the
> better option.
>
> Thanks,
> Miguel Saldivar
>
> On Fri, Oct 18, 2019 at 9:04 AM Ian Lance Taylor <iant@google.com> wrote:
>
>> On Thu, Oct 17, 2019 at 10:20 PM Miguel Saldivar <saldivarcher@gmail.com>
>> wrote:
>> >
>> > This is a small fix for Bug 67299, where symbol: `Z1fCf` which would
>> become
>> > `f(float complex)` instead of `f(floatcomplex )`.
>> > I thought this would be the preferred way of printing, because both
>> > `llvm-cxxfilt` and `cpp_filt` both print the the mangled name in this
>> > fashion.
>>
>> Thanks.  Personally I think it would be better to change the strings
>> to " _Complex" and " _Imaginary".  I'm open to discussion on this.
>>
>> Ian
>>
>> > From 4ca98c0749bae1389594b31ee7f6ef575aafcd8f Mon Sep 17 00:00:00 2001
>> > From: Miguel Saldivar <saldivarcher@gmail.com>
>> > Date: Thu, 17 Oct 2019 16:36:19 -0700
>> > Subject: [PATCH][Demangler] Small fix for complex values
>> >
>> > gcc/libiberty/
>> > * cp-demangle.c (d_print_mod): Add a space before printing `complex`
>> > and `imaginary`, as opposed to after.
>> >
>> > gcc/libiberty/
>> > * testsuite/demangle-expected: Adjust test.
>> > ---
>> >  libiberty/ChangeLog                   | 5 +++++
>> >  libiberty/cp-demangle.c               | 4 ++--
>> >  libiberty/testsuite/demangle-expected | 2 +-
>> >  3 files changed, 8 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
>> > index 97d9767c2ea..62d5527b95b 100644
>> > --- a/libiberty/ChangeLog
>> > +++ b/libiberty/ChangeLog
>> > @@ -1,3 +1,8 @@
>> > +2019-10-17  Miguel Saldivar  <saldivarcher@gmail.com>
>> > + * cp-demangle.c (d_print_mod): Add a space before printing `complex`
>> > + and `imaginary`, as opposed to after.
>> > + * testsuite/demangle-expected: Adjust test.
>> > +
>> >  2019-10-03  Eduard-Mihai Burtescu  <eddyb@lyken.rs>
>> >
>> >   * rust-demangle.c (looks_like_rust): Remove.
>> > diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
>> > index aa78c86dd44..bd4dfb785a9 100644
>> > --- a/libiberty/cp-demangle.c
>> > +++ b/libiberty/cp-demangle.c
>> > @@ -5977,10 +5977,10 @@ d_print_mod (struct d_print_info *dpi, int
>> options,
>> >        d_append_string (dpi, "&&");
>> >        return;
>> >      case DEMANGLE_COMPONENT_COMPLEX:
>> > -      d_append_string (dpi, "complex ");
>> > +      d_append_string (dpi, " complex");
>> >        return;
>> >      case DEMANGLE_COMPONENT_IMAGINARY:
>> > -      d_append_string (dpi, "imaginary ");
>> > +      d_append_string (dpi, " imaginary");
>> >        return;
>> >      case DEMANGLE_COMPONENT_PTRMEM_TYPE:
>> >        if (d_last_char (dpi) != '(')
>> > diff --git a/libiberty/testsuite/demangle-expected
>> > b/libiberty/testsuite/demangle-expected
>> > index f21ed00e559..43f003655b2 100644
>> > --- a/libiberty/testsuite/demangle-expected
>> > +++ b/libiberty/testsuite/demangle-expected
>> > @@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof
>> > ((*((Y*)(0)))+(*((Y*)(0))))>*)
>> >  #
>> >  --format=gnu-v3
>> >  _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
>> > -void baz<int>(A<sizeof (foo((int)(), (floatcomplex
>> )00000000_00000000))>*)
>> > +void baz<int>(A<sizeof (foo((int)(), (float
>> complex)00000000_00000000))>*)
>> >  #
>> >  --format=gnu-v3
>> >  _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
>> > --
>> > 2.23.0
>>
>
Ian Lance Taylor Oct. 20, 2019, 4:35 a.m. UTC | #4
On Sat, Oct 19, 2019 at 9:11 PM Miguel Saldivar <saldivarcher@gmail.com> wrote:
>
> Updated patch that uses `_Complex` and `_Imaginary`
>
> Thanks,
> Miguel Saldivar
>
> From 742b37c88bea0118046ac359cabe5f250d69ee30 Mon Sep 17 00:00:00 2001
> From: Miguel Saldivar <saldivarcher@gmail.com>
> Date: Sat, 19 Oct 2019 21:06:07 -0700
> Subject: [PATCH] Fix for complex and imaginary values
>
> gcc/libiberty/
> * cp-demangle.c (d_print_mod): Print " _Complex" and " _Imaginary",
> as opposed to "complex " and "imaginary "
>
> gcc/libiberty/
> * testsuite/demangle-expected: Adjust test.

This is OK.

Thanks.

Ian





> ---
>  libiberty/ChangeLog                   | 5 +++++
>  libiberty/cp-demangle.c               | 4 ++--
>  libiberty/testsuite/demangle-expected | 2 +-
>  3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
> index 97d9767c2ea..62d5527b95b 100644
> --- a/libiberty/ChangeLog
> +++ b/libiberty/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-10-17  Miguel Saldivar  <saldivarcher@gmail.com>
> +       * cp-demangle.c (d_print_mod): Add a space before printing `complex`
> +       and `imaginary`, as opposed to after.
> +       * testsuite/demangle-expected: Adjust test.
> +
>  2019-10-03  Eduard-Mihai Burtescu  <eddyb@lyken.rs>
>
>         * rust-demangle.c (looks_like_rust): Remove.
> diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
> index aa78c86dd44..877ad359be1 100644
> --- a/libiberty/cp-demangle.c
> +++ b/libiberty/cp-demangle.c
> @@ -5977,10 +5977,10 @@ d_print_mod (struct d_print_info *dpi, int options,
>        d_append_string (dpi, "&&");
>        return;
>      case DEMANGLE_COMPONENT_COMPLEX:
> -      d_append_string (dpi, "complex ");
> +      d_append_string (dpi, " _Complex");
>        return;
>      case DEMANGLE_COMPONENT_IMAGINARY:
> -      d_append_string (dpi, "imaginary ");
> +      d_append_string (dpi, " _Imaginary");
>        return;
>      case DEMANGLE_COMPONENT_PTRMEM_TYPE:
>        if (d_last_char (dpi) != '(')
> diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
> index f21ed00e559..bdeb69ae487 100644
> --- a/libiberty/testsuite/demangle-expected
> +++ b/libiberty/testsuite/demangle-expected
> @@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof ((*((Y*)(0)))+(*((Y*)(0))))>*)
>  #
>  --format=gnu-v3
>  _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
> -void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
> +void baz<int>(A<sizeof (foo((int)(), (float _Complex)00000000_00000000))>*)
>  #
>  --format=gnu-v3
>  _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
> --
> 2.23.0
>
>
> On Fri, Oct 18, 2019 at 11:30 AM Miguel Saldivar <saldivarcher@gmail.com> wrote:
>>
>> The only reason  I wanted `float complex` was for interoperability
>> between the two other demanglers. Although the go demangler
>> does use `_Complex` and `_Imaginary`, so I guess it's sort of split.
>> But I agree, `_Complex` and `_Imaginary` is probably the
>> better option.
>>
>> Thanks,
>> Miguel Saldivar
>>
>> On Fri, Oct 18, 2019 at 9:04 AM Ian Lance Taylor <iant@google.com> wrote:
>>>
>>> On Thu, Oct 17, 2019 at 10:20 PM Miguel Saldivar <saldivarcher@gmail.com> wrote:
>>> >
>>> > This is a small fix for Bug 67299, where symbol: `Z1fCf` which would become
>>> > `f(float complex)` instead of `f(floatcomplex )`.
>>> > I thought this would be the preferred way of printing, because both
>>> > `llvm-cxxfilt` and `cpp_filt` both print the the mangled name in this
>>> > fashion.
>>>
>>> Thanks.  Personally I think it would be better to change the strings
>>> to " _Complex" and " _Imaginary".  I'm open to discussion on this.
>>>
>>> Ian
>>>
>>> > From 4ca98c0749bae1389594b31ee7f6ef575aafcd8f Mon Sep 17 00:00:00 2001
>>> > From: Miguel Saldivar <saldivarcher@gmail.com>
>>> > Date: Thu, 17 Oct 2019 16:36:19 -0700
>>> > Subject: [PATCH][Demangler] Small fix for complex values
>>> >
>>> > gcc/libiberty/
>>> > * cp-demangle.c (d_print_mod): Add a space before printing `complex`
>>> > and `imaginary`, as opposed to after.
>>> >
>>> > gcc/libiberty/
>>> > * testsuite/demangle-expected: Adjust test.
>>> > ---
>>> >  libiberty/ChangeLog                   | 5 +++++
>>> >  libiberty/cp-demangle.c               | 4 ++--
>>> >  libiberty/testsuite/demangle-expected | 2 +-
>>> >  3 files changed, 8 insertions(+), 3 deletions(-)
>>> >
>>> > diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
>>> > index 97d9767c2ea..62d5527b95b 100644
>>> > --- a/libiberty/ChangeLog
>>> > +++ b/libiberty/ChangeLog
>>> > @@ -1,3 +1,8 @@
>>> > +2019-10-17  Miguel Saldivar  <saldivarcher@gmail.com>
>>> > + * cp-demangle.c (d_print_mod): Add a space before printing `complex`
>>> > + and `imaginary`, as opposed to after.
>>> > + * testsuite/demangle-expected: Adjust test.
>>> > +
>>> >  2019-10-03  Eduard-Mihai Burtescu  <eddyb@lyken.rs>
>>> >
>>> >   * rust-demangle.c (looks_like_rust): Remove.
>>> > diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
>>> > index aa78c86dd44..bd4dfb785a9 100644
>>> > --- a/libiberty/cp-demangle.c
>>> > +++ b/libiberty/cp-demangle.c
>>> > @@ -5977,10 +5977,10 @@ d_print_mod (struct d_print_info *dpi, int options,
>>> >        d_append_string (dpi, "&&");
>>> >        return;
>>> >      case DEMANGLE_COMPONENT_COMPLEX:
>>> > -      d_append_string (dpi, "complex ");
>>> > +      d_append_string (dpi, " complex");
>>> >        return;
>>> >      case DEMANGLE_COMPONENT_IMAGINARY:
>>> > -      d_append_string (dpi, "imaginary ");
>>> > +      d_append_string (dpi, " imaginary");
>>> >        return;
>>> >      case DEMANGLE_COMPONENT_PTRMEM_TYPE:
>>> >        if (d_last_char (dpi) != '(')
>>> > diff --git a/libiberty/testsuite/demangle-expected
>>> > b/libiberty/testsuite/demangle-expected
>>> > index f21ed00e559..43f003655b2 100644
>>> > --- a/libiberty/testsuite/demangle-expected
>>> > +++ b/libiberty/testsuite/demangle-expected
>>> > @@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof
>>> > ((*((Y*)(0)))+(*((Y*)(0))))>*)
>>> >  #
>>> >  --format=gnu-v3
>>> >  _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
>>> > -void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
>>> > +void baz<int>(A<sizeof (foo((int)(), (float complex)00000000_00000000))>*)
>>> >  #
>>> >  --format=gnu-v3
>>> >  _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
>>> > --
>>> > 2.23.0
Jeff Law Oct. 28, 2019, 7:15 p.m. UTC | #5
On 10/19/19 10:35 PM, Ian Lance Taylor wrote:
> On Sat, Oct 19, 2019 at 9:11 PM Miguel Saldivar <saldivarcher@gmail.com> wrote:
>>
>> Updated patch that uses `_Complex` and `_Imaginary`
>>
>> Thanks,
>> Miguel Saldivar
>>
>> From 742b37c88bea0118046ac359cabe5f250d69ee30 Mon Sep 17 00:00:00 2001
>> From: Miguel Saldivar <saldivarcher@gmail.com>
>> Date: Sat, 19 Oct 2019 21:06:07 -0700
>> Subject: [PATCH] Fix for complex and imaginary values
>>
>> gcc/libiberty/
>> * cp-demangle.c (d_print_mod): Print " _Complex" and " _Imaginary",
>> as opposed to "complex " and "imaginary "
>>
>> gcc/libiberty/
>> * testsuite/demangle-expected: Adjust test.
> 
> This is OK.
> 
> Thanks.
I've installed this on the trunk.
jeff
Miguel Saldivar Oct. 29, 2019, 4:26 p.m. UTC | #6
There seems to be a small issue with the commit, somehow "float _Complex"
turned into "Complex"
within "demangle-expected", so the test now fails. Attached will be a fix
for it. Thank you for committing
the fix though.

Miguel

From 7eb6afb42ff1ce1c22f0fce167c3fb593d316abb Mon Sep 17 00:00:00 2001
From: Miguel Saldivar <saldivarcher@gmail.com>
Date: Tue, 29 Oct 2019 09:17:00 -0700
Subject: [PATCH] [Patch] Fix small issue with "demangle-expected"

gcc/libiberty/
* testsuite/demangle-expected: Fix test.
---
 libiberty/ChangeLog                   | 4 ++++
 libiberty/testsuite/demangle-expected | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index bba2be8b81b..f84dc18231c 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-29  Miguel Saldivar  <saldivarcher@gmail.com>
+
+       * testsuite/demangle-expected: Fix test.
+
 2019-10-28  Miguel Saldivar  <saldivarcher@gmail.com>

        * cp-demangle.c (d_print_mod): Add a space before printing `complex`
diff --git a/libiberty/testsuite/demangle-expected
b/libiberty/testsuite/demangle-expected
index 61681484d0e..bdeb69ae487 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof
((*((Y*)(0)))+(*((Y*)(0))))>*)
 #
 --format=gnu-v3
 _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
-void baz<int>(A<sizeof (foo((int)(), (float Complex)00000000_00000000))>*)
+void baz<int>(A<sizeof (foo((int)(), (float _Complex)00000000_00000000))>*)
 #
 --format=gnu-v3
 _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
--
2.23.0

On Mon, Oct 28, 2019 at 12:15 PM Jeff Law <law@redhat.com> wrote:

> On 10/19/19 10:35 PM, Ian Lance Taylor wrote:
> > On Sat, Oct 19, 2019 at 9:11 PM Miguel Saldivar <saldivarcher@gmail.com>
> wrote:
> >>
> >> Updated patch that uses `_Complex` and `_Imaginary`
> >>
> >> Thanks,
> >> Miguel Saldivar
> >>
> >> From 742b37c88bea0118046ac359cabe5f250d69ee30 Mon Sep 17 00:00:00 2001
> >> From: Miguel Saldivar <saldivarcher@gmail.com>
> >> Date: Sat, 19 Oct 2019 21:06:07 -0700
> >> Subject: [PATCH] Fix for complex and imaginary values
> >>
> >> gcc/libiberty/
> >> * cp-demangle.c (d_print_mod): Print " _Complex" and " _Imaginary",
> >> as opposed to "complex " and "imaginary "
> >>
> >> gcc/libiberty/
> >> * testsuite/demangle-expected: Adjust test.
> >
> > This is OK.
> >
> > Thanks.
> I've installed this on the trunk.
> jeff
>
>
Jeff Law Nov. 16, 2019, 2:45 p.m. UTC | #7
On 10/29/19 10:26 AM, Miguel Saldivar wrote:
> There seems to be a small issue with the commit, somehow "float _Complex"
> turned into "Complex"
> within "demangle-expected", so the test now fails. Attached will be a fix
> for it. Thank you for committing
> the fix though.
patch is complaining that your patches are mangled.  I tried to apply
the first by hand and clearly goof'd it.  Hopefully I got it right this
time.

Thanks,
Jeff
diff mbox series

Patch

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 97d9767c2ea..62d5527b95b 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@ 
+2019-10-17  Miguel Saldivar  <saldivarcher@gmail.com>
+ * cp-demangle.c (d_print_mod): Add a space before printing `complex`
+ and `imaginary`, as opposed to after.
+ * testsuite/demangle-expected: Adjust test.
+
 2019-10-03  Eduard-Mihai Burtescu  <eddyb@lyken.rs>

  * rust-demangle.c (looks_like_rust): Remove.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index aa78c86dd44..bd4dfb785a9 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -5977,10 +5977,10 @@  d_print_mod (struct d_print_info *dpi, int options,
       d_append_string (dpi, "&&");
       return;
     case DEMANGLE_COMPONENT_COMPLEX:
-      d_append_string (dpi, "complex ");
+      d_append_string (dpi, " complex");
       return;
     case DEMANGLE_COMPONENT_IMAGINARY:
-      d_append_string (dpi, "imaginary ");
+      d_append_string (dpi, " imaginary");
       return;
     case DEMANGLE_COMPONENT_PTRMEM_TYPE:
       if (d_last_char (dpi) != '(')
diff --git a/libiberty/testsuite/demangle-expected
b/libiberty/testsuite/demangle-expected
index f21ed00e559..43f003655b2 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -1278,7 +1278,7 @@  int& int_if_addable<Y>(A<sizeof
((*((Y*)(0)))+(*((Y*)(0))))>*)
 #
 --format=gnu-v3
 _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
-void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
+void baz<int>(A<sizeof (foo((int)(), (float complex)00000000_00000000))>*)
 #
 --format=gnu-v3