1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
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- --
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- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Butil
; use Butil
;
27 with Debug
; use Debug
;
28 with Fname
; use Fname
;
30 with Osint
; use Osint
;
31 with Output
; use Output
;
36 -- Make control characters visible
38 -- The following variable records which characters currently are
39 -- used as line type markers in the ALI file. This is used in
40 -- Scan_ALI to detect (or skip) invalid lines.
42 Known_ALI_Lines
: constant array (Character range 'A' .. 'Z') of Boolean :=
43 ('V' => True, -- version
44 'M' => True, -- main program
45 'A' => True, -- argument
46 'P' => True, -- program
47 'R' => True, -- restriction
48 'I' => True, -- interrupt
51 'L' => True, -- linker option
53 'E' => True, -- external
54 'D' => True, -- dependency
56 'S' => True, -- specific dispatching
57 'Y' => True, -- limited_with
58 'Z' => True, -- implicit with from instantiation
59 'C' => True, -- SCO information
60 'F' => True, -- SPARK cross-reference information
67 procedure Initialize_ALI
is
69 -- When (re)initializing ALI data structures the ALI user expects to
70 -- get a fresh set of data structures. Thus we first need to erase the
71 -- marks put in the name table by the previous set of ALI routine calls.
72 -- These two loops are empty and harmless the first time in.
74 for J
in ALIs
.First
.. ALIs
.Last
loop
75 Set_Name_Table_Int
(ALIs
.Table
(J
).Afile
, 0);
78 for J
in Units
.First
.. Units
.Last
loop
79 Set_Name_Table_Int
(Units
.Table
(J
).Uname
, 0);
82 -- Free argument table strings
84 for J
in Args
.First
.. Args
.Last
loop
85 Free
(Args
.Table
(J
));
88 -- Initialize all tables
102 -- Add dummy zero'th item in Linker_Options and Notes for sort calls
104 Linker_Options
.Increment_Last
;
105 Notes
.Increment_Last
;
107 -- Initialize global variables recording cumulative options in all
108 -- ALI files that are read for a given processing run in gnatbind.
110 Dynamic_Elaboration_Checks_Specified
:= False;
111 Locking_Policy_Specified
:= ' ';
112 No_Normalize_Scalars_Specified
:= False;
113 No_Object_Specified
:= False;
114 GNATprove_Mode_Specified
:= False;
115 Normalize_Scalars_Specified
:= False;
116 Partition_Elaboration_Policy_Specified
:= ' ';
117 Queuing_Policy_Specified
:= ' ';
118 SSO_Default_Specified
:= False;
119 Task_Dispatching_Policy_Specified
:= ' ';
120 Unreserve_All_Interrupts_Specified
:= False;
121 Frontend_Exceptions_Specified
:= False;
122 Zero_Cost_Exceptions_Specified
:= False;
134 Read_Xref
: Boolean := False;
135 Read_Lines
: String := "";
136 Ignore_Lines
: String := "X";
137 Ignore_Errors
: Boolean := False;
138 Directly_Scanned
: Boolean := False) return ALI_Id
140 P
: Text_Ptr
:= T
'First;
141 Line
: Logical_Line_Number
:= 1;
147 Ignore
: array (Character range 'A' .. 'Z') of Boolean;
148 -- Ignore (X) is set to True if lines starting with X are to
149 -- be ignored by Scan_ALI and skipped, and False if the lines
150 -- are to be read and processed.
152 Bad_ALI_Format
: exception;
153 -- Exception raised by Fatal_Error if Err is True
155 function At_Eol
return Boolean;
156 -- Test if at end of line
158 function At_End_Of_Field
return Boolean;
159 -- Test if at end of line, or if at blank or horizontal tab
161 procedure Check_At_End_Of_Field
;
162 -- Check if we are at end of field, fatal error if not
164 procedure Checkc
(C
: Character);
165 -- Check next character is C. If so bump past it, if not fatal error
167 procedure Check_Unknown_Line
;
168 -- If Ignore_Errors mode, then checks C to make sure that it is not
169 -- an unknown ALI line type characters, and if so, skips lines
170 -- until the first character of the line is one of these characters,
171 -- at which point it does a Getc to put that character in C. The
172 -- call has no effect if C is already an appropriate character.
173 -- If not in Ignore_Errors mode, a fatal error is signalled if the
174 -- line is unknown. Note that if C is an EOL on entry, the line is
175 -- skipped (it is assumed that blank lines are never significant).
176 -- If C is EOF on entry, the call has no effect (it is assumed that
177 -- the caller will properly handle this case).
179 procedure Fatal_Error
;
180 -- Generate fatal error message for badly formatted ALI file if
181 -- Err is false, or raise Bad_ALI_Format if Err is True.
183 procedure Fatal_Error_Ignore
;
184 pragma Inline
(Fatal_Error_Ignore
);
185 -- In Ignore_Errors mode, has no effect, otherwise same as Fatal_Error
187 function Getc
return Character;
188 -- Get next character, bumping P past the character obtained
190 function Get_File_Name
191 (Lower
: Boolean := False;
192 May_Be_Quoted
: Boolean := False) return File_Name_Type
;
193 -- Skip blanks, then scan out a file name (name is left in Name_Buffer
194 -- with length in Name_Len, as well as returning a File_Name_Type value.
195 -- If May_Be_Quoted is True and the first non blank character is '"',
196 -- then remove starting and ending quotes and undoubled internal quotes.
197 -- If lower is false, the case is unchanged, if Lower is True then the
198 -- result is forced to all lower case for systems where file names are
199 -- not case sensitive. This ensures that gnatbind works correctly
200 -- regardless of the case of the file name on all systems. The scan
201 -- is terminated by a end of line, space or horizontal tab. Any other
202 -- special characters are included in the returned name.
205 (Ignore_Spaces
: Boolean := False;
206 Ignore_Special
: Boolean := False;
207 May_Be_Quoted
: Boolean := False) return Name_Id
;
208 -- Skip blanks, then scan out a name (name is left in Name_Buffer with
209 -- length in Name_Len, as well as being returned in Name_Id form).
210 -- If Lower is set to True then the Name_Buffer will be converted to
211 -- all lower case, for systems where file names are not case sensitive.
212 -- This ensures that gnatbind works correctly regardless of the case
213 -- of the file name on all systems. The termination condition depends
214 -- on the settings of Ignore_Spaces and Ignore_Special:
216 -- If Ignore_Spaces is False (normal case), then scan is terminated
217 -- by the normal end of field condition (EOL, space, horizontal tab)
219 -- If Ignore_Special is False (normal case), the scan is terminated by
220 -- a typeref bracket or an equal sign except for the special case of
221 -- an operator name starting with a double quote which is terminated
222 -- by another double quote.
224 -- If May_Be_Quoted is True and the first non blank character is '"'
225 -- the name is 'unquoted'. In this case Ignore_Special is ignored and
226 -- assumed to be True.
228 -- It is an error to set both Ignore_Spaces and Ignore_Special to True.
229 -- This function handles wide characters properly.
231 function Get_Nat
return Nat
;
232 -- Skip blanks, then scan out an unsigned integer value in Nat range
233 -- raises ALI_Reading_Error if the encoutered type is not natural.
235 function Get_Stamp
return Time_Stamp_Type
;
236 -- Skip blanks, then scan out a time stamp
238 function Get_Unit_Name
return Unit_Name_Type
;
239 -- Skip blanks, then scan out a file name (name is left in Name_Buffer
240 -- with length in Name_Len, as well as returning a Unit_Name_Type value.
241 -- The case is unchanged and terminated by a normal end of field.
243 function Nextc
return Character;
244 -- Return current character without modifying pointer P
246 procedure Get_Typeref
247 (Current_File_Num
: Sdep_Id
;
249 File_Num
: out Sdep_Id
;
251 Ref_Type
: out Character;
253 Standard_Entity
: out Name_Id
);
254 -- Parse the definition of a typeref (<...>, {...} or (...))
257 -- Skip past spaces, then skip past end of line (fatal error if not
258 -- at end of line). Also skips past any following blank lines.
261 -- Skip rest of current line and any following blank lines
263 procedure Skip_Space
;
264 -- Skip past white space (blanks or horizontal tab)
267 -- Skip past next character, does not affect value in C. This call
268 -- is like calling Getc and ignoring the returned result.
270 ---------------------
271 -- At_End_Of_Field --
272 ---------------------
274 function At_End_Of_Field
return Boolean is
283 function At_Eol
return Boolean is
285 return Nextc
= EOF
or else Nextc
= CR
or else Nextc
= LF
;
288 ---------------------------
289 -- Check_At_End_Of_Field --
290 ---------------------------
292 procedure Check_At_End_Of_Field
is
294 if not At_End_Of_Field
then
295 if Ignore_Errors
then
296 while Nextc
> ' ' loop
303 end Check_At_End_Of_Field
;
305 ------------------------
306 -- Check_Unknown_Line --
307 ------------------------
309 procedure Check_Unknown_Line
is
311 while C
not in 'A' .. 'Z'
312 or else not Known_ALI_Lines
(C
)
314 if C
= CR
or else C
= LF
then
321 elsif Ignore_Errors
then
329 end Check_Unknown_Line
;
335 procedure Checkc
(C
: Character) is
339 elsif Ignore_Errors
then
350 procedure Fatal_Error
is
355 procedure Wchar
(C
: Character);
356 -- Write a single character, replacing horizontal tab by spaces
358 procedure Wchar
(C
: Character) is
363 exit when Col
mod 8 = 0;
372 -- Start of processing for Fatal_Error
376 raise Bad_ALI_Format
;
380 Write_Str
("fatal error: file ");
382 Write_Str
(" is incorrectly formatted");
385 Write_Str
("make sure you are using consistent versions " &
387 -- Split the following line so that it can easily be transformed for
388 -- other back-ends where the compiler might have a different name.
394 -- Find start of line
398 and then T
(Ptr1
- 1) /= CR
399 and then T
(Ptr1
- 1) /= LF
404 Write_Int
(Int
(Line
));
419 and then T
(Ptr2
) /= CR
420 and then T
(Ptr2
) /= LF
432 if T
(Ptr1
) = HT
then
444 Exit_Program
(E_Fatal
);
447 ------------------------
448 -- Fatal_Error_Ignore --
449 ------------------------
451 procedure Fatal_Error_Ignore
is
453 if not Ignore_Errors
then
456 end Fatal_Error_Ignore
;
462 function Get_File_Name
463 (Lower
: Boolean := False;
464 May_Be_Quoted
: Boolean := False) return File_Name_Type
469 F
:= Get_Name
(Ignore_Special
=> True,
470 May_Be_Quoted
=> May_Be_Quoted
);
472 -- Convert file name to all lower case if file names are not case
473 -- sensitive. This ensures that we handle names in the canonical
474 -- lower case format, regardless of the actual case.
476 if Lower
and not File_Names_Case_Sensitive
then
477 Canonical_Case_File_Name
(Name_Buffer
(1 .. Name_Len
));
480 return File_Name_Type
(F
);
489 (Ignore_Spaces
: Boolean := False;
490 Ignore_Special
: Boolean := False;
491 May_Be_Quoted
: Boolean := False) return Name_Id
500 if Ignore_Errors
then
509 -- Deal with quoted characters
511 if May_Be_Quoted
and then Char
= '"' then
514 if Ignore_Errors
then
537 Add_Char_To_Name_Buffer
(Char
);
540 -- Other than case of quoted character
545 Add_Char_To_Name_Buffer
(Getc
);
547 exit when At_End_Of_Field
and then not Ignore_Spaces
;
549 if not Ignore_Special
then
550 if Name_Buffer
(1) = '"' then
551 exit when Name_Len
> 1
552 and then Name_Buffer
(Name_Len
) = '"';
555 -- Terminate on parens or angle brackets or equal sign
557 exit when Nextc
= '(' or else Nextc
= ')'
558 or else Nextc
= '{' or else Nextc
= '}'
559 or else Nextc
= '<' or else Nextc
= '>'
562 -- Terminate on comma
564 exit when Nextc
= ',';
566 -- Terminate if left bracket not part of wide char
567 -- sequence Note that we only recognize brackets
568 -- notation so far ???
570 exit when Nextc
= '[' and then T
(P
+ 1) /= '"';
572 -- Terminate if right bracket not part of wide char
575 exit when Nextc
= ']' and then T
(P
- 1) /= '"';
588 function Get_Unit_Name
return Unit_Name_Type
is
590 return Unit_Name_Type
(Get_Name
);
597 function Get_Nat
return Nat
is
603 -- Check if we are on a number. In the case of bad ALI files, this
606 if not (Nextc
in '0' .. '9') then
612 V
:= V
* 10 + (Character'Pos (Getc
) - Character'Pos ('0'));
614 exit when At_End_Of_Field
;
615 exit when Nextc
< '0' or else Nextc
> '9';
625 function Get_Stamp
return Time_Stamp_Type
is
633 if Ignore_Errors
then
634 return Dummy_Time_Stamp
;
640 -- Following reads old style time stamp missing first two digits
642 if Nextc
in '7' .. '9' then
647 -- Normal case of full year in time stamp
653 for J
in Start
.. T
'Last loop
664 procedure Get_Typeref
665 (Current_File_Num
: Sdep_Id
;
667 File_Num
: out Sdep_Id
;
669 Ref_Type
: out Character;
671 Standard_Entity
: out Name_Id
)
676 when '<' => Ref
:= Tref_Derived
;
677 when '(' => Ref
:= Tref_Access
;
678 when '{' => Ref
:= Tref_Type
;
679 when others => Ref
:= Tref_None
;
682 -- Case of typeref field present
684 if Ref
/= Tref_None
then
685 P
:= P
+ 1; -- skip opening bracket
687 if Nextc
in 'a' .. 'z' then
688 File_Num
:= No_Sdep_Id
;
692 Standard_Entity
:= Get_Name
(Ignore_Spaces
=> True);
697 File_Num
:= Sdep_Id
(N
+ Nat
(First_Sdep_Entry
) - 1);
701 File_Num
:= Current_File_Num
;
707 Standard_Entity
:= No_Name
;
710 -- ??? Temporary workaround for nested generics case:
711 -- 4i4 Directories{1|4I9[4|6[3|3]]}
715 Nested_Brackets
: Natural := 0;
721 Nested_Brackets
:= Nested_Brackets
+ 1;
723 Nested_Brackets
:= Nested_Brackets
- 1;
725 if Nested_Brackets
= 0 then
734 P
:= P
+ 1; -- skip closing bracket
737 -- No typeref entry present
740 File_Num
:= No_Sdep_Id
;
744 Standard_Entity
:= No_Name
;
752 function Getc
return Character is
766 function Nextc
return Character is
775 procedure Skip_Eol
is
780 if Ignore_Errors
then
781 while not At_Eol
loop
789 -- Loop to skip past blank lines (first time through skips this EOL)
791 while Nextc
< ' ' and then Nextc
/= EOF
loop
804 procedure Skip_Line
is
806 while not At_Eol
loop
817 procedure Skip_Space
is
819 while Nextc
= ' ' or else Nextc
= HT
loop
835 -- Start of processing for Scan_ALI
838 First_Sdep_Entry
:= Sdep
.Last
+ 1;
840 -- Acquire lines to be ignored
844 ('U' |
'W' |
'Y' |
'Z' |
'D' |
'X' => False, others => True);
846 -- Read_Lines parameter given
848 elsif Read_Lines
/= "" then
849 Ignore
:= ('U' => False, others => True);
851 for J
in Read_Lines
'Range loop
852 Ignore
(Read_Lines
(J
)) := False;
855 -- Process Ignore_Lines parameter
858 Ignore
:= (others => False);
860 for J
in Ignore_Lines
'Range loop
861 pragma Assert
(Ignore_Lines
(J
) /= 'U');
862 Ignore
(Ignore_Lines
(J
)) := True;
866 -- Setup ALI Table entry with appropriate defaults
870 Set_Name_Table_Int
(F
, Int
(Id
));
874 Compile_Errors
=> False,
875 First_Interrupt_State
=> Interrupt_States
.Last
+ 1,
876 First_Sdep
=> No_Sdep_Id
,
877 First_Specific_Dispatching
=> Specific_Dispatching
.Last
+ 1,
878 First_Unit
=> No_Unit_Id
,
879 GNATprove_Mode
=> False,
880 Last_Interrupt_State
=> Interrupt_States
.Last
,
881 Last_Sdep
=> No_Sdep_Id
,
882 Last_Specific_Dispatching
=> Specific_Dispatching
.Last
,
883 Last_Unit
=> No_Unit_Id
,
884 Locking_Policy
=> ' ',
887 Main_Program
=> None
,
889 Normalize_Scalars
=> False,
890 Ofile_Full_Name
=> Full_Object_File_Name
,
891 Partition_Elaboration_Policy
=> ' ',
892 Queuing_Policy
=> ' ',
893 Restrictions
=> No_Restrictions
,
894 SAL_Interface
=> False,
897 Task_Dispatching_Policy
=> ' ',
898 Time_Slice_Value
=> -1,
900 Unit_Exception_Table
=> False,
901 Ver
=> (others => ' '),
903 Frontend_Exceptions
=> False,
904 Zero_Cost_Exceptions
=> False);
906 -- Now we acquire the input lines from the ALI file. Note that the
907 -- convention in the following code is that as we enter each section,
908 -- C is set to contain the first character of the following line.
913 -- Acquire library version
917 -- The V line missing really indicates trouble, most likely it
918 -- means we don't have an ALI file at all, so here we give a
919 -- fatal error even if we are in Ignore_Errors mode.
923 elsif Ignore
('V') then
931 for J
in 1 .. Ver_Len_Max
loop
934 ALIs
.Table
(Id
).Ver
(J
) := C
;
935 ALIs
.Table
(Id
).Ver_Len
:= J
;
944 -- Acquire main program line if present
957 ALIs
.Table
(Id
).Main_Program
:= Func
;
959 ALIs
.Table
(Id
).Main_Program
:= Proc
;
969 ALIs
.Table
(Id
).Main_Priority
:= Get_Nat
;
977 ALIs
.Table
(Id
).Time_Slice_Value
:= Get_Nat
;
985 ALIs
.Table
(Id
).Main_CPU
:= Get_Nat
;
992 ALIs
.Table
(Id
).WC_Encoding
:= Getc
;
1001 -- Acquire argument lines
1003 First_Arg
:= Args
.Last
+ 1;
1007 exit A_Loop
when C
/= 'A';
1009 if Ignore
('A') then
1015 -- Scan out argument
1018 while not At_Eol
loop
1019 Add_Char_To_Name_Buffer
(Getc
);
1022 -- If -fstack-check, record that it occurred. Note that an
1023 -- additional string parameter can be specified, in the form of
1024 -- -fstack-check={no|generic|specific}. "no" means no checking,
1025 -- "generic" means force the use of old-style checking, and
1026 -- "specific" means use the best checking method.
1029 and then Name_Buffer
(1 .. 13) = "-fstack-check"
1030 and then Name_Buffer
(1 .. Name_Len
) /= "-fstack-check=no"
1032 Stack_Check_Switch_Set
:= True;
1035 -- Store the argument
1037 Args
.Increment_Last
;
1038 Args
.Table
(Args
.Last
) := new String'(Name_Buffer (1 .. Name_Len));
1051 if Ignore_Errors then
1063 if Ignore ('P
') then
1071 while not At_Eol loop
1076 -- Processing for CE
1080 ALIs.Table (Id).Compile_Errors := True;
1082 -- Processing for DB
1086 Detect_Blocking := True;
1088 -- Processing for Ex
1091 Partition_Elaboration_Policy_Specified := Getc;
1092 ALIs.Table (Id).Partition_Elaboration_Policy :=
1093 Partition_Elaboration_Policy_Specified;
1095 -- Processing for FX
1101 ALIs.Table (Id).Frontend_Exceptions := True;
1102 Frontend_Exceptions_Specified := True;
1107 -- Processing for GP
1111 GNATprove_Mode_Specified := True;
1112 ALIs.Table (Id).GNATprove_Mode := True;
1114 -- Processing for Lx
1117 Locking_Policy_Specified := Getc;
1118 ALIs.Table (Id).Locking_Policy := Locking_Policy_Specified;
1120 -- Processing for flags starting with N
1125 -- Processing for NO
1128 ALIs.Table (Id).No_Object := True;
1129 No_Object_Specified := True;
1131 -- Processing for NR
1134 No_Run_Time_Mode := True;
1135 Configurable_Run_Time_Mode := True;
1137 -- Processing for NS
1140 ALIs.Table (Id).Normalize_Scalars := True;
1141 Normalize_Scalars_Specified := True;
1144 -- Invalid switch starting with N
1150 -- Processing for OH/OL
1155 if C = 'L
' or else C = 'H
' then
1156 ALIs.Table (Id).SSO_Default := C;
1157 SSO_Default_Specified := True;
1163 -- Processing for Qx
1166 Queuing_Policy_Specified := Getc;
1167 ALIs.Table (Id).Queuing_Policy := Queuing_Policy_Specified;
1169 -- Processing for flags starting with S
1174 -- Processing for SL
1177 ALIs.Table (Id).SAL_Interface := True;
1179 -- Processing for SS
1182 Opt.Sec_Stack_Used := True;
1184 -- Invalid switch starting with S
1190 -- Processing for Tx
1193 Task_Dispatching_Policy_Specified := Getc;
1194 ALIs.Table (Id).Task_Dispatching_Policy :=
1195 Task_Dispatching_Policy_Specified;
1197 -- Processing for switch starting with U
1202 -- Processing for UA
1205 Unreserve_All_Interrupts_Specified := True;
1207 -- Processing for UX
1210 ALIs.Table (Id).Unit_Exception_Table := True;
1212 -- Invalid switches starting with U
1218 -- Processing for ZX
1224 ALIs.Table (Id).Zero_Cost_Exceptions := True;
1225 Zero_Cost_Exceptions_Specified := True;
1230 -- Invalid parameter
1238 if not NS_Found then
1239 No_Normalize_Scalars_Specified := True;
1248 -- Loop to skip to first restrictions line
1251 if Ignore_Errors then
1263 -- Ignore all 'R
' lines if that is required
1265 if Ignore ('R
') then
1271 -- Here we process the restrictions lines (other than unit name cases)
1274 Scan_Restrictions : declare
1275 Save_R : constant Restrictions_Info := Cumulative_Restrictions;
1276 -- Save cumulative restrictions in case we have a fatal error
1278 Bad_R_Line : exception;
1279 -- Signal bad restrictions line (raised on unexpected character)
1286 -- Named restriction case
1292 -- Loop through RR and RV lines
1294 while C = 'R
' and then Nextc /= ' ' loop
1298 -- Acquire restriction name
1301 while not At_Eol and then Nextc /= '=' loop
1302 Name_Len := Name_Len + 1;
1303 Name_Buffer (Name_Len) := Getc;
1306 -- Now search list of restrictions to find match
1309 RN : String renames Name_Buffer (1 .. Name_Len);
1312 R := Restriction_Id'First;
1313 while R /= Not_A_Restriction_Id loop
1314 if Restriction_Id'Image (R) = RN then
1318 R := Restriction_Id'Succ (R);
1321 -- We don't recognize the restriction. This might be
1322 -- thought of as an error, and it really is, but we
1323 -- want to allow building with inconsistent versions
1324 -- of the binder and ali files (see comments at the
1325 -- start of package System.Rident), so we just ignore
1328 goto Done_With_Restriction_Line;
1335 -- Boolean restriction case
1337 when All_Boolean_Restrictions =>
1340 ALIs.Table (Id).Restrictions.Violated (R) :=
1342 Cumulative_Restrictions.Violated (R) := True;
1345 ALIs.Table (Id).Restrictions.Set (R) := True;
1346 Cumulative_Restrictions.Set (R) := True;
1352 -- Parameter restriction case
1354 when All_Parameter_Restrictions =>
1355 if At_Eol or else Nextc /= '=' then
1361 N := Natural (Get_Nat);
1368 ALIs.Table (Id).Restrictions.Set (R) := True;
1369 ALIs.Table (Id).Restrictions.Value (R) := N;
1371 if Cumulative_Restrictions.Set (R) then
1372 Cumulative_Restrictions.Value (R) :=
1374 (Cumulative_Restrictions.Value (R), N);
1376 Cumulative_Restrictions.Set (R) := True;
1377 Cumulative_Restrictions.Value (R) := N;
1380 -- Restriction violated
1383 ALIs.Table (Id).Restrictions.Violated (R) :=
1385 Cumulative_Restrictions.Violated (R) := True;
1386 ALIs.Table (Id).Restrictions.Count (R) := N;
1388 -- Checked Max_Parameter case
1390 if R in Checked_Max_Parameter_Restrictions then
1391 Cumulative_Restrictions.Count (R) :=
1393 (Cumulative_Restrictions.Count (R), N);
1395 -- Other checked parameter cases
1399 pragma Unsuppress (Overflow_Check);
1402 Cumulative_Restrictions.Count (R) :=
1403 Cumulative_Restrictions.Count (R) + N;
1406 when Constraint_Error =>
1408 -- A constraint error comes from the
1409 -- addition. We reset to the maximum
1410 -- and indicate that the real value
1413 Cumulative_Restrictions.Value (R) :=
1415 Cumulative_Restrictions.Unknown (R) :=
1424 ALIs.Table (Id).Restrictions.Unknown (R) :=
1426 Cumulative_Restrictions.Unknown (R) := True;
1429 -- Other than 'R
' or 'V
'
1439 -- Bizarre error case NOT_A_RESTRICTION
1441 when Not_A_Restriction_Id =>
1449 <<Done_With_Restriction_Line>>
1454 -- Positional restriction case
1460 -- Acquire information for boolean restrictions
1462 for R in All_Boolean_Restrictions loop
1467 ALIs.Table (Id).Restrictions.Violated (R) := True;
1468 Cumulative_Restrictions.Violated (R) := True;
1471 ALIs.Table (Id).Restrictions.Set (R) := True;
1472 Cumulative_Restrictions.Set (R) := True;
1482 -- Acquire information for parameter restrictions
1484 for RP in All_Parameter_Restrictions loop
1490 ALIs.Table (Id).Restrictions.Set (RP) := True;
1493 N : constant Integer := Integer (Get_Nat);
1495 ALIs.Table (Id).Restrictions.Value (RP) := N;
1497 if Cumulative_Restrictions.Set (RP) then
1498 Cumulative_Restrictions.Value (RP) :=
1500 (Cumulative_Restrictions.Value (RP), N);
1502 Cumulative_Restrictions.Set (RP) := True;
1503 Cumulative_Restrictions.Value (RP) := N;
1511 -- Acquire restrictions violations information
1519 ALIs.Table (Id).Restrictions.Violated (RP) := True;
1520 Cumulative_Restrictions.Violated (RP) := True;
1523 N : constant Integer := Integer (Get_Nat);
1526 ALIs.Table (Id).Restrictions.Count (RP) := N;
1528 if RP in Checked_Max_Parameter_Restrictions then
1529 Cumulative_Restrictions.Count (RP) :=
1531 (Cumulative_Restrictions.Count (RP), N);
1535 pragma Unsuppress (Overflow_Check);
1538 Cumulative_Restrictions.Count (RP) :=
1539 Cumulative_Restrictions.Count (RP) + N;
1542 when Constraint_Error =>
1544 -- A constraint error comes from the add. We
1545 -- reset to the maximum and indicate that the
1546 -- real value is now unknown.
1548 Cumulative_Restrictions.Value (RP) :=
1550 Cumulative_Restrictions.Unknown (RP) := True;
1556 ALIs.Table (Id).Restrictions.Unknown (RP) := True;
1557 Cumulative_Restrictions.Unknown (RP) := True;
1574 -- Here if error during scanning of restrictions line
1579 -- In Ignore_Errors mode, undo any changes to restrictions
1580 -- from this unit, and continue on, skipping remaining R
1581 -- lines for this unit.
1583 if Ignore_Errors then
1584 Cumulative_Restrictions := Save_R;
1585 ALIs.Table (Id).Restrictions := No_Restrictions;
1593 -- In normal mode, this is a fatal error
1598 end Scan_Restrictions;
1601 -- Acquire additional restrictions (No_Dependence) lines if present
1604 if Ignore ('R
') then
1608 No_Deps.Append ((Id, Get_Name));
1615 -- Acquire 'I
' lines if present
1620 if Ignore ('I
') then
1626 I_State : Character;
1635 Interrupt_States.Append (
1636 (Interrupt_Id => Int_Num,
1637 Interrupt_State => I_State,
1638 IS_Pragma_Line => Line_No));
1640 ALIs.Table (Id).Last_Interrupt_State := Interrupt_States.Last;
1648 -- Acquire 'S
' lines if present
1653 if Ignore ('S
') then
1669 First_Prio := Get_Nat;
1670 Last_Prio := Get_Nat;
1673 Specific_Dispatching.Append (
1674 (Dispatching_Policy => Policy,
1675 First_Priority => First_Prio,
1676 Last_Priority => Last_Prio,
1677 PSD_Pragma_Line => Line_No));
1679 ALIs.Table (Id).Last_Specific_Dispatching :=
1680 Specific_Dispatching.Last;
1689 -- Loop to acquire unit entries
1693 exit U_Loop when C /= 'U
';
1695 -- Note: as per spec, we never ignore U lines
1699 Units.Increment_Last;
1701 if ALIs.Table (Id).First_Unit = No_Unit_Id then
1702 ALIs.Table (Id).First_Unit := Units.Last;
1706 UL : Unit_Record renames Units.Table (Units.Last);
1709 UL.Uname := Get_Unit_Name;
1710 UL.Predefined := Is_Predefined_Unit;
1711 UL.Internal := Is_Internal_Unit;
1713 UL.Sfile := Get_File_Name (Lower => True);
1715 UL.Preelab := False;
1716 UL.No_Elab := False;
1717 UL.Shared_Passive := False;
1719 UL.Remote_Types := False;
1720 UL.Serious_Errors := False;
1721 UL.Has_RACW := False;
1722 UL.Init_Scalars := False;
1723 UL.Is_Generic := False;
1724 UL.Icasing := Mixed_Case;
1725 UL.Kcasing := All_Lower_Case;
1726 UL.Dynamic_Elab := False;
1727 UL.Elaborate_Body := False;
1728 UL.Set_Elab_Entity := False;
1729 UL.Version := "00000000";
1730 UL.First_With := Withs.Last + 1;
1731 UL.First_Arg := First_Arg;
1732 UL.Elab_Position := 0;
1733 UL.SAL_Interface := ALIs.Table (Id).SAL_Interface;
1734 UL.Directly_Scanned := Directly_Scanned;
1735 UL.Body_Needed_For_SAL := False;
1736 UL.Elaborate_Body_Desirable := False;
1737 UL.Optimize_Alignment := 'O
';
1738 UL.Has_Finalizer := False;
1740 if Debug_Flag_U then
1741 Write_Str (" ----> reading unit ");
1742 Write_Int (Int (Units.Last));
1744 Write_Unit_Name (UL.Uname);
1745 Write_Str (" from file ");
1746 Write_Name (UL.Sfile);
1751 -- Check for duplicated unit in different files
1754 Info : constant Int := Get_Name_Table_Int
1755 (Units.Table (Units.Last).Uname);
1758 and then Units.Table (Units.Last).Sfile /=
1759 Units.Table (Unit_Id (Info)).Sfile
1761 -- If Err is set then ignore duplicate unit name. This is the
1762 -- case of a call from gnatmake, where the situation can arise
1763 -- from substitution of source files. In such situations, the
1764 -- processing in gnatmake will always result in any required
1765 -- recompilations in any case, and if we consider this to be
1766 -- an error we get strange cases (for example when a generic
1767 -- instantiation is replaced by a normal package) where we
1768 -- read the old ali file, decide to recompile, and then decide
1769 -- that the old and new ali files are incompatible.
1774 -- If Err is not set, then this is a fatal error. This is
1775 -- the case of being called from the binder, where we must
1776 -- definitely diagnose this as an error.
1780 Write_Str ("error: duplicate unit name: ");
1783 Write_Str ("error: unit """);
1784 Write_Unit_Name (Units.Table (Units.Last).Uname);
1785 Write_Str (""" found in file """);
1786 Write_Name_Decoded (Units.Table (Units.Last).Sfile);
1790 Write_Str ("error
: unit
""");
1791 Write_Unit_Name (Units.Table (Unit_Id (Info)).Uname);
1792 Write_Str (""" found
in file
""");
1793 Write_Name_Decoded (Units.Table (Unit_Id (Info)).Sfile);
1797 Exit_Program (E_Fatal);
1803 (Units.Table (Units.Last).Uname, Int (Units.Last));
1805 -- Scan out possible version and other parameters
1814 if C in '0' .. '9' or else C in 'a
' .. 'f
' then
1815 Units.Table (Units.Last).Version (1) := C;
1817 for J in 2 .. 8 loop
1819 Units.Table (Units.Last).Version (J) := C;
1828 Check_At_End_Of_Field;
1829 Units.Table (Units.Last).Elaborate_Body_Desirable := True;
1832 Check_At_End_Of_Field;
1833 Units.Table (Units.Last).Body_Needed_For_SAL := True;
1839 -- DE parameter (Dynamic elaboration checks)
1845 Check_At_End_Of_Field;
1846 Units.Table (Units.Last).Dynamic_Elab := True;
1847 Dynamic_Elaboration_Checks_Specified := True;
1858 Units.Table (Units.Last).Elaborate_Body := True;
1860 Units.Table (Units.Last).Set_Elab_Entity := True;
1865 Check_At_End_Of_Field;
1867 -- GE parameter (generic)
1873 Check_At_End_Of_Field;
1874 Units.Table (Units.Last).Is_Generic := True;
1879 -- IL/IS/IU parameters
1885 Units.Table (Units.Last).Icasing := All_Lower_Case;
1887 Units.Table (Units.Last).Init_Scalars := True;
1888 Initialize_Scalars_Used := True;
1890 Units.Table (Units.Last).Icasing := All_Upper_Case;
1895 Check_At_End_Of_Field;
1903 Units.Table (Units.Last).Kcasing := Mixed_Case;
1905 Units.Table (Units.Last).Kcasing := All_Upper_Case;
1910 Check_At_End_Of_Field;
1918 Units.Table (Units.Last).No_Elab := True;
1919 Check_At_End_Of_Field;
1924 -- PF/PR/PU/PK parameters
1930 Units.Table (Units.Last).Has_Finalizer := True;
1932 Units.Table (Units.Last).Preelab := True;
1934 Units.Table (Units.Last).Pure := True;
1936 Units.Table (Units.Last).Unit_Kind := 'p
';
1941 Check_At_End_Of_Field;
1943 -- OL/OO/OS/OT parameters
1948 if C = 'L
' or else C = 'O
' or else C = 'S
' or else C = 'T
' then
1949 Units.Table (Units.Last).Optimize_Alignment := C;
1954 Check_At_End_Of_Field;
1962 Units.Table (Units.Last).RCI := True;
1964 Units.Table (Units.Last).Remote_Types := True;
1966 Units.Table (Units.Last).Has_RACW := True;
1971 Check_At_End_Of_Field;
1973 -- SE/SP/SU parameters
1979 Units.Table (Units.Last).Serious_Errors := True;
1981 Units.Table (Units.Last).Shared_Passive := True;
1983 Units.Table (Units.Last).Unit_Kind := 's
';
1988 Check_At_End_Of_Field;
2000 -- Scan out With lines for this unit
2004 exit With_Loop when C /= 'W
' and then C /= 'Y
' and then C /= 'Z
';
2006 if Ignore ('W
') then
2012 Withs.Increment_Last;
2013 Withs.Table (Withs.Last).Uname := Get_Unit_Name;
2014 Withs.Table (Withs.Last).Elaborate := False;
2015 Withs.Table (Withs.Last).Elaborate_All := False;
2016 Withs.Table (Withs.Last).Elab_Desirable := False;
2017 Withs.Table (Withs.Last).Elab_All_Desirable := False;
2018 Withs.Table (Withs.Last).SAL_Interface := False;
2019 Withs.Table (Withs.Last).Limited_With := (C = 'Y
');
2020 Withs.Table (Withs.Last).Implicit_With_From_Instantiation
2023 -- Generic case with no object file available
2026 Withs.Table (Withs.Last).Sfile := No_File;
2027 Withs.Table (Withs.Last).Afile := No_File;
2032 Withs.Table (Withs.Last).Sfile := Get_File_Name
2034 Withs.Table (Withs.Last).Afile := Get_File_Name
2037 -- Scan out possible E, EA, ED, and AD parameters
2039 while not At_Eol loop
2045 Check_At_End_Of_Field;
2047 -- Store AD indication unless ignore required
2049 if not Ignore_ED then
2050 Withs.Table (Withs.Last).Elab_All_Desirable := True;
2053 elsif Nextc = 'E
' then
2056 if At_End_Of_Field then
2057 Withs.Table (Withs.Last).Elaborate := True;
2059 elsif Nextc = 'A
' then
2061 Check_At_End_Of_Field;
2062 Withs.Table (Withs.Last).Elaborate_All := True;
2066 Check_At_End_Of_Field;
2068 -- Store ED indication unless ignore required
2070 if not Ignore_ED then
2071 Withs.Table (Withs.Last).Elab_Desirable :=
2088 Units.Table (Units.Last).Last_With := Withs.Last;
2089 Units.Table (Units.Last).Last_Arg := Args.Last;
2091 -- If there are linker options lines present, scan them
2095 Linker_Options_Loop : loop
2097 exit Linker_Options_Loop when C /= 'L
';
2099 if Ignore ('L
') then
2110 if C < Character'Val (16#20#)
2111 or else C > Character'Val (16#7E#)
2116 C := Character'Val (0);
2123 for J in 1 .. 2 loop
2126 if C in '0' .. '9' then
2129 Character'Pos ('0');
2131 elsif C in 'A' .. 'F' then
2134 Character'Pos ('A') +
2143 Add_Char_To_Name_Buffer (Character'Val (V));
2148 exit when Nextc /= '"';
2152 Add_Char_To_Name_Buffer (C);
2156 Add_Char_To_Name_Buffer (NUL);
2161 end loop Linker_Options_Loop;
2163 -- Store the linker options entry if one was found
2165 if Name_Len /= 0 then
2166 Linker_Options.Increment_Last;
2168 Linker_Options.Table (Linker_Options.Last).Name :=
2171 Linker_Options.Table (Linker_Options.Last).Unit :=
2174 Linker_Options.Table (Linker_Options.Last).Internal_File :=
2175 Is_Internal_File_Name (F);
2177 Linker_Options.Table (Linker_Options.Last).Original_Pos :=
2178 Linker_Options.Last;
2181 -- If there are notes present, scan them
2185 exit Notes_Loop when C /= 'N';
2187 if Ignore ('N') then
2193 Notes.Increment_Last;
2194 Notes.Table (Notes.Last).Pragma_Type := Getc;
2195 Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
2197 Notes.Table (Notes.Last).Pragma_Col := Get_Nat;
2199 if not At_Eol and then Nextc = ':' then
2201 Notes.Table (Notes.Last).Pragma_Source_File :=
2202 Get_File_Name (Lower => True);
2204 Notes.Table (Notes.Last).Pragma_Source_File :=
2205 Units.Table (Units.Last).Sfile;
2209 Notes.Table (Notes.Last).Pragma_Args := No_Name;
2212 -- Note: can't use Get_Name here as the remainder of the
2213 -- line is unstructured text whose syntax depends on the
2214 -- particular pragma used.
2219 while not At_Eol loop
2220 Add_Char_To_Name_Buffer (Getc);
2228 end loop Notes_Loop;
2231 -- End loop through units for one ALI file
2233 ALIs.Table (Id).Last_Unit := Units.Last;
2234 ALIs.Table (Id).Sfile := Units.Table (ALIs.Table (Id).First_Unit).Sfile;
2236 -- Set types of the units (there can be at most 2 of them)
2238 if ALIs.Table (Id).First_Unit /= ALIs.Table (Id).Last_Unit then
2239 Units.Table (ALIs.Table (Id).First_Unit).Utype := Is_Body;
2240 Units.Table (ALIs.Table (Id).Last_Unit).Utype := Is_Spec;
2243 -- Deal with body only and spec only cases, note that the reason we
2244 -- do our own checking of the name (rather than using Is_Body_Name)
2245 -- is that Uname drags in far too much compiler junk.
2247 Get_Name_String (Units.Table (Units.Last).Uname);
2249 if Name_Buffer (Name_Len) = 'b' then
2250 Units.Table (Units.Last).Utype := Is_Body_Only;
2252 Units.Table (Units.Last).Utype := Is_Spec_Only;
2256 -- Scan out external version references and put in hash table
2260 exit E_Loop when C /= 'E';
2262 if Ignore ('E') then
2278 exit when At_End_Of_Field;
2279 Add_Char_To_Name_Buffer (C);
2282 Version_Ref.Set (new String'(Name_Buffer (1 .. Name_Len)), True);
2289 -- Scan out source dependency lines for this ALI file
2291 ALIs.Table (Id).First_Sdep := Sdep.Last + 1;
2295 exit D_Loop when C /= 'D';
2297 if Ignore ('D') then
2303 Sdep.Increment_Last;
2305 -- In the following call, Lower is not set to True, this is either
2306 -- a bug, or it deserves a special comment as to why this is so???
2308 -- The file/path name may be quoted
2310 Sdep.Table (Sdep.Last).Sfile :=
2311 Get_File_Name (May_Be_Quoted => True);
2313 Sdep.Table (Sdep.Last).Stamp := Get_Stamp;
2314 Sdep.Table (Sdep.Last).Dummy_Entry :=
2315 (Sdep.Table (Sdep.Last).Stamp = Dummy_Time_Stamp);
2317 -- Acquire checksum value
2330 exit when At_Eol or else Ctr = 8;
2332 if Nextc in '0' .. '9' then
2334 Character'Pos (Nextc) - Character'Pos ('0');
2336 elsif Nextc in 'a' .. 'f' then
2338 Character'Pos (Nextc) - Character'Pos ('a') + 10;
2348 if Ctr = 8 and then At_End_Of_Field then
2349 Sdep.Table (Sdep.Last).Checksum := Chk;
2355 -- Acquire (sub)unit and reference file name entries
2357 Sdep.Table (Sdep.Last).Subunit_Name := No_Name;
2358 Sdep.Table (Sdep.Last).Unit_Name := No_Name;
2359 Sdep.Table (Sdep.Last).Rfile :=
2360 Sdep.Table (Sdep.Last).Sfile;
2361 Sdep.Table (Sdep.Last).Start_Line := 1;
2366 -- Here for (sub)unit name
2368 if Nextc not in '0' .. '9' then
2370 while not At_End_Of_Field loop
2371 Add_Char_To_Name_Buffer (Getc);
2374 -- Set the (sub)unit name. Note that we use Name_Find rather
2375 -- than Name_Enter here as the subunit name may already
2376 -- have been put in the name table by the Project Manager.
2379 or else Name_Buffer (Name_Len - 1) /= '%'
2381 Sdep.Table (Sdep.Last).Subunit_Name := Name_Find;
2383 Name_Len := Name_Len - 2;
2384 Sdep.Table (Sdep.Last).Unit_Name := Name_Find;
2390 -- Here for reference file name entry
2392 if Nextc in '0' .. '9' then
2393 Sdep.Table (Sdep.Last).Start_Line := Get_Nat;
2398 while not At_End_Of_Field loop
2399 Add_Char_To_Name_Buffer (Getc);
2402 Sdep.Table (Sdep.Last).Rfile := Name_Enter;
2412 ALIs.Table (Id).Last_Sdep := Sdep.Last;
2414 -- We must at this stage be at an Xref line or the end of file
2426 -- If we are ignoring Xref sections we are done (we ignore all
2427 -- remaining lines since only xref related lines follow X).
2429 if Ignore ('X') and then not Debug_Flag_X then
2433 -- Loop through Xref sections
2437 exit X_Loop when C /= 'X';
2439 -- Make new entry in section table
2441 Xref_Section.Increment_Last;
2443 Read_Refs_For_One_File : declare
2444 XS : Xref_Section_Record renames
2445 Xref_Section.Table (Xref_Section.Last);
2447 Current_File_Num : Sdep_Id;
2448 -- Keeps track of the current file number (changed by nn|)
2451 XS.File_Num := Sdep_Id (Get_Nat + Nat (First_Sdep_Entry) - 1);
2452 XS.File_Name := Get_File_Name;
2453 XS.First_Entity := Xref_Entity.Last + 1;
2455 Current_File_Num := XS.File_Num;
2462 -- Loop through Xref entities
2464 while C /= 'X' and then C /= EOF loop
2465 Xref_Entity.Increment_Last;
2467 Read_Refs_For_One_Entity : declare
2468 XE : Xref_Entity_Record renames
2469 Xref_Entity.Table (Xref_Entity.Last);
2472 procedure Read_Instantiation_Reference;
2473 -- Acquire instantiation reference. Caller has checked
2474 -- that current character is '[' and on return the cursor
2475 -- is skipped past the corresponding closing ']'.
2477 ----------------------------------
2478 -- Read_Instantiation_Reference --
2479 ----------------------------------
2481 procedure Read_Instantiation_Reference is
2482 Local_File_Num : Sdep_Id := Current_File_Num;
2485 Xref.Increment_Last;
2488 XR : Xref_Record renames Xref.Table (Xref.Last);
2491 P := P + 1; -- skip [
2496 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2497 Local_File_Num := XR.File_Num;
2502 XR.File_Num := Local_File_Num;
2509 -- Recursive call for next reference
2512 pragma Warnings (Off); -- kill recursion warning
2513 Read_Instantiation_Reference;
2514 pragma Warnings (On);
2517 -- Skip closing bracket after recursive call
2521 end Read_Instantiation_Reference;
2523 -- Start of processing for Read_Refs_For_One_Entity
2532 XE.Visibility := Global;
2534 XE.Visibility := Static;
2536 XE.Visibility := Other;
2539 XE.Entity := Get_Name;
2541 -- Handle the information about generic instantiations
2544 Skipc; -- Opening '['
2547 if Nextc /= '|' then
2548 XE.Iref_File_Num := Current_File_Num;
2552 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2554 XE.Iref_Line := Get_Nat;
2562 XE.Iref_File_Num := No_Sdep_Id;
2566 Current_File_Num := XS.File_Num;
2568 -- Renaming reference is present
2572 XE.Rref_Line := Get_Nat;
2578 XE.Rref_Col := Get_Nat;
2580 -- No renaming reference present
2589 XE.Oref_File_Num := No_Sdep_Id;
2590 XE.Tref_File_Num := No_Sdep_Id;
2591 XE.Tref := Tref_None;
2592 XE.First_Xref := Xref.Last + 1;
2594 -- Loop to check for additional info present
2607 (Current_File_Num, Ref, File, Line, Typ, Col, Std);
2608 exit when Ref = Tref_None;
2610 -- Do we have an overriding procedure?
2612 if Ref = Tref_Derived and then Typ = 'p' then
2613 XE.Oref_File_Num := File;
2614 XE.Oref_Line := Line;
2617 -- Arrays never override anything, and <> points to
2618 -- the index types instead
2620 elsif Ref = Tref_Derived and then XE.Etype = 'A' then
2622 -- Index types are stored in the list of references
2624 Xref.Increment_Last;
2627 XR : Xref_Record renames Xref.Table (Xref.Last);
2629 XR.File_Num := File;
2631 XR.Rtype := Array_Index_Reference;
2636 -- Interfaces are stored in the list of references,
2637 -- although the parent type itself is stored in XE.
2638 -- The first interface (when there are only
2639 -- interfaces) is stored in XE.Tref*)
2641 elsif Ref = Tref_Derived
2643 and then XE.Tref_File_Num /= No_Sdep_Id
2645 Xref.Increment_Last;
2648 XR : Xref_Record renames Xref.Table (Xref.Last);
2650 XR.File_Num := File;
2652 XR.Rtype := Interface_Reference;
2659 XE.Tref_File_Num := File;
2660 XE.Tref_Line := Line;
2661 XE.Tref_Type := Typ;
2663 XE.Tref_Standard_Entity := Std;
2668 -- Loop through cross-references for this entity
2675 exit when Nextc /= '.';
2679 Xref.Increment_Last;
2682 XR : Xref_Record renames Xref.Table (Xref.Last);
2689 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2690 Current_File_Num := XR.File_Num;
2694 XR.File_Num := Current_File_Num;
2700 -- Imported entities reference as in:
2701 -- 494b<c,__gnat_copy_attribs>25
2705 XR.Imported_Lang := Get_Name;
2707 pragma Assert (Nextc = ',');
2710 XR.Imported_Name := Get_Name;
2712 pragma Assert (Nextc = '>');
2716 XR.Imported_Lang := No_Name;
2717 XR.Imported_Name := No_Name;
2723 Read_Instantiation_Reference;
2728 -- Record last cross-reference
2730 XE.Last_Xref := Xref.Last;
2734 when Bad_ALI_Format =>
2736 -- If ignoring errors, then we skip a line with an
2737 -- unexpected error, and try to continue subsequent
2740 if Ignore_Errors then
2741 Xref_Entity.Decrement_Last;
2745 -- Otherwise, we reraise the fatal exception
2750 end Read_Refs_For_One_Entity;
2753 -- Record last entity
2755 XS.Last_Entity := Xref_Entity.Last;
2757 end Read_Refs_For_One_File;
2762 -- Here after dealing with xref sections
2764 -- Ignore remaining lines, which belong to an additional section of the
2765 -- ALI file not considered here (like SCO or SPARK information).
2772 when Bad_ALI_Format =>
2780 function SEq (F1, F2 : String_Ptr) return Boolean is
2782 return F1.all = F2.all;
2789 function SHash (S : String_Ptr) return Vindex is
2794 for J in S.all'Range loop
2795 H := H * 2 + Character'Pos (S (J));
2798 return Vindex (Vindex'First + Vindex (H mod Vindex'Range_Length));