bool public_flag = Is_Public (gnat_entity) || imported_p;
bool extern_flag
= (Is_Public (gnat_entity) && !definition) || imported_p;
+ 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
}
else if (kind == E_Subprogram_Type)
- gnu_decl = create_type_decl (gnu_entity_name, gnu_type, attr_list,
- !Comes_From_Source (gnat_entity),
- debug_info_p, gnat_entity);
+ gnu_decl
+ = create_type_decl (gnu_entity_name, gnu_type, attr_list,
+ artificial_flag, debug_info_p, gnat_entity);
else
{
if (has_stub)
gnu_stub_name = gnu_ext_name;
gnu_ext_name = create_concat_name (gnat_entity, "internal");
public_flag = false;
+ artificial_flag = true;
}
- gnu_decl = create_subprog_decl (gnu_entity_name, gnu_ext_name,
- gnu_type, gnu_param_list,
- inline_flag, public_flag,
- extern_flag, attr_list,
- gnat_entity);
+ gnu_decl
+ = create_subprog_decl (gnu_entity_name, gnu_ext_name, gnu_type,
+ gnu_param_list, inline_flag, public_flag,
+ extern_flag, artificial_flag, attr_list,
+ gnat_entity);
if (has_stub)
{
tree gnu_stub_decl
= create_subprog_decl (gnu_entity_name, gnu_stub_name,
gnu_stub_type, gnu_stub_param_list,
- inline_flag, true,
- extern_flag, attr_list,
- gnat_entity);
+ inline_flag, true, extern_flag,
+ false, attr_list, gnat_entity);
SET_DECL_FUNCTION_STUB (gnu_decl, gnu_stub_decl);
}
}
/* If we really have a ..._DECL node, set a couple of flags on it. But we
- cannot do that if we are reusing the ..._DECL node made for a renamed
- object, since the predicates don't apply to it but to GNAT_ENTITY. */
- if (DECL_P (gnu_decl) && !(Present (Renamed_Object (gnat_entity)) && saved))
+ cannot do so if we are reusing the ..._DECL node made for an alias or a
+ renamed object as the predicates don't apply to it but to GNAT_ENTITY. */
+ if (DECL_P (gnu_decl)
+ && !Present (Alias (gnat_entity))
+ && !(Present (Renamed_Object (gnat_entity)) && saved))
{
if (!Comes_From_Source (gnat_entity))
DECL_ARTIFICIAL (gnu_decl) = 1;
- if (!debug_info_p && TREE_CODE (gnu_decl) != FUNCTION_DECL)
+ if (!debug_info_p)
DECL_IGNORED_P (gnu_decl) = 1;
}
tree record_type, tree size, tree pos,
int packed, int addressable);
-/* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter,
- PARAM_TYPE is its type. READONLY is true if the parameter is
- readonly (either an In parameter or an address of a pass-by-ref
- parameter). */
+/* Return a PARM_DECL node. PARAM_NAME is the name of the parameter and
+ PARAM_TYPE is its type. READONLY is true if the parameter is readonly
+ (either an In parameter or an address of a pass-by-ref parameter). */
extern tree create_param_decl (tree param_name, tree param_type,
bool readonly);
-/* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
+/* Return a LABEL_DECL node for LABEL_NAME. */
+extern tree create_label_decl (tree label_name);
+
+/* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the TREE_CHAIN field).
- INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, and ATTR_LIST are used to set the
- appropriate fields in the FUNCTION_DECL. GNAT_NODE gives the location. */
+ INLINE_FLAG, 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. */
extern tree create_subprog_decl (tree subprog_name, tree asm_name,
- tree subprog_type, tree param_decl_list,
- bool inlinee_flag, bool public_flag,
- bool extern_flag,
+ tree subprog_type, tree param_decl_list,
+ bool inline_flag, bool public_flag,
+ bool extern_flag, bool artificial_flag,
struct attrib *attr_list, Node_Id gnat_node);
-/* Returns a LABEL_DECL node for LABEL_NAME. */
-extern tree create_label_decl (tree label_name);
-
/* Set up the framework for generating code for SUBPROG_DECL, a subprogram
body. This routine needs to be invoked before processing the declarations
appearing in the subprogram. */
build_function_type (ptr_void_type_node,
tree_cons (NULL_TREE,
sizetype, t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IS_MALLOC (malloc_decl) = 1;
/* malloc32 is a function declaration tree for a function to allocate
build_function_type (ptr_void_type_node,
tree_cons (NULL_TREE,
sizetype, t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IS_MALLOC (malloc32_decl) = 1;
/* free is a function declaration tree for a function to free memory. */
tree_cons (NULL_TREE,
ptr_void_type_node,
t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
/* This is used for 64-bit multiplication with overflow checking. */
mulv64_decl
= create_subprog_decl (get_identifier ("__gnat_mulv64"), NULL_TREE,
build_function_type_list (int64_type, int64_type,
int64_type, NULL_TREE),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, 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 (jmpbuf_ptr_type, NULL_TREE),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (get_jmpbuf_decl) = 1;
set_jmpbuf_decl
NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (set_jmpbuf_decl) = 1;
/* setjmp returns an integer and has one operand, which is a pointer to
(get_identifier ("__builtin_setjmp"), NULL_TREE,
build_function_type (integer_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP;
(get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF;
tree_cons (NULL_TREE,
ptr_void_type_node,
t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (begin_handler_decl) = 1;
end_handler_decl
tree_cons (NULL_TREE,
ptr_void_type_node,
t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (end_handler_decl) = 1;
/* If in no exception handlers mode, all raise statements are redirected to
tree_cons (NULL_TREE,
integer_type_node,
t))),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, 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 (build_pointer_type (except_type_node), NULL_TREE),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
raise_nodefer_decl
= create_subprog_decl
tree_cons (NULL_TREE,
build_pointer_type (except_type_node),
t)),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
/* Indicate that these never return. */
TREE_THIS_VOLATILE (raise_nodefer_decl) = 1;
tree_cons (NULL_TREE,
integer_type_node,
void_tree)))))),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
}
else
{
tree_cons
(NULL_TREE, build_pointer_type (unsigned_char_type_node),
tree_cons (NULL_TREE, integer_type_node, void_tree))),
- NULL_TREE, false, true, true, NULL, Empty);
+ NULL_TREE, false, true, true, true, NULL, Empty);
}
TREE_THIS_VOLATILE (result) = 1;
ptr_void_type_node,
ptr_void_type_node,
NULL_TREE),
- NULL_TREE, 0, 1, 1, 0, Empty);
+ NULL_TREE, false, true, true, true, NULL,
+ Empty);
/* ??? DECL_CONTEXT shouldn't have been set because of DECL_EXTERNAL. */
DECL_CONTEXT (gnat_vms_condition_handler_decl) = NULL_TREE;
relayout_decl (gnu_result_decl);
}
- /* Propagate the debug mode. */
- if (!Needs_Debug_Info (gnat_subprog_id))
- DECL_IGNORED_P (gnu_subprog_decl) = 1;
-
/* Set the line number in the decl to correspond to that of the body so that
the line number notes are written correctly. */
Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (gnu_subprog_decl));
tree gnu_elab_proc_decl
= create_subprog_decl
(create_concat_name (gnat_unit_entity, body_p ? "elabb" : "elabs"),
- NULL_TREE, void_ftype, NULL_TREE, false, true, false, NULL, gnat_unit);
+ NULL_TREE, void_ftype, NULL_TREE, false, true, false, true, NULL,
+ gnat_unit);
struct elab_info *info;
VEC_safe_push (tree, gc, gnu_elab_proc_stack, gnu_elab_proc_decl);
(Entity (Prefix (gnat_node)),
attr == Attr_Elab_Body ? "elabb" : "elabs"),
NULL_TREE, void_ftype, NULL_TREE, false,
- true, true, NULL, gnat_node);
+ true, true, true, NULL, gnat_node);
gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attr);
}
return false;
}
-/* Given 2 consecutive field decls PREV_FIELD and CURR_FIELD, return true
+/* Given two consecutive field decls PREV_FIELD and CURR_FIELD, return true
unless we can prove these 2 fields are laid out in such a way that no gap
exist between the end of PREV_FIELD and the beginning of CURR_FIELD. OFFSET
is the distance in bits between the end of PREV_FIELD and the starting
return true;
}
-/* Returns a LABEL_DECL node for LABEL_NAME. */
+/* Return a LABEL_DECL node for LABEL_NAME. */
tree
create_label_decl (tree label_name)
return label_decl;
}
\f
-/* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
+/* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the TREE_CHAIN field).
- INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, and ATTR_LIST are used to set the
- appropriate fields in the FUNCTION_DECL. GNAT_NODE gives the location. */
+ INLINE_FLAG, 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. */
tree
-create_subprog_decl (tree subprog_name, tree asm_name,
- tree subprog_type, tree param_decl_list, bool inline_flag,
- bool public_flag, bool extern_flag,
- struct attrib *attr_list, Node_Id gnat_node)
+create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
+ tree param_decl_list, bool inline_flag, bool public_flag,
+ bool extern_flag, bool artificial_flag,
+ struct attrib *attr_list, Node_Id gnat_node)
{
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name,
subprog_type);
tree result_decl = build_decl (input_location, RESULT_DECL, NULL_TREE,
TREE_TYPE (subprog_type));
+ DECL_ARGUMENTS (subprog_decl) = param_decl_list;
/* If this is a non-inline function nested inside an inlined external
function, we cannot honor both requests without cloning the nested
&& DECL_EXTERNAL (current_function_decl))
DECL_DECLARED_INLINE_P (current_function_decl) = 0;
- DECL_EXTERNAL (subprog_decl) = extern_flag;
- TREE_PUBLIC (subprog_decl) = public_flag;
- TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
+ DECL_ARTIFICIAL (subprog_decl) = artificial_flag;
+ DECL_EXTERNAL (subprog_decl) = extern_flag;
+ DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag;
+ DECL_NO_INLINE_WARNING_P (subprog_decl) = inline_flag && artificial_flag;
+
+ TREE_PUBLIC (subprog_decl) = public_flag;
+ TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type);
TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type);
- DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag;
- DECL_ARGUMENTS (subprog_decl) = param_decl_list;
DECL_ARTIFICIAL (result_decl) = 1;
DECL_IGNORED_P (result_decl) = 1;