diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-11-30 11:50:53 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-11-30 11:50:53 +0000 |
commit | 2056c5ede5306b0a0ad948d8409c5f7484ee65bf (patch) | |
tree | dcd71d54265ff238bf0e079a7cf34b93eac626bb /gcc/ada/gcc-interface/utils.c | |
parent | 933a73251d95fb930028cb76eee7a892f41f867b (diff) | |
download | gcc-2056c5ede5306b0a0ad948d8409c5f7484ee65bf.zip gcc-2056c5ede5306b0a0ad948d8409c5f7484ee65bf.tar.gz gcc-2056c5ede5306b0a0ad948d8409c5f7484ee65bf.tar.bz2 |
gigi.h (create_var_decl): Adjust prototype.
* gcc-interface/gigi.h (create_var_decl): Adjust prototype.
(create_subprog_decl): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Rename
static_p into static_flag and add volatile_flag local variable.
Do not locally change the type of a volatile object, except for the
pointed-to type if the object is handled by reference. Adjust calls
to create_var_decl.
<E_Subprogram_Type>: Likewise for const and noreturn subprograms.
(get_minimal_subprog_decl): Adjust call to create_subprog_decl.
(elaborate_expression_1): Adjust call to create_var_decl.
(gnat_to_gnu_field): Minor tweak.
* gcc-interface/trans.c (gigi): Adjust calls to create_var_decl and
create_subprog_decl.
(build_raise_check): Likewise.
(Subprogram_Body_to_gnu): Likewise.
(create_temporary): Likewise.
(Handled_Sequence_Of_Statements_to_gnu): Likewise.
(Exception_Handler_to_gnu_gcc): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(gnat_to_gnu): Likewise.
* gcc-interface/utils.c (maybe_pad_type): Likewise.
(create_var_decl): Add VOLATILE_FLAG parameter and handle it.
(create_subprog_decl): Add CONST_FLAG and VOLATILE_FLAG parameters and
handle them.
From-SVN: r231065
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 56 |
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; |