return strcmp (as1->name, as2->name);
}
+/* Return true if we should mangle a type attribute with name NAME. */
+
+static bool
+mangle_type_attribute_p (tree name)
+{
+ const attribute_spec *as = lookup_attribute_spec (name);
+ if (!as || !as->affects_type_identity)
+ return false;
+
+ /* Skip internal-only attributes, which are distinguished from others
+ by having a space. At present, all internal-only attributes that
+ affect type identity are target-specific and are handled by
+ targetm.mangle_type instead.
+
+ Another reason to do this is that a space isn't a valid identifier
+ character for most file formats. */
+ if (strchr (IDENTIFIER_POINTER (name), ' '))
+ return false;
+
+ /* The following attributes are mangled specially. */
+ if (is_attribute_p ("transaction_safe", name))
+ return false;
+ if (is_attribute_p ("abi_tag", name))
+ return false;
+
+ return true;
+}
+
/* Non-terminal <CV-qualifiers> for type nodes. Returns the number of
CV-qualifiers written for TYPE.
{
auto_vec<tree> vec;
for (tree a = TYPE_ATTRIBUTES (type); a; a = TREE_CHAIN (a))
- {
- tree name = get_attribute_name (a);
- const attribute_spec *as = lookup_attribute_spec (name);
- if (as && as->affects_type_identity
- && !is_attribute_p ("transaction_safe", name)
- && !is_attribute_p ("abi_tag", name))
- vec.safe_push (a);
- }
+ if (mangle_type_attribute_p (get_attribute_name (a)))
+ vec.safe_push (a);
if (abi_warn_or_compat_version_crosses (10) && !vec.is_empty ())
G.need_abi_warning = true;
if (abi_version_at_least (10))