diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-05-22 07:10:37 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-05-22 07:10:37 -0400 |
commit | 15c8ec1ccde96eb39e9cced074149b8828ef5a49 (patch) | |
tree | 8eb521640092425569a92d93fc071de7299b92fc /gcc | |
parent | 4033d0e70207cb1f4df19c65dfb0246b64173dbc (diff) | |
download | gcc-15c8ec1ccde96eb39e9cced074149b8828ef5a49.zip gcc-15c8ec1ccde96eb39e9cced074149b8828ef5a49.tar.gz gcc-15c8ec1ccde96eb39e9cced074149b8828ef5a49.tar.bz2 |
(valid_machine_attribute): Handle attribute on pointer-to-function
types.
From-SVN: r9762
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/tree.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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; |