[Ada] Encoding of with clauses in ALI files

Programming / Compilers / GCC - pmderodat [138bc75d-0d04-0410-961f-82ee72b054a4] - 11 January 2018 08:51 EST

This patch modifies the encodings of with clauses in ALI files to adhere to the existing API. The encodigs are as follows:

- Explicit with clauses are encoded on a 'W' line (same as before).

- Implicit with clauses for ancestor units are encoded on a 'W' line (same as before).

- Limited_with clauses are encoded on a 'Y' line (same as before).

- ABE and RTSfind-related with clauses are encoded on a 'Z' line.


-- Source --


-- case_10_func.adb

function Case_10_Func return Boolean is begin return True; end Case_10_Func;

-- case_10_gen_func.ads

generic function Case_10_Gen_Func return Boolean;

-- case_10_gen_func.adb

function Case_10_Gen_Func return Boolean is begin return True; end Case_10_Gen_Func;

-- case_10_tasks.ads

package Case_10_Tasks is task type Task_Typ is end Task_Typ; end Case_10_Tasks;

-- case_10_tasks.adb

package body Case_10_Tasks is task body Task_Typ is begin null; end Task_Typ; end Case_10_Tasks;

-- case_10_gen.ads

with Case_10_Func; with Case_10_Gen_Func; with Case_10_Tasks;

generic package Case_10_Gen is
Val : constant Boolean := Case_10_Func;

function Inst is new Case_10_Gen_Func;

Tsk : Case_10_Tasks.Task_Typ; end Case_10_Gen;

-- case_10.ads

with Case_10_Gen;

package Case_10 is package Inst is new Case_10_Gen; end Case_10;


-- Compilation and output --


$ gcc -c case_10.ads $ grep "W " case_10.ali | sort $ grep "Z " case_10.ali | sort W case_10_gen%s case_10_gen.ads case_10_gen.ali Z case_10_func%b case_10_func.adb case_10_func.ali Z case_10_gen_func%s case_10_gen_func.adb case_10_gen_func.ali ED Z case_10_tasks%s case_10_tasks.adb case_10_tasks.ali AD Z system.soft_links%s s-soflin.adb s-soflin.ali Z system.tasking%s s-taskin.adb s-taskin.ali Z system.tasking.stages%s s-tassta.adb s-tassta.ali

2018-01-11 Hristian Kirtchev

gcc/ada/

- ali.adb: Document the remaining letters available for ALI lines. (Scan_ALI): A with clause is internal when it is encoded on a 'Z' line.
- ali.ads: Update type With_Record. Field Implicit_With_From_Instantiation is no longer in use. Add field Implicit_With.
- csinfo.adb (CSinfo): Remove the setup for attribute Implicit_With_From_Instantiation.
- lib-writ.adb (Collect_Withs): Correct the logic which marks a unit as either implicitly or explicitly withed. (Is_Implicit_With_Clause): New routine. (Write_ALI): Rename array Implicit_With to Has_Implicit_With to avoid confusion with the with clause attribute by the same name. (Write_With_Lines): Update the emission of 'W', 'Y', and 'Z' headers.
- rtsfind.adb (Maybe_Add_With): Code cleanup.
- sem_ch8.adb (Present_System_Aux): Code cleanup.
- sem_ch10.adb (Expand_With_Clause): Mark the with clause as generated for a parent unit. (Implicit_With_On_Parent): Mark the with clause as generated for a parent unit.
- sem_ch12.adb (Inherit_Context): With clauses inherited by an instantiation are no longer marked as Implicit_With_From_Instantiation because they are already marked as implicit.
- sem_elab.adb (Ensure_Prior_Elaboration_Static): Remove the kludge which marks implicit with clauses as related to an instantiation.
- sinfo.adb (Implicit_With_From_Instantiation): Removed. (Parent_With): New routine. (Set_Implicit_With_From_Instantiation): Removed. (Set_Parent_With): New routine.
- sinfo.ads: Update the documentation of attribute Implicit_With. Remove attribute Implicit_With_From_Instantiation along with occurrences in nodes. Add attribute Parent_With along with occurrences in nodes. (Implicit_With_From_Instantiation): Removed along with pragma Inline. (Parent_With): New routine along with pragma Inline. (Set_Implicit_With_From_Instantiation): Removed along with pragma Inline. (Set_Parent_With): New routine along with pragma Inline.

107ff8d6f32 [Ada] Encoding of with clauses in ALI files
gcc/ada/ChangeLog | 39 ++++++++++++++++
gcc/ada/ali.adb | 11 ++---
gcc/ada/ali.ads | 15 +++----
gcc/ada/csinfo.adb | 3 +-
gcc/ada/lib-writ.adb | 81 ++++++++++++++++++++++++++++-----
gcc/ada/rtsfind.adb | 14 +++---
gcc/ada/sem_ch10.adb | 125 ++++++++++++++++++++++++++-------------------------
gcc/ada/sem_ch12.adb | 8 ++--
gcc/ada/sem_ch8.adb | 11 ++---
gcc/ada/sem_elab.adb | 12 +----
gcc/ada/sinfo.adb | 32 ++++++-------
gcc/ada/sinfo.ads | 64 +++++++++++++++-----------
12 files changed, 258 insertions(+), 157 deletions(-)

Upstream: gcc.gnu.org


  • Share