This change only affects GNATprove backend, where it avoids spurious
errors on missing ALI files for units indirectly withed from the current
unit and processed as part of a different .gpr project.

No test provided, because only GNATprove is affected.

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

2019-09-17  Piotr Trojanek  <troja...@adacore.com>

gcc/ada/

        * ali.ads: Fix casing in comment.
        * ali-util.ads, ali-util.adb (Read_Withed_ALIs): Remove
        Ignore_Errors parameter; it was only set to non-default value of
        True when running in GNATprove_Mode and wrongly reset to False
        when calling this routine recursively. Now in GNATprove mode we
        want it to be always True, so in fact it is equivalent to
        GNATProve_Mode flag itself (which was already used in this
        routine).
--- gcc/ada/ali-util.adb
+++ gcc/ada/ali-util.adb
@@ -215,10 +215,7 @@ package body ALI.Util is
    -- Read_Withed_ALIs --
    ----------------------
 
-   procedure Read_Withed_ALIs
-     (Id            : ALI_Id;
-      Ignore_Errors : Boolean := False)
-   is
+   procedure Read_Withed_ALIs (Id : ALI_Id) is
       Afile  : File_Name_Type;
       Text   : Text_Buffer_Ptr;
       Idread : ALI_Id;
@@ -240,14 +237,14 @@ package body ALI.Util is
             then
                Text := Read_Library_Info (Afile);
 
-               --  Unless Ignore_Errors is true, return with an error if source
+               --  Unless in GNATprove mode, return with an error if source
                --  cannot be found. We used to skip this check when we did not
                --  compile library generics separately, but we now always do,
                --  so there is no special case here anymore.
 
                if Text = null then
 
-                  if not Ignore_Errors then
+                  if not GNATprove_Mode then
                      Error_Msg_File_1 := Afile;
                      Error_Msg_File_2 := Withs.Table (W).Sfile;
                      Error_Msg ("{ not found, { must be compiled");
@@ -268,7 +265,7 @@ package body ALI.Util is
                   Free (Text);
 
                   if ALIs.Table (Idread).Compile_Errors
-                    and then not Ignore_Errors
+                    and then not GNATprove_Mode
                   then
                      Error_Msg_File_1 := Withs.Table (W).Sfile;
                      Error_Msg ("{ had errors, must be fixed, and recompiled");
@@ -279,7 +276,6 @@ package body ALI.Util is
 
                   elsif ALIs.Table (Idread).No_Object
                     and then not GNATprove_Mode
-                    and then not Ignore_Errors
                   then
                      Error_Msg_File_1 := Withs.Table (W).Sfile;
                      Error_Msg ("{ must be recompiled");

--- gcc/ada/ali-util.ads
+++ gcc/ada/ali-util.ads
@@ -107,15 +107,13 @@ package ALI.Util is
    -- Subprograms for Manipulating ALI Information --
    --------------------------------------------------
 
-   procedure Read_Withed_ALIs
-     (Id            : ALI_Id;
-      Ignore_Errors : Boolean := False);
+   procedure Read_Withed_ALIs (Id : ALI_Id);
    --  Process an ALI file which has been read and scanned by looping through
    --  all withed units in the ALI file, checking if they have been processed.
    --  Each unit that has not yet been processed will be read, scanned, and
-   --  processed recursively. If Ignore_Errors is True, then failure to read an
-   --  ALI file is not reported as an error, and scanning continues with other
-   --  ALI files.
+   --  processed recursively. In GNATprove mode a failure to read an ALI file
+   --  is not reported as an error, and scanning continues with other ALI
+   --  files.
 
    procedure Set_Source_Table (A : ALI_Id);
    --  Build source table entry corresponding to the ALI file whose id is A

--- gcc/ada/ali.ads
+++ gcc/ada/ali.ads
@@ -1429,7 +1429,7 @@ package ALI is
    --    both. If both are provided then only the Read_Lines value is used,
    --    and the Ignore_Lines parameter is ignored.
    --
-   --    Read_XREF is set True to read and acquire the cross-reference
+   --    Read_Xref is set True to read and acquire the cross-reference
    --    information. If Read_XREF is set to True, then the effect is to ignore
    --    all lines other than U, W, D and X lines and the Ignore_Lines and
    --    Read_Lines parameters are ignored (i.e. the use of True for Read_XREF

Reply via email to