This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Minimizing recompilation with multiple limited_with clauses


This patch simplifies the contents of Ali files, but removing from it
dependency lines that denote units that are not analyzed, because they only
appear in the context of units named in limited_with clauses.


The following must execute quietly:

   gcc -c -gnatc a_things.ads
   grep c_things a_things.ali
   grep f_things a_things.ali

---
limited with B_Things;

package A_Things is

   type Instance is tagged null record;
   type Class_Access is access all Instance'Class;

   procedure Do_Something (Self : Instance);
   function Get_B_Instance (Self : Instance)
     return access B_Things.Instance'Class;
   function Get_B_Class_Acccess (Self : Instance) return B_Things.Class_Access;

end A_Things;
---
limited with A_Things;
limited with C_Things;

package B_Things is

   type Instance is tagged null record;
   type Class_Access is access all Instance'Class;
   Some_Junk : Integer := 1235;
   procedure Do_Something (Self : Instance);

   function Get_A_Instance (Self : Instance)
      return access A_Things.Instance'Class;
   function Get_A_Class_Acccess (Self : Instance)
      return A_Things.Class_Access;

   function Get_C_Instance (Self : Instance)
      return access C_Things.Instance'Class;
   function Get_C_Class_Acccess (Self : Instance)
      return C_Things.Class_Access;

end B_Things;
---
limited with B_Things;
limited with D_Things;

package C_Things is

   type Instance is tagged null record;
   type Class_Access is access all Instance'Class;

   procedure Do_Something (Self : Instance);

   function Get_B_Instance (Self : Instance)
      return access B_Things.Instance'Class;
   function Get_B_Class_Acccess (Self : Instance)
      return B_Things.Class_Access;

   function Get_D_Instance (Self : Instance)
      return access D_Things.Instance'Class;
   function Get_D_Class_Acccess (Self : Instance)
      return D_Things.Class_Access;

end C_Things;
---
limited with C_Things;
limited with E_Things;

package D_Things is

   type Instance is tagged null record;
   type Class_Access is access all Instance'Class;

   procedure Do_Something (Self : Instance);

   function Get_C_Instance (Self : Instance)
      return access C_Things.Instance'Class;
   function Get_C_Class_Acccess (Self : Instance)
      return C_Things.Class_Access;

   function Get_E_Instance (Self : Instance)
      return access E_Things.Instance'Class;
   function Get_E_Class_Acccess (Self : Instance)
      return E_Things.Class_Access;

end D_Things;
---
limited with E_Things;
limited with F_Things;

package E_Things is

   type Instance is tagged null record;
   type Class_Access is access all Instance'Class;

   procedure Do_Something (Self : Instance);

   function Get_D_Instance (Self : Instance)
      return access D_Things.Instance'Class;
   function Get_D_Class_Acccess (Self : Instance)
      return D_Things.Class_Access;

   function Get_F_Instance (Self : Instance)
      return access F_Things.Instance'Class;
   function Get_F_Class_Acccess (Self : Instance)
      return F_Things.Class_Access;

end E_Things;
---
limited with E_Things;

package F_Things is

   type Instance is tagged private;
   type Class_Access is access all Instance'Class;

   procedure Do_Something (Self : Instance);

   function Get_E_Instance (Self : Instance)
      return access E_Things.Instance'Class is (null);
   function Get_E_Class_Acccess (Self : Instance)
      return E_Things.Class_Access is (null);

private

   type Instance is tagged record
      X : Integer;
      Y : Integer;
      Z : Integer;
   end record;

end F_Things;

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

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* lib-writ.adb (Write_ALI): Do not record in ali file units
	that are present in the files table but not analyzed. These
	units are present because they appear in the context of units
	named in limited_with clauses, and the unit being compiled does
	not depend semantically on them.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]