aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/decl.c
AgeCommit message (Collapse)AuthorFilesLines
2007-08-14re PR ada/19037 (constant renaming creates new constant)Olivier Hainque1-118/+109
2007-08-14 Olivier Hainque <hainque@adacore.com> Eric Botcazou <ebotcazou@adacore.com> * targtyps.c (get_target_maximum_default_alignment): New function. Maximum alignment that the compiler might choose by default for a type or object. (get_target_default_allocator_alignment): New function. Alignment known to be honored by the target default allocator. (get_target_maximum_allowed_alignment): New function. Maximum alignment we might accept for any type or object on the target. (get_target_maximum_alignment): Now synonym of maximum_default_alignment * gigi.h (get_target_maximum_default_alignment): Declare new function. (get_target_default_allocator_alignment): Likewise. (get_target_maximum_allowed_alignment): Likewise. PR ada/19037 * decl.c (gnat_to_gnu_entity) <object>: Except for the renaming of the result of a function call, first try to use a stabilized reference for a constant renaming too. (validate_alignment): Use target_maximum_allowed_alignment instead of MAX_OFILE_ALIGNMENT as the upper bound to what we accept. (gnat_to_gnu_entity): Use common nodes directly. (gnat_to_gnu_entity) <object>: Pick the values of the type to annotate alignment and size for the object. (lvalue_required_p): Handle N_Parameter_Association like N_Function_Call and N_Procedure_Call_Statement. (takes_address): Rename to lvalue_required_p, add third parameter 'aliased' and adjust recursive calls. <N_Indexed_Component>: Update 'aliased' from the array type. <N_Selected_Component>: New case. <N_Object_Renaming_Declaration>: New Likewise. (Identifier_to_gnu): Adjust for above changes. (maybe_stabilize_reference) <CONST_DECL>: New case. * utils2.c (build_binary_op) <ARRAY_RANGE_REF>: Look through conversion between type variants. (build_simple_component_ref): Likewise. (build_call_alloc_dealloc): Use target_default_allocator_alignment instead of BIGGEST_ALIGNMENT as the threshold to trigger the super aligning type circuitry for allocations from the default storage pool. (build_allocator): Likewise. (build_simple_component_ref): Manually fold the reference for a constructor if the record type contains a template. * utils.c (value_zerop): Delete. (gnat_init_decl_processing): Emit debug info for common types. (rest_of_record_type_compilation): If a union contains a field with a non-constant qualifier, treat it as variable-sized. (finish_record_type): Give the stub TYPE_DECL a name. (rest_of_record_type_compilation): Likewise. (convert) <CONSTRUCTOR>: New case. Build a new constructor if types are equivalent array types. (create_field_decl): Claim fields of any ARRAY_TYPE are addressable, even if the type is not passed by reference. (static_ctors, static_dtors): Delete. (end_subprog_body): Do not record constructors and destructors. (build_global_cdtor): Delete. (gnat_write_global_declarations): Do not call build_global_cdtor. * lang-specs.h: If TARGET_VXWORKS_RTP is defined, append -mrtp when -fRTS=rtp is specified. If CONFIG_DUAL_EXCEPTIONS is 1, append -fsjlj when -fRTS=sjlj is specified. * misc.c (gnat_init_gcc_eh): Use __gnat_eh_personality_sj for the name of the personality function with SJLJ exceptions. * raise-gcc.c (PERSONALITY_FUNCTION): Use __gnat_eh_personality_sj for the name of the personality function with SJLJ exceptions. From-SVN: r127422
2007-08-11decl.c, utils2.c: Fix whitespace in last change.Kaveh R. Ghazi1-3/+4
* decl.c, utils2.c: Fix whitespace in last change. From-SVN: r127359
2007-08-11decl.c (compare_field_bitpos): Constify.Kaveh R. Ghazi1-4/+3
* decl.c (compare_field_bitpos): Constify. * utils2.c (compare_elmt_bitpos): Likewise. From-SVN: r127358
2007-06-10decl.c (gnat_to_gnu_entity): Use pointers to dummy nodes...Duncan Sands1-20/+32
* decl.c (gnat_to_gnu_entity): Use pointers to dummy nodes, rather than to void, for the fields when making a new fat pointer type. (gnat_substitute_in_type): Now substitute_in_type. * gigi.h (gnat_substitute_in_type): Likewise. * trans.c (gnat_gimplify_expr): Remove COMPONENT_REF kludge. * utils.c (update_pointer_to): Update fat pointers by updating the dummy node pointers used for the fields. From-SVN: r125602
2007-06-06decl.c (gnat_to_gnu_entity): Manually mark the top of the renamed expression ↵Eric Botcazou1-766/+1040
of a full renaming at toplevel. 2007-04-20 Eric Botcazou <ebotcazou@adacore.com> Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Olivier Hainque <hainque@adacore.com> * decl.c (gnat_to_gnu_entity) <object>: Manually mark the top of the renamed expression of a full renaming at toplevel. (gnat_to_gnu_entity, case object): If not defining, do not look inside the values the constant is initialized to if it is an N_Allocator. (gnat_to_gnu_entity) <E_Array_Subtype>: Manually mark the top of the TYPE_SIZE_UNIT of inner types after the stride is elaborated. (make_aligning_type): Accept an extra ROOM argument for storage to be made available before the aligned field, and an extra BASE_ALIGN argument for callers to pass the alignment guaranteed to be honored for the whole aligning object. Avoid call to finish_record_type, which only interferes with the sizes we want to set. (gnat_to_gnu_entity) <E_Variable>: Pass the required extra arguments to make_aligning_type for super-aligned objects on stack. (components_to_record): Pass the adjusted size of the type when creating fields in the qualified union for the variant part. (gnat_substitute_in_type): Copy TYPE_USER_ALIGN. (gnat_to_gnu_entity, case E_Signed_Integer_Subtype): Likewise for packed array type. (maybe_pad_type): Set TYPE_USER_ALIGN. (make_aligning_type): Likewise. ALIGN argument is unsigned int. (gnat_to_gnu_entity, case E_Function): Back annotate return mechanism. (gnat_to_gnu_param): Likewise, for parameters. (gnat_to_gnu_entity) <object>: Always instantiate the renaming object if it is constant and stems from a function call. (gnat_to_gnu_entity) <E_Record_Type>: Set packed to -2 if the alignment of the record is specified. Adjust accordingly. (adjust_packed): New static function. (gnat_to_gnu_field): Use it to adjust the packedness setting. (components_to_record): Likewise. (gnat_to_gnu_entity) <object>: Do not test the renamed expression for side-effects if the object is deemed constant. (gnat_to_gnu_entity) <E_Array_Type>: Create a name for the fat pointer type instead of merely finalizing it. Tidy. <E_Access_Subprogram_Type>: Retrieve the type from the TYPE_DECL. <E_Access_Type>: Likewise. (defer_debug_incomplete_list): Rename to defer_finalize_list. (defer_debug_level): Delete. (gnat_to_gnu_entity) <debug_deferred>: Likewise <E_Array_Type>: Call rest_of_record_type_compilation on the fat pointer type. <E_Record_Type>: Do not explicitly defer finalizing the type. Adjust for write_record_type_debug_info renaming. <E_Subprogram_Type>: Likewise. Finalize deferred types right after deferred incomplete types are expanded. (rest_of_type_decl_compilation): New global function. (components_to_record): Rename defer_debug parameter to do_not_finalize. (components_to_record): Propagate the packedness to the fields of the qualified union type if there is a variant part. (gnat_to_gnu_entity) <E_Array_Type>: Use new function instead of inline code to adjust the XUT field offsets. (gnat_to_gnu_entity): Adjust for new prototype of finish_record_type. <E_Record_Subtype>: Do not let finish_record_type compute the sizes and write the debug info if the type derives from a discriminated one. (gnat_to_gnu_entity) <E_Array_Type>: Adjust call to create_index_type. <E_Array_Subtype>: Likewise. <E_String_Literal_Subtype>: Likewise. (gnat_to_gnu_entity): Set TYPE_USER_ALIGN on types only if they have an alignment clause. (maybe_pad_type): Update ORIG_SIZE to the minimum required to meet ALIGN before giving warning. (prepend_one_attribute_to): New function, helper to prepend an attribute to an attribute list. (gnat_to_gnu_entity) <E_Procedure>: Use it. (prepend_attributes): Likewise. (gnat_to_gnu_entity) <E_Variable>: Use constants of the proper type. <E_Array_Type>: Declare the padding type for the element type, if any. <E_Array_Subtype>: Likewise. (defer_limited_with): New variable. (Gigi_Equivalent_Type): New function. (gnat_to_gnu_entity): Use it at start and use result throughout. (gnat_to_gnu_entity, case E_Access_Type): Rework to use Gigi_Equivalent_Type, support Limited_With, allow two levels of indirection, precompute if unconstrained array to simplify logic, and use defer_limited_with to defer elaboration of some types from limited with. (finalize_from_with_types): New function. From-SVN: r125370
2007-04-06decl.c (gnat_to_gnu_entity): Associate an external VAR_DECL to a CONST_DECL ↵Olivier Hainque1-33/+46
we make for a public constant... 2007-04-06 Olivier Hainque <hainque@adacore.com> Eric Botcazou <botcazou@adacore.com> * decl.c (gnat_to_gnu_entity) <E_Constant>: Associate an external VAR_DECL to a CONST_DECL we make for a public constant when we know the corresponding definition has created the so made visible variable. Handle anonymous access to protected subprogram. (gnat_to_gnu_entity) <E_Variable>: Do not make the underlying type of an object with an address clause volatile. Re-enable original fix. <E_Subprogram_Type>: Set TYPE_REF_CAN_ALIAS_ALL on the reference type too. (gnat_to_gnu_entity) <E_Class_Wide_Type>: Retrieve the TYPE_DECL associated with either the Equivalent or Root type, instead of the naked type node. (gnat_to_gnu_entity): Manually mark the top of the DECL_FIELD_OFFSET subtree for every field of a global record type. (gnat_to_gnu_entity) <E_Record_Subtype>: If the subtype has discriminants, invoke again variable_size on its newly computed sizes. From-SVN: r123557
2007-03-09cuintp.c (UI_To_gnu): Use fold_buildN calls instead of calling fold with the ↵Roger Sayle1-6/+9
result of buildN. * cuintp.c (UI_To_gnu): Use fold_buildN calls instead of calling fold with the result of buildN. * decl.c (gnat_to_gnu_entity): Likewise. * trans.c (Attribute_to_gnu, gnat_to_gnu, emit_check): Likewise. * utils.c (finish_record_type, merge_sizes, max_size, convert): Likewise. * utils2.c (gnat_truthvalue_conversion, compare_arrays, nonbinary_modular_operation, build_binary_op, build_unary_op, build_cond_expr): Likewise. * utils.c (convert): Use fold_build1 when casting values to void. * utils2.c (gnat_truthvalue_conversion): Use build_int_cst and fold_convert instead of convert when appropriate. From-SVN: r122752
2007-02-25decl.c (annotate_value): Adjust for refactoring of tree_map hierarchy.Mark Mitchell1-1/+1
* decl.c (annotate_value): Adjust for refactoring of tree_map hierarchy. From-SVN: r122317
2007-02-25extend.texi: Document optional priority argument to constructors and ↵Mark Mitchell1-1/+1
destructors. * doc/extend.texi: Document optional priority argument to constructors and destructors. * tree.c (init_priority_for_decl): Adjust GTY markers. (init_ttree): Use priority-info hash functions for init_priority_for_decl. (tree_map_eq): Rename to ... (tree_map_base_eq): ... this. (tree_map_marked_p): Rename to ... (tree_map_base_marked_p): ... this. (tree_map_base_hash): New function. (decl_init_priority_lookup): Rework. (decl_fini_priority_lookup): New function. (decl_priority_info): New function. (decl_init_priority_insert): Use it. (decl_fini_priority_insert): Likewise. (decl_restrict_base_lookup): Adjust for refactoring of tree_map hierarchy. (decl_restrict_base_insert): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_lookup): Likewise. (decl_value_expr_insert): Likewise. * tree.h (priority_type): New type. (decl_init_priority_lookup): Use priority_type. (decl_fini_priority_lookup): New function. (decl_init_priority_insert): Use priority_type. (decl_fini_priority_insert): New function. (DECL_HAS_INIT_PRIORITY): Tweak comments. (DECL_INIT_PRIORITY): Likewise. (SET_DECL_INIT_PRIORITY): Add comment. (DECL_FINI_PRIORITY): New macro. (SET_DECL_FINI_PRIORITY): Likewise. (DEFAULT_INIT_PRIORITY): Document. (MAX_INIT_PRIORITY): Likewise. (MAX_RESERVED_INIT_PRIORITY): Likewise. (tree_map_base): New type. (tree_map_base_eq): New function. (tree_map_base_hash): Likewise. (tree_map_base_marked_p): Likewise. (tree_map): Inherit from tree_map_base. (tree_map_eq): Make it a macro. (tree_map_marked_p): Likewise. (tree_int_map): Inherit from tree_map_base. (tree_int_map_eq): Make it a macro. (tree_int_map_hash): Likewise. (tree_int_map_marked_p): Likewise. (tree_priority_map): New type. (tree_priority_map_eq): New macro. (tree_priority_map_hash): Likewise. (tree_priority_map_marked_p): Likewise. * varasm.c (emults_decl): Adjust for refactoring of tree_map hierarchy. (emutls_common_1): Likewise. * lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise. * tree-ssa-structalias.c (heapvar_lookup): Adjust for refactoring of tree_map hierarchy. * tree-cfg.c (move_stmt_r): Likewise. (new_label_mapper): Likewise. * c-tree.h (c_expand_body): Move to ... * c-common.h (c_expand_body): ... here. * c-decl.c (c_expand_body): Move to ... * c-common.c (c_expand_body): ... here. (c_common_attribute_table): Allow 1 argument for the constructor and destructor attributes. (get_priority): New function. (handle_constructor_attribute): Set DECL_INIT_PRIORITY. (handle_destructor_attribute): Set DECL_FINI_PRIORITY. * cp-tree.h (static_ctors): Remove. * cp-tree.h (static_dtors): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_lookup): Adjust for refactoring of tree_map hierarchy. (decl_shadowed_for_var_insert): Likewise. * semantics.c (expand_body): Use c_expand_body. (expand_or_defer_fn): Don't update static_ctors or static_dtors. * decl2.c (static_ctors): Remove. (static_dtors): Likewise. (generate_ctor_or_dtor_function): Pass NULL_TREE to objc_generate_static_init_call. Do not call static_[cd]tors. (generate_ctor_and_dtor_functions_for_priority): Do not check for static_[cd]tors. (cp_write_global_declarations): Likewise. * decl.c (annotate_value): Adjust for refactoring of tree_map hierarchy. * gcc.dg/initpri1.c: New test. * gcc.dg/initpri2.c: Likewise. * g++.dg/special/initpri1.C: New test. * g++.dg/special/initpri2.C: Likewise. * g++.dg/special/conpr-1.C: Use init_priority effective target. * g++.dg/special/conpr-2.C: Likewise. * g++.dg/special/conpr-3.C: Likewise. * g++.dg/special/conpr-4.C: Likewise. * g++.dg/special/initp1.C: Likewise. * g++.dg/special/ecos.exp: Remove code to detect availability of constructor priorities. * lib/target-support.exp (target_init_priority): New function. From-SVN: r122315
2007-02-06tree.c (tree_int_map_hash, [...]): Remove prototypes and make them non-static.Paolo Bonzini1-3/+30
gcc: 2007-02-06 Paolo Bonzini <bonzini@gnu.org> * tree.c (tree_int_map_hash, tree_int_map_eq, tree_int_map_marked_p): Remove prototypes and make them non-static. (struct tree_int_map): Remove. * tree.h (struct tree_int_map): Move here, turning TO into an unsigned int. (tree_int_map_hash, tree_int_map_eq, tree_int_map_marked_p): Declare. * tree.h (TREE_COMPLEXITY): Remove. (struct tree_exp): Remove complexity field. * tree.c (build1_stat): Don't set it. gcc/ada: 2007-02-06 Paolo Bonzini <bonzini@gnu.org> * Make-lang.in (ada/decl.o): Add gt-ada-decl.h dependency. * decl.c: Include gt-ada-decl.h. (annotate_value_cache): New. (annotate_value): Use it instead of TREE_COMPLEXITY. From-SVN: r121647
2007-01-25decl.c (gnat_to_gnu_entity): Use TREE_OVERFLOW instead of ↵Roger Sayle1-12/+10
TREE_CONSTANT_OVERFLOW. * decl.c (gnat_to_gnu_entity): Use TREE_OVERFLOW instead of TREE_CONSTANT_OVERFLOW. (allocatable_size_p, annotate_value): Likewise. * trans.c (gnat_to_gnu): Likewise. * utils.c (unchecked_convert): Likewise. * utils2.c (build_simple_component_ref): Likewise. From-SVN: r121177
2006-10-31gigi.h: (tree_code_for_record_type): Declare.Eric Botcazou1-226/+198
2006-10-31 Eric Botcazou <ebotcazou@adacore.com> Nicolas Setton <setton@adacore.com> Olivier Hainque <hainque@adacore.com> Gary Dismukes <dismukes@adacore.com> * gigi.h: (tree_code_for_record_type): Declare. (add_global_renaming_pointer): Rename to record_global_renaming_pointer. (get_global_renaming_pointers): Rename to invalidate_global_renaming_pointers. (static_ctors): Delete. (static_dtors): Likewise. (gnat_write_global_declarations): Declare. (create_var_decl): Adjust descriptive comment to indicate that the subprogram may return a CONST_DECL node. (create_true_var_decl): Declare new function, similar to create_var_decl but forcing the creation of a VAR_DECL node. (get_global_renaming_pointers): Declare. (add_global_renaming_pointer): Likewise. * ada-tree.h (DECL_READONLY_ONCE_ELAB): New macro. * decl.c (gnat_to_gnu_entity) <case E_Function>: Don't copy the type tree before setting TREE_ADDRESSABLE for by-reference return mechanism processing. (gnat_to_gnu_entity): Remove From_With_Type from computation for imported_p. <E_Access_Type>: Use the Non_Limited_View as the full view of the designated type if the pointer comes from a limited_with clause. Make incomplete designated type if it is in the main unit and has a freeze node. <E_Incomplete_Type>: Rework to treat Non_Limited_View, Full_View, and Underlying_Full_View similarly. Return earlier if the full view already has an associated tree. (gnat_to_gnu_entity) <E_Record_Type>: Restore comment. (gnat_to_gnu_entity) <E_Record_Type>: Do not use a dummy type. (gnat_to_gnu_entity) <E_Variable>: Set TYPE_REF_CAN_ALIAS_ALL on the reference type built for objects with an address clause. Use create_true_var_decl with const_flag set for DECL_CONST_CORRESPONDING_VARs, ensuring a VAR_DECL is created with TREE_READONLY set. (gnat_to_gnu_entity, case E_Enumeration_Type): Set TYPE_NAME for Character and Wide_Character types. This info is read by the dwarf-2 writer, and is needed to be able to use the command "ptype character" in the debugger. (gnat_to_gnu_entity): When generating a type representing a Character or Wide_Character type, set the flag TYPE_STRING_FLAG, so that debug writers can distinguish it from ordinary integers. (elaborate_expression_1): Test the DECL_READONLY_ONCE_ELAB flag in addition to TREE_READONLY to assert the constantness of variables for elaboration purposes. (gnat_to_gnu_entity, subprogram cases): Change loops on formal parameters to call new Einfo function First_Formal_With_Extras. (gnat_to_gnu_entity): In type_annotate mode, replace a discriminant of a protected type with its corresponding discriminant, to obtain a usable declaration (gnat_to_gnu_entity) <E_Access_Protected_Subprogram_Type>: Be prepared for a multiple elaboration of the "equivalent" type. (gnat_to_gnu_entity): Adjust for renaming of add_global_renaming_pointer into record_global_renaming_pointer. (gnat_to_gnu_entity) <E_Array_Type>: Do not force TYPE_NONALIASED_COMPONENT to 0 if the element type is an aggregate. <E_Array_Subtype>: Likewise. (gnat_to_gnu_entity) <E_Incomplete_Subtype>: Add support for regular incomplete subtypes and incomplete subtypes of incomplete types visible through a limited with clause. (gnat_to_gnu_entity) <E_Array_Subtype>: Take into account the bounds of the base index type for the maximum size of the array only if they are constant. (gnat_to_gnu_entity, renaming object case): Do not wrap up the expression into a SAVE_EXPR if stabilization failed. * utils.c (create_subprog_decl): Turn TREE_ADDRESSABLE on the type of a result decl into DECL_BY_REFERENCE on this decl, now what is expected by lower level compilation passes. (gnat_genericize): New function, lowering a function body to GENERIC. Turn the type of RESULT_DECL into a real reference type if the decl has been marked DECL_BY_REFERENCE, and adjust references to the latter accordingly. (gnat_genericize_r): New function. Tree walking callback for gnat_genericize. (convert_from_reference, is_byref_result): New functions. Helpers for gnat_genericize_r. (create_type_decl): Call gnat_pushdecl before calling rest_of_decl_compilation, to make sure that field TYPE_NAME of type_decl is properly set before calling the debug information writers. (write_record_type_debug_info): The heuristics which compute the alignment of a field in a variant record might not be accurate. Add a safety test to make sure no alignment is set to a smaller value than the alignment of the field type. (make_dummy_type): Use the Non_Limited_View as the underlying type if the type comes from a limited_with clause. Do not loop on the full view. (GET_GNU_TREE, SET_GNU_TREE, PRESENT_GNU_TREE): New macros. (dummy_node_table): New global variable, moved from decl.c. (GET_DUMMY_NODE, SET_DUMMY_NODE, PRESENT_DUMMY_NODE): New macros. (save_gnu_tree): Use above macros. (get_gnu_tree): Likewise. (present_gnu_tree): Likewise. (init_dummy_type): New function, moved from decl.c. Use above macros. (make_dummy_type): Likewise. (tree_code_for_record_type): New function extracted from make_dummy_type (init_gigi_decls): Set DECL_IS_MALLOC on gnat_malloc. (static_ctors): Change it to a vector, make static. (static_dtors): Likewise. (end_subprog_body): Adjust for above change. (build_global_cdtor): Moved from trans.c. (gnat_write_global_declarations): Emit global constructor and destructor, and call cgraph_optimize before emitting debug info for global declarations. (global_decls): New global variable. (gnat_pushdecl): Store the global declarations in global_decls, for later use. (gnat_write_global_declarations): Emit debug information for global declarations. (create_var_decl_1): Former create_var_decl, with an extra argument to state whether the creation of a CONST_DECL is allowed. (create_var_decl): Behavior unchanged. Now a wrapper around create_var_decl_1 allowing CONST_DECL creation. (create_true_var_decl): New function, similar to create_var_decl but forcing the creation of a VAR_DECL node (CONST_DECL not allowed). (create_field_decl): Do not always mark the field as addressable if its type is an aggregate. (global_renaming_pointers): New static variable. (add_global_renaming_pointer): New function. (get_global_renaming_pointers): Likewise. * misc.c (gnat_dwarf_name): New function. (LANG_HOOKS_DWARF_NAME): Define to gnat_dwarf_name. (gnat_post_options): Add comment about structural alias analysis. (gnat_parse_file): Do not call cgraph_optimize here. (LANG_HOOKS_WRITE_GLOBALS): Define to gnat_write_global_declarations. * trans.c (process_freeze_entity): Don't abort if we already have a non dummy GCC tree for a Concurrent_Record_Type, as it might legitimately have been elaborated while processing the associated Concurrent_Type prior to this explicit freeze node. (Identifier_to_gnu): Do not make a variable referenced in a SJLJ exception handler volatile if it is of variable size. (process_type): Remove bypass for types coming from a limited_with clause. (call_to_gnu): When processing the copy-out of a N_Type_Conversion GNAT actual, convert the corresponding gnu_actual to the real destination type when necessary. (add_decl_expr): Set the DECL_READONLY_ONCE_ELAB flag on variables originally TREE_READONLY but whose elaboration cannot be performed statically. Part of fix for F504-021. (tree_transform, subprogram cases): Change loops on formal parameters to call new Einfo function First_Formal_With_Extras. (gnat_to_gnu) <N_Op_Shift_Right_Arithmetic>: Ignore constant overflow stemming from type conversion for the lhs. (Attribute_to_gnu) <Attr_Alignment>: Also divide the alignment by the number of bits per unit for components of records. (gnat_to_gnu) <N_Code_Statement>: Mark operands addressable if needed. (Handled_Sequence_Of_Statements_to_gnu): Register the cleanup associated with At_End_Proc after the SJLJ EH cleanup. (Compilation_Unit_to_gnu): Call elaborate_all_entities only on the main compilation unit. (elaborate_all_entities): Do not retest type_annotate_only. (tree_transform) <N_Abstract_Subprogram_Declaration>: Process the result type of an abstract subprogram, which may be an itype associated with an anonymous access result (related to AI-318-02). (build_global_cdtor): Move to utils.c. (Case_Statement_to_gnu): Avoid adding the choice of a when statement if this choice is not a null tree nor an integer constant. (gigi): Run unshare_save_expr via walk_tree_without_duplicates on the body of elaboration routines instead of mark_unvisited. (add_stmt): Do not mark the tree. (add_decl_expr): Tweak comment. (mark_unvisited): Delete. (unshare_save_expr): New static function. (call_to_gnu): Issue an error when making a temporary around a procedure call because of non-addressable actual parameter if the type of the formal is by_reference. (Compilation_Unit_to_gnu): Invalidate the global renaming pointers after building the elaboration routine. From-SVN: r118331
2006-10-03* decl.c, utils.c: Fix comment typos.Kazu Hirata1-1/+1
From-SVN: r117405
2006-09-29decl.c (gnat_to_gnu_entity): Do not set "const" flag on "pure" Ada ↵Eric Botcazou1-3/+13
subprograms if SJLJ exceptions are used. * decl.c (gnat_to_gnu_entity) <E_Procedure>: Do not set "const" flag on "pure" Ada subprograms if SJLJ exceptions are used. * trans.c (Handled_Sequence_Of_Statements_to_gnu): Set TREE_NO_WARNING on the declaration node of JMPBUF_SAVE. * utils.c (init_gigi_decls): Set DECL_IS_PURE on the declaration nodes of Get_Jmpbuf_Address_Soft and Get_GNAT_Exception. * utils2.c (build_call_0_expr): Do not set TREE_SIDE_EFFECTS. From-SVN: r117299
2006-09-15re PR ada/15802 (ICE at expr.c:6764 (placeholder mechanism))Eric Botcazou1-10/+53
PR ada/15802 * decl.c (same_discriminant_p): New static function. (gnat_to_gnu_entity) <E_Record_Type>: When there is a parent subtype and we have discriminants, fix up the COMPONENT_REFs for the discriminants to make them reference the corresponding fields of the parent subtype after it has been built. From-SVN: r116981
2006-09-13re PR ada/28591 (ICE in splice_child_die, at dwarf2out.c:5513)Eric Botcazou1-7/+10
PR ada/28591 * decl.c (components_to_record): Defer emitting debug info for the record type associated with the variant until after we are sure to actually use it. From-SVN: r116928
2006-05-28decl.c, [...]: Fix comment typos.Kazu Hirata1-3/+3
* decl.c, env.c, gigi.h, init.c, initialize.c, raise-gcc.c, sem_ch13.adb, sysdep.c, targtyps.c, tb-alvxw.c, tracebak.c, trans.c, utils.c: Fix comment typos. Follow spelling conventions. * gnat_rm.texi, gnat_ugn.texi, : Fix typos. Follow spelling conventions. From-SVN: r114171
2006-02-17re PR ada/26315 (ACATS failures c43208b c85006a c85006d cd92001)Eric Botcazou1-0/+1
2006-02-17 Eric Botcazou <botcazou@adacore.com> PR ada/26315 * utils2.c (find_common_type): If both input types are BLKmode and have the same constant size, keep using the first one. * bindgen.adb: (Gen_Versions_Ada): Revert previous workaround. * decl.c (gnat_to_gnu_entity): Only check TREE_OVERFLOW for a constant. * misc.c (gnat_handle_option): New case for -Woverlength-strings. From-SVN: r111183
2006-02-15re PR ada/26096 (Ada bootstrap fails in g-alleve.adb)Richard Kenner1-71/+147
2006-02-13 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Olivier Hainque <hainque@adacore.com> Eric Botcazou <ebotcazou@adacore.com> * ada-tree.h: (TYPE_UNCHECKED_UNION_P): Deleted. * gigi.h (value_factor_p): Add prototype and description, now public. * decl.c (gnat_to_gnu_field): Don't attempt BLKmode to integral type promotion for field with rep clause if the associated size was proven to be in error. Expand comments describing attempts to use a packable type. (gnat_to_gnu_entity) <E_Signed_Integer_Subtype, E_Floating_Point_Subtype>: Inherit alias set of what we are making a subtype of to ensure conflicts amongst all subtypes in a hierarchy, necessary since these are not different types and pointers may actually designate any subtype in this hierarchy. (gnat_to_gnu_entity, case E_Record_Type): Always make fields for discriminants but put them into record only if not Unchecked_Union; pass flag to components_to_record showing Unchecked_Union. (make_dummy_type): Use UNION_TYPE only if Unchecked_Union and no components before variants; don't set TYPE_UNCHECKED_UNION_P. (components_to_record): New argument UNCHECKED_UNION. Remove special case code for Unchecked_Union and instead use main code with small changes. PR ada/26096 (gnat_to_gnu_entity) <E_Variable>: Do not initialize the aligning variable with the expression being built, only its inner field. * trans.c (Handled_Sequence_Of_Statements_to_gnu): Remove call to emit_sequence_entry_statements. (emit_sequence_entry_statements, body_with_handlers_p): Delete. (establish_gnat_vms_condition_handler): Move before Subprogram_Body_to_gnu. (Subprogram_Body_to_gnu): On VMS, establish_gnat_vms_condition_handler for a subprogram if it has a foreign convention or is exported. (Identifier_to_gnu): Manually unshare the DECL_INITIAL tree when it is substituted for a CONST_DECL. (tree_transform, case N_Aggregate): Remove code for UNION_TYPE and pass Etype to assoc_to_constructor. (assoc_to_constructor): New argument, GNAT_ENTITY; use it to ignore discriminants of Unchecked_Union. (TARGET_ABI_OPEN_VMS): Define to 0 if not defined, so that later uses don't need cluttering preprocessor directives. (establish_gnat_vms_condition_handler): New function. Establish the GNAT condition handler as current in the compiled function. (body_with_handlers_p): New function. Tell whether a given sequence of statements node is attached to a package or subprogram body and involves exception handlers possibly nested within inner block statements. (emit_sequence_entry_statements): New function, to emit special statements on entry of sequences when necessary. Establish GNAT condition handler in the proper cases for VMS. (Handled_Sequence_Of_Statements_to_gnu): Start block code with emit_sequence_entry_statements. * utils2.c (find_common_type): If both input types are BLKmode and have a constant size, use the smaller one. (build_simple_component_ref): Also match if FIELD and NEW_FIELD are the same. * utils.c (value_factor_p): Make public, to allow uses from other gigi units. (create_type_decl): Do not set the flag DECL_IGNORED_P for dummy types. (convert, case UNION_TYPE): Remove special treatment for unchecked unions. PR ada/18659 (update_pointer_to): Update variants of pointer types to unconstrained arrays by attaching the list of fields of the main variant. From-SVN: r111030
2006-02-06decl.c (gnat_substitute_in_type): Don't handle CHAR_TYPE.Roger Sayle1-1/+0
* decl.c (gnat_substitute_in_type): Don't handle CHAR_TYPE. From-SVN: r110647
2005-12-09decl.c (gnat_to_gnu_entity, [...]): Don't early expand pointer ↵Olivier Hainque1-43/+50
initialization values. 2005-12-05 Olivier Hainque <hainque@adacore.com> * decl.c (gnat_to_gnu_entity, renaming object case): Don't early expand pointer initialization values. Make a SAVE_EXPR instead. Add comments about the use and expansion of SAVE_EXPRs in the various possible renaming handling cases. (components_to_record, compare_field_bitpos): Sort by DECL_UID, not by abusing DECL_FCONTEXT. From-SVN: r108286
2005-11-15decl.c: Factor common code to build a storage type for an unconstrained ↵Thomas Quinot1-118/+159
object from a... 2005-11-14 Thomas Quinot <quinot@adacore.com> Olivier Hainque <hainque@adacore.com> Eric Botcazou <ebotcazou@adacore.com> * decl.c: Factor common code to build a storage type for an unconstrained object from a fat or thin pointer type and a constrained object type. (annotate_value): Handle BIT_AND_EXPR. (annotate_rep): Don't restrict the back annotation of inherited components to the type_annotate_only case. (gnat_to_gnu_entity) <E_Array_Type>: Do not invoke create_type_decl if we are not defining the type. <E_Record_Type>: Likewise. (gnat_to_gnu_entity) <object, renaming>: Adjust comments and structure to get advantage of the new maybe_stabilize_reference interface, to ensure that what we reference is indeed stabilized instead of relying on assumptions on what the stabilizer does. (gnat_to_gnu_entity) <E_Incomplete_Type>: If the entity is an incomplete type imported through a limited_with clause, use its non-limited view. (Has_Stdcall_Convention): New macro, to centralize the Windows vs others differentiation. (gnat_to_gnu_entity): Use Has_Stdcall_Convention instead of a spread mix of #if sections + explicit comparisons of convention identifiers. (gnat_to_gnu_entity) <E_Variable>: Decrement force_global if necessary before early-returning for certain types when code generation is disabled. (gnat_to_gnu_entity) <object>: Adjust comment attached to the nullification of gnu_expr we do for objects with address clause and that we are not defining. (elaborate_expression_1): Do not create constants when creating variables needed by the debug info: the dwarf2 writer considers that CONST_DECLs is used only to represent enumeration constants, and emits nothing for them. (gnat_to_gnu_entity) <object>: When turning a non-definition of an object with an address clause into an indirect reference, drop the initializing expression. Include "expr.h". (STACK_CHECK_BUILTIN): Delete. (STACK_CHECK_PROBE_INTERVAL): Likewise. (STACK_CHECK_MAX_FRAME_SIZE): Likewise. (STACK_CHECK_MAX_VAR_SIZE): Likewise. (gnat_to_gnu_entity): If gnat_entity is a renaming, do not mark the tree corresponding to the renamed object as ignored for debugging purposes. * trans.c (tree_transform, case N_Attribute_Reference, case Attr_Size & related): For a prefix that is a dereference of a fat or thin pointer, if there is an actual subtype provided by the front-end, use that subtype to build an actual type with bounds template. (tree_transform, case N_Free_Statement): If an Actual_Designated_Subtype is provided by the front-end, use that subtype to compute the size of the deallocated object. (gnat_to_gnu): When adding a statement into an elaboration procedure, check for a potential violation of a No_Elaboration_Code restriction. (maybe_stabilize_reference): New function, like gnat_stabilize_reference with extra arguments to control whether to recurse through non-values and to let the caller know if the stabilization has succeeded. (gnat_stabilize_reference): Now a simple wrapper around maybe_stabilize, for common uses without restriction on lvalues and without need to check for the success indication. (gnat_to_gnu, call_to_gnu): Adjust calls to gnat_stabilize_reference, to pass false instead of 0 as the FORCE argument which is a bool. (Identifier_to_gnu): Remove checks ensuring that an renamed object attached to a renaming pointer has been properly stabilized, as no such object is attached otherwise. (call_to_gnu): Invoke create_var_decl to create the temporary when the function uses the "target pointer" return mechanism. Reinstate conversion of the actual to the type of the formal parameter before any other specific treatment based on the passing mechanism. This turns out to be necessary in order for PLACEHOLDER substitution to work properly when the latter type is unconstrained. * gigi.h (build_unc_object_type_from_ptr): New subprogram, factoring a common pattern. (maybe_stabilize_reference): New function, like gnat_stabilize_reference with extra arguments to control whether to recurse through non-values and to let the caller know if the stabilization has succeeded. * utils2.c (gnat_build_constructor): Only sort the fields for possible static output of record constructor if all the components are constant. (gnat_build_constructor): For a record type, sort the list of field initializers in increasing bit position order. Factor common code to build a storage type for an unconstrained object from a fat or thin pointer type and a constrained object type. (build_unary_op) <ADDR_EXPR>: Always recurse down conversions between types variants, and process special cases of VIEW_CONVERT expressions as their NOP_EXPR counterpart to ensure we get to the CORRESPONDING_VARs associated with CONST_DECls. (build_binary_op) <MODIFY_EXPR>: Do not strip VIEW_CONVERT_EXPRs on the right-hand side. * utils.c (build_unc_object_type_from_ptr): New subprogram, factoring a common pattern. (convert) <VIEW_CONVERT_EXPR>: Return the inner operand directly if we are converting back to its original type. (convert) <JM input>: Fallthrough regular conversion code instead of extracting the object if converting to a type variant. (create_var_decl): When a variable has an initializer requiring code generation and we are at the top level, check for a potential violation of a No_Elaboration_Code restriction. (create_var_decl): call expand_decl for CONST_DECLs, to set MODE, ALIGN SIZE and SIZE_UNIT which we need for later back-annotations. * utils.c: (convert) <STRING_CST>: Remove obsolete code. <VIEW_CONVERT_EXPR>: Do not lift the conversion if the target type is an unchecked union. (pushdecl): Set DECL_NO_STATIC_CHAIN on imported nested functions. (convert) <VIEW_CONVERT_EXPR>: When the types have the same main variant, just replace the VIEW_CONVERT_EXPR. <UNION_TYPE>: Revert 2005-03-02 change. * repinfo.h, repinfo.ads: Add tcode for BIT_AND_EXPR. * repinfo.adb (Print_Expr, Rep_Value): Handle Bit_And_Expressions. From-SVN: r106961
2005-10-21re PR ada/22418 (Ada produces mis-match (non compatible) types in MODIFY_EXPR)Olivier Hainque1-1/+1
PR ada/22418 * decl.c (maybe_pad_type): Use proper bitsizetype for XVZ objects, as we create them to store a size in bits. From-SVN: r105743
2005-08-29re PR ada/21053 (Warnings from init.c)Arnaud Charlet1-4/+12
2005-08-29 Arnaud Charlet <charlet@adacore.com> Doug Rupp <rupp@adacore.com> * s-stalib.adb: Add missing pragma Warnings (On) to reenable Warnings when needed. (Inside_Elab_Final_Code): Moved to init.c to avoid having to keep this code in the GNAT run-time. * decl.c, fe.h: Replace GCC_ZCX by Back_End_Exceptions. PR ada/21053 * init.c (__gnat_error_handler [many]): Mark "msg" as const (__gnat_error_handler [HPUX]): Mark siginfo parameter as unused (__gnat_inside_elab_final_code): Moved here from Standard_Library and only defined for the compiler. __gnat_error_handler [VMS]: Adjust sigargs to account for PC & PSL. (__gnat_inum_to_ivec): Do not define this function on VxWorks when using RTPs because directly vectored Interrupt routines are not supported on this configuration. (getpid): Do not redefine this function on VxWorks when using RTPs because this primitive is well supported by the RTP libraries. (copy_msg): Correct the code that checks for buffer overflow. Discovered during code reading. From-SVN: r103606
2005-08-01* decl.c, utils.c: Fix comment typos.Kazu Hirata1-1/+1
From-SVN: r102630
2005-07-29* decl.c, init.c, initialize.c: Fix comment typos.Kazu Hirata1-1/+1
From-SVN: r102556
2005-07-20Make CONSTRUCTOR use VEC to store initializers.Giovanni Bajo1-10/+10
* c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-09decl.c (components_to_record): Use DECL_FCONTEXT instead of DECL_SECTION_NAME.Andrew Pinski1-4/+4
2005-07-09 Andrew Pinski <pinskia@physics.uc.edu> * decl.c (components_to_record): Use DECL_FCONTEXT instead of DECL_SECTION_NAME. (compare_field_bitpos): Likewise. From-SVN: r101834
2005-07-07decl.c (gnat_to_gnu_entity): Do not strip the padding type if the parameter ↵Eric Botcazou1-2/+6
is not passed by copy but... 2005-07-07 Eric Botcazou <ebotcazou@adacore.com> * decl.c (gnat_to_gnu_entity) <E_Procedure>: Do not strip the padding type if the parameter is not passed by copy but reference by default. From-SVN: r101693
2005-07-04decl.c (prepend_attributes): New case.Eric Botcazou1-0/+8
2005-07-04 Eric Botcazou <ebotcazou@adacore.com> * decl.c (prepend_attributes) <Pragma_Linker_Constructor>: New case. <Pragma_Linker_Destructor>: Likewise. * einfo.ads (Has_Gigi_Rep_Item): Document Pragma_Linker_Constructor and Pragma_Linker_Destructor. * gigi.h (attr_type): Add ATTR_LINK_CONSTRUCTOR and ATTR_LINK_DESTRUCTOR. (static_ctors, static_dtors): New variables. * misc.c (gnat_expand_body): Output current function as constructor and destructor if requested. * par-prag.adb: Add processing for pragma Linker_Constructor and Linker_Destructor. * sem_prag.adb (Find_Unique_Parameterless_Procedure): New function extracted from Check_Interrupt_Or_Attach_Handler. (Check_Interrupt_Or_Attach_Handler): Invoke it. Implement pragma Linker_Constructor and Linker_Destructor with the help of Find_Unique_Parameterless_Procedure. Replace Name_Alias with Name_Target for pragma Linker_Alias. * snames.h, snames.ads, snames.adb: Add Name_Linker_Constructor and Name_Linker_Destructor. Add Pragma_Linker_Constructor and Pragma_Linker_Destructor. * snames.adb: Remove Name_Alias. * trans.c: Include cgraph.h. (build_global_cdtor): New function. (Compilation_Unit_to_gnu): Build global constructor and destructor if needed. (tree_transform) <N_Identifier>: Substitute renaming of view-conversions of objects too. (addressable_p) <COMPONENT_REF>: Unconditionally test DECL_NONADDRESSABLE_P on STRICT_ALIGNMENT platforms. * utils.c (process_attributes) <ATTR_LINK_ALIAS>: Do not assemble the variable if it is external. (static_ctors, static_dtors): New global variables. (process_attributes) <ATTR_LINK_CONSTRUCTOR>: New case. <ATTR_LINK_DESTRUCTOR>: Likewise. (end_subprog_body): Chain function as constructor and destructor if requested. * exp_util.adb (Force_Evaluation): Unconditionally invoke Remove_Side_Effects with Variable_Ref set to true. (Remove_Side_Effects): Handle scalar types first. Use a renaming for non-scalar types even if Variable_Ref is true and for class-wide expressions. From-SVN: r101576
2005-07-01Update FSF addressR. Kelley Cook1-2/+2
From-SVN: r101492
2005-06-16re PR ada/20515 ("stdcall" imports are not handled correctly)Eric Botcazou1-20/+38
2005-06-10 Eric Botcazou <ebotcazou@adacore.com> Olivier Hainque <hainque@adacore.com> Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Pascal Obry <obry@adacore.com> * gigi.h: (build_allocator): Add arg IGNORE_INIT_TYPE. * trans.c (call_to_gnu): Issue a warning for users of Starlet when making a temporary around a procedure call because of non-addressable actual parameter. (process_freeze_entity): If entity is a private type, capture size information that may have been computed for the full view. (tree_transform, case N_Allocator): If have initializing expression, check type for Has_Constrained_Partial_View and pass that to build_allocator. (tree_transform, case N_Return_Statement): Pass extra arg to build_allocator. * decl.c (annotate_value): Remove early return if -gnatR is not specified. (gnat_to_gnu_field): Don't make a packable type for a component clause if the position is byte aligned, the field is aliased, and the clause size isn't a multiple of the packable alignment. It serves no useful purpose packing-wise and would be rejected later on. (gnat_to_gnu_entity, case object): Pass extra arg to build_allocator. PR ada/20515 (gnat_to_gnu_entity): Remove use of macro _WIN32 which is wrong in the context of cross compilers. We use TARGET_DLLIMPORT_DECL_ATTRIBUTES instead. (create_concat_name): Idem. From-SVN: r101070
2005-05-29cal.c, [...]: Fix comment typos.Kazu Hirata1-3/+3
* cal.c, decl.c, init.c, raise.c, trans.c, utils2.c: Fix comment typos. * gnat_rm.texi, gnat_ugn.texi: Fix typos. From-SVN: r100312
2005-04-01adaint.c, [...]: Fix comment typos.Kazu Hirata1-7/+7
* adaint.c, cal.c, decl.c, gigi.h, gmem.c, init.c, link.c, raise.c, tracebak.c, trans.c, utils2.c, utils.c: Fix comment typos. From-SVN: r97369
2005-03-30tree.def (FILE_TYPE): Removed.Tom Tromey1-1/+0
gcc: * tree.def (FILE_TYPE): Removed. * typeclass.h (enum type_class): Removed file_type_class. * dwarf2out.c (is_base_type): Updated. (gen_type_die): Likewise. * dbxout.c (dbxout_type): Updated. * builtins.c (type_to_class): Updated. * tree.c (type_contains_placeholder_1): Updated. * config/sparc/sparc.c (sparc_type_code): Updated. * config/ia64/ia64.c (hfa_element_mode): Updated. * expr.c (count_type_elements): Updated. * stor-layout.c (layout_type): Updated. * tree-inline.c (remap_type): Updated. * tree-pretty-print.c (dump_generic_node): Updated. gcc/java: * decl.c (gnat_substitute_in_type): Don't handle FILE_TYPE. From-SVN: r97282
2005-03-29decl.c (gnat_to_gnu_entity): Rework comment.Eric Botcazou1-7/+6
2005-03-29 Eric Botcazou <ebotcazou@adacore.com> * decl.c (gnat_to_gnu_entity) <E_Variable>: Rework comment. * trans.c (tree_transform) <N_Identifier>: Use correct predicates. From-SVN: r97191
2005-03-18ada-tree.h: (DECL_RENAMING_GLOBAL_P): New predicate.Eric Botcazou1-27/+14
2005-03-17 Eric Botcazou <ebotcazou@adacore.com> * ada-tree.h: (DECL_RENAMING_GLOBAL_P): New predicate. (DECL_RENAMED_OBJECT): New accessor macro. (SET_DECL_RENAMED_OBJECT): New setter macro. * decl.c (gnat_to_gnu_entity) <E_Variable>: Stabilize the renamed object in all cases. Attach the renamed object to the VAR_DECL. (gnat_to_gnu_field): Do not lift the record wrapper if the size of the field is not prescribed. * misc.c (gnat_handle_option): Handle -gnatO separately. (gnat_print_decl) <VAR_DECL>: New case. Print the DECL_RENAMED_OBJECT node. * lang.opt: Declare separate -gnatO option. * trans.c (tree_transform) <N_Identifier>: If the object is a renaming pointer, replace it with the renamed object. <N_Validate_Unchecked_Conversion>: Warn for a conversion to a fat pointer type if the source is not a fat pointer type whose underlying array has the same non-zero alias set as that of the destination array. From-SVN: r96660
2005-03-15re PR ada/19900 (ACATS c391002 c432002 ICE categorize_ctor_elements_1)Eric Botcazou1-109/+154
2005-03-08 Eric Botcazou <ebotcazou@adacore.com> Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Nicolas Setton <setton@adacore.com> Ed Schonberg <schonberg@adacore.com> PR ada/19900 PR ada/19408 PR ada/19140 PR ada/20255 * decl.c (gnat_to_gnu_field): Reject aliased components with a representation clause that prescribes a size not equal to the rounded size of their types. (gnat_to_gnu_entity, case E_Component): Always look at Original_Record_Component if Present and not the entity. (gnat_to_gnu_entity, case E_Record_Subtype): Rework handling of subtypes of tagged extension types by not making field for components that are inside the parent. (gnat_to_gnu_entity) <E_Record_Type>: Fix typo in the alignment formula (gnat_to_gnu_entity) <E_Variable>: Do not convert again the expression to the type of the object when the object is constant. Reverse defer_debug_incomplete_list before traversing it, so that trees are processed in the order at which they were added to the list. This order is important when using the stabs debug format. If we are deferring the output of debug information, also defer this output for a function return type. When adding fields to a record, prevent emitting debug information for incomplete records, emit the information only when the record is complete. (components_to_record): New parameter defer_debug. (gnat_to_gnu_entity, case E_Array_Subtype): Call copy_alias_set. (gnat_to_gnu_field_decl): New function. (substitution_list, annotate_rep): Call it. (gnat_to_gnu_entity, case E_Record_Subtype): Likewise. (gnat_to_gnu_entity, case E_Record_Type): Likewise. No longer update discriminants to not be a COMPONENT_REF. (copy_alias_set): Strip padding from input type; also handle unconstrained arrays properly. * gigi.h (write_record_type_debug_info): New function. Convert to use ANSI-style prototypes. Remove unused declarations for emit_stack_check, elab_all_gnat and set_second_error_entity. (gnat_to_gnu_field_decl): New decl. * utils.c (write_record_type_debug_info): New function. (finish_record_type): Delegate generation of debug information to write_record_type_debug_info. (update_pointer_to): Remove unneeded calls to rest_of_decl_compilation. (update_pointer_to): Fix pasto. (convert) <UNION_TYPE>: Accept slight type variations when converting to an unchecked union type. * exp_ch13.adb (Expand_N_Freeze_Entity): If Freeze_Type returns True, replace the N_Freeze_Entity with a null statement. * freeze.adb (Freeze_Expression): If the freeze nodes are generated within a constrained subcomponent of an enclosing record, place the freeze nodes in the scope stack entry for the enclosing record. (Undelay_Type): New Subprogram. (Set_Small_Size): Pass T, the type to modify; all callers changed. (Freeze_Entity, Freeze_Record_Type): Change the way we handle types within records; allow them to have freeze nodes if their base types aren't frozen yet. * sem_ch3.adb (Derived_Type_Declaration): New predicate Comes_From_Generic, to recognize accurately that the parent type in a derived type declaration can be traced back to a formal type, because it is one or is derived from one, or because its completion is derived from one. (Constrain_Component_Type): If component comes from source and has no explicit constraint, no need to constrain in in a subtype of the enclosing record. (Constrain_Access, Constrain_Array): Allow itypes to be delayed. Minor change to propagate Is_Ada_2005 flag * trans.c (gnat_to_gnu, case N_Aggregate): Verify that Expansion_Delayed is False. (assoc_to_constructor): Ignore fields that have a Corresponding_Discriminant. (gnat_to_gnu) <N_Return_Statement>: Restructure. If the function returns "by target", dereference the target pointer using the type of the actual return value. <all>: Be prepared for a null gnu_result. (processed_inline_subprograms): Check flag_really_no_inline instead of flag_no_inline. (set_second_error_entity): Remove unused function. (gnat_to_gnu, case N_Selected_Component): Call gnat_to_gnu_field_decl. (assoc_to_constructor): Likewise. From-SVN: r96492
2005-02-10Fix for c330001 - PR ada/19386Eric Botcazou1-16/+43
2005-02-09 Eric Botcazou <ebotcazou@adacore.com> Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Fix for c330001 - PR ada/19386 * decl.c: (gnat_to_gnu_field): Do not necessarily invoke make_packable_type on the field if Pragma Component_Alignment (Storage_Unit). (gnat_to_gnu_entity, case object): Do not treat a renaming that has side-effects as if it were a constant; also make SAVE_EXPR to protect side-effects. (gnat_to_gnu_entity, case E_Record_Subtype): If have _Parent, make a UNION_TYPE. (make_dummy_type): Set TYPE_UNCHECKED_UNION_P. (components_to_record): Test it. Fix improper usage of REFERENCE_CLASS_P. * utils2.c (build_binary_op, case MODIFY_EXPRP): Treat UNION_TYPE as RECORD_TYPE. * utils2.c: Minor reformatting. * utils.c (convert, case UNION_TYPE): Check TYPE_UNCHECKED_UNION; handle other cases like RECORD_TYPE. * utils.c (gnat_pushdecl): Set TREE_NO_WARNING. From-SVN: r94812
2005-01-03decl.c (compatible_signatures_p): New function.Arnaud Charlet1-3/+72
* decl.c (compatible_signatures_p): New function. The intended purpose is to check if two function signatures for a call-site and a callee are compatible enough for the call to be valid. The underlying purpose is to check if a call to a mapped builtin is using the right interface. The current code actually does not check antyhing - this a placeholder for future refinements. (gnat_to_gnu_entity) <E_Subprogram_Call>: Add preliminary bits to handle builtin calls for convention Intrinsic. * gigi.h (builtin_decl_for): Declare (new function). * utils.c (gnat_install_builtins): Install the target specific builtins. (builtin_decl_for): New function, provide a dummy body for now. From-SVN: r92833
2004-12-09tree.def (SET_TYPE): Remove.Nathan Sidwell1-1/+0
* tree.def (SET_TYPE): Remove. (CONSTRUCTOR): Update description. * builtins.c (type_to_class) Remove SET_TYPE case. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (is_base_type): Likewise. (gen_set_type_die): Remove. (gen_type_die): Remove SET_TYPE case. * expr.c (count_type_elements): Likewise. (mostly_zeroes_p): Likewise. (store_constructor): Likewise. * print_tree.c (print_node): Likewise. * stor-layout.c (layout_type): Likewise. * tree-browser.c (browse_tree): Likewise. * tree-inline.c (remap_type): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree.c (type_contains_plaeholder_1, type_hash_eq, variably_modified_type_p, initializer_zerop): Likewise. * tree.h (SET_OR_ARRAY_CHECK): Remove. (AGGREGATE_TYPE_P): Remove SET_TYPE check. (TYPE_DOMAIN): Use ARRAY_TYPE_CHECK. * typeclass.h (enum type_class): Remove set_type_class. * varasm.c (const_hash_1): Remove SET_TYPE case. (compare_constant, copy_constant, output_constant): Likewise. * config/i386/i386.c (classify_argument): Likewise. * config/ia64/ia64.c (hfa_element_mode): Likewise. * config/sparc/sparc.c (sparc_type_code): Likewise. * ada/decl.c (gnat_substitute_in_type): Remove SET_TYPE case. From-SVN: r91931
2004-12-08decl.c (maybe_pad_type): Use TYPE_SIZE_UNIT of the input type for ↵Arnaud Charlet1-7/+11
TYPE_SIZE_UNIT of result type if... * decl.c (maybe_pad_type): Use TYPE_SIZE_UNIT of the input type for TYPE_SIZE_UNIT of result type if SIZE is not specified. (make_aligning_type): Pass -1 as ADDRESSABLE to prevent the creation of a bitfield, which we know is useless and causes trouble because of alignment implications. * utils.c (create_var_decl): Set DECL_COMMON again on targets without BSS sections. (process_attributes): Clear DECL_COMMON again when a section attribute is present. (finish_record_type): Independently track if RECORD_TYPE has SIZE and/or SIZE_UNIT already set and use to compute final SIZE and SIZE_UNIT. (create_field_decl): Special case ADDRESSABLE negative to mean "no bitfield creation", to be used by make_aligning_type. Don't restrict bitfield creation to !ADDRESSABLE any more, as some BLKmode fields claimed addressable still have to be bitfields. Use value_factor_p instead of a raw binop construction to check for the position's alignment. From-SVN: r91879
2004-11-19a-exexpr.adb (Others_Value, [...]): New variables...Arnaud Charlet1-14/+27
* 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
2004-10-27decl.c (gnat_to_gnu_field): Use the type of the inner object for a JM type ↵Eric Botcazou1-15/+19
only if... 2004-10-26 Eric Botcazou <ebotcazou@act-europe.fr> * decl.c (gnat_to_gnu_field): Use the type of the inner object for a JM type only if its size matches that of the wrapper. When a size is prescribed and the field is not aliased, remove the wrapper of a JM type only if the size is not greater than that of the packed array. (gnat_to_gnu_entity): Change the extension of packed array wrappers from LJM to JM. From-SVN: r89647
2004-10-04cuintp.c, [...]: Use gcc_assert and gcc_unreachable.Richard Kenner1-67/+53
2004-10-04 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * cuintp.c, decl.c, utils2.c: Use gcc_assert and gcc_unreachable. * trans.c (assoc_to_constructor): Fix unused var warning if no checking. (gnat_gimplify_expr, case ADDR_EXPR): Fix error in last change. Use gcc_assert and gcc_unreachable. * decl.c (gnat_to_gnu_entity, case object): Check and process a specified alignment before validating size. (gnat_to_gnu_entity) <E_Modular_Integer_Subtype>: Create a stripped-down declaration for the type of the inner field when making a JM type. * utils.c (finish_record_type): Do not compute the size in units incrementally. Instead compute it once for the rep clause case. Use gcc_assert and gcc_unreachable. From-SVN: r88493
2004-09-21decl.c (gnat_to_gnu_entity): Check for a dummy designated type via TYPE_MODE ↵Olivier Hainque1-1/+1
instead of COMPLETE_TYPE_P. 2004-09-21 Olivier Hainque <hainque@act-europe.fr> * decl.c (gnat_to_gnu_entity) <E_General_Access_Type>: Check for a dummy designated type via TYPE_MODE instead of COMPLETE_TYPE_P. This ensures proper handling of types with rep clauses, which might have their TYPE_SIZE set already. From-SVN: r87807
2004-09-21decl.c (gnat_to_gnu_type, [...]): Wrap modular packed array types in both ↵Robert Dewar1-15/+24
little- and big-endian cases. 2004-09-21 Robert Dewar <dewar@gnat.com> * decl.c (gnat_to_gnu_type, case E_Modular_Integer_Type): Wrap modular packed array types in both little- and big-endian cases. This change ensures that we no longer count on the unused bits being initialized for such types (and in particular ensures that equality testing will only read the relevant bits). Change name TYPE_LEFT_JUSTIFIED_MODULAR_P to TYPE_JUSTIFIED_MODULAR_P These changes mean that we no longer need to initialize small packed arrays. (gnat_to_gnu_entity) <E_Record_Subtype>: Apply the same optimization to an LJM field as to its parent field. * ada-tree.h:, trans.c, utils.c, utils2.c: Change name TYPE_LEFT_JUSTIFIED_MODULAR_P to TYPE_JUSTIFIED_MODULAR_P From-SVN: r87806
2004-09-17alias.c (find_base_decl): Remove unreachable case '3' block.Jeffrey D. Oldham1-4/+3
2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-13[multiple changes]Arnaud Charlet1-47/+63
2004-09-09 Vincent Celier <celier@gnat.com> * a-direct.ads: Add pragma Ada_05 (Directory_Entry_Type): Give default value to component Kind to avoid not initialized warnings. * a-direct.adb (Current_Directory): Remove directory separator at the end. (Delete_Directory, Delete_Tree): Raise Name_Error if Directory is not an existing directory. (Fetch_Next_Entry): Give default value to variable Kind to avoid warning (Size (String)): Function C_Size returns Long_Integer, not File_Size. Convert the result to File_Size. * prj.ads: (Project_Error): New exception * prj-attr.adb: Except in procedure Initialize, Fail comes from Prj.Com, not from Osint. (Attrs, Package_Attributes): Tables moved to private part of spec (Add_Attribute, Add_Unknown_Package): Moved to new child package Prj.Attr.PM. (Register_New_Package (Name, Attributes), Register_New_Attribute): Raise Prj.Project_Error after call to Fail. (Register_New_Package (Name, Id)): Set Id to Empty_Package after calling Fail. Check that package name is not already in use. * prj-attr.ads: Comment updates to indicate that all subprograms may be used by tools, not only by the project manager, and to indicate that exception Prj.Prj_Error may be raised in case of problem. (Add_Unknown_Package, Add_Attribute): Moved to new child package Prj.Attr.PM. (Attrs, Package_Attributes): Table instantiations moved from the body to the private part to be accessible from Prj.Attr.PM body. * prj-dect.adb (Parse_Package_Declaration): Call Add_Unknown_Package from new package Prj.Attr.PM. (Parse_Attribute_Declaration): Call Add_Attribute from new package Prj.Attr.PM. * Makefile.in: Add prj-attr-pm.o to gnatmake object list * gnatbind.adb (Gnatbind): Correct warning message (Elaboration_Check instead of Elaboration_Checks). * a-calend.adb: Minor reformatting 2004-09-09 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * gigi.h (maybe_pad_type): New declaration. (create_subprog_type): New arg RETURNS_BY_TARGET_PTR. * ada-tree.h: (TYPE_RETURNS_BY_TARGET_PTR_P): New macro. * cuintp.c: Convert to use buildN. * decl.c (maybe_pad_type): No longer static. (gnat_to_gnu_entity, case E_Function): Handle case of returning by target pointer. Convert to use buildN. * trans.c (call_to_gnu): Add arg GNU_TARGET; support TYPE_RETURNS_BY_TARGET_PTR_P. All callers changed. (gnat_to_gnu, case N_Assignment_Statement): Call call_to_gnu if call on RHS. (gnat_to_gnu, case N_Return): Handle TYPE_RETURN_BY_TARGET_PTR_P. (gnat_gimplify_expr, case ADDR_EXPR): New case. Convert to use buildN. * utils2.c (gnat_build_constructor): Also set TREE_INVARIANT and TREE_READONLY for const. Convert to use buildN. * utils.c (create_subprog_type): New operand RETURNS_BY_TARGET_PTR. (create_var_decl): Refine when TREE_STATIC is set. Convert to use buildN. 2004-09-09 Gary Dismukes <dismukes@gnat.com> * gnat_ugn.texi: Delete text relating to checking of ali and object consistency. * a-except.adb (Rcheck_*): Add pragmas No_Return for each of these routines. 2004-09-09 Jose Ruiz <ruiz@act-europe.fr> * gnat_ugn.texi: Add Detect_Blocking to the list of configuration pragmas recognized by GNAT. * gnat_rm.texi: Document pragma Detect_Blocking. * s-solita.adb (Timed_Delay_T): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation. * s-taprob.adb (Lock): When pragma Detect_Blocking is active increase the protected action nesting level. (Lock_Read_Only): When pragma Detect_Blocking is active increase the protected action nesting level. (Unlock): When pragma Detect_Blocking is active decrease the protected action nesting level. * s-taskin.adb (Initialize_ATCB): Initialize to 0 the Protected_Action_Nesting. * s-taskin.ads: Adding the field Protected_Action_Nesting to the Common_ATCB record. It contains the dynamic level of protected action nesting for each task. It is needed for checking whether potentially blocking operations are called from protected operations. (Detect_Blocking): Adding a Boolean constant reflecting whether pragma Detect_Blocking is active or not in the partition. * s-tasren.adb (Call_Simple): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation. (Task_Entry_Call): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation. (Timed_Task_Entry_Call): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation. * s-tassta.adb (Abort_Tasks): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation. * s-tpoben.adb (Lock_Entries): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation, and increase the protected action nesting level. (Lock_Read_Only_Entries): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation, and increase the protected action nesting level. (Unlock_Entries): When pragma Detect_Blocking is active decrease the protected action nesting level. * s-tposen.adb (Lock_Entry): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation, and increase the protected action nesting level. (Lock_Read_Only_Entry): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation, and increase the protected action nesting level. (Protected_Single_Entry_Call): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation. (Timed_Protected_Single_Entry_Call): When pragma Detect_Blocking is active, raise Program_Error if called from a protected operation. (Unlock_Entry): When pragma Detect_Blocking is active decrease the protected action nesting level. * sem_util.adb (Check_Potentially_Blocking_Operation): Remove the insertion of the statement raising Program_Error. The run time contains the required machinery for handling that. * sem_util.ads: Change comment associated to procedure Check_Potentially_Blocking_Operation. This procedure does not insert a call for raising the exception because that is currently done by the run time. * raise.h (__gnat_set_globals): Pass the detect_blocking parameter. * init.c: Add the global variable __gl_detect_blocking that indicates whether pragma Detect_Blocking is active (1) or not (0). Needed for making the pragma available at run time. (__gnat_set_globals): Pass and update the detect_blocking parameter. * lib-writ.adb (Write_ALI): Set the DB flag in the ali file if pragma Detect_Blocking is active. * lib-writ.ads: Document the Detect_Blocking flag (DB) in ali files. * ali.adb (Scan_ALI): Set the Detect_Blocking value to true if the flag DB is found in the ali file. Any unit compiled with pragma Detect_Blocking active forces its effect in the whole partition. * a-retide.adb (Delay_Until): Raise Program_Error if pragma Detect_Blocking is active and delay is called from a protected operation. * bindgen.adb (Gen_Adainit_Ada): When generating the call to __gnat_set_globals, pass 1 as Detect_Blocking parameter if pragma Detect_Blocking is active (0 otherwise). (Gen_Adainit_C): When generating the call to __gnat_set_globals, pass 1 as Detect_Blocking parameter if pragma Detect_Blocking is active (0 otherwise). 2004-09-09 Thomas Quinot <quinot@act-europe.fr> * gnat_rm.texi: Rename GNAT.Perfect_Hash.Generators to GNAT.Perfect_Hash_Generators, and remove the empty GNAT.Perfect_Hash package. * s-parint.ads, s-parint.adb (Get_RAS_Info): New subprogram. (Register_Receiving_Stub): Add Subp_Info formal parameter. Update API in placeholder implemetation of s-parint to reflect changes in distribution runtime library. * sem_ch3.adb (Expand_Derived_Record): Rename to Expand_Record_Extension. * sem_disp.adb (Check_Controlling_Formals): Improve error message for primitive operations of potentially distributed object types that have non-controlling anonymous access formals. * sem_dist.ads, sem_dist.adb (Build_RAS_Primitive_Specification): New subprogram. New implementation of expansion for remote access-to-subprogram types, based on the RACW infrastructure. This version of sem_dist is compatible with PolyORB/DSA as well as GLADE. * sem_prag.adb (Analyze_Pragma, case Pragma_Asynchronous): For a pragma Asynchrronous that applies to a remote access-to-subprogram type, mark the underlying RACW type as asynchronous. * link.c: FreeBSD uses GNU ld: set __gnat_objlist_file_supported and __gnat_using_gnu_linker to 1. * Makefile.rtl, impunit.adb, g-perhas.ads, g-pehage.ads, g-pehage.adb: Rename GNAT.Perfect_Hash.Generators to GNAT.Perfect_Hash_Generators, and remove the empty GNAT.Perfect_Hash package. * atree.adb: Minor reformatting * exp_ch3.adb (Expand_Derived_Record): Rename to Expand_Record_Extension. (Build_Record_Init_Proc.Build_Assignment): The default expression in a component declaration must remain attached at that point in the tree so New_Copy_Tree copies it if the enclosing record type is derived. It is therefore necessary to take a copy of the expression when building the corresponding assignment statement in the init proc. As a side effect, in the case of a derived record type, we now see the original expression, without any rewriting that could have occurred during expansion of the ancestor type's init proc, and we do not need to go back to Original_Node. * exp_ch3.ads (Expand_Derived_Record): Rename to Expand_Record_Extension. * exp_dist.ads, exp_dist.adb (Underlying_RACW_Type): New subprogram. Returns the RACW type used to implement a remote access-to-subprogram type. (Add_RAS_Proxy_And_Analyze, Build_Remote_Subprogram_Proxy_Type): New subprograms. Used to create a proxy tagged object for a remote subprogram. The proxy object is used as the designated object for RAS values on the same partition (unless All_Calls_Remote applies). (Build_Get_Unique_RP_Call): New subprogram. Build a call to System.Partition_Interface.Get_Unique_Remote_Pointer. (Add_RAS_Access_TSS, Add_RAS_Dereference_TSS): Renamed from Add_RAS_*_Attribute. (Add_Receiving_Stubs_To_Declarations): Generate a table of local subprograms. New implementation of expansion for remote access-to-subprogram types, based on the RACW infrastructure. * exp_dist.ads (Copy_Specification): Update comment to note that this function can copy the specification from either a subprogram specification or an access-to-subprogram type definition. 2004-09-09 Ed Schonberg <schonberg@gnat.com> * sem_type.adb (Disambiguate): Handle properly an accidental ambiguity in an instance, between an explicit subprogram an one inherited from a type derived from an actual. * exp_ch6.adb (Expand_N_Subprogram_Body): If polling is enabled, do not add a polling call if the subprogram is to be inlined by the back-end, to avoid repeated calls with multiple inlinings. * checks.adb (Apply_Alignment_Check): If the expression in the address clause is a call whose name is not a static entity (e.g. a dispatching call), treat as dynamic. 2004-09-09 Robert Dewar <dewar@gnat.com> * g-trasym.ads: Minor reformatting * exp_ch3.adb (Component_Needs_Simple_Initialization): Don't except packed arrays, since unused bits are expected to be zero for a comparison. 2004-09-09 Eric Botcazou <ebotcazou@act-europe.fr> * exp_pakd.ads: Fix an inacurracy and a couple of typos in the head comment. 2004-09-09 Pascal Obry <obry@gnat.com> * mdll.ads, mdll.adb (Build_Dynamic_Library): New parameter Map_File to enable map file generation. Add the right option to generate the map file if Map_File is set to True. * gnatdll.adb (Gen_Map_File): New variable. (Syntax): Add info about new -m (Map_File) option. (Parse_Command_Line): Add support for -m option. (gnatdll): Pass Gen_Map_File to Build_Dynamic_Library calls. Minor reformatting. 2004-09-09 Laurent Pautet <pautet@act-europe.fr> * gnatls.adb: Add a very verbose mode -V. Such mode is required by the new gnatdist implementation. Define a subpackage isolating the output routines specific to this verbose mode. 2004-09-09 Joel Brobecker <brobecker@gnat.com> * Makefile.rtl: (GNATRTL_NONTASKING_OBJS): Add g-dynhta. * gnat_ugn.texi (Main Subprograms): Fix typo. Deduced, not deducted. 2004-09-09 Cyrille Comar <comar@act-europe.fr> * opt.adb (Set_Opt_Config_Switches): Use Ada_Version_Runtime to compile internal unit. * opt.ads: Add Ada_Version_Runtime constant used to decide which version of the language is used to compile the run time. 2004-09-09 Arnaud Charlet <charlet@act-europe.fr> * sem_util.adb (Requires_Transient_Scope): Re-enable handling of variable length temporaries for function return now that the back-end and gigi support it. From-SVN: r87435
2004-09-01[multiple changes]Arnaud Charlet1-11/+23
2004-08-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * misc.c (gnat_print_type): Use TYPE_RM_SIZE_NUM. * trans.c (struct stmt_group): Delete field GLOBAL. (gnat_init_stmt_group): Do not initialize it. (call_to_gnu): Use save_expr, not protect_multiple_eval. (Exception_Handler_to_gnu_sjlj): Call build_int_cst, not build_int_2 (gnat_to_gnu, case N_Character_Literal, N_String_Literal): Likewise. (gnat_to_gnu, case N_Compilation_Unit): Do not set GLOBAL in stmt group. (start_stmt_group): Likewise. (add_stmt, add_decl_expr): Rework handling of global DECL_EXPRs. * utils2.c (ggc.h): Include. (build_call_raise): Call build_int_cst, not build_int_2. * utils.c (gnat_init_decl_processing): Fix arg to build_common_tree_nodes. (create_subprog_type): Do not use SET_TYPE_CI_CO_LIST. (gnat_define_builtin): Set built_in_decls. (init_gigi_decls): Call build_int_cst, not build_int_2. * ada-tree.h (struct lang_decl, struct lang_type): Field is type tree. (GET_TYPE_LANG_SPECIFIC, SET_TYPE_LANG_SPECIFIC): New macros. (GET_DECL_LANG_SPECIFIC, SET_DECL_LANG_SPECIFIC): Likewise. (TYPE_CI_CO_LIST, SET_TYPE_CI_CO_LIST, TYPE_MODULE, SET_TYPE_MODULE): Use them. (TYPE_INDEX_TYPE, SET_TYPE_INDEX_TYPE, TYPE_DIGITS_VALUE): Likewise. (SET_TYPE_DIGITS_VALUE, TYPE_UNCONSTRAINED_ARRAY): Likewise. (SET_TYPE_UNCONSTRAINED_ARRAY, TYPE_ADA_SIZE, SET_TYPE_ADA_SIZE): Likewise. (TYPE_ACTUAL_BOUNDS, SET_TYPE_ACTUAL_BOUNDS): Likewise. (DECL_CONST_CORRESPONDING_VAR, SET_DECL_CONST_CORRESPONDING_VAR): Likewise. (DECL_ORIGINAL_FIELD, SET_DECL_ORIGINAL_FIELD): Likewise. (TYPE_RM_SIZE_INT, TYPE_RM_SIZE_ENUM, SET_TYPE_RM_SIZE_ENUM): Deleted. (TYPE_RM_SIZE_NUM): New macro. (TYPE_RM_SIZE): Modified to use above. * cuintp.c: (build_cst_from_int): New function. (UI_To_gnu): Use it. * decl.c (gnat_to_gnu_entity): Use TYPE_RM_SIZE_NUM. (make_type_from_size): Avoid changing TYPE_UNSIGNED of a type. (gnat_substitute_in_type, case ARRAY_TYPE): If old had a MIN_EXPR for the size, copy it into new. 2004-08-31 Robert Dewar <dewar@gnat.com> * exp_ch6.adb (Expand_Call): Properly handle validity checks for packed indexed component where array is an IN OUT formal. This generated garbage code previously. * gnat_ugn.texi: Document -fverbose-asm * gnat-style.texi: Minor updates (note that boolean constants and variables are joined with AND/OR rather than short circuit forms). 2004-08-31 Ed Schonberg <schonberg@gnat.com> * exp_util.adb (Safe_Unchecked_Type_Conversion): Conversion is safe if it is an upward conversion of an untagged type with no representation change. 2004-08-31 Thomas Quinot <quinot@act-europe.fr> * rtsfind.ads: Move RCI_Subp_Info and RCI_Subp_Info_Array to System.Partition_Interface. * checks.adb (Apply_Access_Checks): Do not generate checks when expander is not active (but check for unset reference to prefix of dereference). * sem_prag.adb (Analyze_Pragma, case Pragma_Debug): Uniformly rewrite pragma Debug as an if statement with a constant condition, for consistent treatment of entity references contained within the enclosed procedure call. 2004-08-31 Vincent Celier <celier@gnat.com> * bindgen.adb: (Set_EA_Last): New procedure (Gen_Exception_Table_Ada, Gen_Exception_Table_C): Use new procedure Set_EA_Last. (Gen_Adafinal_Ada): If no finalization, adafinal does nothing (Gen_Output_File_Ada): Always call Gen_Adafinal_Ada, so that SAL can be linked without errors. (Gen_Exception_Table_Ada): Correct bugs when generating code for arrays ST and EA. (Gen_Exception_Table_C): Correct same bugs * vms_data.ads: Add new qualifier /VERBOSE_ASM to GCC_Switches * g-os_lib.adb (Normalize_Pathname.Get_Directory): When Dir is empty, on Windows, make sure that the drive letter is in upper case. * g-os_lib.ads (Normalize_Pathname): Add a comment to indicate that on Windows, when the drive letter is added and Case_Sensitive is True, the drive letter is forced to upper case. * mlib-tgt-irix.adb (Build_Dynamic_Library): Transfer all -lxxx options to Options_2 for the call to MLib.Utl.Gcc. * bld.adb (Put_Include_Project): Use '/', not '\' on Windows as directory separator when defining BASE_DIR. 2004-08-19 Pascal Obry <obry@gnat.com> * gprcmd.adb (Extend): Do not output trailing directory separator. This is not needed and it confuses Windows GNU/make which does not report directory terminated by a slash as a directory. (gprcmd): Idem for "pwd" internal command. * Makefile.generic: Use __GPRCOLON__ instead of pipe character in target names rewrite to fix regressions with recent version of GNU/make. Starting with GNU/make 3.80 the pipe character was not handled properly anymore. From-SVN: r86883