This patch fixes an issue whereby the compilation of partial sources
(packages without bodies that require them) would not occur when said
sources were remote call interfaces. This is required because such
interfaces may have bodies that only exist on the server side or vice
versa

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

2018-09-26  Justin Squirek  <squi...@adacore.com>

gcc/ada/

        * lib-writ.adb, lib-writ.ads (Write_With_Lines): Add
        documentation and an extra conditional check for RCI units so
        that generated ali files will list the spec only instead of a
        body when a body is not found.
--- gcc/ada/lib-writ.adb
+++ gcc/ada/lib-writ.adb
@@ -960,9 +960,14 @@ package body Lib.Writ is
 
                   --  In GNATprove mode we must write the spec of a unit which
                   --  requires a body if that body is not found. This will
-                  --  allow partial analysis on incomplete sources.
-
-                  if GNATprove_Mode then
+                  --  allow partial analysis on incomplete sources. Also, in
+                  --  the case of a unit that is a remote call interface, the
+                  --  bodies of packages may not exist but still may form a
+                  --  valid program - so we handle that here as well.
+
+                  if GNATprove_Mode
+                    or else Is_Remote_Call_Interface (Cunit_Entity (Unum))
+                  then
                      Body_Fname :=
                        Get_File_Name
                          (Uname    => Get_Body_Name (Uname),

--- gcc/ada/lib-writ.ads
+++ gcc/ada/lib-writ.ads
@@ -624,18 +624,19 @@ package Lib.Writ is
    --    Z unit-name [source-name lib-name] [E] [EA] [ED] [AD]
 
    --      One W line is present for each unit that is mentioned in an explicit
-   --      non-limited with clause by the current unit. One Y line is present
+   --      nonlimited with clause by the current unit. One Y line is present
    --      for each unit that is mentioned in an explicit limited with clause
    --      by the current unit. One Z line is present for each unit that is
    --      only implicitly withed by the current unit. The first parameter is
    --      the unit name in internal format. The second parameter is the file
-   --      name of the body unit on which the current compliation depends -
-   --      except when in GNATprove mode. In GNATprove mode, when packages
-   --      which require a body have no associated source file, the file name
-   --      of the spec is used instead to allow partial analysis of incomplete
-   --      sources. The third parameter is the file name of the library
-   --      information file that contains the results of compiling this unit.
-   --      The optional modifiers are used as follows:
+   --      name of the body unit on which the current compilation unit depends,
+   --      except when in GNATprove mode or when the unit is a remote call
+   --      interface. In these cases, when packages that require a body have
+   --      no associated source file, the file name of the spec is used instead
+   --      to allow partial analysis of incomplete sources. The third parameter
+   --      is the file name of the library information file that contains the
+   --      results of compiling this unit. The optional modifiers are used as
+   --      follows:
 
    --        E   pragma Elaborate applies to this unit
 

Reply via email to