* gcc-interface/gigi.h (record_builtin_type): Adjust comment.
(tree create_type_decl): Likewise.
(create_var_decl_1): Add artificial_p and debug_info_p parameters.
(create_var_decl): Likewise.
(create_true_var_decl): Delete.
(create_subprog_decl): Add debug_info_p parameter.
* gcc-interface/decl.c (gnat_to_gnu_entity): Add artificial_p local
variable and use it throughout. Remove DECL_ARTIFICIAL settings.
<E_Variable>: Adjust calls to create_var_decl and create_var_decl_1.
Remove DECL_IGNORED_P settings.
<E_Enumeration_Type>: Likewise.
<E_Record_Type>: Likewise.
<E_Subprogram_Type>: Likewise. Remove artificial_flag local variable.
Adjust call to create_subprog_decl.
(get_minimal_subprog_decl): Likewise.
(elaborate_expression_1): Adjust call to create_var_decl.
* gcc-interface/trans.c (gigi): Adjust calls to create_var_decl and
create_subprog_decl. Remove DECL_ARTIFICIAL & DECL_IGNORED_P settings.
* gcc-interface/utils.c (maybe_pad_type): Likewise.
(record_builtin_type): Adjust comment.
(create_type_stub_decl): Remove obsolete comment.
(create_var_decl_1): Add artificial_p and debug_info_p parameters.
Set DECL_ARTIFICIAL and DECL_IGNORED_P accordingly.
(create_subprog_decl): Add debug_info_p parameter. Set DECL_IGNORED_P
accordingly.
From-SVN: r224699
+2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/gigi.h (record_builtin_type): Adjust comment.
+ (tree create_type_decl): Likewise.
+ (create_var_decl_1): Add artificial_p and debug_info_p parameters.
+ (create_var_decl): Likewise.
+ (create_true_var_decl): Delete.
+ (create_subprog_decl): Add debug_info_p parameter.
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Add artificial_p local
+ variable and use it throughout. Remove DECL_ARTIFICIAL settings.
+ <E_Variable>: Adjust calls to create_var_decl and create_var_decl_1.
+ Remove DECL_IGNORED_P settings.
+ <E_Enumeration_Type>: Likewise.
+ <E_Record_Type>: Likewise.
+ <E_Subprogram_Type>: Likewise. Remove artificial_flag local variable.
+ Adjust call to create_subprog_decl.
+ (get_minimal_subprog_decl): Likewise.
+ (elaborate_expression_1): Adjust call to create_var_decl.
+ * gcc-interface/trans.c (gigi): Adjust calls to create_var_decl and
+ create_subprog_decl. Remove DECL_ARTIFICIAL & DECL_IGNORED_P settings.
+ * gcc-interface/utils.c (maybe_pad_type): Likewise.
+ (record_builtin_type): Adjust comment.
+ (create_type_stub_decl): Remove obsolete comment.
+ (create_var_decl_1): Add artificial_p and debug_info_p parameters.
+ Set DECL_ARTIFICIAL and DECL_IGNORED_P accordingly.
+ (create_subprog_decl): Add debug_info_p parameter. Set DECL_IGNORED_P
+ accordingly.
+
+2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/misc.c (LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL): Define.
+
2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Make sure
const Entity_Kind kind = Ekind (gnat_entity);
/* True if this is a type. */
const bool is_type = IN (kind, Type_Kind);
+ /* True if this is an artificial entity. */
+ const bool artificial_p = !Comes_From_Source (gnat_entity);
/* True if debug info is requested for this entity. */
const bool debug_info_p = Needs_Debug_Info (gnat_entity);
/* True if this entity is to be considered as imported. */
tree gnu_new_var
= create_var_decl (create_concat_name (gnat_entity, "ALIGN"),
NULL_TREE, gnu_new_type, NULL_TREE, false,
- false, false, false, NULL, gnat_entity);
- DECL_ARTIFICIAL (gnu_new_var) = 1;
+ false, false, false, true, debug_info_p,
+ NULL, gnat_entity);
/* Initialize the aligned field if we have an initializer. */
if (gnu_expr)
just above, we have nothing to do here. */
if (!TYPE_IS_THIN_POINTER_P (gnu_type))
{
+ /* This variable is a GNAT encoding used by Workbench: let it
+ go through the debugging information but mark it as
+ artificial: users are not interested in it. */
tree gnu_unc_var
= create_var_decl (concat_name (gnu_entity_name, "UNC"),
NULL_TREE, gnu_type, gnu_expr,
const_flag, Is_Public (gnat_entity),
imported_p || !definition, static_p,
- NULL, gnat_entity);
+ true, debug_info_p, NULL, gnat_entity);
gnu_expr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_unc_var);
TREE_CONSTANT (gnu_expr) = 1;
= create_var_decl_1 (gnu_entity_name, gnu_ext_name, gnu_type,
gnu_expr, const_flag, Is_Public (gnat_entity),
imported_p || !definition, static_p,
- !renamed_obj, attr_list, gnat_entity);
+ artificial_p, debug_info_p, !renamed_obj,
+ attr_list, gnat_entity);
DECL_BY_REF_P (gnu_decl) = used_by_ref;
DECL_POINTS_TO_READONLY_P (gnu_decl) = used_by_ref && inner_const_flag;
DECL_CAN_NEVER_BE_NULL_P (gnu_decl) = Can_Never_Be_Null (gnat_entity);
|| Is_Aliased (Etype (gnat_entity))))
{
tree gnu_corr_var
- = create_true_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
- gnu_expr, true, Is_Public (gnat_entity),
- !definition, static_p, attr_list,
- gnat_entity);
+ = create_var_decl_1 (gnu_entity_name, gnu_ext_name, gnu_type,
+ gnu_expr, true, Is_Public (gnat_entity),
+ !definition, static_p, artificial_p,
+ debug_info_p, false, attr_list,
+ gnat_entity);
SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var);
-
- /* As debugging information will be generated for the variable,
- do not generate debugging information for the constant. */
- if (debug_info_p)
- DECL_IGNORED_P (gnu_decl) = 1;
- else
- DECL_IGNORED_P (gnu_corr_var) = 1;
}
/* If this is a constant, even if we don't need a true variable, we
{
tree gnu_value
= UI_To_gnu (Enumeration_Rep (gnat_literal), gnu_type);
+ /* Do not generate debug info for individual enumerators. */
tree gnu_literal
= create_var_decl (get_entity_name (gnat_literal), NULL_TREE,
gnu_type, gnu_value, true, false, false,
+ false, !Comes_From_Source (gnat_literal),
false, NULL, gnat_literal);
- /* Do not generate debug info for individual enumerators. */
- DECL_IGNORED_P (gnu_literal) = 1;
save_gnu_tree (gnat_literal, gnu_literal, false);
gnu_list
= tree_cons (DECL_NAME (gnu_literal), gnu_value, gnu_list);
SET_TYPE_RM_MIN_VALUE
(gnu_type, elaborate_expression (Type_Low_Bound (gnat_entity),
gnat_entity, "L", definition, true,
- Needs_Debug_Info (gnat_entity)));
+ debug_info_p));
SET_TYPE_RM_MAX_VALUE
(gnu_type, elaborate_expression (Type_High_Bound (gnat_entity),
gnat_entity, "U", definition, true,
- Needs_Debug_Info (gnat_entity)));
+ debug_info_p));
TYPE_BIASED_REPRESENTATION_P (gnu_type)
= Has_Biased_Representation (gnat_entity);
SET_TYPE_RM_MIN_VALUE
(gnu_type, elaborate_expression (Type_Low_Bound (gnat_entity),
gnat_entity, "L", definition, true,
- Needs_Debug_Info (gnat_entity)));
+ debug_info_p));
SET_TYPE_RM_MAX_VALUE
(gnu_type, elaborate_expression (Type_High_Bound (gnat_entity),
gnat_entity, "U", definition, true,
- Needs_Debug_Info (gnat_entity)));
+ debug_info_p));
/* Inherit our alias set from what we're a subtype of, as for
integer subtypes. */
}
create_type_decl (create_concat_name (gnat_entity, "XUA"), tem,
- !Comes_From_Source (gnat_entity), debug_info_p,
- gnat_entity);
+ artificial_p, debug_info_p, gnat_entity);
/* Give the fat pointer type a name. If this is a packed array, tell
the debugger how to interpret the underlying bits. */
else
gnat_name = gnat_entity;
create_type_decl (create_concat_name (gnat_name, "XUP"), gnu_fat_type,
- !Comes_From_Source (gnat_entity), debug_info_p,
- gnat_entity);
+ artificial_p, debug_info_p, gnat_entity);
/* Create the type to be designated by thin pointers: a record type for
the array and its template. We used to shift the fields to have the
gnu_decl
= create_type_decl (gnu_entity_name, gnu_type,
!Comes_From_Source (Etype (gnat_entity))
- && !Comes_From_Source (gnat_entity),
- debug_info_p, gnat_entity);
+ && artificial_p, debug_info_p,
+ gnat_entity);
/* Save it as our equivalent in case the call below elaborates
this type again. */
components_to_record (gnu_type, Component_List (record_definition),
gnu_field_list, packed, definition, false,
all_rep, is_unchecked_union,
- !Comes_From_Source (gnat_entity), debug_info_p,
+ artificial_p, debug_info_p,
false, OK_To_Reorder_Components (gnat_entity),
all_rep ? NULL_TREE : bitsize_zero_node, NULL);
= create_var_decl (create_concat_name (gnat_entity,
"XVZ"),
NULL_TREE, sizetype, gnu_size_unit,
- false, false, false, false, NULL,
- gnat_entity);
+ false, false, false, false, true,
+ debug_info_p, NULL, gnat_entity);
}
gnu_variant_list.release ();
= build_pointer_type
(make_dummy_type (Directly_Designated_Type (gnat_entity)));
gnu_decl = create_type_decl (gnu_entity_name, gnu_type,
- !Comes_From_Source (gnat_entity),
- debug_info_p, gnat_entity);
+ artificial_p, debug_info_p,
+ gnat_entity);
this_made_decl = true;
gnu_type = TREE_TYPE (gnu_decl);
save_gnu_tree (gnat_entity, gnu_decl, false);
process_attributes (&gnu_type, &attr_list, false, gnat_entity);
gnu_decl = create_type_decl (gnu_entity_name, gnu_type,
- !Comes_From_Source (gnat_entity),
- debug_info_p, gnat_entity);
+ artificial_p, debug_info_p,
+ gnat_entity);
this_made_decl = true;
gnu_type = TREE_TYPE (gnu_decl);
save_gnu_tree (gnat_entity, gnu_decl, false);
|| imported_p
|| (Convention (gnat_entity) == Convention_Intrinsic
&& Has_Pragma_Inline_Always (gnat_entity)));
- bool artificial_flag = !Comes_From_Source (gnat_entity);
/* The semantics of "pure" in Ada essentially matches that of "const"
in the back-end. In particular, both properties are orthogonal to
the "nothrow" property if the EH circuitry is explicit in the
gnu_decl
= create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
gnu_address, false, Is_Public (gnat_entity),
- extern_flag, false, NULL, gnat_entity);
+ extern_flag, false, artificial_p,
+ debug_info_p, NULL, gnat_entity);
DECL_BY_REF_P (gnu_decl) = 1;
}
{
process_attributes (&gnu_type, &attr_list, false, gnat_entity);
gnu_decl
- = create_type_decl (gnu_entity_name, gnu_type, artificial_flag,
+ = create_type_decl (gnu_entity_name, gnu_type, artificial_p,
debug_info_p, gnat_entity);
}
else
gnu_decl
= create_subprog_decl (gnu_entity_name, gnu_ext_name, gnu_type,
gnu_param_list, inline_status,
- public_flag, extern_flag, artificial_flag,
- attr_list, gnat_entity);
+ public_flag, extern_flag, artificial_p,
+ debug_info_p, attr_list, gnat_entity);
/* This is unrelated to the stub built right above. */
DECL_STUBBED_P (gnu_decl)
= Convention (gnat_entity) == Convention_Stubbed;
if (!gnu_decl)
gnu_decl = create_type_decl (gnu_entity_name, gnu_type,
- !Comes_From_Source (gnat_entity),
- debug_info_p, gnat_entity);
+ artificial_p, debug_info_p,
+ gnat_entity);
else
{
TREE_TYPE (gnu_decl) = gnu_type;
Set_RM_Size (gnat_entity, annotate_value (rm_size (gnu_type)));
}
- /* If we really have a ..._DECL node, set a couple of flags on it. But we
- cannot do so if we are reusing the ..._DECL node made for an equivalent
- type or an alias or a renamed object as the predicates don't apply to it
- but to GNAT_ENTITY. */
- if (DECL_P (gnu_decl)
- && !(is_type && gnat_equiv_type != gnat_entity)
- && !Present (Alias (gnat_entity))
- && !(Present (Renamed_Object (gnat_entity)) && saved))
- {
- /* ??? DECL_ARTIFICIAL, and possibly DECL_IGNORED_P below, should
- be set before calling rest_of_decl_compilation above (through
- create_var_decl_1). This is because rest_of_decl_compilation
- calls the debugging backend and will create a DIE without
- DW_AT_artificial.
-
- This is currently causing gnat.dg/specs/debug1.ads to FAIL. */
- if (!Comes_From_Source (gnat_entity))
- DECL_ARTIFICIAL (gnu_decl) = 1;
-
- if (!debug_info_p)
- DECL_IGNORED_P (gnu_decl) = 1;
- }
-
/* If we haven't already, associate the ..._DECL node that we just made with
the input GNAT entity node. */
if (!saved)
return
create_subprog_decl (gnu_entity_name, gnu_ext_name, void_ftype, NULL_TREE,
- is_disabled, true, true, true, attr_list, gnat_entity);
+ is_disabled, true, true, true, false, attr_list,
+ gnat_entity);
}
/* Return whether the E_Subprogram_Type/E_Function/E_Procedure GNAT_ENTITY is
new variable must not be tagged "external", as we used to do here as
soon as DEFINITION was false. */
tree gnu_decl
- = create_var_decl_1 (create_concat_name (gnat_entity, s), NULL_TREE,
- TREE_TYPE (gnu_expr), gnu_expr, true,
- expr_public_p, !definition && expr_global_p,
- expr_global_p, !need_debug, NULL, gnat_entity);
-
- /* Whether or not gnat_entity comes from source, this variable is a
- compilation artifact. */
- DECL_ARTIFICIAL (gnu_decl) = 1;
+ = create_var_decl (create_concat_name (gnat_entity, s), NULL_TREE,
+ TREE_TYPE (gnu_expr), gnu_expr, true,
+ expr_public_p, !definition && expr_global_p,
+ expr_global_p, true, need_debug, NULL, gnat_entity);
/* Using this variable at debug time (if need_debug is true) requires a
proper location. The back-end will compute a location for this
tree gnu_desig_type);
/* Record TYPE as a builtin type for Ada. NAME is the name of the type.
- ARTIFICIAL_P is true if it's a type that was generated by the compiler. */
+ ARTIFICIAL_P is true if the type was generated by the compiler. */
extern void record_builtin_type (const char *name, tree type,
bool artificial_p);
extern tree create_type_stub_decl (tree type_name, tree type);
/* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE
- is a ..._TYPE node giving its data type. 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 debug information about this type. GNAT_NODE
- is used for the position of the decl. */
+ is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
+ declaration was generated by the compiler. DEBUG_INFO_P is true if we
+ need to write debug information about this type. GNAT_NODE is used for
+ the position of the decl. */
extern tree create_type_decl (tree type_name, tree type, bool artificial_p,
bool debug_info_p, Node_Id gnat_node);
STATIC_FLAG is only relevant when not at top level. In that case
it indicates whether to always allocate storage to the variable.
+ ARTIFICIAL_P is true if the variable was generated by the compiler.
+
+ DEBUG_INFO_P is true if we need to write debug information for it.
+
GNAT_NODE is used for the position of the decl. */
extern tree
create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
bool const_flag, bool public_flag, bool extern_flag,
- bool static_flag, bool const_decl_allowed_p,
- struct attrib *attr_list, Node_Id gnat_node);
+ bool static_flag, bool artificial_p, bool debug_info_p,
+ bool const_decl_allowed_p, struct attrib *attr_list,
+ Node_Id gnat_node);
/* Wrapper around create_var_decl_1 for cases where we don't care whether
a VAR or a CONST decl node is created. */
#define create_var_decl(var_name, asm_name, type, var_init, \
const_flag, public_flag, extern_flag, \
- static_flag, attr_list, gnat_node) \
+ static_flag, artificial_p, debug_info_p,\
+ attr_list, gnat_node) \
create_var_decl_1 (var_name, asm_name, type, var_init, \
const_flag, public_flag, extern_flag, \
- static_flag, true, attr_list, gnat_node)
-
-/* Wrapper around create_var_decl_1 for cases where a VAR_DECL node is
- required. The primary intent is for DECL_CONST_CORRESPONDING_VARs, which
- must be VAR_DECLs and on which we want TREE_READONLY set to have them
- possibly assigned to a readonly data section. */
-#define create_true_var_decl(var_name, asm_name, type, var_init, \
- const_flag, public_flag, extern_flag, \
- static_flag, attr_list, gnat_node) \
- create_var_decl_1 (var_name, asm_name, type, var_init, \
- const_flag, public_flag, extern_flag, \
- static_flag, false, attr_list, gnat_node)
+ static_flag, artificial_p, debug_info_p, \
+ true, attr_list, gnat_node)
/* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is
its type and RECORD_TYPE is the type of the enclosing record. If SIZE is
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the DECL_CHAIN field).
- INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are
- used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is
- used for the position of the decl. */
+ INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
+ appropriate fields in the FUNCTION_DECL.
+
+ ARTIFICIAL_P is true if the subprogram was generated by the compiler.
+
+ DEBUG_INFO_P is true if we need to write debug information for it.
+
+ GNAT_NODE is used for the position of the decl. */
extern tree create_subprog_decl (tree subprog_name, tree asm_name,
tree subprog_type, tree param_decl_list,
enum inline_status_t inline_status,
bool public_flag, bool extern_flag,
- bool artificial_flag,
+ bool artificial_p, bool debug_info_p,
struct attrib *attr_list, Node_Id gnat_node);
/* Process the attributes in ATTR_LIST for NODE, which is either a DECL or
gcc_assert (t == boolean_false_node);
t = create_var_decl (get_entity_name (gnat_literal), NULL_TREE,
boolean_type_node, t, true, false, false, false,
- NULL, gnat_literal);
- DECL_IGNORED_P (t) = 1;
+ true, false, NULL, gnat_literal);
save_gnu_tree (gnat_literal, t, false);
gnat_literal = Next_Literal (gnat_literal);
t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node);
gcc_assert (t == boolean_true_node);
t = create_var_decl (get_entity_name (gnat_literal), NULL_TREE,
boolean_type_node, t, true, false, false, false,
- NULL, gnat_literal);
- DECL_IGNORED_P (t) = 1;
+ true, false, NULL, gnat_literal);
save_gnu_tree (gnat_literal, t, false);
void_ftype = build_function_type_list (void_type_node, NULL_TREE);
memory. */
malloc_decl
= create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE,
- ftype, NULL_TREE, is_disabled, true, true, true,
+ ftype,
+ NULL_TREE, is_disabled, true, true, true, false,
NULL, Empty);
DECL_IS_MALLOC (malloc_decl) = 1;
build_function_type_list (void_type_node,
ptr_type_node,
NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL,
- Empty);
+ NULL_TREE, is_disabled, true, true, true, false,
+ NULL, Empty);
/* This is used for 64-bit multiplication with overflow checking. */
int64_type = gnat_type_for_size (64, 0);
= create_subprog_decl (get_identifier ("__gnat_mulv64"), NULL_TREE,
build_function_type_list (int64_type, int64_type,
int64_type, NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL,
- Empty);
+ NULL_TREE, is_disabled, true, true, true, false,
+ NULL, Empty);
/* Name of the _Parent field in tagged record types. */
parent_name_id = get_identifier (Get_Name_String (Name_uParent));
= create_subprog_decl
(get_identifier ("system__soft_links__get_jmpbuf_address_soft"),
NULL_TREE, build_function_type_list (jmpbuf_ptr_type, NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
- DECL_IGNORED_P (get_jmpbuf_decl) = 1;
+ NULL_TREE, is_disabled, true, true, true, false, NULL, Empty);
set_jmpbuf_decl
= create_subprog_decl
(get_identifier ("system__soft_links__set_jmpbuf_address_soft"),
NULL_TREE, build_function_type_list (void_type_node, jmpbuf_ptr_type,
NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
- DECL_IGNORED_P (set_jmpbuf_decl) = 1;
+ NULL_TREE, is_disabled, true, true, true, false, NULL, Empty);
/* setjmp returns an integer and has one operand, which is a pointer to
a jmpbuf. */
(get_identifier ("__builtin_setjmp"), NULL_TREE,
build_function_type_list (integer_type_node, jmpbuf_ptr_type,
NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
+ NULL_TREE, is_disabled, true, true, true, false, NULL, Empty);
DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP;
= create_subprog_decl
(get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE,
build_function_type_list (void_type_node, jmpbuf_ptr_type, NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
+ NULL_TREE, is_disabled, true, true, true, false, 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;
begin_handler_decl
= create_subprog_decl (get_identifier ("__gnat_begin_handler"), NULL_TREE,
- ftype, NULL_TREE, is_disabled, true, true, true,
+ ftype, NULL_TREE,
+ is_disabled, true, true, true, false,
NULL, Empty);
- DECL_IGNORED_P (begin_handler_decl) = 1;
end_handler_decl
= create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE,
- ftype, NULL_TREE, is_disabled, true, true, true,
+ ftype, NULL_TREE,
+ is_disabled, true, true, true, false,
NULL, Empty);
- DECL_IGNORED_P (end_handler_decl) = 1;
unhandled_except_decl
= create_subprog_decl (get_identifier ("__gnat_unhandled_except_handler"),
- NULL_TREE,
- ftype, NULL_TREE, is_disabled, true, true, true,
+ NULL_TREE, ftype, NULL_TREE,
+ is_disabled, true, true, true, false,
NULL, Empty);
- DECL_IGNORED_P (unhandled_except_decl) = 1;
reraise_zcx_decl
= create_subprog_decl (get_identifier ("__gnat_reraise_zcx"), NULL_TREE,
- ftype, NULL_TREE, is_disabled, true, true, true,
+ ftype, NULL_TREE,
+ is_disabled, true, true, true, false,
NULL, Empty);
/* Indicate that these never return. */
- DECL_IGNORED_P (reraise_zcx_decl) = 1;
TREE_THIS_VOLATILE (reraise_zcx_decl) = 1;
TREE_SIDE_EFFECTS (reraise_zcx_decl) = 1;
TREE_TYPE (reraise_zcx_decl)
build_pointer_type
(unsigned_char_type_node),
integer_type_node, NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
+ NULL_TREE, is_disabled, true, true, true, false, NULL, Empty);
TREE_THIS_VOLATILE (decl) = 1;
TREE_SIDE_EFFECTS (decl) = 1;
TREE_TYPE (decl)
(get_identifier ("system__soft_links__get_gnat_exception"), NULL_TREE,
build_function_type_list (build_pointer_type (except_type_node),
NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
- DECL_IGNORED_P (get_excptr_decl) = 1;
+ NULL_TREE, is_disabled, true, true, true, false, NULL, Empty);
set_exception_parameter_decl
= create_subprog_decl
(get_identifier ("__gnat_set_exception_parameter"), NULL_TREE,
build_function_type_list (void_type_node, ptr_type_node, ptr_type_node,
NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
+ NULL_TREE, is_disabled, true, true, true, false, NULL, Empty);
raise_nodefer_decl
= create_subprog_decl
build_function_type_list (void_type_node,
build_pointer_type (except_type_node),
NULL_TREE),
- NULL_TREE, is_disabled, true, true, true, NULL, Empty);
+ NULL_TREE, is_disabled, true, true, true, false, NULL, Empty);
/* Indicate that it never returns. */
TREE_THIS_VOLATILE (raise_nodefer_decl) = 1;
others_decl
= create_var_decl (get_identifier ("OTHERS"),
get_identifier ("__gnat_others_value"),
- unsigned_char_type_node,
- NULL_TREE, true, false, true, false, NULL, Empty);
+ unsigned_char_type_node, NULL_TREE,
+ true, false, true, false, true, false,
+ NULL, Empty);
all_others_decl
= create_var_decl (get_identifier ("ALL_OTHERS"),
get_identifier ("__gnat_all_others_value"),
- unsigned_char_type_node,
- NULL_TREE, true, false, true, false, NULL, Empty);
+ unsigned_char_type_node, NULL_TREE,
+ true, false, true, false, true, false,
+ NULL, Empty);
unhandled_others_decl
= create_var_decl (get_identifier ("UNHANDLED_OTHERS"),
get_identifier ("__gnat_unhandled_others_value"),
- unsigned_char_type_node,
- NULL_TREE, true, false, true, false, NULL, Empty);
+ unsigned_char_type_node, NULL_TREE,
+ true, false, true, false, true, false,
+ NULL, Empty);
main_identifier_node = get_identifier ("main");
result
= create_subprog_decl (get_identifier (Name_Buffer),
NULL_TREE, ftype, NULL_TREE,
- is_disabled, true, true, true, NULL, Empty);
+ is_disabled, true, true, true, false,
+ NULL, Empty);
/* Indicate that it never returns. */
TREE_THIS_VOLATILE (result) = 1;
gnu_return_var
= create_var_decl (get_identifier ("RETVAL"), NULL_TREE,
gnu_return_type, NULL_TREE, false, false,
- false, false, NULL, gnat_subprog_id);
+ false, false, true, false,
+ NULL, gnat_subprog_id);
TREE_VALUE (gnu_return_var_elmt) = gnu_return_var;
}
{
tree gnu_temp = create_var_decl (create_tmp_var_name (prefix), NULL_TREE,
type, NULL_TREE, false, false, false, false,
- NULL, Empty);
- DECL_ARTIFICIAL (gnu_temp) = 1;
- DECL_IGNORED_P (gnu_temp) = 1;
-
+ true, false, NULL, Empty);
return gnu_temp;
}
= create_var_decl (get_identifier ("JMPBUF_SAVE"), NULL_TREE,
jmpbuf_ptr_type,
build_call_n_expr (get_jmpbuf_decl, 0),
- false, false, false, false, NULL, gnat_node);
- DECL_ARTIFICIAL (gnu_jmpsave_decl) = 1;
+ false, false, false, false, true, false,
+ NULL, gnat_node);
/* The __builtin_setjmp receivers will immediately reinstall it. Now
because of the unstructured form of EH used by setjmp_longjmp, there
= create_var_decl (get_identifier ("JMP_BUF"), NULL_TREE,
jmpbuf_type,
NULL_TREE,
- false, false, false, false, NULL, gnat_node);
- DECL_ARTIFICIAL (gnu_jmpbuf_decl) = 1;
+ false, false, false, false, true, false,
+ NULL, gnat_node);
set_block_jmpbuf_decl (gnu_jmpbuf_decl);
create_var_decl (get_identifier ("EXCEPT_PTR"), NULL_TREE,
build_pointer_type (except_type_node),
build_call_n_expr (get_excptr_decl, 0),
- false, false, false, false,
+ false, false, false, false, true, false,
NULL, gnat_node));
/* Generate code for each handler. The N_Exception_Handler case does the
= build_call_expr (builtin_decl_explicit (BUILT_IN_EH_POINTER),
1, integer_zero_node);
prev_gnu_incoming_exc_ptr = gnu_incoming_exc_ptr;
- gnu_incoming_exc_ptr = create_var_decl (get_identifier ("EXPTR"), NULL_TREE,
- ptr_type_node, gnu_current_exc_ptr,
- false, false, false, false,
- NULL, gnat_node);
+ gnu_incoming_exc_ptr
+ = create_var_decl (get_identifier ("EXPTR"), NULL_TREE,
+ ptr_type_node, gnu_current_exc_ptr,
+ false, false, false, false, true, true,
+ NULL, gnat_node);
add_stmt_with_node (build_call_n_expr (begin_handler_decl, 1,
gnu_incoming_exc_ptr),
tree gnu_elab_proc_decl
= create_subprog_decl
(create_concat_name (gnat_unit_entity, body_p ? "elabb" : "elabs"),
- NULL_TREE, void_ftype, NULL_TREE, is_disabled, true, false, true, NULL,
- gnat_unit);
+ NULL_TREE, void_ftype, NULL_TREE, is_disabled, true, false, true, true,
+ NULL, gnat_unit);
struct elab_info *info;
vec_safe_push (gnu_elab_proc_stack, gnu_elab_proc_decl);
(Entity (Prefix (gnat_node)),
attr == Attr_Elab_Body ? "elabb" : "elabs"),
NULL_TREE, void_ftype, NULL_TREE, is_disabled,
- true, true, true, NULL, gnat_node);
+ true, true, true, true, NULL, gnat_node);
gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attr);
}
deallocated. */
gnu_expr = create_var_decl (get_identifier ("SAVED_EXPTR"), NULL_TREE,
ptr_type_node, gnu_incoming_exc_ptr,
- false, false, false, false, NULL, gnat_node);
+ false, false, false, false, true, true,
+ NULL, gnat_node);
add_stmt (build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_incoming_exc_ptr,
convert (ptr_type_node, integer_zero_node)));
&& !(TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_IGNORED_P (TYPE_NAME (type))))
{
- tree marker = make_node (RECORD_TYPE);
tree name = TYPE_IDENTIFIER (record);
+ tree size_unit = TYPE_SIZE_UNIT (record);
+
+ /* A variable that holds the size is required even with no encoding since
+ it will be referenced by debugging information attributes. At global
+ level, we need a single variable across all translation units. */
+ if (size
+ && TREE_CODE (size) != INTEGER_CST
+ && (definition || global_bindings_p ()))
+ {
+ size_unit
+ = create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype,
+ size_unit, true, global_bindings_p (),
+ !definition && global_bindings_p (), false,
+ true, true, NULL, gnat_entity);
+ TYPE_SIZE_UNIT (record) = size_unit;
+ }
+
+ tree marker = make_node (RECORD_TYPE);
tree orig_name = TYPE_IDENTIFIER (type);
TYPE_NAME (marker) = concat_name (name, "XVS");
marker, NULL_TREE, NULL_TREE,
0, 0),
0, true);
+ TYPE_SIZE_UNIT (marker) = size_unit;
add_parallel_type (record, marker);
-
- if (definition && size && TREE_CODE (size) != INTEGER_CST)
- TYPE_SIZE_UNIT (marker)
- = create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype,
- TYPE_SIZE_UNIT (record), false, false, false,
- false, NULL, gnat_entity);
}
rest_of_record_type_compilation (record);
}
\f
/* Record TYPE as a builtin type for Ada. NAME is the name of the type.
- ARTIFICIAL_P is true if it's a type that was generated by the compiler. */
+ ARTIFICIAL_P is true if the type was generated by the compiler. */
void
record_builtin_type (const char *name, tree type, bool artificial_p)
tree
create_type_stub_decl (tree type_name, tree type)
{
- /* Using a named TYPE_DECL ensures that a type name marker is emitted in
- STABS while setting DECL_ARTIFICIAL ensures that no DW_TAG_typedef is
- emitted in DWARF. */
tree type_decl = build_decl (input_location, TYPE_DECL, type_name, type);
DECL_ARTIFICIAL (type_decl) = 1;
TYPE_ARTIFICIAL (type) = 1;
}
/* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE
- is a ..._TYPE node giving its data type. 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 debug information about this type. GNAT_NODE
- is used for the position of the decl. */
+ is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
+ declaration was generated by the compiler. DEBUG_INFO_P is true if we
+ need to write debug information about this type. GNAT_NODE is used for
+ the position of the decl. */
tree
create_type_decl (tree type_name, tree type, bool artificial_p,
STATIC_FLAG is only relevant when not at top level. In that case
it indicates whether to always allocate storage to the variable.
+ ARTIFICIAL_P is true if the variable was generated by the compiler.
+
+ DEBUG_INFO_P is true if we need to write debug information for it.
+
GNAT_NODE is used for the position of the decl. */
tree
create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
bool const_flag, bool public_flag, bool extern_flag,
- bool static_flag, bool const_decl_allowed_p,
- struct attrib *attr_list, Node_Id gnat_node)
+ bool static_flag, bool artificial_p, bool debug_info_p,
+ bool const_decl_allowed_p, struct attrib *attr_list,
+ Node_Id gnat_node)
{
/* Whether the object has static storage duration, either explicitly or by
virtue of being declared at the global level. */
if (var_init && !init_const && global_bindings_p ())
Check_Elaboration_Code_Allowed (gnat_node);
- DECL_INITIAL (var_decl) = var_init;
- TREE_READONLY (var_decl) = const_flag;
+ /* Attach the initializer, if any. */
+ DECL_INITIAL (var_decl) = var_init;
+
+ /* Directly set some flags. */
+ DECL_ARTIFICIAL (var_decl) = artificial_p;
DECL_EXTERNAL (var_decl) = extern_flag;
TREE_CONSTANT (var_decl) = constant_p;
+ TREE_READONLY (var_decl) = const_flag;
/* We need to allocate static storage for an object with static storage
duration if it isn't external. */
&& !have_global_bss_p ())
DECL_COMMON (var_decl) = 1;
- /* For an external constant whose initializer is not absolute, do not emit
- debug info. In DWARF this would mean a global relocation in a read-only
- section which runs afoul of the PE-COFF run-time relocation mechanism. */
- if (extern_flag
- && constant_p
- && var_init
- && initializer_constant_valid_p (var_init, TREE_TYPE (var_init))
- != null_pointer_node)
+ /* Do not emit debug info for a CONST_DECL if optimization isn't enabled,
+ since we will create an associated variable. Likewise for an external
+ constant whose initializer is not absolute, because this would mean a
+ global relocation in a read-only section which runs afoul of the PE-COFF
+ run-time relocation mechanism. */
+ if (!debug_info_p
+ || (TREE_CODE (var_decl) == CONST_DECL && !optimize)
+ || (extern_flag
+ && constant_p
+ && var_init
+ && initializer_constant_valid_p (var_init, TREE_TYPE (var_init))
+ != null_pointer_node))
DECL_IGNORED_P (var_decl) = 1;
if (TYPE_VOLATILE (type))
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the DECL_CHAIN field).
- INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are
- used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is
- used for the position of the decl. */
+ INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
+ appropriate fields in the FUNCTION_DECL.
+
+ ARTIFICIAL_P is true if the subprogram was generated by the compiler.
+
+ DEBUG_INFO_P is true if we need to write debug information for it.
+
+ GNAT_NODE is used for the position of the decl. */
tree
create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
tree param_decl_list, enum inline_status_t inline_status,
- bool public_flag, bool extern_flag, bool artificial_flag,
- struct attrib *attr_list, Node_Id gnat_node)
+ bool public_flag, bool extern_flag, bool artificial_p,
+ bool debug_info_p, struct attrib *attr_list,
+ Node_Id gnat_node)
{
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name,
subprog_type);
TREE_TYPE (subprog_type));
DECL_ARGUMENTS (subprog_decl) = param_decl_list;
- DECL_ARTIFICIAL (subprog_decl) = artificial_flag;
+ DECL_ARTIFICIAL (subprog_decl) = artificial_p;
DECL_EXTERNAL (subprog_decl) = extern_flag;
switch (inline_status)
case is_enabled:
DECL_DECLARED_INLINE_P (subprog_decl) = 1;
- DECL_NO_INLINE_WARNING_P (subprog_decl) = artificial_flag;
+ DECL_NO_INLINE_WARNING_P (subprog_decl) = artificial_p;
break;
default:
gcc_unreachable ();
}
+ if (!debug_info_p)
+ DECL_IGNORED_P (subprog_decl) = 1;
+
TREE_PUBLIC (subprog_decl) = public_flag;
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type);
+2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/debug1.ads: Adjust.
+
2015-06-19 Jim Wilson <jim.wilson@linaro.org>
* gcc.target/aarch64/fmovd-zero-mem.c: New.
end Debug1;
--- { dg-final { scan-assembler-times "DW_AT_artificial" 17 } }
+-- { dg-final { scan-assembler-times "DW_AT_artificial" 15 } }