]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Suppress warnings in expansion of "for ... of" loops
authorBob Duff <duff@adacore.com>
Fri, 10 Jul 2020 11:37:33 +0000 (07:37 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 19 Oct 2020 09:53:41 +0000 (05:53 -0400)
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.

gcc/ada/exp_ch6.adb

index aa67343a1c7970740e3df4cb20d18ae31edd6c66..cb85901fcba13b59a4d801179d3e68c40b178395 100644 (file)
@@ -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);
 
This page took 0.069752 seconds and 5 git commands to generate.