From d40dc31924972f90cef920a8f76b3042aefc065d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 17 Feb 2021 10:27:41 +0100 Subject: [PATCH] [Ada] Fix type mismatch warnings during LTO bootstrap #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. --- gcc/ada/libgnat/a-exexpr.adb | 7 ++--- gcc/ada/raise-gcc.c | 60 ++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/gcc/ada/libgnat/a-exexpr.adb b/gcc/ada/libgnat/a-exexpr.adb index f79a499639eb..ff85bc550d61 100644 --- a/gcc/ada/libgnat/a-exexpr.adb +++ b/gcc/ada/libgnat/a-exexpr.adb @@ -282,7 +282,6 @@ package body Exception_Propagation is function Is_Handled_By_Others (E : Exception_Data_Ptr) return bool; pragma Export (C, Is_Handled_By_Others, "__gnat_is_handled_by_others"); - pragma Warnings (Off, Is_Handled_By_Others); function Language_For (E : Exception_Data_Ptr) return Character; pragma Export (C, Language_For, "__gnat_language_for"); @@ -688,7 +687,7 @@ package body Exception_Propagation is -- Foreign_Data_For -- ---------------------- - function Foreign_Data_For (E : SSL.Exception_Data_Ptr) return Address is + function Foreign_Data_For (E : Exception_Data_Ptr) return Address is begin return E.Foreign_Data; end Foreign_Data_For; @@ -697,7 +696,7 @@ package body Exception_Propagation is -- Is_Handled_By_Others -- -------------------------- - function Is_Handled_By_Others (E : SSL.Exception_Data_Ptr) return bool is + function Is_Handled_By_Others (E : Exception_Data_Ptr) return bool is begin return not bool (E.all.Not_Handled_By_Others); end Is_Handled_By_Others; @@ -706,7 +705,7 @@ package body Exception_Propagation is -- Language_For -- ------------------ - function Language_For (E : SSL.Exception_Data_Ptr) return Character is + function Language_For (E : Exception_Data_Ptr) return Character is begin return E.all.Lang; end Language_For; diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c index 6a50a516c968..bbedee509602 100644 --- a/gcc/ada/raise-gcc.c +++ b/gcc/ada/raise-gcc.c @@ -545,14 +545,14 @@ typedef struct /* The three constants below are specific ttype identifiers for special exception ids. Their type should match what a-exexpr exports. */ -extern const char __gnat_others_value; -#define GNAT_OTHERS ((_Unwind_Ptr) &__gnat_others_value) +extern char __gnat_others_value; +#define GNAT_OTHERS ((Exception_Id) &__gnat_others_value) -extern const char __gnat_all_others_value; -#define GNAT_ALL_OTHERS ((_Unwind_Ptr) &__gnat_all_others_value) +extern char __gnat_all_others_value; +#define GNAT_ALL_OTHERS ((Exception_Id) &__gnat_all_others_value) -extern const char __gnat_unhandled_others_value; -#define GNAT_UNHANDLED_OTHERS ((_Unwind_Ptr) &__gnat_unhandled_others_value) +extern char __gnat_unhandled_others_value; +#define GNAT_UNHANDLED_OTHERS ((Exception_Id) &__gnat_unhandled_others_value) /* Describe the useful region data associated with an unwind context. */ @@ -902,12 +902,10 @@ get_call_site_action_for (_Unwind_Ptr ip, #define Foreign_Data_For __gnat_foreign_data_for #define EID_For __gnat_eid_for -extern bool Is_Handled_By_Others (_Unwind_Ptr eid); -extern char Language_For (_Unwind_Ptr eid); - -extern void *Foreign_Data_For (_Unwind_Ptr eid); - -extern Exception_Id EID_For (_GNAT_Exception * e); +extern bool Is_Handled_By_Others (Exception_Id eid); +extern char Language_For (Exception_Id eid); +extern void *Foreign_Data_For (Exception_Id eid); +extern Exception_Id EID_For (_GNAT_Exception *e); #define Foreign_Exception system__exceptions__foreign_exception extern struct Exception_Data Foreign_Exception; @@ -928,7 +926,7 @@ exception_class_eq (const _GNAT_Exception *except, /* Return how CHOICE matches PROPAGATED_EXCEPTION. */ static enum action_kind -is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception) +is_handled_by (Exception_Id choice, _GNAT_Exception *propagated_exception) { /* All others choice match everything. */ if (choice == GNAT_ALL_OTHERS) @@ -937,14 +935,10 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception) /* GNAT exception occurrence. */ if (exception_class_eq (propagated_exception, GNAT_EXCEPTION_CLASS)) { - /* Pointer to the GNAT exception data corresponding to the propagated - occurrence. */ - _Unwind_Ptr E = (_Unwind_Ptr) EID_For (propagated_exception); - if (choice == GNAT_UNHANDLED_OTHERS) return unhandler; - E = (_Unwind_Ptr) EID_For (propagated_exception); + Exception_Id E = EID_For (propagated_exception); /* Base matching rules: An exception data (id) matches itself, "when all_others" matches anything and "when others" matches anything @@ -960,7 +954,7 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception) if (choice == GNAT_ALL_OTHERS || choice == GNAT_OTHERS #ifndef CERT - || choice == (_Unwind_Ptr) &Foreign_Exception + || choice == &Foreign_Exception #endif ) return handler; @@ -1057,25 +1051,25 @@ get_action_description_for (_Unwind_Ptr ip, /* Positive filters are for regular handlers. */ else if (ar_filter > 0) { - /* Do not catch an exception if the _UA_FORCE_UNWIND flag is - passed (to follow the ABI). */ - if (!(uw_phase & _UA_FORCE_UNWIND)) - { + /* Do not catch an exception if the _UA_FORCE_UNWIND flag is + passed (to follow the ABI). */ + if (!(uw_phase & _UA_FORCE_UNWIND)) + { enum action_kind act; - /* See if the filter we have is for an exception which - matches the one we are propagating. */ - _Unwind_Ptr choice = - get_ttype_entry_for (region, ar_filter); + /* See if the filter we have is for an exception which + matches the one we are propagating. */ + Exception_Id choice + = (Exception_Id) get_ttype_entry_for (region, ar_filter); act = is_handled_by (choice, gnat_exception); - if (act != nothing) - { + if (act != nothing) + { action->kind = act; - action->ttype_filter = ar_filter; - return; - } - } + action->ttype_filter = ar_filter; + return; + } + } } /* Negative filter values are for C++ exception specifications.