diff options
author | Bob Duff <duff@adacore.com> | 2020-07-10 07:37:33 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-19 05:53:41 -0400 |
commit | 84adfddd0e703c20203a2414c1a2f0fde3f540b7 (patch) | |
tree | 2ede40ddf2a7b9a4cb02965cbe5076840fd5c718 | |
parent | f1f877eea9bcf2858c039595fdaaa0e8d572e317 (diff) | |
download | gcc-84adfddd0e703c20203a2414c1a2f0fde3f540b7.zip gcc-84adfddd0e703c20203a2414c1a2f0fde3f540b7.tar.gz gcc-84adfddd0e703c20203a2414c1a2f0fde3f540b7.tar.bz2 |
[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.
-rw-r--r-- | gcc/ada/exp_ch6.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index aa67343..cb85901 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); |