aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/ali.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2024-03-08 09:32:51 -0500
committerMarc Poulhiès <poulhies@adacore.com>2024-05-17 10:21:02 +0200
commitd2a118197c767ccbd3905c14ff2ebe82bd0fe9ed (patch)
treed7424f0c2833e134b52db374cdaaab6c0785e795 /gcc/ada/ali.adb
parenta666066298f29bc08379aac75e65d1edb3eb415f (diff)
downloadgcc-d2a118197c767ccbd3905c14ff2ebe82bd0fe9ed.zip
gcc-d2a118197c767ccbd3905c14ff2ebe82bd0fe9ed.tar.gz
gcc-d2a118197c767ccbd3905c14ff2ebe82bd0fe9ed.tar.bz2
ada: gnatbind: subprogram spec no longer exists
If a subprogram spec S is present while compiling something that says "with S;", but the spec is absent while compiling the body of S, then gnatbind fails to detect the mismatch. The spec and body of S might have different parameter and result types. This patch fixes gnatbind to detect this case and give an error. gcc/ada/ * bcheck.adb (Check_Consistency_Of_Sdep): Split out new procedure. Add check for special case of subprogram spec that no longer exists. (Check_Consistency): Call Check_Consistency_Of_Sdep, except when Reified_Child_Spec is True. No need for "goto Continue" or "exit Sdep_Loop". * ali.ads (Subunit_Name, Unit_Name): Change the type to Unit_Name_Type. Add a comment pointing to the ALI file documentation, because it's in a somewhat-surprising place. * ali.adb (Scan_ALI): Subunit_Name and Unit_Name are now Unit_Name_Type. Remove comment explaining why Name_Find is used; Name_Find is the usual case. Do not remove the "%s" or "%b" from the Unit_Name. We need to be able to distinguish specs and bodies. This is also necessary to obey the invariant of Unit_Name_Type. * binde.adb (Write_Closure): Subunit_Name is now Unit_Name_Type. * clean.adb (Clean_Executables): Likewise.
Diffstat (limited to 'gcc/ada/ali.adb')
-rw-r--r--gcc/ada/ali.adb9
1 files changed, 3 insertions, 6 deletions
diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index 6bf48c0..69a91bc 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -3287,8 +3287,8 @@ package body ALI is
-- Acquire (sub)unit and reference file name entries
- Sdep.Table (Sdep.Last).Subunit_Name := No_Name;
- Sdep.Table (Sdep.Last).Unit_Name := No_Name;
+ Sdep.Table (Sdep.Last).Subunit_Name := No_Unit_Name;
+ Sdep.Table (Sdep.Last).Unit_Name := No_Unit_Name;
Sdep.Table (Sdep.Last).Rfile :=
Sdep.Table (Sdep.Last).Sfile;
Sdep.Table (Sdep.Last).Start_Line := 1;
@@ -3304,16 +3304,13 @@ package body ALI is
Add_Char_To_Name_Buffer (Getc);
end loop;
- -- Set the (sub)unit name. Note that we use Name_Find rather
- -- than Name_Enter here as the subunit name may already
- -- have been put in the name table by the Project Manager.
+ -- Set the (sub)unit name.
if Name_Len <= 2
or else Name_Buffer (Name_Len - 1) /= '%'
then
Sdep.Table (Sdep.Last).Subunit_Name := Name_Find;
else
- Name_Len := Name_Len - 2;
Sdep.Table (Sdep.Last).Unit_Name := Name_Find;
end if;