diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-07-26 12:42:13 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-07-26 12:42:13 +0200 |
commit | 615cbd95bd73d35bdf41475f60243f9d9fefc5f4 (patch) | |
tree | 70c781e7f9e0b3989847ce98520d13a3cf176d39 /gcc/ada/utils.c | |
parent | 63d1c7b35fe104326f278f45daf20743853920bb (diff) | |
download | gcc-615cbd95bd73d35bdf41475f60243f9d9fefc5f4.zip gcc-615cbd95bd73d35bdf41475f60243f9d9fefc5f4.tar.gz gcc-615cbd95bd73d35bdf41475f60243f9d9fefc5f4.tar.bz2 |
[multiple changes]
2004-07-26 Arnaud Charlet <charlet@act-europe.fr>
* sem_util.adb (Requires_Transient_Scope): Temporarily disable
optimization, not supported by the tree-ssa back-end.
2004-07-26 Olivier Hainque <hainque@act-europe.fr>
* s-mastop-irix.adb: Update comments.
* a-except.adb (Exception_Information): Raise Constraint_Error if
exception Id is Null_Id.
This is required behavior, which is more reliably and clearly checked
at the top level interface level.
2004-07-26 Javier Miranda <miranda@gnat.com>
* exp_aggr.adb (Build_Array_Aggr_Code): Do not build the initialization
call if a component has no default_expression and the box is used.
* sem_aggr.adb (Resolve_Array_Aggregate): If a component has no
default_expression and you use box, it behaves as if you had declared a
stand-alone object.
(Resolve_Record_Aggregate): If a component has no default_expression and
you use box, it behaves as if you had declared a stand-alone object.
* sem_ch10.adb (Install_Siblings): Do not make visible the private
entities of private-with siblings.
2004-07-26 Ed Schonberg <schonberg@gnat.com>
* sem_ch3.adb (Build_Underlying_Full_View): If this is the full view
for a component of an itype, set the parent pointer for analysis,
there is no list in which to insert it.
* sem_res.adb (Resolve): Call Rewrite_Renamed_Operator only for
bona-fide renamings, not for inherited operations.
* exp_ch4.adb (Expand_Allocator_Expression): If the allocator is an
actual for a formal that is an access parameter, create local
finalization list even if the expression is not an aggregate.
2004-07-26 Ed Schonberg <schonberg@gnat.com>
PR ada/16213
* sem_ch8.adb (Attribute_Renaming, Check_Library_Level_Renaming):
Diagnose properly illegal subprogram renamings that are library units.
2004-07-26 Ed Schonberg <schonberg@gnat.com>
PR ada/15588
* sem_util.adb (Is_OK_Variable_For_Out_Formal): If actual is a type
conversion rewritten as an unchecked conversion, check that original
expression is a variable.
* exp_ch4.adb (Expand_N_Type_Conversion): If rewriting as an
unchecked_conversion, create new node rather than rewriting in place,
to preserve original construct.
2004-07-26 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* gigi.h (gnat_expand_body): Deleted.
* Make-lang.in: (trans.o): Depends on function.h.
* misc.c: (gnat_expand_body): Moved to here.
* trans.c (gnat_expand_body_1): Deleted.
(gnat_expand_body): Moved from here.
(gnat_to_gnu): N_Implicit_Label_Declaration forces being in elab proc.
(add_stmt): Check for marked visited with global_bindings_p.
(gnat_gimplify_expr, case COMPONENT_REF): New case.
(gnat_gimplify_expr, case NULL_EXPR): Set TREE_NO_WARNING for temp.
* utils2.c (build_binary_op, case MODIFY_EXPR): Put LHS in a
VIEW_CONVERT_EXPR if not operation type.
* utils.c (update_pointer_to): Set DECL_ORIGINAL_FIELD for
fat pointer.
* decl.c, cuintp.c, gigi.h, misc.c, trans.c, utils.c, utils2.c: Minor
changes: reformatting of negation operators, removing unneeded
inequality comparison with zero, converting equality comparisons with
zero to negations, changing int/0/1 to bool/false/true, replace calls
to gigi_abort with abort, and various other similar changes.
2004-07-26 Vincent Celier <celier@gnat.com>
* gnatcmd.adb (GNATCmd): Add processing for new built-in command
"setup".
* make.adb (Gnatmake): Fail when a library is not present and there is
no object directory.
* mlib-prj.adb (Check_Library): No need to check if the library needs
to be rebuilt if there is no object directory, hence no object files
to build the library.
* opt.ads (Setup_Projects): New Boolean flag.
* prj-nmsc.adb (Locate_Directory): New parameter Project, Kind and
Location.
Create directory when Kind /= "" and in "gnat setup". Report error if
directory cannot be created.
(Ada_Check): Create library interface copy dir if it does not exist
and we are in "gnat setup".
(Find_Sources): No error if in "gnat setup" and no Ada sources were
found.
(Language_Independent_Check): Create object directory, exec directory
and/or library directory if they do not exist and we are in
"gnat setup".
* vms_conv.ads: (Command_Type): New command Setup.
* vms_conv.adb (Initialize): Add Setup component of Cammand_List.
* vms_data.ads: Add qualifiers/switches for new built-in command
"setup".
From-SVN: r85188
Diffstat (limited to 'gcc/ada/utils.c')
-rw-r--r-- | gcc/ada/utils.c | 386 |
1 files changed, 199 insertions, 187 deletions
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index e307def..2dc27d3 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -149,7 +149,7 @@ init_gnat_to_gnu (void) If GNU_DECL is zero, a previous association is to be reset. */ void -save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, int no_check) +save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check) { /* Check that GNAT_ENTITY is not already defined and that it is being set to something which is a decl. Raise gigi 401 if not. Usually, this @@ -157,8 +157,8 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, int no_check) Gigi problem. */ if (gnu_decl && (associate_gnat_to_gnu[gnat_entity - First_Node_Id] - || (! no_check && ! DECL_P (gnu_decl)))) - gigi_abort (401); + || (!no_check && !DECL_P (gnu_decl)))) + abort (); associate_gnat_to_gnu[gnat_entity - First_Node_Id] = gnu_decl; } @@ -173,18 +173,18 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, int no_check) tree get_gnu_tree (Entity_Id gnat_entity) { - if (! associate_gnat_to_gnu[gnat_entity - First_Node_Id]) - gigi_abort (402); + if (!associate_gnat_to_gnu[gnat_entity - First_Node_Id]) + abort (); return associate_gnat_to_gnu[gnat_entity - First_Node_Id]; } /* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */ -int +bool present_gnu_tree (Entity_Id gnat_entity) { - return (associate_gnat_to_gnu[gnat_entity - First_Node_Id] != NULL_TREE); + return (associate_gnat_to_gnu[gnat_entity - First_Node_Id]) != 0; } @@ -193,8 +193,8 @@ present_gnu_tree (Entity_Id gnat_entity) int global_bindings_p (void) { - return (force_global != 0 || current_binding_level == 0 - || current_binding_level->chain == 0 ? -1 : 0); + return (force_global || !current_binding_level + || !current_binding_level->chain ? -1 : 0); } /* Enter a new binding level. */ @@ -356,12 +356,12 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) for now). */ if (TREE_CODE (decl) == TYPE_DECL - && DECL_NAME (decl) != 0 - && (TYPE_NAME (TREE_TYPE (decl)) == 0 + && DECL_NAME (decl) + && (!TYPE_NAME (TREE_TYPE (decl)) || TREE_CODE (TYPE_NAME (TREE_TYPE (decl))) == IDENTIFIER_NODE || (TREE_CODE (TYPE_NAME (TREE_TYPE (decl))) == TYPE_DECL && DECL_ARTIFICIAL (TYPE_NAME (TREE_TYPE (decl))) - && ! DECL_ARTIFICIAL (decl)))) + && !DECL_ARTIFICIAL (decl)))) TYPE_NAME (TREE_TYPE (decl)) = decl; if (TREE_CODE (decl) != CONST_DECL) @@ -531,7 +531,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) TYPE_PRECISION (longest_float_type_node) = LONG_DOUBLE_TYPE_SIZE; layout_type (longest_float_type_node); create_type_decl (get_identifier ("longest float type"), - longest_float_type_node, NULL, 0, 1, Empty); + longest_float_type_node, NULL, false, true, Empty); } else longest_float_type_node = TREE_TYPE (long_long_float_type); @@ -540,10 +540,11 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) unsigned_type_node = gnat_type_for_size (INT_TYPE_SIZE, 1); create_type_decl (get_identifier ("unsigned int"), unsigned_type_node, - NULL, 0, 1, Empty); + NULL, false, true, Empty); void_type_decl_node = create_type_decl (get_identifier ("void"), - void_type_node, NULL, 0, 1, Empty); + void_type_node, NULL, false, true, + Empty); void_ftype = build_function_type (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); @@ -559,7 +560,8 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, sizetype, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, + Empty); /* free is a function declaration tree for a function to free memory. */ free_decl @@ -568,14 +570,14 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, ptr_void_type_node, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Make the types and functions used for exception processing. */ jmpbuf_type = build_array_type (gnat_type_for_mode (Pmode, 0), build_index_type (build_int_2 (5, 0))); create_type_decl (get_identifier ("JMPBUF_T"), jmpbuf_type, NULL, - 0, 1, Empty); + false, true, Empty); jmpbuf_ptr_type = build_pointer_type (jmpbuf_type); /* Functions to get and set the jumpbuf pointer for the current thread. */ @@ -583,7 +585,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) = create_subprog_decl (get_identifier ("system__soft_links__get_jmpbuf_address_soft"), NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); set_jmpbuf_decl = create_subprog_decl @@ -591,7 +593,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) NULL_TREE, build_function_type (void_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Function to get the current exception. */ get_excptr_decl @@ -599,7 +601,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) (get_identifier ("system__soft_links__get_gnat_exception"), NULL_TREE, build_function_type (build_pointer_type (except_type_node), NULL_TREE), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Functions that raise exceptions. */ raise_nodefer_decl @@ -609,7 +611,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, build_pointer_type (except_type_node), endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Hooks to call when entering/leaving an exception handler. */ begin_handler_decl @@ -618,7 +620,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, ptr_void_type_node, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); end_handler_decl = create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE, @@ -626,7 +628,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, ptr_void_type_node, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* If in no exception handlers mode, all raise statements are redirected to __gnat_last_chance_handler. No need to redefine raise_nodefer_decl, since @@ -642,7 +644,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, integer_type_node, endlink))), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); for (i = 0; i < ARRAY_SIZE (gnat_raise_decls); i++) gnat_raise_decls[i] = decl; @@ -664,7 +666,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, integer_type_node, endlink))), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); } /* Indicate that these never return. */ @@ -690,7 +692,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) (get_identifier ("__builtin_setjmp"), NULL_TREE, build_function_type (integer_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL; DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP; @@ -702,7 +704,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) (get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE, build_function_type (void_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL; DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF; @@ -712,19 +714,19 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) /* Given a record type (RECORD_TYPE) and a chain of FIELD_DECL nodes (FIELDLIST), finish constructing the record or union type. If HAS_REP is - nonzero, this record has a rep clause; don't call layout_type but merely set - the size and alignment ourselves. If DEFER_DEBUG is nonzero, do not call + true, this record has a rep clause; don't call layout_type but merely set + the size and alignment ourselves. If DEFER_DEBUG is true, do not call the debugging routines on this type; it will be done later. */ void -finish_record_type (tree record_type, tree fieldlist, int has_rep, - int defer_debug) +finish_record_type (tree record_type, tree fieldlist, bool has_rep, + bool defer_debug) { enum tree_code code = TREE_CODE (record_type); tree ada_size = bitsize_zero_node; tree size = bitsize_zero_node; tree size_unit = size_zero_node; - int var_size = 0; + bool var_size = false; tree field; TYPE_FIELDS (record_type) = fieldlist; @@ -742,7 +744,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, { TYPE_ALIGN (record_type) = MAX (BITS_PER_UNIT, TYPE_ALIGN (record_type)); TYPE_MODE (record_type) = BLKmode; - if (TYPE_SIZE (record_type) == 0) + if (!TYPE_SIZE (record_type)) { TYPE_SIZE (record_type) = bitsize_zero_node; TYPE_SIZE_UNIT (record_type) = size_zero_node; @@ -789,13 +791,13 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, output routines (except Dwarf2) won't be able to output the fields, so we need to make the special record. */ if (TREE_CODE (this_size) != INTEGER_CST) - var_size = 1; + var_size = true; if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == QUAL_UNION_TYPE) - && ! TYPE_IS_FAT_POINTER_P (type) - && ! TYPE_CONTAINS_TEMPLATE_P (type) - && TYPE_ADA_SIZE (type) != 0) + && !TYPE_IS_FAT_POINTER_P (type) + && !TYPE_CONTAINS_TEMPLATE_P (type) + && TYPE_ADA_SIZE (type)) this_ada_size = TYPE_ADA_SIZE (type); /* Clear DECL_BIT_FIELD for the cases layout_decl does not handle. */ @@ -811,7 +813,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, DECL_NONADDRESSABLE_P (field) |= DECL_BIT_FIELD (field) && DECL_MODE (field) != BLKmode; - if (has_rep && ! DECL_BIT_FIELD (field)) + if (has_rep && !DECL_BIT_FIELD (field)) TYPE_ALIGN (record_type) = MAX (TYPE_ALIGN (record_type), DECL_ALIGN (field)); @@ -863,22 +865,22 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, /* If this is a padding record, we never want to make the size smaller than what was specified in it, if any. */ if (TREE_CODE (record_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type) != 0) + && TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type)) { size = TYPE_SIZE (record_type); size_unit = TYPE_SIZE_UNIT (record_type); } /* Now set any of the values we've just computed that apply. */ - if (! TYPE_IS_FAT_POINTER_P (record_type) - && ! TYPE_CONTAINS_TEMPLATE_P (record_type)) + if (!TYPE_IS_FAT_POINTER_P (record_type) + && !TYPE_CONTAINS_TEMPLATE_P (record_type)) SET_TYPE_ADA_SIZE (record_type, ada_size); if (has_rep) { - if (! (TREE_CODE (record_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (record_type) - && CONTAINS_PLACEHOLDER_P (size))) + if (!(TREE_CODE (record_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (record_type) + && CONTAINS_PLACEHOLDER_P (size))) { TYPE_SIZE (record_type) = round_up (size, TYPE_ALIGN (record_type)); TYPE_SIZE_UNIT (record_type) @@ -889,7 +891,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, compute_record_mode (record_type); } - if (! defer_debug) + if (!defer_debug) { /* If this record is of variable size, rename it so that the debugger knows it is and make a new, parallel, record @@ -897,8 +899,8 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, exp_dbug.ads. But don't do this for records that are padding since they confuse GDB. */ if (var_size - && ! (TREE_CODE (record_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (record_type))) + && !(TREE_CODE (record_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (record_type))) { tree new_record_type = make_node (TREE_CODE (record_type) == QUAL_UNION_TYPE @@ -923,17 +925,19 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, DECL_IGNORED_P (TYPE_STUB_DECL (new_record_type)) = DECL_IGNORED_P (TYPE_STUB_DECL (record_type)); TYPE_SIZE (new_record_type) = size_int (TYPE_ALIGN (record_type)); + TYPE_SIZE_UNIT (new_record_type) + = size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT); /* Now scan all the fields, replacing each field with a new field corresponding to the new encoding. */ - for (old_field = TYPE_FIELDS (record_type); old_field != 0; + for (old_field = TYPE_FIELDS (record_type); old_field; old_field = TREE_CHAIN (old_field)) { tree field_type = TREE_TYPE (old_field); tree field_name = DECL_NAME (old_field); tree new_field; tree curpos = bit_position (old_field); - int var = 0; + bool var = false; unsigned int align = 0; tree pos; @@ -953,14 +957,14 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, else pos = compute_related_constant (curpos, last_pos); - if (pos == 0 && TREE_CODE (curpos) == MULT_EXPR + if (!pos && TREE_CODE (curpos) == MULT_EXPR && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST) { align = TREE_INT_CST_LOW (TREE_OPERAND (curpos, 1)); pos = compute_related_constant (curpos, round_up (last_pos, align)); } - else if (pos == 0 && TREE_CODE (curpos) == PLUS_EXPR + else if (!pos && TREE_CODE (curpos) == PLUS_EXPR && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST && TREE_CODE (TREE_OPERAND (curpos, 0)) == MULT_EXPR && host_integerp (TREE_OPERAND @@ -986,7 +990,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, ??? We really should abort here, but it's too much work to get this correct for all cases. */ - if (pos == 0) + if (!pos) pos = bitsize_zero_node; /* See if this type is variable-size and make a new type @@ -994,7 +998,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, if (TREE_CODE (DECL_SIZE (old_field)) != INTEGER_CST) { field_type = build_pointer_type (field_type); - var = 1; + var = true; } /* Make a new field name, if necessary. */ @@ -1056,7 +1060,7 @@ merge_sizes (tree last_size, tree first_bit, tree size, bool special, tree type = TREE_TYPE (last_size); tree new; - if (! special || TREE_CODE (size) != COND_EXPR) + if (!special || TREE_CODE (size) != COND_EXPR) { new = size_binop (PLUS_EXPR, first_bit, size); if (has_rep) @@ -1149,10 +1153,11 @@ split_plus (tree in, tree *pvar) object. RETURNS_BY_REF is nonzero if the function returns by reference. RETURNS_WITH_DSP is nonzero if the function is to return with a depressed stack pointer. */ + tree create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, - int returns_unconstrained, int returns_by_ref, - int returns_with_dsp) + bool returns_unconstrained, bool returns_by_ref, + bool returns_with_dsp) { /* A chain of TREE_LIST nodes whose TREE_VALUEs are the data type nodes of the subprogram formal parameters. This list is generated by traversing the @@ -1164,7 +1169,7 @@ create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, for (param_decl = param_decl_list; param_decl; param_decl = TREE_CHAIN (param_decl)) param_type_list = tree_cons (NULL_TREE, TREE_TYPE (param_decl), - param_type_list); + param_type_list); /* The list of the function parameter types has to be terminated by the void type to signal to the back-end that we are not dealing with a variable @@ -1181,7 +1186,7 @@ create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, /* TYPE may have been shared since GCC hashes types. If it has a CICO_LIST or the new type should, make a copy of TYPE. Likewise for RETURNS_UNCONSTRAINED and RETURNS_BY_REF. */ - if (TYPE_CI_CO_LIST (type) != 0 || cico_list != 0 + if (TYPE_CI_CO_LIST (type) || cico_list || TYPE_RETURNS_UNCONSTRAINED_P (type) != returns_unconstrained || TYPE_RETURNS_BY_REF_P (type) != returns_by_ref) type = copy_type (type); @@ -1228,24 +1233,24 @@ create_index_type (tree min, tree max, tree index) only a small hole. */ if (TYPE_INDEX_TYPE (type) == index) return type; - else if (TYPE_INDEX_TYPE (type) != 0) + else if (TYPE_INDEX_TYPE (type)) type = copy_type (type); SET_TYPE_INDEX_TYPE (type, index); - create_type_decl (NULL_TREE, type, NULL, 1, 0, Empty); + create_type_decl (NULL_TREE, type, NULL, true, false, Empty); return type; } /* Return a TYPE_DECL node. TYPE_NAME gives the name of the type (a character string) and TYPE is a ..._TYPE node giving its data type. - ARTIFICIAL_P is nonzero if this is a declaration that was generated - by the compiler. DEBUG_INFO_P is nonzero if we need to write debugging + ARTIFICIAL_P is true if this is a declaration that was generated + by the compiler. DEBUG_INFO_P is true if we need to write debugging information about this type. GNAT_NODE is used for the position of the decl. */ tree create_type_decl (tree type_name, tree type, struct attrib *attr_list, - int artificial_p, int debug_info_p, Node_Id gnat_node) + bool artificial_p, bool debug_info_p, Node_Id gnat_node) { tree type_decl = build_decl (TYPE_DECL, type_name, type); enum tree_code code = TREE_CODE (type); @@ -1260,11 +1265,11 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list, a dummy type, which will be completed later, or a type for which debugging information was not requested. */ if (code == UNCONSTRAINED_ARRAY_TYPE || TYPE_IS_DUMMY_P (type) - || ! debug_info_p) + || !debug_info_p) DECL_IGNORED_P (type_decl) = 1; else if (code != ENUMERAL_TYPE && code != RECORD_TYPE - && ! ((code == POINTER_TYPE || code == REFERENCE_TYPE) - && TYPE_IS_DUMMY_P (TREE_TYPE (type)))) + && !((code == POINTER_TYPE || code == REFERENCE_TYPE) + && TYPE_IS_DUMMY_P (TREE_TYPE (type)))) rest_of_decl_compilation (type_decl, NULL, global_bindings_p (), 0); if (!TYPE_IS_DUMMY_P (type)) @@ -1278,9 +1283,9 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list, (a GCC ..._TYPE node). VAR_INIT is the GCC tree for an optional initial expression; NULL_TREE if none. - CONST_FLAG is nonzero if this variable is constant. + CONST_FLAG is true if this variable is constant. - PUBLIC_FLAG is nonzero if this definition is to be made visible outside of + PUBLIC_FLAG is true if this definition is to be made visible outside of the current compilation unit. This flag should be set when processing the variable definitions in a package specification. EXTERN_FLAG is nonzero when processing an external variable declaration (as opposed to a @@ -1293,12 +1298,12 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list, tree create_var_decl (tree var_name, tree asm_name, tree type, tree var_init, - int const_flag, int public_flag, int extern_flag, - int static_flag, struct attrib *attr_list, Node_Id gnat_node) + bool const_flag, bool public_flag, bool extern_flag, + bool static_flag, struct attrib *attr_list, Node_Id gnat_node) { - int init_const - = (var_init == 0 - ? 0 + bool init_const + = (!var_init + ? false : (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (var_init)) && (global_bindings_p () || static_flag ? 0 != initializer_constant_valid_p (var_init, @@ -1321,8 +1326,8 @@ create_var_decl (tree var_name, tree asm_name, tree type, tree var_init, just annotating types, throw away the initialization if it isn't a constant. */ if ((extern_flag && TREE_CODE (var_decl) != CONST_DECL) - || (type_annotate_only && var_init != 0 && ! TREE_CONSTANT (var_init))) - var_init = 0; + || (type_annotate_only && var_init && !TREE_CONSTANT (var_init))) + var_init = NULL_TREE; DECL_INITIAL (var_decl) = var_init; TREE_READONLY (var_decl) = const_flag; @@ -1337,7 +1342,7 @@ create_var_decl (tree var_name, tree asm_name, tree type, tree var_init, we allocate automatic storage unless requested not to. */ TREE_STATIC (var_decl) = global_bindings_p () ? !extern_flag : static_flag; - if (asm_name != 0) + if (asm_name) SET_DECL_ASSEMBLER_NAME (var_decl, asm_name); process_attributes (var_decl, attr_list); @@ -1380,7 +1385,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type, We always set a size in this case to trigger the checks for bitfield creation below, which is typically required when no position has been specified. */ - if (size != 0) + if (size) size = convert (bitsizetype, size); else if (packed == 1) { @@ -1408,35 +1413,35 @@ create_field_decl (tree field_name, tree field_type, tree record_type, We also don't look at STRICT_ALIGNMENT here, and rely on later processing in layout_decl or finish_record_type to clear the bit_field indication if it is in fact not needed. */ - if (size != 0 && TREE_CODE (size) == INTEGER_CST + if (size && TREE_CODE (size) == INTEGER_CST && TREE_CODE (TYPE_SIZE (field_type)) == INTEGER_CST - && ! addressable - && (! operand_equal_p (TYPE_SIZE (field_type), size, 0) - || (pos != 0 - && ! value_zerop (size_binop (TRUNC_MOD_EXPR, pos, - bitsize_int (TYPE_ALIGN - (field_type))))) + && !addressable + && (!operand_equal_p (TYPE_SIZE (field_type), size, 0) + || (pos + && !value_zerop (size_binop (TRUNC_MOD_EXPR, pos, + bitsize_int (TYPE_ALIGN + (field_type))))) || packed || (TYPE_ALIGN (record_type) != 0 && TYPE_ALIGN (record_type) < TYPE_ALIGN (field_type)))) { DECL_BIT_FIELD (field_decl) = 1; DECL_SIZE (field_decl) = size; - if (! packed && pos == 0) + if (!packed && !pos) DECL_ALIGN (field_decl) = (TYPE_ALIGN (record_type) != 0 ? MIN (TYPE_ALIGN (record_type), TYPE_ALIGN (field_type)) : TYPE_ALIGN (field_type)); } - DECL_PACKED (field_decl) = pos != 0 ? DECL_BIT_FIELD (field_decl) : packed; + DECL_PACKED (field_decl) = pos ? DECL_BIT_FIELD (field_decl) : packed; DECL_ALIGN (field_decl) = MAX (DECL_ALIGN (field_decl), DECL_BIT_FIELD (field_decl) ? 1 : packed && TYPE_MODE (field_type) != BLKmode ? BITS_PER_UNIT : TYPE_ALIGN (field_type)); - if (pos != 0) + if (pos) { /* We need to pass in the alignment the DECL is known to have. This is the lowest-order bit set in POS, but no more than @@ -1482,7 +1487,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type, copy. This is the case for true bitfields, but the DECL_BIT_FIELD value we have at this point is not accurate enough, so we don't account for this here and let finish_record_type decide. */ - DECL_NONADDRESSABLE_P (field_decl) = ! addressable; + DECL_NONADDRESSABLE_P (field_decl) = !addressable; return field_decl; } @@ -1500,12 +1505,12 @@ value_zerop (tree exp) } /* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter, - PARAM_TYPE is its type. READONLY is nonzero if the parameter is + PARAM_TYPE is its type. READONLY is true if the parameter is readonly (either an IN parameter or an address of a pass-by-ref parameter). */ tree -create_param_decl (tree param_name, tree param_type, int readonly) +create_param_decl (tree param_name, tree param_type, bool readonly) { tree param_decl = build_decl (PARM_DECL, param_name, param_type); @@ -1606,7 +1611,7 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) { /* If this is the first field of the record, there cannot be any gap */ if (!prev_field) - return 0; + return false; /* If the previous field is a union type, then return False: The only time when such a field is not the last field of the record is when @@ -1614,13 +1619,13 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) was a rep clause for every field), in which case we don't want the alignment constraint to override them. */ if (TREE_CODE (TREE_TYPE (prev_field)) == QUAL_UNION_TYPE) - return 0; + return false; /* If the distance between the end of prev_field and the begining of curr_field is constant, then there is a gap if the value of this constant is not null. */ if (offset && host_integerp (offset, 1)) - return (!integer_zerop (offset)); + return !integer_zerop (offset); /* If the size and position of the previous field are constant, then check the sum of this size and position. There will be a gap @@ -1635,10 +1640,10 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) of the current field alignment, there can not be any gap. */ if (value_factor_p (bit_position (prev_field), DECL_ALIGN (curr_field)) && value_factor_p (DECL_SIZE (prev_field), DECL_ALIGN (curr_field))) - return 0; + return false; /* Fallback, return that there may be a potential gap */ - return 1; + return true; } /* Returns a LABEL_DECL node for LABEL_NAME. */ @@ -1665,8 +1670,8 @@ create_label_decl (tree label_name) tree create_subprog_decl (tree subprog_name, tree asm_name, - tree subprog_type, tree param_decl_list, int inline_flag, - int public_flag, int extern_flag, + tree subprog_type, tree param_decl_list, bool inline_flag, + bool public_flag, bool extern_flag, struct attrib *attr_list, Node_Id gnat_node) { tree return_type = TREE_TYPE (subprog_type); @@ -1675,9 +1680,9 @@ create_subprog_decl (tree subprog_name, tree asm_name, /* If this is a function nested inside an inlined external function, it means we aren't going to compile the outer function unless it is actually inlined, so do the same for us. */ - if (current_function_decl != 0 && DECL_INLINE (current_function_decl) + if (current_function_decl && DECL_INLINE (current_function_decl) && DECL_EXTERNAL (current_function_decl)) - extern_flag = 1; + extern_flag = true; DECL_EXTERNAL (subprog_decl) = extern_flag; TREE_PUBLIC (subprog_decl) = public_flag; @@ -1693,7 +1698,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, if (inline_flag) DECL_DECLARED_INLINE_P (subprog_decl) = 1; - if (asm_name != 0) + if (asm_name) SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name); process_attributes (subprog_decl, attr_list); @@ -1859,7 +1864,7 @@ gnat_type_for_size (unsigned precision, int unsignedp) char type_name[20]; if (precision <= 2 * MAX_BITS_PER_WORD - && signed_and_unsigned_types[precision][unsignedp] != 0) + && signed_and_unsigned_types[precision][unsignedp]) return signed_and_unsigned_types[precision][unsignedp]; if (unsignedp) @@ -1870,7 +1875,7 @@ gnat_type_for_size (unsigned precision, int unsignedp) if (precision <= 2 * MAX_BITS_PER_WORD) signed_and_unsigned_types[precision][unsignedp] = t; - if (TYPE_NAME (t) == 0) + if (!TYPE_NAME (t)) { sprintf (type_name, "%sSIGNED_%d", unsignedp ? "UN" : "", precision); TYPE_NAME (t) = get_identifier (type_name); @@ -1887,7 +1892,7 @@ float_type_for_precision (int precision, enum machine_mode mode) tree t; char type_name[20]; - if (float_types[(int) mode] != 0) + if (float_types[(int) mode]) return float_types[(int) mode]; float_types[(int) mode] = t = make_node (REAL_TYPE); @@ -1895,9 +1900,9 @@ float_type_for_precision (int precision, enum machine_mode mode) layout_type (t); if (TYPE_MODE (t) != mode) - gigi_abort (414); + abort (); - if (TYPE_NAME (t) == 0) + if (!TYPE_NAME (t)) { sprintf (type_name, "FLOAT_%d", precision); TYPE_NAME (t) = get_identifier (type_name); @@ -1934,7 +1939,7 @@ gnat_unsigned_type (tree type_node) type = copy_node (type); TREE_TYPE (type) = type_node; } - else if (TREE_TYPE (type_node) != 0 + else if (TREE_TYPE (type_node) && TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE && TYPE_MODULAR_P (TREE_TYPE (type_node))) { @@ -1957,7 +1962,7 @@ gnat_signed_type (tree type_node) type = copy_node (type); TREE_TYPE (type) = type_node; } - else if (TREE_TYPE (type_node) != 0 + else if (TREE_TYPE (type_node) && TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE && TYPE_MODULAR_P (TREE_TYPE (type_node))) { @@ -1974,7 +1979,7 @@ gnat_signed_type (tree type_node) tree gnat_signed_or_unsigned_type (int unsignedp, tree type) { - if (! INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp) + if (!INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp) return type; else return gnat_type_for_size (TYPE_PRECISION (type), unsignedp); @@ -1982,10 +1987,10 @@ gnat_signed_or_unsigned_type (int unsignedp, tree type) /* EXP is an expression for the size of an object. If this size contains discriminant references, replace them with the maximum (if MAX_P) or - minimum (if ! MAX_P) possible value of the discriminant. */ + minimum (if !MAX_P) possible value of the discriminant. */ tree -max_size (tree exp, int max_p) +max_size (tree exp, bool max_p) { enum tree_code code = TREE_CODE (exp); tree type = TREE_TYPE (exp); @@ -2000,19 +2005,19 @@ max_size (tree exp, int max_p) if (code == TREE_LIST) return tree_cons (TREE_PURPOSE (exp), max_size (TREE_VALUE (exp), max_p), - TREE_CHAIN (exp) != 0 - ? max_size (TREE_CHAIN (exp), max_p) : 0); + TREE_CHAIN (exp) + ? max_size (TREE_CHAIN (exp), max_p) : NULL_TREE); break; case 'r': /* If this contains a PLACEHOLDER_EXPR, it is the thing we want to modify. Otherwise, we treat it like a variable. */ - if (! CONTAINS_PLACEHOLDER_P (exp)) + if (!CONTAINS_PLACEHOLDER_P (exp)) return exp; type = TREE_TYPE (TREE_OPERAND (exp, 1)); return - max_size (max_p ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type), 1); + max_size (max_p ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type), true); case '<': return max_p ? size_one_node : size_zero_node; @@ -2029,7 +2034,7 @@ max_size (tree exp, int max_p) return fold (build1 (code, type, max_size (TREE_OPERAND (exp, 0), - code == NEGATE_EXPR ? ! max_p : max_p))); + code == NEGATE_EXPR ? !max_p : max_p))); case 2: if (code == COMPOUND_EXPR) @@ -2038,7 +2043,7 @@ max_size (tree exp, int max_p) { tree lhs = max_size (TREE_OPERAND (exp, 0), max_p); tree rhs = max_size (TREE_OPERAND (exp, 1), - code == MINUS_EXPR ? ! max_p : max_p); + code == MINUS_EXPR ? !max_p : max_p); /* Special-case wanting the maximum value of a MIN_EXPR. In that case, if one side overflows, return the other. @@ -2053,7 +2058,7 @@ max_size (tree exp, int max_p) else if ((code == MINUS_EXPR || code == PLUS_EXPR) && ((TREE_CONSTANT (lhs) && TREE_OVERFLOW (lhs)) || operand_equal_p (lhs, TYPE_MAX_VALUE (type), 0)) - && ! TREE_CONSTANT (rhs)) + && !TREE_CONSTANT (rhs)) return lhs; else return fold (build (code, type, lhs, rhs)); @@ -2066,13 +2071,13 @@ max_size (tree exp, int max_p) return fold (build (max_p ? MAX_EXPR : MIN_EXPR, type, max_size (TREE_OPERAND (exp, 1), max_p), max_size (TREE_OPERAND (exp, 2), max_p))); - else if (code == CALL_EXPR && TREE_OPERAND (exp, 1) != 0) + else if (code == CALL_EXPR && TREE_OPERAND (exp, 1)) return build (CALL_EXPR, type, TREE_OPERAND (exp, 0), max_size (TREE_OPERAND (exp, 1), max_p), NULL); } } - gigi_abort (408); + abort (); } /* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE. @@ -2102,7 +2107,7 @@ build_template (tree template_type, tree array_type, tree expr) nested arrays stop being the underlying object. */ for (field = TYPE_FIELDS (template_type); field; - (bound_list != 0 + (bound_list ? (bound_list = TREE_CHAIN (bound_list)) : (array_type = TREE_TYPE (array_type))), field = TREE_CHAIN (TREE_CHAIN (field))) @@ -2113,15 +2118,15 @@ build_template (tree template_type, tree array_type, tree expr) for an ARRAY_TYPE. Otherwise, if expr is a PARM_DECL with DECL_BY_COMPONENT_PTR_P, use the bounds of the field in the template. This will give us a maximum range. */ - if (bound_list != 0) + if (bound_list) bounds = TREE_VALUE (bound_list); else if (TREE_CODE (array_type) == ARRAY_TYPE) bounds = TYPE_INDEX_TYPE (TYPE_DOMAIN (array_type)); - else if (expr != 0 && TREE_CODE (expr) == PARM_DECL + else if (expr && TREE_CODE (expr) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (expr)) bounds = TREE_TYPE (field); else - gigi_abort (411); + abort (); min = convert (TREE_TYPE (TREE_CHAIN (field)), TYPE_MIN_VALUE (bounds)); max = convert (TREE_TYPE (field), TYPE_MAX_VALUE (bounds)); @@ -2426,9 +2431,9 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity) post_error ("unsupported descriptor type for &", gnat_entity); } - finish_record_type (record_type, field_list, 0, 1); + finish_record_type (record_type, field_list, false, true); create_type_decl (create_concat_name (gnat_entity, "DESC"), record_type, - NULL, 1, 0, gnat_entity); + NULL, true, false, gnat_entity); return record_type; } @@ -2467,7 +2472,7 @@ build_unc_object_type (tree template_type, tree object_type, tree name) finish_record_type (type, chainon (chainon (NULL_TREE, template_field), array_field), - 0, 0); + false, false); return type; } @@ -2486,12 +2491,12 @@ update_pointer_to (tree old_type, tree new_type) /* If this is the main variant, process all the other variants first. */ if (TYPE_MAIN_VARIANT (old_type) == old_type) - for (type = TYPE_NEXT_VARIANT (old_type); type != 0; + for (type = TYPE_NEXT_VARIANT (old_type); type; type = TYPE_NEXT_VARIANT (type)) update_pointer_to (type, new_type); /* If no pointer or reference, we are done. */ - if (ptr == 0 && ref == 0) + if (!ptr && !ref) return; /* Merge the old type qualifiers in the new type. @@ -2534,7 +2539,7 @@ update_pointer_to (tree old_type, tree new_type) { TREE_TYPE (ptr1) = new_type; - if (TYPE_NAME (ptr1) != 0 + if (TYPE_NAME (ptr1) && TREE_CODE (TYPE_NAME (ptr1)) == TYPE_DECL && TREE_CODE (new_type) != ENUMERAL_TYPE) rest_of_decl_compilation (TYPE_NAME (ptr1), NULL, @@ -2547,7 +2552,7 @@ update_pointer_to (tree old_type, tree new_type) { TREE_TYPE (ref1) = new_type; - if (TYPE_NAME (ref1) != 0 + if (TYPE_NAME (ref1) && TREE_CODE (TYPE_NAME (ref1)) == TYPE_DECL && TREE_CODE (new_type) != ENUMERAL_TYPE) rest_of_decl_compilation (TYPE_NAME (ref1), NULL, @@ -2559,8 +2564,8 @@ update_pointer_to (tree old_type, tree new_type) is actually a RECORD_TYPE where the types of both fields are pointers to void. In that case, copy the field list from the old type to the new one and update the fields' context. */ - else if (TREE_CODE (ptr) != RECORD_TYPE || ! TYPE_IS_FAT_POINTER_P (ptr)) - gigi_abort (412); + else if (TREE_CODE (ptr) != RECORD_TYPE || !TYPE_IS_FAT_POINTER_P (ptr)) + abort (); else { @@ -2569,6 +2574,12 @@ update_pointer_to (tree old_type, tree new_type) tree new_ref; tree var; + SET_DECL_ORIGINAL_FIELD (TYPE_FIELDS (ptr), + TYPE_FIELDS (TYPE_POINTER_TO (new_type))); + SET_DECL_ORIGINAL_FIELD (TREE_CHAIN (TYPE_FIELDS (ptr)), + TREE_CHAIN (TYPE_FIELDS + (TYPE_POINTER_TO (new_type)))); + TYPE_FIELDS (ptr) = TYPE_FIELDS (TYPE_POINTER_TO (new_type)); DECL_CONTEXT (TYPE_FIELDS (ptr)) = ptr; DECL_CONTEXT (TREE_CHAIN (TYPE_FIELDS (ptr))) = ptr; @@ -2656,10 +2667,10 @@ convert_to_fat_pointer (tree type, tree expr) else expr = build1 (INDIRECT_REF, TREE_TYPE (etype), expr); - template = build_component_ref (expr, NULL_TREE, fields, 0); + template = build_component_ref (expr, NULL_TREE, fields, false); expr = build_unary_op (ADDR_EXPR, NULL_TREE, build_component_ref (expr, NULL_TREE, - TREE_CHAIN (fields), 0)); + TREE_CHAIN (fields), false)); } else /* Otherwise, build the constructor for the template. */ @@ -2694,15 +2705,15 @@ convert_to_fat_pointer (tree type, tree expr) static tree convert_to_thin_pointer (tree type, tree expr) { - if (! TYPE_FAT_POINTER_P (TREE_TYPE (expr))) + if (!TYPE_FAT_POINTER_P (TREE_TYPE (expr))) expr = convert_to_fat_pointer (TREE_TYPE (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))), expr); /* We get the pointer to the data and use a NOP_EXPR to make it the proper GCC type. */ - expr - = build_component_ref (expr, NULL_TREE, TYPE_FIELDS (TREE_TYPE (expr)), 0); + expr = build_component_ref (expr, NULL_TREE, TYPE_FIELDS (TREE_TYPE (expr)), + false); expr = build1 (NOP_EXPR, type, expr); return expr; @@ -2732,20 +2743,21 @@ convert (tree type, tree expr) of variable size, do this as an unchecked conversion. */ else if (ecode == RECORD_TYPE && code == RECORD_TYPE && TYPE_IS_PADDING_P (type) && TYPE_IS_PADDING_P (etype) - && (! TREE_CONSTANT (TYPE_SIZE (type)) - || ! TREE_CONSTANT (TYPE_SIZE (etype)))) + && (!TREE_CONSTANT (TYPE_SIZE (type)) + || !TREE_CONSTANT (TYPE_SIZE (etype)))) ; else if (ecode == RECORD_TYPE && TYPE_IS_PADDING_P (etype)) { /* If we have just converted to this padded type, just get the inner expression. */ if (TREE_CODE (expr) == CONSTRUCTOR - && CONSTRUCTOR_ELTS (expr) != 0 + && CONSTRUCTOR_ELTS (expr) && TREE_PURPOSE (CONSTRUCTOR_ELTS (expr)) == TYPE_FIELDS (etype)) return TREE_VALUE (CONSTRUCTOR_ELTS (expr)); else - return convert (type, build_component_ref (expr, NULL_TREE, - TYPE_FIELDS (etype), 0)); + return convert (type, + build_component_ref (expr, NULL_TREE, + TYPE_FIELDS (etype), false)); } else if (code == RECORD_TYPE && TYPE_IS_PADDING_P (type)) { @@ -2753,7 +2765,7 @@ convert (tree type, tree expr) of variable size, remove the conversion to avoid the need for variable-size temporaries. */ if (TREE_CODE (expr) == VIEW_CONVERT_EXPR - && ! TREE_CONSTANT (TYPE_SIZE (type))) + && !TREE_CONSTANT (TYPE_SIZE (type))) expr = TREE_OPERAND (expr, 0); /* If we are just removing the padding from expr, convert the original @@ -2762,7 +2774,7 @@ convert (tree type, tree expr) if (TREE_CODE (expr) == COMPONENT_REF && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == RECORD_TYPE && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (expr, 0))) - && ! TREE_CONSTANT (TYPE_SIZE (type))) + && !TREE_CONSTANT (TYPE_SIZE (type))) return convert (type, TREE_OPERAND (expr, 0)); /* If the result type is a padded type with a self-referentially-sized @@ -2770,7 +2782,7 @@ convert (tree type, tree expr) unchecked converstion. */ else if (TREE_CODE (etype) == RECORD_TYPE && CONTAINS_PLACEHOLDER_P (DECL_SIZE (TYPE_FIELDS (type)))) - return unchecked_convert (type, expr, 0); + return unchecked_convert (type, expr, false); else return @@ -2795,7 +2807,7 @@ convert (tree type, tree expr) if (ecode == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (etype) && code != UNCONSTRAINED_ARRAY_TYPE) return convert (type, build_component_ref (expr, NULL_TREE, - TYPE_FIELDS (etype), 0)); + TYPE_FIELDS (etype), false)); /* If converting to a type that contains a template, convert to the data type and then build the template. */ @@ -2837,8 +2849,8 @@ convert (tree type, tree expr) /* If we are converting a STRING_CST to another constrained array type, just make a new one in the proper type. */ if (code == ecode && AGGREGATE_TYPE_P (etype) - && ! (TREE_CODE (TYPE_SIZE (etype)) == INTEGER_CST - && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) + && !(TREE_CODE (TYPE_SIZE (etype)) == INTEGER_CST + && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) && (TREE_CODE (expr) == STRING_CST || get_alias_set (etype) == get_alias_set (type))) { @@ -2854,14 +2866,14 @@ convert (tree type, tree expr) expr = build_unary_op (INDIRECT_REF, NULL_TREE, build_component_ref (TREE_OPERAND (expr, 0), get_identifier ("P_ARRAY"), - NULL_TREE, 0)); + NULL_TREE, false)); etype = TREE_TYPE (expr); ecode = TREE_CODE (etype); break; case VIEW_CONVERT_EXPR: if (AGGREGATE_TYPE_P (type) && AGGREGATE_TYPE_P (etype) - && ! TYPE_FAT_POINTER_P (type) && ! TYPE_FAT_POINTER_P (etype)) + && !TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return convert (type, TREE_OPERAND (expr, 0)); break; @@ -2878,7 +2890,7 @@ convert (tree type, tree expr) || TREE_CODE (type) == UNION_TYPE) && (TREE_CODE (etype) == RECORD_TYPE || TREE_CODE (etype) == UNION_TYPE) - && ! TYPE_FAT_POINTER_P (type) && ! TYPE_FAT_POINTER_P (etype)) + && !TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return build_unary_op (INDIRECT_REF, NULL_TREE, convert (build_pointer_type (type), TREE_OPERAND (expr, 0))); @@ -2889,7 +2901,7 @@ convert (tree type, tree expr) } /* Check for converting to a pointer to an unconstrained array. */ - if (TYPE_FAT_POINTER_P (type) && ! TYPE_FAT_POINTER_P (etype)) + if (TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return convert_to_fat_pointer (type, expr); /* If we're converting between two aggregate types that have the same main @@ -2916,7 +2928,7 @@ convert (tree type, tree expr) if (TYPE_HAS_ACTUAL_BOUNDS_P (type) && (ecode == ARRAY_TYPE || ecode == UNCONSTRAINED_ARRAY_TYPE || (ecode == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (etype)))) - return unchecked_convert (type, expr, 0); + return unchecked_convert (type, expr, false); else if (TYPE_BIASED_REPRESENTATION_P (type)) return fold (build1 (CONVERT_EXPR, type, fold (build (MINUS_EXPR, TREE_TYPE (type), @@ -2952,14 +2964,14 @@ convert (tree type, tree expr) /* If converting to a thin pointer, handle specially. */ if (TYPE_THIN_POINTER_P (type) - && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)) != 0) + && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))) return convert_to_thin_pointer (type, expr); /* If converting fat pointer to normal pointer, get the pointer to the array and then convert it. */ else if (TYPE_FAT_POINTER_P (etype)) expr = build_component_ref (expr, get_identifier ("P_ARRAY"), - NULL_TREE, 0); + NULL_TREE, false); return fold (convert_to_pointer (type, expr)); @@ -2967,7 +2979,7 @@ convert (tree type, tree expr) return fold (convert_to_real (type, expr)); case RECORD_TYPE: - if (TYPE_LEFT_JUSTIFIED_MODULAR_P (type) && ! AGGREGATE_TYPE_P (etype)) + if (TYPE_LEFT_JUSTIFIED_MODULAR_P (type) && !AGGREGATE_TYPE_P (etype)) return gnat_build_constructor (type, tree_cons (TYPE_FIELDS (type), @@ -2980,7 +2992,7 @@ convert (tree type, tree expr) /* In these cases, assume the front-end has validated the conversion. If the conversion is valid, it will be a bit-wise conversion, so it can be viewed as an unchecked conversion. */ - return unchecked_convert (type, expr, 0); + return unchecked_convert (type, expr, false); case UNION_TYPE: /* Just validate that the type is indeed that of a field @@ -2997,7 +3009,7 @@ convert (tree type, tree expr) convert (TREE_TYPE (tem), expr)); } - gigi_abort (413); + abort (); case UNCONSTRAINED_ARRAY_TYPE: /* If EXPR is a constrained array, take its address, convert it to a @@ -3025,23 +3037,23 @@ convert (tree type, tree expr) build_unary_op (ADDR_EXPR, NULL_TREE, expr))); else - gigi_abort (409); + abort (); case COMPLEX_TYPE: return fold (convert_to_complex (type, expr)); default: - gigi_abort (410); + abort (); } } /* Remove all conversions that are done in EXP. This includes converting from a padded type or to a left-justified modular type. If TRUE_ADDRESS - is nonzero, always return the address of the containing object even if + is true, always return the address of the containing object even if the address is not bit-aligned. */ tree -remove_conversions (tree exp, int true_address) +remove_conversions (tree exp, bool true_address) { switch (TREE_CODE (exp)) { @@ -3049,7 +3061,7 @@ remove_conversions (tree exp, int true_address) if (true_address && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (TREE_TYPE (exp))) - return remove_conversions (TREE_VALUE (CONSTRUCTOR_ELTS (exp)), 1); + return remove_conversions (TREE_VALUE (CONSTRUCTOR_ELTS (exp)), true); break; case COMPONENT_REF: @@ -3088,7 +3100,7 @@ maybe_unconstrained_array (tree exp) = build_unary_op (INDIRECT_REF, NULL_TREE, build_component_ref (TREE_OPERAND (exp, 0), get_identifier ("P_ARRAY"), - NULL_TREE, 0)); + NULL_TREE, false)); TREE_READONLY (new) = TREE_STATIC (new) = TREE_READONLY (exp); return new; } @@ -3126,10 +3138,10 @@ maybe_unconstrained_array (tree exp) } /* Return an expression that does an unchecked converstion of EXPR to TYPE. - If NOTRUNC_P is set, truncation operations should be suppressed. */ + If NOTRUNC_P is true, truncation operations should be suppressed. */ tree -unchecked_convert (tree type, tree expr, int notrunc_p) +unchecked_convert (tree type, tree expr, bool notrunc_p) { tree etype = TREE_TYPE (expr); @@ -3140,15 +3152,15 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* If both types types are integral just do a normal conversion. Likewise for a conversion to an unconstrained array. */ if ((((INTEGRAL_TYPE_P (type) - && ! (TREE_CODE (type) == INTEGER_TYPE - && TYPE_VAX_FLOATING_POINT_P (type))) + && !(TREE_CODE (type) == INTEGER_TYPE + && TYPE_VAX_FLOATING_POINT_P (type))) || (POINTER_TYPE_P (type) && ! TYPE_THIN_POINTER_P (type)) || (TREE_CODE (type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (type))) && ((INTEGRAL_TYPE_P (etype) - && ! (TREE_CODE (etype) == INTEGER_TYPE - && TYPE_VAX_FLOATING_POINT_P (etype))) - || (POINTER_TYPE_P (etype) && ! TYPE_THIN_POINTER_P (etype)) + && !(TREE_CODE (etype) == INTEGER_TYPE + && TYPE_VAX_FLOATING_POINT_P (etype))) + || (POINTER_TYPE_P (etype) && !TYPE_THIN_POINTER_P (etype)) || (TREE_CODE (etype) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (etype)))) || TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) @@ -3181,7 +3193,7 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* If we are converting TO an integral type whose precision is not the same as its size, first unchecked convert to a record that contains an object of the output type. Then extract the field. */ - else if (INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) != 0 + else if (INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type)))) { @@ -3198,7 +3210,7 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* Similarly for integral input type whose precision is not equal to its size. */ - else if (INTEGRAL_TYPE_P (etype) && TYPE_RM_SIZE (etype) != 0 + else if (INTEGRAL_TYPE_P (etype) && TYPE_RM_SIZE (etype) && 0 != compare_tree_int (TYPE_RM_SIZE (etype), GET_MODE_BITSIZE (TYPE_MODE (etype)))) { @@ -3240,19 +3252,19 @@ unchecked_convert (tree type, tree expr, int notrunc_p) the result. We need not do this in the case where the input is an integral type of the same precision and signedness or if the output is a biased type or if both the input and output are unsigned. */ - if (! notrunc_p - && INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) != 0 - && ! (TREE_CODE (type) == INTEGER_TYPE - && TYPE_BIASED_REPRESENTATION_P (type)) + if (!notrunc_p + && INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) + && !(TREE_CODE (type) == INTEGER_TYPE + && TYPE_BIASED_REPRESENTATION_P (type)) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type))) - && ! (INTEGRAL_TYPE_P (etype) - && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (etype) - && operand_equal_p (TYPE_RM_SIZE (type), - (TYPE_RM_SIZE (etype) != 0 - ? TYPE_RM_SIZE (etype) : TYPE_SIZE (etype)), - 0)) - && ! (TYPE_UNSIGNED (type) && TYPE_UNSIGNED (etype))) + && !(INTEGRAL_TYPE_P (etype) + && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (etype) + && operand_equal_p (TYPE_RM_SIZE (type), + (TYPE_RM_SIZE (etype) != 0 + ? TYPE_RM_SIZE (etype) : TYPE_SIZE (etype)), + 0)) + && !(TYPE_UNSIGNED (type) && TYPE_UNSIGNED (etype))) { tree base_type = gnat_type_for_mode (TYPE_MODE (type), TYPE_UNSIGNED (type)); @@ -3282,8 +3294,8 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* If the sizes of the types differ and this is an VIEW_CONVERT_EXPR, show no longer constant. */ if (TREE_CODE (expr) == VIEW_CONVERT_EXPR - && ! operand_equal_p (TYPE_SIZE_UNIT (type), TYPE_SIZE_UNIT (etype), - OEP_ONLY_CONST)) + && !operand_equal_p (TYPE_SIZE_UNIT (type), TYPE_SIZE_UNIT (etype), + OEP_ONLY_CONST)) TREE_CONSTANT (expr) = 0; return expr; |