diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2018-10-09 15:06:21 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-10-09 15:06:21 +0000 |
commit | 865234bf36f1bf8274c3e970f32a8bfb16e96771 (patch) | |
tree | 6796fc117e2a91f77eb6bf252eb289c25cd0454a /gcc | |
parent | fd40a157ba7f2e703570dd83feea84ef3b07fff1 (diff) | |
download | gcc-865234bf36f1bf8274c3e970f32a8bfb16e96771.zip gcc-865234bf36f1bf8274c3e970f32a8bfb16e96771.tar.gz gcc-865234bf36f1bf8274c3e970f32a8bfb16e96771.tar.bz2 |
[Ada] Fix strange warning when using Ada.Iterator_Interface
The back-end was recently changed to issue more -Wuninitialized warnings
on Out parameters and this has caught a case related to
Ada.Iterator_Interface.: This patchlet simply kills this uninteresting
warning.
2018-10-09 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_disp.adb (Make_Disp_Asynchronous_Select_Spec): Set
Warnings_Off on the B out parameter.
gcc/testsuite/
* gnat.dg/warn17.adb: New testcase.
From-SVN: r264977
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/exp_disp.adb | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/warn17.adb | 22 |
4 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 072e19a..a5476022 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> + * exp_disp.adb (Make_Disp_Asynchronous_Select_Spec): Set + Warnings_Off on the B out parameter. + +2018-10-09 Eric Botcazou <ebotcazou@adacore.com> + * einfo.ads: Small comment fix. 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 2169b67..79c0897 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -2487,9 +2487,10 @@ package body Exp_Disp is (Typ : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Typ); - Def_Id : constant Node_Id := + Def_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uDisp_Asynchronous_Select); + B_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uB); Params : constant List_Id := New_List; begin @@ -2501,6 +2502,9 @@ package body Exp_Disp is -- B : out Dummy_Communication_Block; -- Communication block dummy -- F : out Boolean; -- Status flag + -- The B parameter may be left uninitialized + Set_Warnings_Off (B_Id); + Append_List_To (Params, New_List ( Make_Parameter_Specification (Loc, @@ -2518,7 +2522,7 @@ package body Exp_Disp is Parameter_Type => New_Occurrence_Of (RTE (RE_Address), Loc)), Make_Parameter_Specification (Loc, - Defining_Identifier => Make_Defining_Identifier (Loc, Name_uB), + Defining_Identifier => B_Id, Parameter_Type => New_Occurrence_Of (RTE (RE_Dummy_Communication_Block), Loc), Out_Present => True), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 87368c7..8196ce7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/warn17.adb: New testcase. + +2018-10-09 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/inline14.adb, gnat.dg/inline14_pkg.adb, gnat.dg/inline14_pkg.ads: New testcase. diff --git a/gcc/testsuite/gnat.dg/warn17.adb b/gcc/testsuite/gnat.dg/warn17.adb new file mode 100644 index 0000000..6d48e54 --- /dev/null +++ b/gcc/testsuite/gnat.dg/warn17.adb @@ -0,0 +1,22 @@ +-- { dg-do compile } +-- { dg-options "-Wall" } + +with Ada.Iterator_Interfaces; + +procedure Warn17 is + + type Cursor is null record; + + function Has_Element (Position : Cursor) return Boolean; + + function Has_Element (Position : Cursor) return Boolean is (True); + + package My_Iterator is + new Ada.Iterator_Interfaces (Cursor, Has_Element); + + type Iterator is abstract new My_Iterator.Forward_Iterator with null record; + + pragma Unreferenced (Iterator); +begin + null; +end Warn17; |