if (types_match
&& !DECL_EXTERN_C_P (newdecl)
&& !DECL_EXTERN_C_P (olddecl)
- && record_versions
- && maybe_version_functions (newdecl, olddecl,
- (!DECL_FUNCTION_VERSIONED (newdecl)
- || !DECL_FUNCTION_VERSIONED (olddecl))))
- return 0;
+ && targetm.target_option.function_versions (newdecl, olddecl))
+ {
+ if (record_versions)
+ maybe_version_functions (newdecl, olddecl,
+ (!DECL_FUNCTION_VERSIONED (newdecl)
+ || !DECL_FUNCTION_VERSIONED (olddecl)));
+ return 0;
+ }
}
else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
else
{
retrofit_lang_decl (newdecl);
- DECL_LOCAL_DECL_ALIAS (newdecl) = DECL_LOCAL_DECL_ALIAS (olddecl);
+ tree alias = DECL_LOCAL_DECL_ALIAS (newdecl)
+ = DECL_LOCAL_DECL_ALIAS (olddecl);
+ DECL_ATTRIBUTES (alias)
+ = (*targetm.merge_decl_attributes) (alias, newdecl);
+ if (TREE_CODE (newdecl) == FUNCTION_DECL)
+ merge_attribute_bits (newdecl, alias);
}
}
if (TREE_CODE (*iter) == OVERLOAD)
continue;
- if (decls_match (decl, *iter, /*record_decls=*/false))
- return *iter;
+ tree d = *iter;
+
+ /* We can't compare versions in the middle of processing the
+ attribute that has the version. */
+ if (TREE_CODE (d) == FUNCTION_DECL
+ && DECL_FUNCTION_VERSIONED (d))
+ return NULL_TREE;
+
+ if (decls_match (decl, d, /*record_decls=*/false))
+ return d;
}
return NULL_TREE;
}