if (foreign && Is_Descendant_Of_Address (Underlying_Type (gnat_type)))
gnu_type = ptr_type_node;
else
- {
- gnu_type = gnat_to_gnu_type (gnat_type);
-
- /* If this is a standard exception definition, use the standard
- exception type. This is necessary to make sure that imported
- and exported views of exceptions are merged in LTO mode. */
- if (TREE_CODE (TYPE_NAME (gnu_type)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (gnu_type)) == exception_data_name_id)
- gnu_type = except_type_node;
- }
+ gnu_type = gnat_to_gnu_type (gnat_type);
/* For a debug renaming declaration, build a debug-only entity. */
if (Present (Debug_Renaming_Link (gnat_entity)))
/* Fill in locations of fields. */
annotate_rep (gnat_entity, gnu_type);
-
- /* If this is a record type associated with an exception definition,
- equate its fields to those of the standard exception type. This
- will make it possible to convert between them. */
- if (gnu_entity_name == exception_data_name_id)
- {
- tree gnu_std_field;
- for (gnu_field = TYPE_FIELDS (gnu_type),
- gnu_std_field = TYPE_FIELDS (except_type_node);
- gnu_field;
- gnu_field = DECL_CHAIN (gnu_field),
- gnu_std_field = DECL_CHAIN (gnu_std_field))
- SET_DECL_ORIGINAL_FIELD_TO_FIELD (gnu_field, gnu_std_field);
- gcc_assert (!gnu_std_field);
- }
}
break;
tree gnu_field, gnu_size, gnu_pos;
bool is_bitfield;
+ /* Force the type of the Not_Handled_By_Others field to be that of the
+ field in struct Exception_Data declared in raise.h instead of using
+ the declared boolean type. We need to do that because there is no
+ easy way to make use of a C compatible boolean type for the latter. */
+ if (gnu_field_id == not_handled_by_others_name_id
+ && gnu_field_type == boolean_type_node)
+ gnu_field_type = char_type_node;
+
/* The qualifier to be used in messages. */
if (is_aliased)
field_s = "aliased&";
/* Identifier for the name of the _Parent field in tagged record types. */
ADT_parent_name_id,
- /* Identifier for the name of the Exception_Data type. */
- ADT_exception_data_name_id,
+ /* Identifier for the name of the Not_Handled_By_Others field. */
+ ADT_not_handled_by_others_name_id,
/* Types and decls used by the SJLJ exception mechanism. */
ADT_jmpbuf_type,
#define mulv64_decl gnat_std_decls[(int) ADT_mulv64_decl]
#define mulv128_decl gnat_std_decls[(int) ADT_mulv128_decl]
#define parent_name_id gnat_std_decls[(int) ADT_parent_name_id]
-#define exception_data_name_id gnat_std_decls[(int) ADT_exception_data_name_id]
+#define not_handled_by_others_name_id \
+ gnat_std_decls[(int) ADT_not_handled_by_others_name_id]
#define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type]
#define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type]
#define get_jmpbuf_decl gnat_std_decls[(int) ADT_get_jmpbuf_decl]
/* GNAT argc and argv generated by the binder for all Ada programs. */
extern int gnat_argc;
-extern const char **gnat_argv;
+extern char **gnat_argv;
/* Ada code requires variables for these settings rather than elements
of the global_options structure because they are imported. */
save_argv[save_argc] = NULL;
/* Pass just the name of the command through the regular channel. */
- gnat_argv = (const char **) xmalloc (sizeof (char *));
+ gnat_argv = (char **) xmalloc (sizeof (char *));
gnat_argv[0] = xstrdup (save_argv[0]);
gnat_argc = 1;
}
/* Name of the _Parent field in tagged record types. */
parent_name_id = get_identifier (Get_Name_String (Name_uParent));
- /* Name of the Exception_Data type defined in System.Standard_Library. */
- exception_data_name_id
- = get_identifier ("system__standard_library__exception_data");
+ /* Name of the Not_Handled_By_Others field in exception record types. */
+ not_handled_by_others_name_id = get_identifier ("not_handled_by_others");
/* Make the types and functions used for exception processing. */
except_type_node = gnat_to_gnu_type (Base_Type (standard_exception_type));
+ for (t = TYPE_FIELDS (except_type_node); t; t = DECL_CHAIN (t))
+ if (DECL_NAME (t) == not_handled_by_others_name_id)
+ {
+ not_handled_by_others_decl = t;
+ break;
+ }
+ gcc_assert (DECL_P (not_handled_by_others_decl));
+
jmpbuf_type
= build_array_type (gnat_type_for_mode (Pmode, 0),
build_index_type (size_int (5)));
NULL_TREE),
NULL_TREE, is_default, true, true, true, false, false, NULL, Empty);
- not_handled_by_others_decl = get_identifier ("not_handled_by_others");
- for (t = TYPE_FIELDS (except_type_node); t; t = DECL_CHAIN (t))
- if (DECL_NAME (t) == not_handled_by_others_decl)
- {
- not_handled_by_others_decl = t;
- break;
- }
- gcc_assert (DECL_P (not_handled_by_others_decl));
-
/* setjmp returns an integer and has one operand, which is a pointer to
a jmpbuf. */
setjmp_decl
gnu_except_ptr_stack->last (),
convert (TREE_TYPE (gnu_except_ptr_stack->last ()),
build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr)));
-}
+ }
else
gcc_unreachable ();