From 15c8ec1ccde96eb39e9cced074149b8828ef5a49 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 22 May 1995 07:10:37 -0400 Subject: [PATCH] (valid_machine_attribute): Handle attribute on pointer-to-function types. From-SVN: r9762 --- gcc/tree.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gcc/tree.c b/gcc/tree.c index 0388e8b809de..1d7ad92fcffb 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3003,6 +3003,33 @@ valid_machine_attribute (attr_name, attr_args, decl, type) TREE_TYPE (decl) = type; valid = 1; } + + /* Handle putting a type attribute on pointer-to-function-type by putting + the attribute on the function type. */ + else if (TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE + && VALID_MACHINE_TYPE_ATTRIBUTE (TREE_TYPE (type), type_attr_list, + attr_name, attr_args)) + { + tree inner_type = TREE_TYPE (type); + tree inner_attr_list = TYPE_ATTRIBUTES (inner_type); + tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name), + type_attr_list); + + if (attr != NULL_TREE) + TREE_VALUE (attr) = attr_args; + else + { + inner_attr_list = tree_cons (attr_name, attr_args, inner_attr_list); + inner_type = build_type_attribute_variant (inner_type, + inner_attr_list); + } + + if (decl != 0) + TREE_TYPE (decl) = build_pointer_type (inner_type); + + valid = 1; + } #endif return valid; -- 2.43.5