From: Bob Duff Date: Fri, 10 Jul 2020 11:37:33 +0000 (-0400) Subject: [Ada] Suppress warnings in expansion of "for ... of" loops X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=84adfddd0e703c20203a2414c1a2f0fde3f540b7;p=gcc.git [Ada] Suppress warnings in expansion of "for ... of" loops gcc/ada/ * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): Set the Warnings_Off flag on the pointer object used in the expansion of iterators and similar. --- diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index aa67343a1c7..cb85901fcba 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -9538,9 +9538,15 @@ package body Exp_Ch6 is -- Finally, create an access object initialized to a reference to the -- function call. We know this access value cannot be null, so mark the - -- entity accordingly to suppress the access check. + -- entity accordingly to suppress the access check. We need to suppress + -- warnings, because this can be part of the expansion of "for ... of" + -- and similar constructs that generate finalization actions. Such + -- finalization actions are safe, because they check a count that + -- indicates which objects should be finalized, but the back end + -- nonetheless warns about uninitialized objects. Def_Id := Make_Temporary (Loc, 'R', Func_Call); + Set_Warnings_Off (Def_Id); Set_Etype (Def_Id, Ptr_Typ); Set_Is_Known_Non_Null (Def_Id);