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