aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index f236907..10d3e22 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -1369,7 +1369,7 @@ maybe_pad_type (tree type, tree size, unsigned int align,
= create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype,
size_unit, true, global_bindings_p (),
!definition && global_bindings_p (), false,
- true, true, NULL, gnat_entity);
+ false, true, true, NULL, gnat_entity);
TYPE_SIZE_UNIT (record) = size_unit;
}
@@ -2335,8 +2335,10 @@ create_type_decl (tree name, tree type, bool artificial_p, bool debug_info_p,
EXTERN_FLAG is true when processing an external variable declaration (as
opposed to a definition: no storage is to be allocated for the variable).
- STATIC_FLAG is only relevant when not at top level. In that case
- it indicates whether to always allocate storage to the variable.
+ STATIC_FLAG is only relevant when not at top level and indicates whether
+ to always allocate storage to the variable.
+
+ VOLATILE_FLAG is true if this variable is declared as volatile.
ARTIFICIAL_P is true if the variable was generated by the compiler.
@@ -2347,9 +2349,9 @@ create_type_decl (tree name, tree type, bool artificial_p, bool debug_info_p,
tree
create_var_decl (tree name, tree asm_name, tree type, tree init,
bool const_flag, bool public_flag, bool extern_flag,
- bool static_flag, bool artificial_p, bool debug_info_p,
- struct attrib *attr_list, Node_Id gnat_node,
- bool const_decl_allowed_p)
+ bool static_flag, bool volatile_flag, bool artificial_p,
+ bool debug_info_p, struct attrib *attr_list,
+ Node_Id gnat_node, bool const_decl_allowed_p)
{
/* Whether the object has static storage duration, either explicitly or by
virtue of being declared at the global level. */
@@ -2406,16 +2408,6 @@ create_var_decl (tree name, tree asm_name, tree type, tree init,
/* Directly set some flags. */
DECL_ARTIFICIAL (var_decl) = artificial_p;
DECL_EXTERNAL (var_decl) = extern_flag;
- TREE_CONSTANT (var_decl) = constant_p;
- TREE_READONLY (var_decl) = const_flag;
-
- /* We need to allocate static storage for an object with static storage
- duration if it isn't external. */
- TREE_STATIC (var_decl) = !extern_flag && static_storage;
-
- /* The object is public if it is external or if it is declared public
- and has static storage duration. */
- TREE_PUBLIC (var_decl) = extern_flag || (public_flag && static_storage);
/* Ada doesn't feature Fortran-like COMMON variables so we shouldn't
try to fiddle with DECL_COMMON. However, on platforms that don't
@@ -2441,8 +2433,20 @@ create_var_decl (tree name, tree asm_name, tree type, tree init,
!= null_pointer_node))
DECL_IGNORED_P (var_decl) = 1;
- if (TYPE_VOLATILE (type))
- TREE_SIDE_EFFECTS (var_decl) = TREE_THIS_VOLATILE (var_decl) = 1;
+ TREE_CONSTANT (var_decl) = constant_p;
+ TREE_READONLY (var_decl) = const_flag;
+
+ /* The object is public if it is external or if it is declared public
+ and has static storage duration. */
+ TREE_PUBLIC (var_decl) = extern_flag || (public_flag && static_storage);
+
+ /* We need to allocate static storage for an object with static storage
+ duration if it isn't external. */
+ TREE_STATIC (var_decl) = !extern_flag && static_storage;
+
+ TREE_SIDE_EFFECTS (var_decl)
+ = TREE_THIS_VOLATILE (var_decl)
+ = TYPE_VOLATILE (type) | volatile_flag;
if (TREE_SIDE_EFFECTS (var_decl))
TREE_ADDRESSABLE (var_decl) = 1;
@@ -3044,8 +3048,8 @@ create_label_decl (tree name, Node_Id gnat_node)
the list of its parameters (a list of PARM_DECL nodes chained through the
DECL_CHAIN field).
- INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
- appropriate fields in the FUNCTION_DECL.
+ INLINE_STATUS, CONST_FLAG, PUBLIC_FLAG, EXTERN_FLAG, VOLATILE_FLAG as well
+ as ATTR_LIST are used to set the appropriate fields in the FUNCTION_DECL.
ARTIFICIAL_P is true if the subprogram was generated by the compiler.
@@ -3055,8 +3059,9 @@ create_label_decl (tree name, Node_Id gnat_node)
tree
create_subprog_decl (tree name, tree asm_name, tree type, tree param_decl_list,
- enum inline_status_t inline_status, bool public_flag,
- bool extern_flag, bool artificial_p, bool debug_info_p,
+ enum inline_status_t inline_status, bool const_flag,
+ bool public_flag, bool extern_flag, bool volatile_flag,
+ bool artificial_p, bool debug_info_p,
struct attrib *attr_list, Node_Id gnat_node)
{
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, name, type);
@@ -3097,10 +3102,11 @@ create_subprog_decl (tree name, tree asm_name, tree type, tree param_decl_list,
if (!debug_info_p)
DECL_IGNORED_P (subprog_decl) = 1;
+ TREE_READONLY (subprog_decl) = TYPE_READONLY (type) | const_flag;
TREE_PUBLIC (subprog_decl) = public_flag;
- TREE_READONLY (subprog_decl) = TYPE_READONLY (type);
- TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (type);
- TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (type);
+ TREE_SIDE_EFFECTS (subprog_decl)
+ = TREE_THIS_VOLATILE (subprog_decl)
+ = TYPE_VOLATILE (type) | volatile_flag;
DECL_ARTIFICIAL (result_decl) = 1;
DECL_IGNORED_P (result_decl) = 1;