On Wed, Oct 04, 2017 at 12:51:18PM -0400, Nathan Sidwell wrote: > Applying to trunk.
+void +record_mangling (tree decl, bool need_warning) +{ + if (!mangled_decls) + mangled_decls = hash_map<lang_identifier *, tree>::create_ggc (499); + + gcc_checking_assert (DECL_ASSEMBLER_NAME_SET_P (decl)); + tree id = DECL_ASSEMBLER_NAME (decl); + bool existed; + tree *slot = &mangled_decls->get_or_insert (id, &existed); + + /* If this is already an alias, remove the alias, because the real + decl takes presidence. */ s/presidence/precedence/ ? + if (!existed) + ; + else if (DECL_ARTIFICIAL (*slot) && DECL_IGNORED_P (*slot)) + if (symtab_node *n = symtab_node::get (*slot)) + if (n->cpp_implicit_alias) + { + n->remove (); + existed = false; + } Wouldn't simply symtab_node *n; if (existed && DECL_ARTIFICIAL (*slot) && DECL_IGNORED_P (*slot) && (n = symtab_node::get (*slot)) && n->cpp_implicit_alias) { n->remove (); existed = false; } be more in line with the coding style? thanks, + + if (!existed) + *slot = decl; + else if (need_warning) + { + error_at (DECL_SOURCE_LOCATION (decl), + "mangling of %q#D as %qE conflicts with a previous mangle", + decl, id); + inform (DECL_SOURCE_LOCATION (*slot), + "previous mangling %q#D", *slot); + inform (DECL_SOURCE_LOCATION (decl), + "a later -fabi-version= (or =0)" + " avoids this error with a change in mangling"); + *slot = decl; + } +}