GNATprove was emitting spurious checks about objects of the File_Type being
uninitialized and there was no easy to fix that (those checks could only be
silenced by pragma Annotate or by hiding File_Type behind as SPARK wrapper).

Now the full view of File_Type is annotated with Default_Initial_Condition
and GNATprove knows that objects of that type are default-initialized. The
default initialization is implicitly defined in the Ada RM (as indeed
there is no procedure that would take an IN OUT parameter of that type).

Semantics of Ada programs shall not be affected by these annotations,
so no frontend test is provided. It only affects GNATprove.

Tested on x86_64-pc-linux-gnu, committed on trunk

2018-01-11  Piotr Trojanek  <troja...@adacore.com>

gcc/ada/

        * libgnat/a-direio.ads, libgnat/a-sequio.ads, libgnat/a-ststio.ads,
        libgnat/a-textio.ads, libgnat/a-witeio.ads, libgnat/a-ztexio.ads
        (File_Type): Add Default_Initial_Condition aspect.
--- gcc/ada/libgnat/a-direio.ads
+++ gcc/ada/libgnat/a-direio.ads
@@ -50,7 +50,7 @@ package Ada.Direct_IO is
      (Element_Type'Has_Tagged_Values,
       "Element_Type for Direct_IO instance has tagged values");
 
-   type File_Type is limited private;
+   type File_Type is limited private with Default_Initial_Condition;
 
    type File_Mode is (In_File, Inout_File, Out_File);
 --- gcc/ada/libgnat/a-sequio.ads
+++ gcc/ada/libgnat/a-sequio.ads
@@ -50,7 +50,7 @@ package Ada.Sequential_IO is
      (Element_Type'Has_Tagged_Values,
       "Element_Type for Sequential_IO instance has tagged values");
 
-   type File_Type is limited private;
+   type File_Type is limited private with Default_Initial_Condition;
 
    type File_Mode is (In_File, Out_File, Append_File);
 --- gcc/ada/libgnat/a-ststio.ads
+++ gcc/ada/libgnat/a-ststio.ads
@@ -41,7 +41,7 @@ package Ada.Streams.Stream_IO is
 
    type Stream_Access is access all Root_Stream_Type'Class;
 
-   type File_Type is limited private;
+   type File_Type is limited private with Default_Initial_Condition;
 
    type File_Mode is (In_File, Out_File, Append_File);
 --- gcc/ada/libgnat/a-textio.ads
+++ gcc/ada/libgnat/a-textio.ads
@@ -49,7 +49,7 @@ with System.WCh_Con;
 package Ada.Text_IO is
    pragma Elaborate_Body;
 
-   type File_Type is limited private;
+   type File_Type is limited private with Default_Initial_Condition;
    type File_Mode is (In_File, Out_File, Append_File);
 
    --  The following representation clause allows the use of unchecked--- gcc/ada/libgnat/a-witeio.ads
+++ gcc/ada/libgnat/a-witeio.ads
@@ -51,7 +51,7 @@ with System.WCh_Con;
 
 package Ada.Wide_Text_IO is
 
-   type File_Type is limited private;
+   type File_Type is limited private with Default_Initial_Condition;
    type File_Mode is (In_File, Out_File, Append_File);
 
    --  The following representation clause allows the use of unchecked--- gcc/ada/libgnat/a-ztexio.ads
+++ gcc/ada/libgnat/a-ztexio.ads
@@ -51,7 +51,7 @@ with System.WCh_Con;
 
 package Ada.Wide_Wide_Text_IO is
 
-   type File_Type is limited private;
+   type File_Type is limited private with Default_Initial_Condition;
    type File_Mode is (In_File, Out_File, Append_File);
 
    --  The following representation clause allows the use of unchecked

Reply via email to