Commit 4084f789 by Richard Kenner

(valid_machine_attribute): Now receive name and args.

From-SVN: r9262
parent 53065596
...@@ -2902,22 +2902,27 @@ build_type_attribute_variant (ttype, attribute) ...@@ -2902,22 +2902,27 @@ build_type_attribute_variant (ttype, attribute)
return ttype; return ttype;
} }
/* Return a 1 if NEW_ATTR is valid for either declaration DECL or type TYPE /* Return a 1 if ATTR_NAME and ATTR_ARGS is valid for either declaration DECL
and 0 otherwise. Validity is determined the configuration macros or type TYPE and 0 otherwise. Validity is determined the configuration
VALID_MACHINE_DECL_ATTRIBUTE and VALID_MACHINE_TYPE_ATTRIBUTE. */ macros VALID_MACHINE_DECL_ATTRIBUTE and VALID_MACHINE_TYPE_ATTRIBUTE. */
int int
valid_machine_attribute (new_attr, decl, type) valid_machine_attribute (attr_name, attr_args, decl, type)
tree new_attr; tree attr_name, attr_args;
tree decl; tree decl;
tree type; tree type;
{ {
int valid = 0; int valid = 0;
tree decl_attr_list = DECL_MACHINE_ATTRIBUTES (decl); tree decl_attr_list = decl != 0 ? DECL_MACHINE_ATTRIBUTES (decl) : 0;
tree type_attr_list = TYPE_ATTRIBUTES (type); tree type_attr_list = TYPE_ATTRIBUTES (type);
/* For now, we don't support args. */
if (attr_args != 0)
return 0;
#ifdef VALID_MACHINE_DECL_ATTRIBUTE #ifdef VALID_MACHINE_DECL_ATTRIBUTE
if (VALID_MACHINE_DECL_ATTRIBUTE (decl, decl_attr_list, new_attr)) if (decl != 0
&& VALID_MACHINE_DECL_ATTRIBUTE (decl, decl_attr_list, attr_name))
{ {
tree attr_list; tree attr_list;
int in_list = 0; int in_list = 0;
...@@ -2925,11 +2930,11 @@ valid_machine_attribute (new_attr, decl, type) ...@@ -2925,11 +2930,11 @@ valid_machine_attribute (new_attr, decl, type)
for (attr_list = decl_attr_list; for (attr_list = decl_attr_list;
attr_list; attr_list;
attr_list = TREE_CHAIN (attr_list)) attr_list = TREE_CHAIN (attr_list))
if (TREE_VALUE (attr_list) == new_attr) if (TREE_VALUE (attr_list) == attr_name)
in_list = 1; in_list = 1;
if (! in_list) if (! in_list)
decl_attr_list = tree_cons (NULL_TREE, new_attr, decl_attr_list); decl_attr_list = tree_cons (NULL_TREE, attr_name, decl_attr_list);
decl = build_decl_attribute_variant (decl, decl_attr_list); decl = build_decl_attribute_variant (decl, decl_attr_list);
valid = 1; valid = 1;
...@@ -2937,7 +2942,7 @@ valid_machine_attribute (new_attr, decl, type) ...@@ -2937,7 +2942,7 @@ valid_machine_attribute (new_attr, decl, type)
#endif #endif
#ifdef VALID_MACHINE_TYPE_ATTRIBUTE #ifdef VALID_MACHINE_TYPE_ATTRIBUTE
if (VALID_MACHINE_TYPE_ATTRIBUTE (type, type_attr_list, new_attr)) if (VALID_MACHINE_TYPE_ATTRIBUTE (type, type_attr_list, attr_name))
{ {
tree attr_list; tree attr_list;
int in_list = 0; int in_list = 0;
...@@ -2945,13 +2950,15 @@ valid_machine_attribute (new_attr, decl, type) ...@@ -2945,13 +2950,15 @@ valid_machine_attribute (new_attr, decl, type)
for (attr_list = type_attr_list; for (attr_list = type_attr_list;
attr_list; attr_list;
attr_list = TREE_CHAIN (attr_list)) attr_list = TREE_CHAIN (attr_list))
if (TREE_VALUE (attr_list) == new_attr) if (TREE_VALUE (attr_list) == attr_name)
in_list = 1; in_list = 1;
if (! in_list) if (! in_list)
type_attr_list = tree_cons (NULL_TREE, new_attr, type_attr_list); type_attr_list = tree_cons (NULL_TREE, attr_name, type_attr_list);
decl = build_type_attribute_variant (type, type_attr_list); type = build_type_attribute_variant (type, type_attr_list);
if (decl != 0)
TREE_TYPE (decl) = type;
valid = 1; valid = 1;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment