diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-11-19 11:54:53 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-11-19 11:54:53 +0100 |
commit | ee57599295edea9f7edd73768deab9cc526dc505 (patch) | |
tree | 6efa7bf4ecf82f27c400f99353c69a8bcca1b6c7 /gcc/ada/decl.c | |
parent | f5a0cbf1083ff9d9635c813929b89d9f831f4ec9 (diff) | |
download | gcc-ee57599295edea9f7edd73768deab9cc526dc505.zip gcc-ee57599295edea9f7edd73768deab9cc526dc505.tar.gz gcc-ee57599295edea9f7edd73768deab9cc526dc505.tar.bz2 |
a-exexpr.adb (Others_Value, [...]): New variables...
* a-exexpr.adb (Others_Value, All_Others_Value): New variables, the
address of which may be used to represent "others" and "all others"
choices in exception tables, instead of the current harcoded
(void *)0 and (void *)1.
(Setup_Exception): Do nothing in the GNAT SJLJ case.
* gigi.h (others_decl, all_others_decl): New decls representing the
new Others_Value and All_Others_Value objects.
(struct attrib): Rename "arg" component as "args", since GCC expects a
list of arguments in there.
* raise.c (GNAT_OTHERS, GNAT_ALL_OTHERS): Are now the address of the
corresponding objects exported by a-exexpr, instead of hardcoded dummy
addresses.
* trans.c (Exception_Handler_to_gnu_zcx): Use the address of
others_decl and all_others_decl instead of hardcoded dummy addresses
to represent "others" and "all others" choices, which is cleaner and
more flexible with respect to the possible eh pointer encoding policies.
* utils.c (init_gigi_decls): Initialize others_decl and all_others_decl.
(process_attributes): Account for the naming change of the "args"
attribute list entry component.
* decl.c (build_attr_list): Rename into prepend_attributes to allow
cumulating attributes for different entities into a single list.
(gnat_to_gnu_entity): Use prepend_attributes to build the list of
attributes for the current entity and propagate first subtype
attributes to other subtypes.
<E_Procedure>: Attribute arguments are attr->args and not
attr->arg any more.
(build_attr_list): Ditto. Make attr->args a TREE_LIST when there is an
argument provided, as this is what GCC expects. Use NULL_TREE instead
of 0 for trees.
From-SVN: r90900
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r-- | gcc/ada/decl.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index f76ad64..d5c56b5 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -83,7 +83,7 @@ static struct incomplete static void copy_alias_set (tree, tree); static tree substitution_list (Entity_Id, Entity_Id, tree, bool); static bool allocatable_size_p (tree, bool); -static struct attrib *build_attr_list (Entity_Id); +static void prepend_attributes (Entity_Id, struct attrib **); static tree elaborate_expression (Node_Id, Entity_Id, tree, bool, bool, bool); static bool is_variable_size (tree); static tree elaborate_expression_1 (Node_Id, Entity_Id, tree, tree, @@ -298,9 +298,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && (kind == E_Function || kind == E_Procedure))) force_global++, this_global = true; - /* Handle any attributes. */ + /* Handle any attributes directly attached to the entity. */ if (Has_Gigi_Rep_Item (gnat_entity)) - attr_list = build_attr_list (gnat_entity); + prepend_attributes (gnat_entity, &attr_list); + + /* Machine_Attributes on types are expected to be propagated to subtypes. + The corresponding Gigi_Rep_Items are only attached to the first subtype + though, so we handle the propagation here. */ + if (Is_Type (gnat_entity) && Base_Type (gnat_entity) != gnat_entity + && !Is_First_Subtype (gnat_entity) + && Has_Gigi_Rep_Item (First_Subtype (Base_Type (gnat_entity)))) + prepend_attributes (First_Subtype (Base_Type (gnat_entity)), &attr_list); switch (kind) { @@ -3598,7 +3606,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) attr->next = attr_list; attr->type = ATTR_MACHINE_ATTRIBUTE; attr->name = get_identifier ("stdcall"); - attr->arg = NULL_TREE; + attr->args = NULL_TREE; attr->error_point = gnat_entity; attr_list = attr; } @@ -4365,12 +4373,11 @@ allocatable_size_p (tree gnu_size, bool static_p) return (int) our_size == our_size; } -/* Return a list of attributes for GNAT_ENTITY, if any. */ +/* Prepend to ATTR_LIST the list of attributes for GNAT_ENTITY, if any. */ -static struct attrib * -build_attr_list (Entity_Id gnat_entity) +static void +prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list) { - struct attrib *attr_list = 0; Node_Id gnat_temp; for (gnat_temp = First_Rep_Item (gnat_entity); Present (gnat_temp); @@ -4378,7 +4385,7 @@ build_attr_list (Entity_Id gnat_entity) if (Nkind (gnat_temp) == N_Pragma) { struct attrib *attr; - tree gnu_arg0 = 0, gnu_arg1 = 0; + tree gnu_arg0 = NULL_TREE, gnu_arg1 = NULL_TREE; Node_Id gnat_assoc = Pragma_Argument_Associations (gnat_temp); enum attr_type etype; @@ -4424,17 +4431,23 @@ build_attr_list (Entity_Id gnat_entity) } attr = (struct attrib *) xmalloc (sizeof (struct attrib)); - attr->next = attr_list; + attr->next = *attr_list; attr->type = etype; attr->name = gnu_arg0; - attr->arg = gnu_arg1; + + /* If we have an argument specified together with an attribute name, + make it a single TREE_VALUE entry in a list of arguments, as GCC + expects it. */ + if (gnu_arg1 != NULL_TREE) + attr->args = build_tree_list (NULL_TREE, gnu_arg1); + else + attr->args = NULL_TREE; + attr->error_point = Present (Next (First (gnat_assoc))) ? Expression (Next (First (gnat_assoc))) : gnat_temp; - attr_list = attr; + *attr_list = attr; } - - return attr_list; } /* Get the unpadded version of a GNAT type. */ |