return NULL_TREE;
}
-/* Return nonzero if ELEM is part of the chain CHAIN. */
+/* Return nonzero if ELEM is part of the chain CHAIN. */
int
chain_member (elem, chain)
return 0;
}
+/* Return nonzero if ELEM is equal to TREE_VALUE (CHAIN) for any piece of
+ chain CHAIN. */
+
+int
+chain_member_value (elem, chain)
+ tree elem, chain;
+{
+ while (chain)
+ {
+ if (elem == TREE_VALUE (chain))
+ return 1;
+ chain = TREE_CHAIN (chain);
+ }
+
+ return 0;
+}
+
/* Return the length of a chain of nodes chained through TREE_CHAIN.
We expect a null pointer to mark the end of the chain.
This is the Lisp primitive `length'. */
BLOCK_CHAIN (block) = chain;
return block;
}
+
\f
+/* Return a declaration like DDECL except that its DECL_MACHINE_ATTRIBUTE
+ is ATTRIBUTE. */
+
+tree
+build_decl_attribute_variant (ddecl, attribute)
+ tree ddecl, attribute;
+{
+ DECL_MACHINE_ATTRIBUTES (ddecl) = attribute;
+ return ddecl;
+}
+
/* Return a type like TTYPE except that its TYPE_ATTRIBUTE
is ATTRIBUTE.
return ttype;
}
+
+/* Return a 1 if NEW_ATTR is valid for either declaration DECL or type TYPE
+ and 0 otherwise. Validity is determined the configuration macros
+ VALID_MACHINE_DECL_ATTRIBUTE and VALID_MACHINE_TYPE_ATTRIBUTE. */
+
+int
+valid_machine_attribute (new_attr, decl, type)
+ tree new_attr;
+ tree decl;
+ tree type;
+{
+ int valid = 0;
+ tree decl_attr_list = DECL_MACHINE_ATTRIBUTES (decl);
+ tree type_attr_list = TYPE_ATTRIBUTES (type);
+
+#ifdef VALID_MACHINE_DECL_ATTRIBUTE
+ if (VALID_MACHINE_DECL_ATTRIBUTE (decl,
+ decl_attr_list,
+ new_attr))
+ {
+ tree attr_list;
+ int in_list = 0;
+
+ for (attr_list = decl_attr_list;
+ attr_list;
+ attr_list = TREE_CHAIN (attr_list))
+ if (TREE_VALUE (attr_list) == new_attr)
+ in_list = 1;
+
+ if (! in_list)
+ decl_attr_list = tree_cons (NULL_TREE, new_attr, decl_attr_list);
+
+ decl = build_decl_attribute_variant (decl, decl_attr_list);
+ valid = 1;
+ }
+#endif
+
+#ifdef VALID_MACHINE_TYPE_ATTRIBUTE
+ if (VALID_MACHINE_TYPE_ATTRIBUTE (type,
+ type_attr_list,
+ new_attr))
+ {
+ tree attr_list;
+ int in_list = 0;
+
+ for (attr_list = type_attr_list;
+ attr_list;
+ attr_list = TREE_CHAIN (attr_list))
+ if (TREE_VALUE (attr_list) == new_attr)
+ in_list = 1;
+
+ if (!in_list)
+ type_attr_list = tree_cons (NULL_TREE, new_attr, type_attr_list);
+
+ decl = build_type_attribute_variant (type, type_attr_list);
+ valid = 1;
+ }
+#endif
+
+ return valid;
+}
\f
/* Return a type like TYPE except that its TYPE_READONLY is CONSTP
and its TYPE_VOLATILE is VOLATILEP.