mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 18:20:51 +08:00
re PR c++/12909 (ambiguity in mangling vector types)
PR c++/12909 * method.c (make_alias_for): Handle VAR_DECL, too. * decl2.c (vague_linkage_p): Rename from vague_linkage_fn_p. * tree.c (no_linkage_check): Adjust. * decl.c (maybe_commonize_var): Adjust. * mangle.c (mangle_decl): Adjust. * cp-tree.h: Adjust. From-SVN: r157202
This commit is contained in:
parent
58a15cf8ee
commit
d6dcdbd5f6
@ -6,6 +6,11 @@
|
||||
ABI version, make the later mangled name an alias.
|
||||
* method.c (make_alias_for): Copy DECL_ARGUMENTS.
|
||||
* Make-lang.in (mangle.o): Depend on cgraph.h.
|
||||
* method.c (make_alias_for): Handle VAR_DECL, too.
|
||||
* decl2.c (vague_linkage_p): Rename from vague_linkage_fn_p.
|
||||
* tree.c (no_linkage_check): Adjust.
|
||||
* decl.c (maybe_commonize_var): Adjust.
|
||||
* cp-tree.h: Adjust.
|
||||
|
||||
2010-03-01 Marco Poletti <poletti.marco@gmail.com>
|
||||
|
||||
|
@ -4735,7 +4735,7 @@ extern tree build_memfn_type (tree, tree, cp_cv_quals);
|
||||
extern tree change_return_type (tree, tree);
|
||||
extern void maybe_retrofit_in_chrg (tree);
|
||||
extern void maybe_make_one_only (tree);
|
||||
extern bool vague_linkage_fn_p (tree);
|
||||
extern bool vague_linkage_p (tree);
|
||||
extern void grokclassfn (tree, tree,
|
||||
enum overload_flags);
|
||||
extern tree grok_array_decl (tree, tree);
|
||||
|
@ -4642,7 +4642,7 @@ maybe_commonize_var (tree decl)
|
||||
/* Don't mess with __FUNCTION__. */
|
||||
&& ! DECL_ARTIFICIAL (decl)
|
||||
&& DECL_FUNCTION_SCOPE_P (decl)
|
||||
&& vague_linkage_fn_p (DECL_CONTEXT (decl)))
|
||||
&& vague_linkage_p (DECL_CONTEXT (decl)))
|
||||
{
|
||||
if (flag_weak)
|
||||
{
|
||||
|
@ -1642,20 +1642,21 @@ maybe_make_one_only (tree decl)
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns true iff DECL, a FUNCTION_DECL, has vague linkage. This
|
||||
predicate will give the right answer during parsing of the function,
|
||||
which other tests may not. */
|
||||
/* Returns true iff DECL, a FUNCTION_DECL or VAR_DECL, has vague linkage.
|
||||
This predicate will give the right answer during parsing of the
|
||||
function, which other tests may not. */
|
||||
|
||||
bool
|
||||
vague_linkage_fn_p (tree fn)
|
||||
vague_linkage_p (tree decl)
|
||||
{
|
||||
/* Unfortunately, import_export_decl has not always been called
|
||||
before the function is processed, so we cannot simply check
|
||||
DECL_COMDAT. */
|
||||
return (DECL_COMDAT (fn)
|
||||
|| ((DECL_DECLARED_INLINE_P (fn)
|
||||
|| DECL_TEMPLATE_INSTANTIATION (fn))
|
||||
&& TREE_PUBLIC (fn)));
|
||||
return (DECL_COMDAT (decl)
|
||||
|| (((TREE_CODE (decl) == FUNCTION_DECL
|
||||
&& DECL_DECLARED_INLINE_P (decl))
|
||||
|| DECL_TEMPLATE_INSTANTIATION (decl))
|
||||
&& TREE_PUBLIC (decl)));
|
||||
}
|
||||
|
||||
/* Determine whether or not we want to specifically import or export CTYPE,
|
||||
|
@ -3083,7 +3083,7 @@ mangle_decl (const tree decl)
|
||||
DECL_IGNORED_P (alias) = 1;
|
||||
TREE_PUBLIC (alias) = TREE_PUBLIC (decl);
|
||||
DECL_VISIBILITY (alias) = DECL_VISIBILITY (decl);
|
||||
if (vague_linkage_fn_p (decl))
|
||||
if (vague_linkage_p (decl))
|
||||
DECL_WEAK (alias) = 1;
|
||||
cgraph_same_body_alias (alias, decl);
|
||||
}
|
||||
|
@ -207,34 +207,38 @@ finish_thunk (tree thunk)
|
||||
|
||||
static GTY (()) int thunk_labelno;
|
||||
|
||||
/* Create a static alias to function. */
|
||||
/* Create a static alias to target. */
|
||||
|
||||
tree
|
||||
make_alias_for (tree function, tree newid)
|
||||
make_alias_for (tree target, tree newid)
|
||||
{
|
||||
tree alias = build_decl (DECL_SOURCE_LOCATION (function),
|
||||
FUNCTION_DECL, newid, TREE_TYPE (function));
|
||||
DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function);
|
||||
tree alias = build_decl (DECL_SOURCE_LOCATION (target),
|
||||
TREE_CODE (target), newid, TREE_TYPE (target));
|
||||
DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (target);
|
||||
cxx_dup_lang_specific_decl (alias);
|
||||
DECL_CONTEXT (alias) = NULL;
|
||||
TREE_READONLY (alias) = TREE_READONLY (function);
|
||||
TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function);
|
||||
TREE_READONLY (alias) = TREE_READONLY (target);
|
||||
TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target);
|
||||
TREE_PUBLIC (alias) = 0;
|
||||
DECL_INTERFACE_KNOWN (alias) = 1;
|
||||
DECL_NOT_REALLY_EXTERN (alias) = 1;
|
||||
DECL_THIS_STATIC (alias) = 1;
|
||||
DECL_SAVED_FUNCTION_DATA (alias) = NULL;
|
||||
DECL_DESTRUCTOR_P (alias) = 0;
|
||||
DECL_CONSTRUCTOR_P (alias) = 0;
|
||||
DECL_EXTERNAL (alias) = 0;
|
||||
DECL_ARTIFICIAL (alias) = 1;
|
||||
DECL_PENDING_INLINE_P (alias) = 0;
|
||||
DECL_DECLARED_INLINE_P (alias) = 0;
|
||||
DECL_USE_TEMPLATE (alias) = 0;
|
||||
DECL_TEMPLATE_INSTANTIATED (alias) = 0;
|
||||
DECL_TEMPLATE_INFO (alias) = NULL;
|
||||
DECL_INITIAL (alias) = error_mark_node;
|
||||
DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target));
|
||||
if (TREE_CODE (alias) == FUNCTION_DECL)
|
||||
{
|
||||
DECL_SAVED_FUNCTION_DATA (alias) = NULL;
|
||||
DECL_DESTRUCTOR_P (alias) = 0;
|
||||
DECL_CONSTRUCTOR_P (alias) = 0;
|
||||
DECL_PENDING_INLINE_P (alias) = 0;
|
||||
DECL_DECLARED_INLINE_P (alias) = 0;
|
||||
DECL_INITIAL (alias) = error_mark_node;
|
||||
DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target));
|
||||
}
|
||||
else
|
||||
TREE_STATIC (alias) = 1;
|
||||
TREE_ADDRESSABLE (alias) = 1;
|
||||
TREE_USED (alias) = 1;
|
||||
SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
|
||||
|
@ -1607,7 +1607,7 @@ no_linkage_check (tree t, bool relaxed_p)
|
||||
return no_linkage_check (TYPE_CONTEXT (t), relaxed_p);
|
||||
else if (TREE_CODE (r) == FUNCTION_DECL)
|
||||
{
|
||||
if (!relaxed_p || !vague_linkage_fn_p (r))
|
||||
if (!relaxed_p || !vague_linkage_p (r))
|
||||
return t;
|
||||
else
|
||||
r = CP_DECL_CONTEXT (r);
|
||||
|
Loading…
x
Reference in New Issue
Block a user