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

Iain Buclaw ibuclaw@gdcproject.org
Thu Apr 20 19:11:00 GMT 2017


On 15 April 2017 at 17:24, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> This updates the implementation to reflect a part of the D ABI spec
> that has been removed.  There should never be a bare integer value
> encoded into a template argument list.  Integers are always prefixed
> by `i' if they are positive or `N' if they are negative.
>
> Have verified this indeed is the case using the code below, and
> updated all coverage tests to match the compiler.
>
>     module demangle;
>
>     template test(alias T)
>     {
>         void test() { auto t = T; }
>     }
>
>     pragma(msg, (test!(cast(byte)123)).mangleof);
>     pragma(msg, (test!(cast(int)123)).mangleof);
>     pragma(msg, (test!(cast(short)123)).mangleof);
>     pragma(msg, (test!(cast(ubyte)123)).mangleof);
>     pragma(msg, (test!(cast(uint)123)).mangleof);
>     pragma(msg, (test!(cast(ushort)123)).mangleof);
>     pragma(msg, (test!(cast(long)123)).mangleof);
>     pragma(msg, (test!(cast(ulong)123)).mangleof);
>     pragma(msg, (test!(true)).mangleof);
>     pragma(msg, (test!(false)).mangleof);
>     pragma(msg, (test!('\x0a')).mangleof);
>     pragma(msg, (test!(' ')).mangleof);
>     pragma(msg, (test!('A')).mangleof);
>     pragma(msg, (test!('~')).mangleof);
>     pragma(msg, (test!('\u03e8')).mangleof);
>     pragma(msg, (test!('\U000186a0')).mangleof);
>
> ---

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.



More information about the Gcc-patches mailing list