Updated patch that uses `_Complex` and `_Imaginary`

Thanks,
Miguel Saldivar

>From 742b37c88bea0118046ac359cabe5f250d69ee30 Mon Sep 17 00:00:00 2001
From: Miguel Saldivar <saldivarc...@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  <saldivarc...@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  <ed...@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 <saldivarc...@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 <i...@google.com> wrote:
>
>> On Thu, Oct 17, 2019 at 10:20 PM Miguel Saldivar <saldivarc...@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 <saldivarc...@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  <saldivarc...@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  <ed...@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
>>
>

Reply via email to