diff options
author | Thomas Quinot <quinot@adacore.com> | 2007-08-14 10:45:05 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-08-14 10:45:05 +0200 |
commit | 9410151a22e5a54497fcc44bf30dccf3569441e0 (patch) | |
tree | d0e7a73386d172b2419d7f2ead4f393e6d2ab8d5 /gcc/ada/binde.adb | |
parent | 5e1527bd5913aa38b5975022665985773747127a (diff) | |
download | gcc-9410151a22e5a54497fcc44bf30dccf3569441e0.zip gcc-9410151a22e5a54497fcc44bf30dccf3569441e0.tar.gz gcc-9410151a22e5a54497fcc44bf30dccf3569441e0.tar.bz2 |
binde.adb (Elab_All_Links): Remove unnecessary call to Generic_Separately_Compiled (if...
2007-08-14 Thomas Quinot <quinot@adacore.com>
Vincent Celier <celier@adacore.com>
* binde.adb (Elab_All_Links): Remove unnecessary call to
Generic_Separately_Compiled (if a unit satisfies this predicate, there
won't be an associated Afile).
(Elab_All_Links): Fail if a referenced unit cannot be found
* bindgen.adb:
Fix comments in bindgen regarding consistency checks done in Bcheck:
the checks are made across units within a partition, not across several
partitions.
Fix generation of C binder file for VxWorks.
* lib.adb (Generic_Separately_Compiled): Rename to
Generic_May_Lack_ALI, more descriptive of the current use of the
predicate, and update documentation.
* lib-writ.ads, lib-writ.adb (Write_With_Lines): Minor code
reorganization and documentation update for the case of predefined
library generics (for which we do not reference an Afile).
From-SVN: r127439
Diffstat (limited to 'gcc/ada/binde.adb')
-rw-r--r-- | gcc/ada/binde.adb | 71 |
1 files changed, 62 insertions, 9 deletions
diff --git a/gcc/ada/binde.adb b/gcc/ada/binde.adb index 7479e51..9190db0 100644 --- a/gcc/ada/binde.adb +++ b/gcc/ada/binde.adb @@ -28,12 +28,14 @@ with Binderr; use Binderr; with Butil; use Butil; with Debug; use Debug; with Fname; use Fname; -with Lib; use Lib; with Namet; use Namet; with Opt; use Opt; +with Osint; with Output; use Output; with Targparm; use Targparm; +with System.Case_Util; use System.Case_Util; + package body Binde is -- The following data structures are used to represent the graph that is @@ -864,18 +866,69 @@ package body Binde is Units.Table (Before).First_With .. Units.Table (Before).Last_With loop -- Skip if this with is an interface to a stand-alone library. - -- Skip also if no ALI file for this with, happens with certain - -- specialized generic files that do not get compiled. + -- Skip also if no ALI file for this WITH, happens for language + -- defined generics while bootstrapping the compiler (see body of + -- Lib.Writ.Write_With_Lines). if not Withs.Table (W).SAL_Interface and then Withs.Table (W).Afile /= No_File - and then Generic_Separately_Compiled (Withs.Table (W).Sfile) then - Elab_All_Links - (Unit_Id_Of (Withs.Table (W).Uname), - After, - Reason, - Make_Elab_Entry (Withs.Table (W).Uname, Link)); + declare + Info : constant Int := + Get_Name_Table_Info + (Withs.Table (W).Uname); + + begin + -- If the unit is unknown, for some unknown reason, fail + -- graciously explaining that the unit is unknown. Without + -- this check, gnatbind will crash in Unit_Id_Of. + + if Info = 0 or else Unit_Id (Info) = No_Unit_Id then + declare + Withed : String := + Get_Name_String (Withs.Table (W).Uname); + Last_Withed : Natural := Withed'Last; + Withing : String := + Get_Name_String + (Units.Table (Before).Uname); + Last_Withing : Natural := Withing'Last; + Spec_Body : String := " (Spec)"; + + begin + To_Mixed (Withed); + To_Mixed (Withing); + + if Last_Withed > 2 and then + Withed (Last_Withed - 1) = '%' + then + Last_Withed := Last_Withed - 2; + end if; + + if Last_Withing > 2 and then + Withing (Last_Withing - 1) = '%' + then + Last_Withing := Last_Withing - 2; + end if; + + if Units.Table (Before).Utype = Is_Body or else + Units.Table (Before).Utype = Is_Body_Only + then + Spec_Body := " (Body)"; + end if; + + Osint.Fail + ("could not find unit ", + Withed (Withed'First .. Last_Withed) & " needed by " & + Withing (Withing'First .. Last_Withing) & Spec_Body); + end; + end if; + + Elab_All_Links + (Unit_Id_Of (Withs.Table (W).Uname), + After, + Reason, + Make_Elab_Entry (Withs.Table (W).Uname, Link)); + end; end if; end loop; |