This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
target-specific type attributes
- To: egcs-patches at cygnus dot com
- Subject: target-specific type attributes
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Thu, 16 Jul 1998 13:57:46 +0100
- Cc: richard dot earnshaw at arm dot com
- Organization: ARM Ltd.
- Reply-To: richard dot earnshaw at arm dot com
Currently
struct f {char a, int b;} __attribute__((packed));
declares a packed structure as expected, but
struct f {char a, int b;} __attribute__((md-specific-attr));
quietly fails to give the desired result. This is because
valid_machine_attribute creates a new type variant of struct f rather than
modifying the base type. It then promptly discards it.
If possible, I'd like the following patch to be in egcs-1.1;
<date> Richard Earnshaw (rearnsha@arm.com)
* tree.c (valid_machine_attribute): Only create a new type variant if
there is a decl to use it.
Index: tree.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tree.c,v
retrieving revision 1.36
diff -p -r1.36 tree.c
*** tree.c 1998/07/07 00:05:24 1.36
--- tree.c 1998/07/16 12:45:50
*************** valid_machine_attribute (attr_name, attr
*** 3391,3398 ****
}
else
{
type_attr_list = tree_cons (attr_name, attr_args, type_attr_list);
! type = build_type_attribute_variant (type, type_attr_list);
}
if (decl != 0)
TREE_TYPE (decl) = type;
--- 3391,3404 ----
}
else
{
+ /* If this is part of a declaration, create a type variant,
+ otherwise, this is part of a type definition, so add it
+ to the base type. */
type_attr_list = tree_cons (attr_name, attr_args, type_attr_list);
! if (decl != 0)
! type = build_type_attribute_variant (type, type_attr_list);
! else
! TYPE_ATTRIBUTES (type) = type_attr_list;
}
if (decl != 0)
TREE_TYPE (decl) = type;