]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: gnatbind: subprogram spec no longer exists
authorBob Duff <duff@adacore.com>
Fri, 8 Mar 2024 14:32:51 +0000 (09:32 -0500)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 17 May 2024 08:21:02 +0000 (10:21 +0200)
commitd2a118197c767ccbd3905c14ff2ebe82bd0fe9ed
treed7424f0c2833e134b52db374cdaaab6c0785e795
parenta666066298f29bc08379aac75e65d1edb3eb415f
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.
gcc/ada/ali.adb
gcc/ada/ali.ads
gcc/ada/bcheck.adb
gcc/ada/binde.adb
gcc/ada/clean.adb