This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/7] [D] libiberty: Remove wrongly spec'd mangle rule for encoded integers.


On 20 April 2017 at 20:58, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>
> Hmm, it seems like D compilers until 3 years ago infact used to mangle
> in this way.  Better keep it around then for a little while longer for
> compatibility.  I'll follow-up with an amendment which doesn't remove
> the cases, instead adding an explanatory comment on why it's present,
> but still fixing up the coverage tests anyway, as they should try to
> reflect as close to actual mangling as possible.
>
> --
> Iain.

Attaching patch v2.

---
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Tue Apr 25 18:43:35 2017 +0200

    libiberty/ChangeLog:
    
    2017-04-15  Iain Buclaw  <ibuclaw@gdcproject.org>
    
    	* d-demangle.c (dlang_value): Fix comment to clarify why cases for
	digits are required.
    	* testsuite/d-demangle-expected: Update integer value tests.

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 12457f0..32633f5 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -1244,6 +1244,10 @@ dlang_value (string *decl, const char *mangled, const char *name, char type)
       if (*mangled < '0' || *mangled > '9')
 	return NULL;
       /* Fall through */
+
+    /* There really should always be an `i' before encoded numbers, but there
+       wasn't in early versions of D2, so this case range must remain for
+       backwards compatibility.  */
     case '0': case '1': case '2': case '3': case '4':
     case '5': case '6': case '7': case '8': case '9':
       mangled = dlang_parse_integer (decl, mangled, type);
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index 04d39f4..616cf0f 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -650,35 +650,35 @@ _D8demangle13__T4testVPinZv
 demangle.test!(null)
 #
 --format=dlang
-_D8demangle14__T4testVg123Zv
+_D8demangle15__T4testVgi123Zv
 demangle.test!(123)
 #
 --format=dlang
-_D8demangle14__T4testVi123Zv
+_D8demangle15__T4testVii123Zv
 demangle.test!(123)
 #
 --format=dlang
-_D8demangle14__T4testVs123Zv
+_D8demangle15__T4testVsi123Zv
 demangle.test!(123)
 #
 --format=dlang
-_D8demangle14__T4testVh123Zv
+_D8demangle15__T4testVhi123Zv
 demangle.test!(123u)
 #
 --format=dlang
-_D8demangle14__T4testVk123Zv
+_D8demangle15__T4testVki123Zv
 demangle.test!(123u)
 #
 --format=dlang
-_D8demangle14__T4testVt123Zv
+_D8demangle15__T4testVti123Zv
 demangle.test!(123u)
 #
 --format=dlang
-_D8demangle14__T4testVl123Zv
+_D8demangle15__T4testVli123Zv
 demangle.test!(123L)
 #
 --format=dlang
-_D8demangle14__T4testVm123Zv
+_D8demangle15__T4testVmi123Zv
 demangle.test!(123uL)
 #
 --format=dlang
@@ -698,35 +698,35 @@ _D8demangle15__T4testVmN123Zv
 demangle.test!(-123uL)
 #
 --format=dlang
-_D8demangle12__T4testVb1Zv
+_D8demangle13__T4testVbi1Zv
 demangle.test!(true)
 #
 --format=dlang
-_D8demangle12__T4testVb0Zv
+_D8demangle13__T4testVbi0Zv
 demangle.test!(false)
 #
 --format=dlang
-_D8demangle13__T4testVa10Zv
+_D8demangle14__T4testVai10Zv
 demangle.test!('\x0a')
 #
 --format=dlang
-_D8demangle13__T4testVa32Zv
+_D8demangle14__T4testVai32Zv
 demangle.test!(' ')
 #
 --format=dlang
-_D8demangle13__T4testVa65Zv
+_D8demangle14__T4testVai65Zv
 demangle.test!('A')
 #
 --format=dlang
-_D8demangle14__T4testVa126Zv
+_D8demangle15__T4testVai126Zv
 demangle.test!('~')
 #
 --format=dlang
-_D8demangle15__T4testVu1000Zv
+_D8demangle16__T4testVui1000Zv
 demangle.test!('\u03e8')
 #
 --format=dlang
-_D8demangle17__T4testVw100000Zv
+_D8demangle18__T4testVwi100000Zv
 demangle.test!('\U000186a0')
 #
 --format=dlang
@@ -1020,7 +1020,7 @@ _D8demangle20__T2fnVAiA4i1i2i3i4Z2fnFZv
 demangle.fn!([1, 2, 3, 4]).fn()
 #
 --format=dlang
-_D8demangle10__T2fnVi1Z2fnFZv
+_D8demangle11__T2fnVii1Z2fnFZv
 demangle.fn!(1).fn()
 #
 --format=dlang

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]