misc.c (gnat_types_compatible_p, [...]): Remove.

* misc.c (gnat_types_compatible_p, LANG_HOOKS_TYPES_COMPATIBLE_P):
	Remove.
	(LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): New.

	* adaint.h: (__gnat_dup, __gnat_dup2): Add missing decls.

	* trans.c (Exception_Handler_to_gnu_sjlj): Also handle renamed
	exception.
	(call_to_gnu): Convert to actual DECL_ARG_TYPE, not variant of it.

From-SVN: r91890
This commit is contained in:
Arnaud Charlet 2004-12-08 12:47:46 +01:00
parent bd94e912ff
commit 6a2b39bdda
3 changed files with 18 additions and 36 deletions

View File

@ -78,6 +78,8 @@ extern OS_Time __gnat_file_time_fd (int);
extern void __gnat_set_file_time_name (char *, time_t);
extern void __gnat_get_env_value_ptr (char *, int *,
char **);
extern int __gnat_dup (int);
extern int __gnat_dup2 (int, int);
extern int __gnat_file_exists (char *);
extern int __gnat_is_regular_file (char *);
extern int __gnat_is_absolute_path (char *,int);

View File

@ -94,7 +94,6 @@ static bool gnat_post_options (const char **);
static HOST_WIDE_INT gnat_get_alias_set (tree);
static void gnat_print_decl (FILE *, tree, int);
static void gnat_print_type (FILE *, tree, int);
static int gnat_types_compatible_p (tree, tree);
static const char *gnat_printable_name (tree, int);
static tree gnat_eh_runtime_type (tree);
static int gnat_eh_type_covers (tree, tree);
@ -130,6 +129,8 @@ static tree gnat_type_max_size (tree);
#define LANG_HOOKS_PUSHDECL lhd_return_tree
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL gnat_finish_incomplete_decl
#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
#undef LANG_HOOKS_GET_ALIAS_SET
#define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set
#undef LANG_HOOKS_EXPAND_EXPR
@ -142,8 +143,6 @@ static tree gnat_type_max_size (tree);
#define LANG_HOOKS_PRINT_DECL gnat_print_decl
#undef LANG_HOOKS_PRINT_TYPE
#define LANG_HOOKS_PRINT_TYPE gnat_print_type
#undef LANG_HOOKS_TYPES_COMPATIBLE_P
#define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p
#undef LANG_HOOKS_TYPE_MAX_SIZE
#define LANG_HOOKS_TYPE_MAX_SIZE gnat_type_max_size
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
@ -554,27 +553,6 @@ gnat_print_type (FILE *file, tree node, int indent)
}
}
/* We consider two types compatible if they have the same main variant,
but we also consider two array types compatible if they have the same
component type and bounds.
??? We may also want to generalize to considering lots of integer types
compatible, but we need to understand the effects of alias sets first. */
static int
gnat_types_compatible_p (tree x, tree y)
{
if (TREE_CODE (x) == ARRAY_TYPE && TREE_CODE (y) == ARRAY_TYPE
&& gnat_types_compatible_p (TREE_TYPE (x), TREE_TYPE (y))
&& operand_equal_p (TYPE_MIN_VALUE (TYPE_DOMAIN (x)),
TYPE_MIN_VALUE (TYPE_DOMAIN (y)), 0)
&& operand_equal_p (TYPE_MAX_VALUE (TYPE_DOMAIN (x)),
TYPE_MAX_VALUE (TYPE_DOMAIN (y)), 0))
return 1;
else
return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y);
}
static const char *
gnat_printable_name (tree decl, int verbosity)
{

View File

@ -1621,7 +1621,9 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
gnat_formal = Next_Formal_With_Extras (gnat_formal),
gnat_actual = Next_Actual (gnat_actual))
{
tree gnu_formal_type = gnat_to_gnu_type (Etype (gnat_formal));
tree gnu_formal
= (present_gnu_tree (gnat_formal)
? get_gnu_tree (gnat_formal) : NULL_TREE);
/* We treat a conversion between aggregate types as if it is an
unchecked conversion. */
bool unchecked_convert_p
@ -1632,10 +1634,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
? Expression (gnat_actual) : gnat_actual);
tree gnu_name = gnat_to_gnu (gnat_name);
tree gnu_name_type = gnat_to_gnu_type (Etype (gnat_name));
tree gnu_formal
= (present_gnu_tree (gnat_formal)
? get_gnu_tree (gnat_formal) : NULL_TREE);
tree gnu_actual;
tree gnu_formal_type;
/* If it's possible we may need to use this expression twice, make sure
than any side-effects are handled via SAVE_EXPRs. Likewise if we need
@ -1739,9 +1739,6 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)),
gnu_actual);
if (TREE_CODE (gnu_actual) != SAVE_EXPR)
gnu_actual = convert (gnu_formal_type, gnu_actual);
/* If we have not saved a GCC object for the formal, it means it is an
OUT parameter not passed by reference and that does not need to be
copied in. Otherwise, look at the PARM_DECL to see if it is passed by
@ -1856,9 +1853,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
integer_zero_node),
false);
else
gnu_actual
= convert (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (gnu_formal)),
gnu_actual);
gnu_actual = convert (DECL_ARG_TYPE (gnu_formal), gnu_actual);
}
gnu_actual_list = tree_cons (NULL_TREE, gnu_actual, gnu_actual_list);
@ -2244,8 +2239,15 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node)
else if (Nkind (gnat_temp) == N_Identifier
|| Nkind (gnat_temp) == N_Expanded_Name)
{
tree gnu_expr
= gnat_to_gnu_entity (Entity (gnat_temp), NULL_TREE, 0);
Entity_Id gnat_ex_id = Entity (gnat_temp);
tree gnu_expr;
/* Exception may be a renaming. Recover original exception which is
the one elaborated and registered. */
if (Present (Renamed_Object (gnat_ex_id)))
gnat_ex_id = Renamed_Object (gnat_ex_id);
gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, 0);
this_choice
= build_binary_op