This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] [C++ ABI] support non-standard integer types in mangle.c
- From: "Markus F.X.J. Oberhumer" <markus at oberhumer dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Geoffrey Keating <geoffk at geoffk dot org>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 12 Apr 2005 18:47:09 +0200
- Subject: Re: [RFC] [C++ ABI] support non-standard integer types in mangle.c
- Organization: oberhumer.com
- References: <4226377B.8000500@oberhumer.com> <m2650847ep.fsf@greed.local> <4227A868.6070502@oberhumer.com> <4227B63A.2050207@codesourcery.com> <425BCAD6.5030809@oberhumer.com> <425BE9A1.80409@codesourcery.com>
Mark Mitchell wrote:
Markus F.X.J. Oberhumer wrote:
! if (TYPE_UNSIGNED (type))
! {
! write_unsigned_number (4 + len);
! write_string ("uint");
! }
! else
! {
! write_unsigned_number (3 + len);
! write_string ("int");
! }
Do this part as:
prefix = TYPE_UNSIGNED (type) ? "uint" : "int";
write_unsigned_number (strlen (prefix) + len);
write_string (prefix);
With that change, this patch is OK.
As you don't seem to mind an extra strlen() call I've opted for a little
more clarity. Newly built ILP64 gcc and tested. Please review and apply.
Thanks,
Markus
--
Markus Oberhumer, <markus@oberhumer.com>, http://www.oberhumer.com/
2005-04-12 Markus F.X.J. Oberhumer <markus@oberhumer.com>
* mangle.c (write_builtin_type): Handle integer types which are
not one of the shared integer type nodes and emit a "vendor
extended builtin type" with an encoding in the form of "u5int96".
Index: mangle.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/mangle.c,v
retrieving revision 1.117
diff -c -3 -p -r1.117 mangle.c
*** mangle.c 24 Mar 2005 07:20:36 -0000 1.117
--- mangle.c 12 Apr 2005 16:42:47 -0000
*************** write_builtin_type (tree type)
*** 1757,1771 ****
{
tree t = c_common_type_for_mode (TYPE_MODE (type),
TYPE_UNSIGNED (type));
! if (type == t)
{
! gcc_assert (TYPE_PRECISION (type) == 128);
! write_char (TYPE_UNSIGNED (type) ? 'o' : 'n');
}
else
{
! type = t;
! goto iagain;
}
}
}
--- 1757,1791 ----
{
tree t = c_common_type_for_mode (TYPE_MODE (type),
TYPE_UNSIGNED (type));
! if (type != t)
{
! type = t;
! goto iagain;
}
+
+ if (TYPE_PRECISION (type) == 128)
+ write_char (TYPE_UNSIGNED (type) ? 'o' : 'n');
else
{
! /* Allow for cases where TYPE is not one of the shared
! integer type nodes and write a "vendor extended builtin
! type" with a name the form intN or uintN, respectively.
! Situations like this can happen if you have an
! __attribute__((__mode__(__SI__))) type and use exotic
! switches like '-mint64' on MIPS or '-mint8' on AVR.
! Of course, this is undefined by the C++ ABI (and
! '-mint8' is not even Standard C conforming), but when
! using such special options you're pretty much in nowhere
! land anyway. */
! const char *prefix;
! char prec[11]; /* up to ten digits for an unsigned */
!
! prefix = TYPE_UNSIGNED (type) ? "uint" : "int";
! sprintf (prec, "%u", (unsigned) TYPE_PRECISION (type));
! write_char ('u'); /* "vendor extended builtin type" */
! write_unsigned_number (strlen (prefix) + strlen (prec));
! write_string (prefix);
! write_string (prec);
}
}
}