This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: enable-build-with-cxx bootstrap compare broken by r149964
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jerry Quinn <jlquinn at optonline dot net>
- Cc: Jason Merrill <jason at redhat dot com>, GCC <gcc at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 Oct 2009 12:14:48 +0100
- Subject: Re: enable-build-with-cxx bootstrap compare broken by r149964
- References: <1250345548.19163.155.camel@cerberus.qb5.org> <4A960A78.8040704@redhat.com> <1251694626.7629.2.camel@cerberus.qb5.org> <4AAE6745.3070706@redhat.com> <4AB7B28E.7030501@redhat.com> <1253617474.4274.2795.camel@cerberus.qb5.org> <4AB8D3D1.8010704@redhat.com> <1253712164.4274.2800.camel@cerberus.qb5.org> <4ABA391C.2050903@redhat.com> <1256357452.31533.131.camel@cerberus.qb5.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Just some random comments:
On Sat, Oct 24, 2009 at 12:10:52AM -0400, Jerry Quinn wrote:
> + if (mark_private)
> + {
> + /* Inject '*' at beginning of name to force pointer comparison.
> */
> + char* buf = (char*) XNEWVEC (char, length + 1);
> + buf[0] = '*';
> + memcpy (buf + 1, name, length);
> + name_string = build_string (length + 1, buf);
> + XDELETEVEC (buf);
You could as well use XALLOCAVEC (char, length + 1) and remove
XDELETEVEC. No need to cast the result of XNEWVEC or XALLOCAVEC to
char *. And, the formatting is wrong, space goes after char, no space
between * and buf.
> /* Generate the NTBS array variable. */
> tree name_type = build_cplus_array_type
> (build_qualified_type (char_type_node, TYPE_QUAL_CONST),
> NULL_TREE);
> - tree name_string = tinfo_name (target);
> + // tree name_string = tinfo_name (target);
This should be removed, rather than commented out.
> @@ -2921,10 +2893,6 @@
> name_base = obstack_alloc (&name_obstack, 0);
> }
>
> -/* Done with mangling. If WARN is true, and the name of G.entity will
> - be mangled differently in a future version of the ABI, issue a
> - warning. */
> -
> static void
> finish_mangling_internal (const bool warn)
> {
Why are you removing the comment?
> @@ -3011,18 +2979,15 @@
> SET_DECL_ASSEMBLER_NAME (decl, id);
> }
>
> -/* Generate the mangled representation of TYPE for the typeinfo name.
> */
> +/* Generate the mangled representation of TYPE. */
>
> const char *
> -mangle_type_string_for_rtti (const tree type)
> +mangle_type_string (const tree type)
Why this change?
> bool operator==(const type_info& __arg) const
> {
> return ((__name == __arg.__name)
> - || __builtin_strcmp (__name, __arg.__name) == 0);
> + || (__name[0] != '*' && __arg.__name[0] != '*' &&
> + __builtin_strcmp (__name, __arg.__name) == 0));
I see no point in both tests for * here, just __name[0] != '*'
should be enough (or __arg.__name[0] != '*'). If one string starts with *
and the other doesn't, strcmp will return non-0.
> --- libstdc++-v3/libsupc++/tinfo.cc (revision 153489)
> +++ libstdc++-v3/libsupc++/tinfo.cc (working copy)
> @@ -41,7 +41,9 @@
> #if __GXX_MERGED_TYPEINFO_NAMES
> return name () == arg.name ();
> #else
> - return (&arg == this) || (__builtin_strcmp (name (), arg.name ()) ==
> 0);
> + return (&arg == this)
> + || (name ()[0] != '*' && arg.name ()[0] != '*'
> + && (__builtin_strcmp (name (), arg.name ()) == 0));
> #endif
> }
Likewise.
Jakub