Skip to content

Commit d40dc31

Browse files
Eric Botcazoupmderodat
authored andcommitted
[Ada] Fix type mismatch warnings during LTO bootstrap gcc-mirror#5
gcc/ada/ * raise-gcc.c (__gnat_others_value): Remove const qualifier. (__gnat_all_others_value): Likewise. (__gnat_unhandled_others_value): Likewise. (GNAT_OTHERS): Cast to Exception_Id instead of _Unwind_Ptr. (GNAT_ALL_OTHERS): Likewise. (GNAT_UNHANDLED_OTHERS): Likewise. (Is_Handled_By_Others): Change parameter type to Exception_Id. (Language_For): Likewise. (Foreign_Data_For): Likewise. (is_handled_by): Likewise. Adjust throughout, remove redundant line and fix indentation. * libgnat/a-exexpr.adb (Is_Handled_By_Others): Remove pragma and useless qualification from parameter type. (Foreign_Data_For): Likewise. (Language_For): Likewise.
1 parent d3ab01f commit d40dc31

File tree

2 files changed

+30
-37
lines changed

2 files changed

+30
-37
lines changed

gcc/ada/libgnat/a-exexpr.adb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ package body Exception_Propagation is
282282

283283
function Is_Handled_By_Others (E : Exception_Data_Ptr) return bool;
284284
pragma Export (C, Is_Handled_By_Others, "__gnat_is_handled_by_others");
285-
pragma Warnings (Off, Is_Handled_By_Others);
286285

287286
function Language_For (E : Exception_Data_Ptr) return Character;
288287
pragma Export (C, Language_For, "__gnat_language_for");
@@ -688,7 +687,7 @@ package body Exception_Propagation is
688687
-- Foreign_Data_For --
689688
----------------------
690689

691-
function Foreign_Data_For (E : SSL.Exception_Data_Ptr) return Address is
690+
function Foreign_Data_For (E : Exception_Data_Ptr) return Address is
692691
begin
693692
return E.Foreign_Data;
694693
end Foreign_Data_For;
@@ -697,7 +696,7 @@ package body Exception_Propagation is
697696
-- Is_Handled_By_Others --
698697
--------------------------
699698

700-
function Is_Handled_By_Others (E : SSL.Exception_Data_Ptr) return bool is
699+
function Is_Handled_By_Others (E : Exception_Data_Ptr) return bool is
701700
begin
702701
return not bool (E.all.Not_Handled_By_Others);
703702
end Is_Handled_By_Others;
@@ -706,7 +705,7 @@ package body Exception_Propagation is
706705
-- Language_For --
707706
------------------
708707

709-
function Language_For (E : SSL.Exception_Data_Ptr) return Character is
708+
function Language_For (E : Exception_Data_Ptr) return Character is
710709
begin
711710
return E.all.Lang;
712711
end Language_For;

gcc/ada/raise-gcc.c

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,14 @@ typedef struct
545545
/* The three constants below are specific ttype identifiers for special
546546
exception ids. Their type should match what a-exexpr exports. */
547547

548-
extern const char __gnat_others_value;
549-
#define GNAT_OTHERS ((_Unwind_Ptr) &__gnat_others_value)
548+
extern char __gnat_others_value;
549+
#define GNAT_OTHERS ((Exception_Id) &__gnat_others_value)
550550

551-
extern const char __gnat_all_others_value;
552-
#define GNAT_ALL_OTHERS ((_Unwind_Ptr) &__gnat_all_others_value)
551+
extern char __gnat_all_others_value;
552+
#define GNAT_ALL_OTHERS ((Exception_Id) &__gnat_all_others_value)
553553

554-
extern const char __gnat_unhandled_others_value;
555-
#define GNAT_UNHANDLED_OTHERS ((_Unwind_Ptr) &__gnat_unhandled_others_value)
554+
extern char __gnat_unhandled_others_value;
555+
#define GNAT_UNHANDLED_OTHERS ((Exception_Id) &__gnat_unhandled_others_value)
556556

557557
/* Describe the useful region data associated with an unwind context. */
558558

@@ -902,12 +902,10 @@ get_call_site_action_for (_Unwind_Ptr ip,
902902
#define Foreign_Data_For __gnat_foreign_data_for
903903
#define EID_For __gnat_eid_for
904904

905-
extern bool Is_Handled_By_Others (_Unwind_Ptr eid);
906-
extern char Language_For (_Unwind_Ptr eid);
907-
908-
extern void *Foreign_Data_For (_Unwind_Ptr eid);
909-
910-
extern Exception_Id EID_For (_GNAT_Exception * e);
905+
extern bool Is_Handled_By_Others (Exception_Id eid);
906+
extern char Language_For (Exception_Id eid);
907+
extern void *Foreign_Data_For (Exception_Id eid);
908+
extern Exception_Id EID_For (_GNAT_Exception *e);
911909

912910
#define Foreign_Exception system__exceptions__foreign_exception
913911
extern struct Exception_Data Foreign_Exception;
@@ -928,7 +926,7 @@ exception_class_eq (const _GNAT_Exception *except,
928926
/* Return how CHOICE matches PROPAGATED_EXCEPTION. */
929927

930928
static enum action_kind
931-
is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception)
929+
is_handled_by (Exception_Id choice, _GNAT_Exception *propagated_exception)
932930
{
933931
/* All others choice match everything. */
934932
if (choice == GNAT_ALL_OTHERS)
@@ -937,14 +935,10 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception)
937935
/* GNAT exception occurrence. */
938936
if (exception_class_eq (propagated_exception, GNAT_EXCEPTION_CLASS))
939937
{
940-
/* Pointer to the GNAT exception data corresponding to the propagated
941-
occurrence. */
942-
_Unwind_Ptr E = (_Unwind_Ptr) EID_For (propagated_exception);
943-
944938
if (choice == GNAT_UNHANDLED_OTHERS)
945939
return unhandler;
946940

947-
E = (_Unwind_Ptr) EID_For (propagated_exception);
941+
Exception_Id E = EID_For (propagated_exception);
948942

949943
/* Base matching rules: An exception data (id) matches itself, "when
950944
all_others" matches anything and "when others" matches anything
@@ -960,7 +954,7 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception)
960954
if (choice == GNAT_ALL_OTHERS
961955
|| choice == GNAT_OTHERS
962956
#ifndef CERT
963-
|| choice == (_Unwind_Ptr) &Foreign_Exception
957+
|| choice == &Foreign_Exception
964958
#endif
965959
)
966960
return handler;
@@ -1057,25 +1051,25 @@ get_action_description_for (_Unwind_Ptr ip,
10571051
/* Positive filters are for regular handlers. */
10581052
else if (ar_filter > 0)
10591053
{
1060-
/* Do not catch an exception if the _UA_FORCE_UNWIND flag is
1061-
passed (to follow the ABI). */
1062-
if (!(uw_phase & _UA_FORCE_UNWIND))
1063-
{
1054+
/* Do not catch an exception if the _UA_FORCE_UNWIND flag is
1055+
passed (to follow the ABI). */
1056+
if (!(uw_phase & _UA_FORCE_UNWIND))
1057+
{
10641058
enum action_kind act;
10651059

1066-
/* See if the filter we have is for an exception which
1067-
matches the one we are propagating. */
1068-
_Unwind_Ptr choice =
1069-
get_ttype_entry_for (region, ar_filter);
1060+
/* See if the filter we have is for an exception which
1061+
matches the one we are propagating. */
1062+
Exception_Id choice
1063+
= (Exception_Id) get_ttype_entry_for (region, ar_filter);
10701064

10711065
act = is_handled_by (choice, gnat_exception);
1072-
if (act != nothing)
1073-
{
1066+
if (act != nothing)
1067+
{
10741068
action->kind = act;
1075-
action->ttype_filter = ar_filter;
1076-
return;
1077-
}
1078-
}
1069+
action->ttype_filter = ar_filter;
1070+
return;
1071+
}
1072+
}
10791073
}
10801074

10811075
/* Negative filter values are for C++ exception specifications.

0 commit comments

Comments
 (0)