Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/lib-load.adb @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
4 -- -- | 4 -- -- |
5 -- L I B . L O A D -- | 5 -- L I B . L O A D -- |
6 -- -- | 6 -- -- |
7 -- B o d y -- | 7 -- B o d y -- |
8 -- -- | 8 -- -- |
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. -- | 9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- |
10 -- -- | 10 -- -- |
11 -- GNAT is free software; you can redistribute it and/or modify it under -- | 11 -- GNAT is free software; you can redistribute it and/or modify it under -- |
12 -- terms of the GNU General Public License as published by the Free Soft- -- | 12 -- terms of the GNU General Public License as published by the Free Soft- -- |
13 -- ware Foundation; either version 3, or (at your option) any later ver- -- | 13 -- ware Foundation; either version 3, or (at your option) any later ver- -- |
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- | 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
243 Unit_File_Name => Fname, | 243 Unit_File_Name => Fname, |
244 Unit_Name => Spec_Name, | 244 Unit_Name => Spec_Name, |
245 Version => 0, | 245 Version => 0, |
246 OA_Setting => 'O'); | 246 OA_Setting => 'O'); |
247 | 247 |
248 Init_Unit_Name (Unum, Spec_Name); | |
249 | |
248 Set_Comes_From_Source_Default (Save_CS); | 250 Set_Comes_From_Source_Default (Save_CS); |
249 Set_Error_Posted (Cunit_Entity); | 251 Set_Error_Posted (Cunit_Entity); |
250 Set_Error_Posted (Cunit); | 252 Set_Error_Posted (Cunit); |
251 return Unum; | 253 return Unum; |
252 end Create_Dummy_Package_Unit; | 254 end Create_Dummy_Package_Unit; |
605 Calling_Unit := No_Unit; | 607 Calling_Unit := No_Unit; |
606 end if; | 608 end if; |
607 | 609 |
608 -- See if we already have an entry for this unit | 610 -- See if we already have an entry for this unit |
609 | 611 |
610 Unum := Main_Unit; | 612 Unum := Unit_Names.Get (Uname_Actual); |
611 while Unum <= Units.Last loop | 613 if Unum = No_Unit then |
612 exit when Uname_Actual = Units.Table (Unum).Unit_Name; | 614 Unum := Units.Last + 1; |
613 Unum := Unum + 1; | 615 end if; |
614 end loop; | |
615 | 616 |
616 -- Whether or not the entry was found, Unum is now the right value, | 617 -- Whether or not the entry was found, Unum is now the right value, |
617 -- since it is one more than Units.Last (i.e. the index of the new | 618 -- since it is one more than Units.Last (i.e. the index of the new |
618 -- entry we will create) in the not found case. | 619 -- entry we will create) in the not found case. |
619 | 620 |
725 | 726 |
726 -- Make a partial entry in the file table, used even in the file not | 727 -- Make a partial entry in the file table, used even in the file not |
727 -- found case to print the dependency chain including the last entry | 728 -- found case to print the dependency chain including the last entry |
728 | 729 |
729 Units.Increment_Last; | 730 Units.Increment_Last; |
730 Units.Table (Unum).Unit_Name := Uname_Actual; | 731 Init_Unit_Name (Unum, Uname_Actual); |
731 | 732 |
732 -- File was found | 733 -- File was found |
733 | 734 |
734 if Src_Ind > No_Source_File then | 735 if Src_Ind > No_Source_File then |
735 Units.Table (Unum) := | 736 Units.Table (Unum) := |
891 | 892 |
892 -- Remove unit from stack, to avoid cascaded errors on | 893 -- Remove unit from stack, to avoid cascaded errors on |
893 -- subsequent missing files. | 894 -- subsequent missing files. |
894 | 895 |
895 Load_Stack.Decrement_Last; | 896 Load_Stack.Decrement_Last; |
896 Units.Decrement_Last; | 897 Remove_Unit (Unum); |
897 | 898 |
898 -- If unit not required, remove load stack entry and the junk | 899 -- If unit not required, remove load stack entry and the junk |
899 -- file table entry, and return No_Unit to indicate not found, | 900 -- file table entry, and return No_Unit to indicate not found, |
900 | 901 |
901 else | 902 else |
902 Load_Stack.Decrement_Last; | 903 Load_Stack.Decrement_Last; |
903 Units.Decrement_Last; | 904 Remove_Unit (Unum); |
904 end if; | 905 end if; |
905 | 906 |
906 Unum := No_Unit; | 907 Unum := No_Unit; |
907 goto Done; | 908 goto Done; |
908 end if; | 909 end if; |
919 -------------------------- | 920 -------------------------- |
920 -- Make_Child_Decl_Unit -- | 921 -- Make_Child_Decl_Unit -- |
921 -------------------------- | 922 -------------------------- |
922 | 923 |
923 procedure Make_Child_Decl_Unit (N : Node_Id) is | 924 procedure Make_Child_Decl_Unit (N : Node_Id) is |
924 Unit_Decl : constant Node_Id := Library_Unit (N); | 925 Unit_Decl : constant Node_Id := Library_Unit (N); |
926 Unit_Num : constant Unit_Number_Type := Get_Cunit_Unit_Number (N); | |
925 | 927 |
926 begin | 928 begin |
927 Units.Increment_Last; | 929 Units.Increment_Last; |
928 Units.Table (Units.Last) := Units.Table (Get_Cunit_Unit_Number (N)); | 930 Units.Table (Units.Last) := Units.Table (Unit_Num); |
929 Units.Table (Units.Last).Unit_Name := | |
930 Get_Spec_Name (Unit_Name (Get_Cunit_Unit_Number (N))); | |
931 Units.Table (Units.Last).Cunit := Unit_Decl; | 931 Units.Table (Units.Last).Cunit := Unit_Decl; |
932 Units.Table (Units.Last).Cunit_Entity := | 932 Units.Table (Units.Last).Cunit_Entity := |
933 Defining_Identifier | 933 Defining_Identifier |
934 (Defining_Unit_Name (Specification (Unit (Unit_Decl)))); | 934 (Defining_Unit_Name (Specification (Unit (Unit_Decl)))); |
935 Init_Unit_Name (Units.Last, Get_Spec_Name (Unit_Name (Unit_Num))); | |
935 | 936 |
936 -- The library unit created for of a child subprogram unit plays no | 937 -- The library unit created for of a child subprogram unit plays no |
937 -- role in code generation and binding, so label it accordingly. | 938 -- role in code generation and binding, so label it accordingly. |
938 | 939 |
939 Units.Table (Units.Last).Generate_Code := False; | 940 Units.Table (Units.Last).Generate_Code := False; |
961 | 962 |
962 if In_Main then | 963 if In_Main then |
963 Units.Table (Units.Last) := Units.Table (Main_Unit); | 964 Units.Table (Units.Last) := Units.Table (Main_Unit); |
964 Units.Table (Units.Last).Cunit := Library_Unit (N); | 965 Units.Table (Units.Last).Cunit := Library_Unit (N); |
965 Units.Table (Units.Last).Generate_Code := True; | 966 Units.Table (Units.Last).Generate_Code := True; |
967 Init_Unit_Name (Units.Last, Unit_Name (Main_Unit)); | |
968 | |
966 Units.Table (Main_Unit).Cunit := N; | 969 Units.Table (Main_Unit).Cunit := N; |
967 Units.Table (Main_Unit).Unit_Name := | 970 Units.Table (Main_Unit).Version := Source_Checksum (Sind); |
971 Init_Unit_Name (Main_Unit, | |
968 Get_Body_Name | 972 Get_Body_Name |
969 (Unit_Name (Get_Cunit_Unit_Number (Library_Unit (N)))); | 973 (Unit_Name (Get_Cunit_Unit_Number (Library_Unit (N))))); |
970 Units.Table (Main_Unit).Version := Source_Checksum (Sind); | |
971 | 974 |
972 else | 975 else |
973 -- Duplicate information from instance unit, for the body. The unit | 976 -- Duplicate information from instance unit, for the body. The unit |
974 -- node N has been rewritten as a body, but it was placed in the | 977 -- node N has been rewritten as a body, but it was placed in the |
975 -- units table when first loaded as a declaration. | 978 -- units table when first loaded as a declaration. |