1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2017, 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
61 'T' => True, -- task stack information
68 procedure Initialize_ALI
is
70 -- When (re)initializing ALI data structures the ALI user expects to
71 -- get a fresh set of data structures. Thus we first need to erase the
72 -- marks put in the name table by the previous set of ALI routine calls.
73 -- These two loops are empty and harmless the first time in.
75 for J
in ALIs
.First
.. ALIs
.Last
loop
76 Set_Name_Table_Int
(ALIs
.Table
(J
).Afile
, 0);
79 for J
in Units
.First
.. Units
.Last
loop
80 Set_Name_Table_Int
(Units
.Table
(J
).Uname
, 0);
83 -- Free argument table strings
85 for J
in Args
.First
.. Args
.Last
loop
86 Free
(Args
.Table
(J
));
89 -- Initialize all tables
103 -- Add dummy zero'th item in Linker_Options and Notes for sort calls
105 Linker_Options
.Increment_Last
;
106 Notes
.Increment_Last
;
108 -- Initialize global variables recording cumulative options in all
109 -- ALI files that are read for a given processing run in gnatbind.
111 Dynamic_Elaboration_Checks_Specified
:= False;
112 Locking_Policy_Specified
:= ' ';
113 No_Normalize_Scalars_Specified
:= False;
114 No_Object_Specified
:= False;
115 No_Component_Reordering_Specified
:= False;
116 GNATprove_Mode_Specified
:= False;
117 Normalize_Scalars_Specified
:= False;
118 Partition_Elaboration_Policy_Specified
:= ' ';
119 Queuing_Policy_Specified
:= ' ';
120 SSO_Default_Specified
:= False;
121 Task_Dispatching_Policy_Specified
:= ' ';
122 Unreserve_All_Interrupts_Specified
:= False;
123 Frontend_Exceptions_Specified
:= False;
124 Zero_Cost_Exceptions_Specified
:= False;
136 Read_Xref
: Boolean := False;
137 Read_Lines
: String := "";
138 Ignore_Lines
: String := "X";
139 Ignore_Errors
: Boolean := False;
140 Directly_Scanned
: Boolean := False) return ALI_Id
142 P
: Text_Ptr
:= T
'First;
143 Line
: Logical_Line_Number
:= 1;
149 Ignore
: array (Character range 'A' .. 'Z') of Boolean;
150 -- Ignore (X) is set to True if lines starting with X are to
151 -- be ignored by Scan_ALI and skipped, and False if the lines
152 -- are to be read and processed.
154 Bad_ALI_Format
: exception;
155 -- Exception raised by Fatal_Error if Err is True
157 function At_Eol
return Boolean;
158 -- Test if at end of line
160 function At_End_Of_Field
return Boolean;
161 -- Test if at end of line, or if at blank or horizontal tab
163 procedure Check_At_End_Of_Field
;
164 -- Check if we are at end of field, fatal error if not
166 procedure Checkc
(C
: Character);
167 -- Check next character is C. If so bump past it, if not fatal error
169 procedure Check_Unknown_Line
;
170 -- If Ignore_Errors mode, then checks C to make sure that it is not
171 -- an unknown ALI line type characters, and if so, skips lines
172 -- until the first character of the line is one of these characters,
173 -- at which point it does a Getc to put that character in C. The
174 -- call has no effect if C is already an appropriate character.
175 -- If not in Ignore_Errors mode, a fatal error is signalled if the
176 -- line is unknown. Note that if C is an EOL on entry, the line is
177 -- skipped (it is assumed that blank lines are never significant).
178 -- If C is EOF on entry, the call has no effect (it is assumed that
179 -- the caller will properly handle this case).
181 procedure Fatal_Error
;
182 -- Generate fatal error message for badly formatted ALI file if
183 -- Err is false, or raise Bad_ALI_Format if Err is True.
185 procedure Fatal_Error_Ignore
;
186 pragma Inline
(Fatal_Error_Ignore
);
187 -- In Ignore_Errors mode, has no effect, otherwise same as Fatal_Error
189 function Getc
return Character;
190 -- Get next character, bumping P past the character obtained
192 function Get_File_Name
193 (Lower
: Boolean := False;
194 May_Be_Quoted
: Boolean := False) return File_Name_Type
;
195 -- Skip blanks, then scan out a file name (name is left in Name_Buffer
196 -- with length in Name_Len, as well as returning a File_Name_Type value.
197 -- If May_Be_Quoted is True and the first non blank character is '"',
198 -- then remove starting and ending quotes and undoubled internal quotes.
199 -- If lower is false, the case is unchanged, if Lower is True then the
200 -- result is forced to all lower case for systems where file names are
201 -- not case sensitive. This ensures that gnatbind works correctly
202 -- regardless of the case of the file name on all systems. The scan
203 -- is terminated by a end of line, space or horizontal tab. Any other
204 -- special characters are included in the returned name.
207 (Ignore_Spaces
: Boolean := False;
208 Ignore_Special
: Boolean := False;
209 May_Be_Quoted
: Boolean := False) return Name_Id
;
210 -- Skip blanks, then scan out a name (name is left in Name_Buffer with
211 -- length in Name_Len, as well as being returned in Name_Id form).
212 -- If Lower is set to True then the Name_Buffer will be converted to
213 -- all lower case, for systems where file names are not case sensitive.
214 -- This ensures that gnatbind works correctly regardless of the case
215 -- of the file name on all systems. The termination condition depends
216 -- on the settings of Ignore_Spaces and Ignore_Special:
218 -- If Ignore_Spaces is False (normal case), then scan is terminated
219 -- by the normal end of field condition (EOL, space, horizontal tab)
221 -- If Ignore_Special is False (normal case), the scan is terminated by
222 -- a typeref bracket or an equal sign except for the special case of
223 -- an operator name starting with a double quote which is terminated
224 -- by another double quote.
226 -- If May_Be_Quoted is True and the first non blank character is '"'
227 -- the name is 'unquoted'. In this case Ignore_Special is ignored and
228 -- assumed to be True.
230 -- It is an error to set both Ignore_Spaces and Ignore_Special to True.
231 -- This function handles wide characters properly.
233 function Get_Nat
return Nat
;
234 -- Skip blanks, then scan out an unsigned integer value in Nat range
235 -- raises ALI_Reading_Error if the encoutered type is not natural.
237 function Get_Stamp
return Time_Stamp_Type
;
238 -- Skip blanks, then scan out a time stamp
240 function Get_Unit_Name
return Unit_Name_Type
;
241 -- Skip blanks, then scan out a file name (name is left in Name_Buffer
242 -- with length in Name_Len, as well as returning a Unit_Name_Type value.
243 -- The case is unchanged and terminated by a normal end of field.
245 function Nextc
return Character;
246 -- Return current character without modifying pointer P
248 procedure Get_Typeref
249 (Current_File_Num
: Sdep_Id
;
251 File_Num
: out Sdep_Id
;
253 Ref_Type
: out Character;
255 Standard_Entity
: out Name_Id
);
256 -- Parse the definition of a typeref (<...>, {...} or (...))
259 -- Skip past spaces, then skip past end of line (fatal error if not
260 -- at end of line). Also skips past any following blank lines.
263 -- Skip rest of current line and any following blank lines
265 procedure Skip_Space
;
266 -- Skip past white space (blanks or horizontal tab)
269 -- Skip past next character, does not affect value in C. This call
270 -- is like calling Getc and ignoring the returned result.
272 ---------------------
273 -- At_End_Of_Field --
274 ---------------------
276 function At_End_Of_Field
return Boolean is
285 function At_Eol
return Boolean is
287 return Nextc
= EOF
or else Nextc
= CR
or else Nextc
= LF
;
290 ---------------------------
291 -- Check_At_End_Of_Field --
292 ---------------------------
294 procedure Check_At_End_Of_Field
is
296 if not At_End_Of_Field
then
297 if Ignore_Errors
then
298 while Nextc
> ' ' loop
305 end Check_At_End_Of_Field
;
307 ------------------------
308 -- Check_Unknown_Line --
309 ------------------------
311 procedure Check_Unknown_Line
is
313 while C
not in 'A' .. 'Z'
314 or else not Known_ALI_Lines
(C
)
316 if C
= CR
or else C
= LF
then
323 elsif Ignore_Errors
then
331 end Check_Unknown_Line
;
337 procedure Checkc
(C
: Character) is
341 elsif Ignore_Errors
then
352 procedure Fatal_Error
is
357 procedure Wchar
(C
: Character);
358 -- Write a single character, replacing horizontal tab by spaces
360 procedure Wchar
(C
: Character) is
365 exit when Col
mod 8 = 0;
374 -- Start of processing for Fatal_Error
378 raise Bad_ALI_Format
;
382 Write_Str
("fatal error: file ");
384 Write_Str
(" is incorrectly formatted");
387 Write_Str
("make sure you are using consistent versions " &
389 -- Split the following line so that it can easily be transformed for
390 -- other back-ends where the compiler might have a different name.
396 -- Find start of line
400 and then T
(Ptr1
- 1) /= CR
401 and then T
(Ptr1
- 1) /= LF
406 Write_Int
(Int
(Line
));
421 and then T
(Ptr2
) /= CR
422 and then T
(Ptr2
) /= LF
434 if T
(Ptr1
) = HT
then
446 Exit_Program
(E_Fatal
);
449 ------------------------
450 -- Fatal_Error_Ignore --
451 ------------------------
453 procedure Fatal_Error_Ignore
is
455 if not Ignore_Errors
then
458 end Fatal_Error_Ignore
;
464 function Get_File_Name
465 (Lower
: Boolean := False;
466 May_Be_Quoted
: Boolean := False) return File_Name_Type
471 F
:= Get_Name
(Ignore_Special
=> True,
472 May_Be_Quoted
=> May_Be_Quoted
);
474 -- Convert file name to all lower case if file names are not case
475 -- sensitive. This ensures that we handle names in the canonical
476 -- lower case format, regardless of the actual case.
478 if Lower
and not File_Names_Case_Sensitive
then
479 Canonical_Case_File_Name
(Name_Buffer
(1 .. Name_Len
));
482 return File_Name_Type
(F
);
491 (Ignore_Spaces
: Boolean := False;
492 Ignore_Special
: Boolean := False;
493 May_Be_Quoted
: Boolean := False) return Name_Id
502 if Ignore_Errors
then
511 -- Deal with quoted characters
513 if May_Be_Quoted
and then Char
= '"' then
516 if Ignore_Errors
then
539 Add_Char_To_Name_Buffer
(Char
);
542 -- Other than case of quoted character
547 Add_Char_To_Name_Buffer
(Getc
);
549 exit when At_End_Of_Field
and then not Ignore_Spaces
;
551 if not Ignore_Special
then
552 if Name_Buffer
(1) = '"' then
553 exit when Name_Len
> 1
554 and then Name_Buffer
(Name_Len
) = '"';
557 -- Terminate on parens or angle brackets or equal sign
559 exit when Nextc
= '(' or else Nextc
= ')'
560 or else Nextc
= '{' or else Nextc
= '}'
561 or else Nextc
= '<' or else Nextc
= '>'
564 -- Terminate on comma
566 exit when Nextc
= ',';
568 -- Terminate if left bracket not part of wide char
569 -- sequence Note that we only recognize brackets
570 -- notation so far ???
572 exit when Nextc
= '[' and then T
(P
+ 1) /= '"';
574 -- Terminate if right bracket not part of wide char
577 exit when Nextc
= ']' and then T
(P
- 1) /= '"';
590 function Get_Unit_Name
return Unit_Name_Type
is
592 return Unit_Name_Type
(Get_Name
);
599 function Get_Nat
return Nat
is
605 -- Check if we are on a number. In the case of bad ALI files, this
608 if not (Nextc
in '0' .. '9') then
614 V
:= V
* 10 + (Character'Pos (Getc
) - Character'Pos ('0'));
616 exit when At_End_Of_Field
;
617 exit when Nextc
< '0' or else Nextc
> '9';
627 function Get_Stamp
return Time_Stamp_Type
is
635 if Ignore_Errors
then
636 return Dummy_Time_Stamp
;
642 -- Following reads old style time stamp missing first two digits
644 if Nextc
in '7' .. '9' then
649 -- Normal case of full year in time stamp
655 for J
in Start
.. T
'Last loop
666 procedure Get_Typeref
667 (Current_File_Num
: Sdep_Id
;
669 File_Num
: out Sdep_Id
;
671 Ref_Type
: out Character;
673 Standard_Entity
: out Name_Id
)
678 when '<' => Ref
:= Tref_Derived
;
679 when '(' => Ref
:= Tref_Access
;
680 when '{' => Ref
:= Tref_Type
;
681 when others => Ref
:= Tref_None
;
684 -- Case of typeref field present
686 if Ref
/= Tref_None
then
687 P
:= P
+ 1; -- skip opening bracket
689 if Nextc
in 'a' .. 'z' then
690 File_Num
:= No_Sdep_Id
;
694 Standard_Entity
:= Get_Name
(Ignore_Spaces
=> True);
699 File_Num
:= Sdep_Id
(N
+ Nat
(First_Sdep_Entry
) - 1);
703 File_Num
:= Current_File_Num
;
709 Standard_Entity
:= No_Name
;
712 -- ??? Temporary workaround for nested generics case:
713 -- 4i4 Directories{1|4I9[4|6[3|3]]}
717 Nested_Brackets
: Natural := 0;
723 Nested_Brackets
:= Nested_Brackets
+ 1;
725 Nested_Brackets
:= Nested_Brackets
- 1;
727 if Nested_Brackets
= 0 then
736 P
:= P
+ 1; -- skip closing bracket
739 -- No typeref entry present
742 File_Num
:= No_Sdep_Id
;
746 Standard_Entity
:= No_Name
;
754 function Getc
return Character is
768 function Nextc
return Character is
777 procedure Skip_Eol
is
782 if Ignore_Errors
then
783 while not At_Eol
loop
791 -- Loop to skip past blank lines (first time through skips this EOL)
793 while Nextc
< ' ' and then Nextc
/= EOF
loop
806 procedure Skip_Line
is
808 while not At_Eol
loop
819 procedure Skip_Space
is
821 while Nextc
= ' ' or else Nextc
= HT
loop
837 -- Start of processing for Scan_ALI
840 First_Sdep_Entry
:= Sdep
.Last
+ 1;
842 -- Acquire lines to be ignored
846 ('T' |
'U' |
'W' |
'Y' |
'Z' |
'D' |
'X' => False, others => True);
848 -- Read_Lines parameter given
850 elsif Read_Lines
/= "" then
851 Ignore
:= ('U' => False, others => True);
853 for J
in Read_Lines
'Range loop
854 Ignore
(Read_Lines
(J
)) := False;
857 -- Process Ignore_Lines parameter
860 Ignore
:= (others => False);
862 for J
in Ignore_Lines
'Range loop
863 pragma Assert
(Ignore_Lines
(J
) /= 'U');
864 Ignore
(Ignore_Lines
(J
)) := True;
868 -- Setup ALI Table entry with appropriate defaults
872 Set_Name_Table_Int
(F
, Int
(Id
));
876 Compile_Errors
=> False,
877 First_Interrupt_State
=> Interrupt_States
.Last
+ 1,
878 First_Sdep
=> No_Sdep_Id
,
879 First_Specific_Dispatching
=> Specific_Dispatching
.Last
+ 1,
880 First_Unit
=> No_Unit_Id
,
881 GNATprove_Mode
=> False,
882 Last_Interrupt_State
=> Interrupt_States
.Last
,
883 Last_Sdep
=> No_Sdep_Id
,
884 Last_Specific_Dispatching
=> Specific_Dispatching
.Last
,
885 Last_Unit
=> No_Unit_Id
,
886 Locking_Policy
=> ' ',
889 Main_Program
=> None
,
890 No_Component_Reordering
=> False,
892 Normalize_Scalars
=> False,
893 Ofile_Full_Name
=> Full_Object_File_Name
,
894 Partition_Elaboration_Policy
=> ' ',
895 Queuing_Policy
=> ' ',
896 Restrictions
=> No_Restrictions
,
897 SAL_Interface
=> False,
900 Task_Dispatching_Policy
=> ' ',
901 Time_Slice_Value
=> -1,
903 Unit_Exception_Table
=> False,
904 Ver
=> (others => ' '),
906 Frontend_Exceptions
=> False,
907 Zero_Cost_Exceptions
=> False);
909 -- Now we acquire the input lines from the ALI file. Note that the
910 -- convention in the following code is that as we enter each section,
911 -- C is set to contain the first character of the following line.
916 -- Acquire library version
920 -- The V line missing really indicates trouble, most likely it
921 -- means we don't have an ALI file at all, so here we give a
922 -- fatal error even if we are in Ignore_Errors mode.
926 elsif Ignore
('V') then
934 for J
in 1 .. Ver_Len_Max
loop
937 ALIs
.Table
(Id
).Ver
(J
) := C
;
938 ALIs
.Table
(Id
).Ver_Len
:= J
;
947 -- Acquire main program line if present
960 ALIs
.Table
(Id
).Main_Program
:= Func
;
962 ALIs
.Table
(Id
).Main_Program
:= Proc
;
972 ALIs
.Table
(Id
).Main_Priority
:= Get_Nat
;
980 ALIs
.Table
(Id
).Time_Slice_Value
:= Get_Nat
;
988 ALIs
.Table
(Id
).Main_CPU
:= Get_Nat
;
995 ALIs
.Table
(Id
).WC_Encoding
:= Getc
;
1004 -- Acquire argument lines
1006 First_Arg
:= Args
.Last
+ 1;
1010 exit A_Loop
when C
/= 'A';
1012 if Ignore
('A') then
1018 -- Scan out argument
1021 while not At_Eol
loop
1022 Add_Char_To_Name_Buffer
(Getc
);
1025 -- If -fstack-check, record that it occurred. Note that an
1026 -- additional string parameter can be specified, in the form of
1027 -- -fstack-check={no|generic|specific}. "no" means no checking,
1028 -- "generic" means force the use of old-style checking, and
1029 -- "specific" means use the best checking method.
1032 and then Name_Buffer
(1 .. 13) = "-fstack-check"
1033 and then Name_Buffer
(1 .. Name_Len
) /= "-fstack-check=no"
1035 Stack_Check_Switch_Set
:= True;
1038 -- Store the argument
1040 Args
.Increment_Last
;
1041 Args
.Table
(Args
.Last
) := new String'(Name_Buffer (1 .. Name_Len));
1054 if Ignore_Errors then
1066 if Ignore ('P
') then
1074 while not At_Eol loop
1079 -- Processing for CE
1083 ALIs.Table (Id).Compile_Errors := True;
1085 -- Processing for DB
1089 Detect_Blocking := True;
1091 -- Processing for Ex
1094 Partition_Elaboration_Policy_Specified := Getc;
1095 ALIs.Table (Id).Partition_Elaboration_Policy :=
1096 Partition_Elaboration_Policy_Specified;
1098 -- Processing for FX
1104 ALIs.Table (Id).Frontend_Exceptions := True;
1105 Frontend_Exceptions_Specified := True;
1110 -- Processing for GP
1114 GNATprove_Mode_Specified := True;
1115 ALIs.Table (Id).GNATprove_Mode := True;
1117 -- Processing for Lx
1120 Locking_Policy_Specified := Getc;
1121 ALIs.Table (Id).Locking_Policy := Locking_Policy_Specified;
1123 -- Processing for flags starting with N
1128 -- Processing for NC
1131 ALIs.Table (Id).No_Component_Reordering := True;
1132 No_Component_Reordering_Specified := True;
1134 -- Processing for NO
1137 ALIs.Table (Id).No_Object := True;
1138 No_Object_Specified := True;
1140 -- Processing for NR
1143 No_Run_Time_Mode := True;
1144 Configurable_Run_Time_Mode := True;
1146 -- Processing for NS
1149 ALIs.Table (Id).Normalize_Scalars := True;
1150 Normalize_Scalars_Specified := True;
1153 -- Invalid switch starting with N
1159 -- Processing for OH/OL
1164 if C = 'L
' or else C = 'H
' then
1165 ALIs.Table (Id).SSO_Default := C;
1166 SSO_Default_Specified := True;
1172 -- Processing for Qx
1175 Queuing_Policy_Specified := Getc;
1176 ALIs.Table (Id).Queuing_Policy := Queuing_Policy_Specified;
1178 -- Processing for flags starting with S
1183 -- Processing for SL
1186 ALIs.Table (Id).SAL_Interface := True;
1188 -- Processing for SS
1191 Opt.Sec_Stack_Used := True;
1193 -- Invalid switch starting with S
1199 -- Processing for Tx
1202 Task_Dispatching_Policy_Specified := Getc;
1203 ALIs.Table (Id).Task_Dispatching_Policy :=
1204 Task_Dispatching_Policy_Specified;
1206 -- Processing for switch starting with U
1211 -- Processing for UA
1214 Unreserve_All_Interrupts_Specified := True;
1216 -- Processing for UX
1219 ALIs.Table (Id).Unit_Exception_Table := True;
1221 -- Invalid switches starting with U
1227 -- Processing for ZX
1233 ALIs.Table (Id).Zero_Cost_Exceptions := True;
1234 Zero_Cost_Exceptions_Specified := True;
1239 -- Invalid parameter
1247 if not NS_Found then
1248 No_Normalize_Scalars_Specified := True;
1257 -- Loop to skip to first restrictions line
1260 if Ignore_Errors then
1272 -- Ignore all 'R
' lines if that is required
1274 if Ignore ('R
') then
1280 -- Here we process the restrictions lines (other than unit name cases)
1283 Scan_Restrictions : declare
1284 Save_R : constant Restrictions_Info := Cumulative_Restrictions;
1285 -- Save cumulative restrictions in case we have a fatal error
1287 Bad_R_Line : exception;
1288 -- Signal bad restrictions line (raised on unexpected character)
1295 -- Named restriction case
1301 -- Loop through RR and RV lines
1303 while C = 'R
' and then Nextc /= ' ' loop
1307 -- Acquire restriction name
1310 while not At_Eol and then Nextc /= '=' loop
1311 Name_Len := Name_Len + 1;
1312 Name_Buffer (Name_Len) := Getc;
1315 -- Now search list of restrictions to find match
1318 RN : String renames Name_Buffer (1 .. Name_Len);
1321 R := Restriction_Id'First;
1322 while R /= Not_A_Restriction_Id loop
1323 if Restriction_Id'Image (R) = RN then
1327 R := Restriction_Id'Succ (R);
1330 -- We don't recognize the restriction. This might be
1331 -- thought of as an error, and it really is, but we
1332 -- want to allow building with inconsistent versions
1333 -- of the binder and ali files (see comments at the
1334 -- start of package System.Rident), so we just ignore
1337 goto Done_With_Restriction_Line;
1344 -- Boolean restriction case
1346 when All_Boolean_Restrictions =>
1349 ALIs.Table (Id).Restrictions.Violated (R) :=
1351 Cumulative_Restrictions.Violated (R) := True;
1354 ALIs.Table (Id).Restrictions.Set (R) := True;
1355 Cumulative_Restrictions.Set (R) := True;
1361 -- Parameter restriction case
1363 when All_Parameter_Restrictions =>
1364 if At_Eol or else Nextc /= '=' then
1370 N := Natural (Get_Nat);
1377 ALIs.Table (Id).Restrictions.Set (R) := True;
1378 ALIs.Table (Id).Restrictions.Value (R) := N;
1380 if Cumulative_Restrictions.Set (R) then
1381 Cumulative_Restrictions.Value (R) :=
1383 (Cumulative_Restrictions.Value (R), N);
1385 Cumulative_Restrictions.Set (R) := True;
1386 Cumulative_Restrictions.Value (R) := N;
1389 -- Restriction violated
1392 ALIs.Table (Id).Restrictions.Violated (R) :=
1394 Cumulative_Restrictions.Violated (R) := True;
1395 ALIs.Table (Id).Restrictions.Count (R) := N;
1397 -- Checked Max_Parameter case
1399 if R in Checked_Max_Parameter_Restrictions then
1400 Cumulative_Restrictions.Count (R) :=
1402 (Cumulative_Restrictions.Count (R), N);
1404 -- Other checked parameter cases
1408 pragma Unsuppress (Overflow_Check);
1411 Cumulative_Restrictions.Count (R) :=
1412 Cumulative_Restrictions.Count (R) + N;
1415 when Constraint_Error =>
1417 -- A constraint error comes from the
1418 -- addition. We reset to the maximum
1419 -- and indicate that the real value
1422 Cumulative_Restrictions.Value (R) :=
1424 Cumulative_Restrictions.Unknown (R) :=
1433 ALIs.Table (Id).Restrictions.Unknown (R) :=
1435 Cumulative_Restrictions.Unknown (R) := True;
1438 -- Other than 'R
' or 'V
'
1448 -- Bizarre error case NOT_A_RESTRICTION
1450 when Not_A_Restriction_Id =>
1458 <<Done_With_Restriction_Line>>
1463 -- Positional restriction case
1469 -- Acquire information for boolean restrictions
1471 for R in All_Boolean_Restrictions loop
1476 ALIs.Table (Id).Restrictions.Violated (R) := True;
1477 Cumulative_Restrictions.Violated (R) := True;
1480 ALIs.Table (Id).Restrictions.Set (R) := True;
1481 Cumulative_Restrictions.Set (R) := True;
1491 -- Acquire information for parameter restrictions
1493 for RP in All_Parameter_Restrictions loop
1499 ALIs.Table (Id).Restrictions.Set (RP) := True;
1502 N : constant Integer := Integer (Get_Nat);
1504 ALIs.Table (Id).Restrictions.Value (RP) := N;
1506 if Cumulative_Restrictions.Set (RP) then
1507 Cumulative_Restrictions.Value (RP) :=
1509 (Cumulative_Restrictions.Value (RP), N);
1511 Cumulative_Restrictions.Set (RP) := True;
1512 Cumulative_Restrictions.Value (RP) := N;
1520 -- Acquire restrictions violations information
1528 ALIs.Table (Id).Restrictions.Violated (RP) := True;
1529 Cumulative_Restrictions.Violated (RP) := True;
1532 N : constant Integer := Integer (Get_Nat);
1535 ALIs.Table (Id).Restrictions.Count (RP) := N;
1537 if RP in Checked_Max_Parameter_Restrictions then
1538 Cumulative_Restrictions.Count (RP) :=
1540 (Cumulative_Restrictions.Count (RP), N);
1544 pragma Unsuppress (Overflow_Check);
1547 Cumulative_Restrictions.Count (RP) :=
1548 Cumulative_Restrictions.Count (RP) + N;
1551 when Constraint_Error =>
1553 -- A constraint error comes from the add. We
1554 -- reset to the maximum and indicate that the
1555 -- real value is now unknown.
1557 Cumulative_Restrictions.Value (RP) :=
1559 Cumulative_Restrictions.Unknown (RP) := True;
1565 ALIs.Table (Id).Restrictions.Unknown (RP) := True;
1566 Cumulative_Restrictions.Unknown (RP) := True;
1583 -- Here if error during scanning of restrictions line
1588 -- In Ignore_Errors mode, undo any changes to restrictions
1589 -- from this unit, and continue on, skipping remaining R
1590 -- lines for this unit.
1592 if Ignore_Errors then
1593 Cumulative_Restrictions := Save_R;
1594 ALIs.Table (Id).Restrictions := No_Restrictions;
1602 -- In normal mode, this is a fatal error
1607 end Scan_Restrictions;
1610 -- Acquire additional restrictions (No_Dependence) lines if present
1613 if Ignore ('R
') then
1617 No_Deps.Append ((Id, Get_Name));
1624 -- Acquire 'I
' lines if present
1629 if Ignore ('I
') then
1635 I_State : Character;
1644 Interrupt_States.Append (
1645 (Interrupt_Id => Int_Num,
1646 Interrupt_State => I_State,
1647 IS_Pragma_Line => Line_No));
1649 ALIs.Table (Id).Last_Interrupt_State := Interrupt_States.Last;
1657 -- Acquire 'S
' lines if present
1662 if Ignore ('S
') then
1678 First_Prio := Get_Nat;
1679 Last_Prio := Get_Nat;
1682 Specific_Dispatching.Append (
1683 (Dispatching_Policy => Policy,
1684 First_Priority => First_Prio,
1685 Last_Priority => Last_Prio,
1686 PSD_Pragma_Line => Line_No));
1688 ALIs.Table (Id).Last_Specific_Dispatching :=
1689 Specific_Dispatching.Last;
1698 -- Loop to acquire unit entries
1702 exit U_Loop when C /= 'U
';
1704 -- Note: as per spec, we never ignore U lines
1708 Units.Increment_Last;
1710 if ALIs.Table (Id).First_Unit = No_Unit_Id then
1711 ALIs.Table (Id).First_Unit := Units.Last;
1715 UL : Unit_Record renames Units.Table (Units.Last);
1718 UL.Uname := Get_Unit_Name;
1719 UL.Predefined := Is_Predefined_Unit;
1720 UL.Internal := Is_Internal_Unit;
1722 UL.Sfile := Get_File_Name (Lower => True);
1724 UL.Preelab := False;
1725 UL.No_Elab := False;
1726 UL.Shared_Passive := False;
1728 UL.Remote_Types := False;
1729 UL.Serious_Errors := False;
1730 UL.Has_RACW := False;
1731 UL.Init_Scalars := False;
1732 UL.Is_Generic := False;
1733 UL.Icasing := Mixed_Case;
1734 UL.Kcasing := All_Lower_Case;
1735 UL.Dynamic_Elab := False;
1736 UL.Elaborate_Body := False;
1737 UL.Set_Elab_Entity := False;
1738 UL.Version := "00000000";
1739 UL.First_With := Withs.Last + 1;
1740 UL.First_Arg := First_Arg;
1741 UL.Elab_Position := 0;
1742 UL.SAL_Interface := ALIs.Table (Id).SAL_Interface;
1743 UL.Directly_Scanned := Directly_Scanned;
1744 UL.Body_Needed_For_SAL := False;
1745 UL.Elaborate_Body_Desirable := False;
1746 UL.Optimize_Alignment := 'O
';
1747 UL.Has_Finalizer := False;
1748 UL.Primary_Stack_Count := 0;
1749 UL.Sec_Stack_Count := 0;
1751 if Debug_Flag_U then
1752 Write_Str (" ----> reading unit ");
1753 Write_Int (Int (Units.Last));
1755 Write_Unit_Name (UL.Uname);
1756 Write_Str (" from file ");
1757 Write_Name (UL.Sfile);
1762 -- Check for duplicated unit in different files
1765 Info : constant Int := Get_Name_Table_Int
1766 (Units.Table (Units.Last).Uname);
1769 and then Units.Table (Units.Last).Sfile /=
1770 Units.Table (Unit_Id (Info)).Sfile
1772 -- If Err is set then ignore duplicate unit name. This is the
1773 -- case of a call from gnatmake, where the situation can arise
1774 -- from substitution of source files. In such situations, the
1775 -- processing in gnatmake will always result in any required
1776 -- recompilations in any case, and if we consider this to be
1777 -- an error we get strange cases (for example when a generic
1778 -- instantiation is replaced by a normal package) where we
1779 -- read the old ali file, decide to recompile, and then decide
1780 -- that the old and new ali files are incompatible.
1785 -- If Err is not set, then this is a fatal error. This is
1786 -- the case of being called from the binder, where we must
1787 -- definitely diagnose this as an error.
1791 Write_Str ("error: duplicate unit name: ");
1794 Write_Str ("error: unit """);
1795 Write_Unit_Name (Units.Table (Units.Last).Uname);
1796 Write_Str (""" found in file """);
1797 Write_Name_Decoded (Units.Table (Units.Last).Sfile);
1801 Write_Str ("error
: unit
""");
1802 Write_Unit_Name (Units.Table (Unit_Id (Info)).Uname);
1803 Write_Str (""" found
in file
""");
1804 Write_Name_Decoded (Units.Table (Unit_Id (Info)).Sfile);
1808 Exit_Program (E_Fatal);
1814 (Units.Table (Units.Last).Uname, Int (Units.Last));
1816 -- Scan out possible version and other parameters
1825 if C in '0' .. '9' or else C in 'a
' .. 'f
' then
1826 Units.Table (Units.Last).Version (1) := C;
1828 for J in 2 .. 8 loop
1830 Units.Table (Units.Last).Version (J) := C;
1839 Check_At_End_Of_Field;
1840 Units.Table (Units.Last).Elaborate_Body_Desirable := True;
1843 Check_At_End_Of_Field;
1844 Units.Table (Units.Last).Body_Needed_For_SAL := True;
1850 -- DE parameter (Dynamic elaboration checks)
1856 Check_At_End_Of_Field;
1857 Units.Table (Units.Last).Dynamic_Elab := True;
1858 Dynamic_Elaboration_Checks_Specified := True;
1869 Units.Table (Units.Last).Elaborate_Body := True;
1871 Units.Table (Units.Last).Set_Elab_Entity := True;
1876 Check_At_End_Of_Field;
1878 -- GE parameter (generic)
1884 Check_At_End_Of_Field;
1885 Units.Table (Units.Last).Is_Generic := True;
1890 -- IL/IS/IU parameters
1896 Units.Table (Units.Last).Icasing := All_Lower_Case;
1898 Units.Table (Units.Last).Init_Scalars := True;
1899 Initialize_Scalars_Used := True;
1901 Units.Table (Units.Last).Icasing := All_Upper_Case;
1906 Check_At_End_Of_Field;
1914 Units.Table (Units.Last).Kcasing := Mixed_Case;
1916 Units.Table (Units.Last).Kcasing := All_Upper_Case;
1921 Check_At_End_Of_Field;
1929 Units.Table (Units.Last).No_Elab := True;
1930 Check_At_End_Of_Field;
1935 -- PF/PR/PU/PK parameters
1941 Units.Table (Units.Last).Has_Finalizer := True;
1943 Units.Table (Units.Last).Preelab := True;
1945 Units.Table (Units.Last).Pure := True;
1947 Units.Table (Units.Last).Unit_Kind := 'p
';
1952 Check_At_End_Of_Field;
1954 -- OL/OO/OS/OT parameters
1959 if C = 'L
' or else C = 'O
' or else C = 'S
' or else C = 'T
' then
1960 Units.Table (Units.Last).Optimize_Alignment := C;
1965 Check_At_End_Of_Field;
1973 Units.Table (Units.Last).RCI := True;
1975 Units.Table (Units.Last).Remote_Types := True;
1977 Units.Table (Units.Last).Has_RACW := True;
1982 Check_At_End_Of_Field;
1984 -- SE/SP/SU parameters
1990 Units.Table (Units.Last).Serious_Errors := True;
1992 Units.Table (Units.Last).Shared_Passive := True;
1994 Units.Table (Units.Last).Unit_Kind := 's
';
1999 Check_At_End_Of_Field;
2011 -- Scan out With lines for this unit
2015 exit With_Loop when C /= 'W
' and then C /= 'Y
' and then C /= 'Z
';
2017 if Ignore ('W
') then
2023 Withs.Increment_Last;
2024 Withs.Table (Withs.Last).Uname := Get_Unit_Name;
2025 Withs.Table (Withs.Last).Elaborate := False;
2026 Withs.Table (Withs.Last).Elaborate_All := False;
2027 Withs.Table (Withs.Last).Elab_Desirable := False;
2028 Withs.Table (Withs.Last).Elab_All_Desirable := False;
2029 Withs.Table (Withs.Last).SAL_Interface := False;
2030 Withs.Table (Withs.Last).Limited_With := (C = 'Y
');
2031 Withs.Table (Withs.Last).Implicit_With_From_Instantiation
2034 -- Generic case with no object file available
2037 Withs.Table (Withs.Last).Sfile := No_File;
2038 Withs.Table (Withs.Last).Afile := No_File;
2043 Withs.Table (Withs.Last).Sfile := Get_File_Name
2045 Withs.Table (Withs.Last).Afile := Get_File_Name
2048 -- Scan out possible E, EA, ED, and AD parameters
2050 while not At_Eol loop
2056 Check_At_End_Of_Field;
2058 -- Store AD indication unless ignore required
2060 if not Ignore_ED then
2061 Withs.Table (Withs.Last).Elab_All_Desirable := True;
2064 elsif Nextc = 'E
' then
2067 if At_End_Of_Field then
2068 Withs.Table (Withs.Last).Elaborate := True;
2070 elsif Nextc = 'A
' then
2072 Check_At_End_Of_Field;
2073 Withs.Table (Withs.Last).Elaborate_All := True;
2077 Check_At_End_Of_Field;
2079 -- Store ED indication unless ignore required
2081 if not Ignore_ED then
2082 Withs.Table (Withs.Last).Elab_Desirable :=
2099 Units.Table (Units.Last).Last_With := Withs.Last;
2100 Units.Table (Units.Last).Last_Arg := Args.Last;
2102 -- Scan out task stack information for the unit if present
2107 if Ignore ('T
') then
2114 Units.Table (Units.Last).Primary_Stack_Count := Get_Nat;
2116 Units.Table (Units.Last).Sec_Stack_Count := Get_Nat;
2124 -- If there are linker options lines present, scan them
2128 Linker_Options_Loop : loop
2130 exit Linker_Options_Loop when C /= 'L
';
2132 if Ignore ('L
') then
2143 if C < Character'Val (16#20#)
2144 or else C > Character'Val (16#7E#)
2149 C := Character'Val (0);
2156 for J in 1 .. 2 loop
2159 if C in '0' .. '9' then
2162 Character'Pos ('0');
2164 elsif C in 'A' .. 'F' then
2167 Character'Pos ('A') +
2176 Add_Char_To_Name_Buffer (Character'Val (V));
2181 exit when Nextc /= '"';
2185 Add_Char_To_Name_Buffer (C);
2189 Add_Char_To_Name_Buffer (NUL);
2194 end loop Linker_Options_Loop;
2196 -- Store the linker options entry if one was found
2198 if Name_Len /= 0 then
2199 Linker_Options.Increment_Last;
2201 Linker_Options.Table (Linker_Options.Last).Name :=
2204 Linker_Options.Table (Linker_Options.Last).Unit :=
2207 Linker_Options.Table (Linker_Options.Last).Internal_File :=
2208 Is_Internal_File_Name (F);
2210 Linker_Options.Table (Linker_Options.Last).Original_Pos :=
2211 Linker_Options.Last;
2214 -- If there are notes present, scan them
2218 exit Notes_Loop when C /= 'N';
2220 if Ignore ('N') then
2226 Notes.Increment_Last;
2227 Notes.Table (Notes.Last).Pragma_Type := Getc;
2228 Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
2230 Notes.Table (Notes.Last).Pragma_Col := Get_Nat;
2232 if not At_Eol and then Nextc = ':' then
2234 Notes.Table (Notes.Last).Pragma_Source_File :=
2235 Get_File_Name (Lower => True);
2237 Notes.Table (Notes.Last).Pragma_Source_File :=
2238 Units.Table (Units.Last).Sfile;
2242 Notes.Table (Notes.Last).Pragma_Args := No_Name;
2245 -- Note: can't use Get_Name here as the remainder of the
2246 -- line is unstructured text whose syntax depends on the
2247 -- particular pragma used.
2252 while not At_Eol loop
2253 Add_Char_To_Name_Buffer (Getc);
2261 end loop Notes_Loop;
2264 -- End loop through units for one ALI file
2266 ALIs.Table (Id).Last_Unit := Units.Last;
2267 ALIs.Table (Id).Sfile := Units.Table (ALIs.Table (Id).First_Unit).Sfile;
2269 -- Set types of the units (there can be at most 2 of them)
2271 if ALIs.Table (Id).First_Unit /= ALIs.Table (Id).Last_Unit then
2272 Units.Table (ALIs.Table (Id).First_Unit).Utype := Is_Body;
2273 Units.Table (ALIs.Table (Id).Last_Unit).Utype := Is_Spec;
2276 -- Deal with body only and spec only cases, note that the reason we
2277 -- do our own checking of the name (rather than using Is_Body_Name)
2278 -- is that Uname drags in far too much compiler junk.
2280 Get_Name_String (Units.Table (Units.Last).Uname);
2282 if Name_Buffer (Name_Len) = 'b' then
2283 Units.Table (Units.Last).Utype := Is_Body_Only;
2285 Units.Table (Units.Last).Utype := Is_Spec_Only;
2289 -- Scan out external version references and put in hash table
2293 exit E_Loop when C /= 'E';
2295 if Ignore ('E') then
2311 exit when At_End_Of_Field;
2312 Add_Char_To_Name_Buffer (C);
2315 Version_Ref.Set (new String'(Name_Buffer (1 .. Name_Len)), True);
2322 -- Scan out source dependency lines for this ALI file
2324 ALIs.Table (Id).First_Sdep := Sdep.Last + 1;
2328 exit D_Loop when C /= 'D';
2330 if Ignore ('D') then
2336 Sdep.Increment_Last;
2338 -- In the following call, Lower is not set to True, this is either
2339 -- a bug, or it deserves a special comment as to why this is so???
2341 -- The file/path name may be quoted
2343 Sdep.Table (Sdep.Last).Sfile :=
2344 Get_File_Name (May_Be_Quoted => True);
2346 Sdep.Table (Sdep.Last).Stamp := Get_Stamp;
2347 Sdep.Table (Sdep.Last).Dummy_Entry :=
2348 (Sdep.Table (Sdep.Last).Stamp = Dummy_Time_Stamp);
2350 -- Acquire checksum value
2363 exit when At_Eol or else Ctr = 8;
2365 if Nextc in '0' .. '9' then
2367 Character'Pos (Nextc) - Character'Pos ('0');
2369 elsif Nextc in 'a' .. 'f' then
2371 Character'Pos (Nextc) - Character'Pos ('a') + 10;
2381 if Ctr = 8 and then At_End_Of_Field then
2382 Sdep.Table (Sdep.Last).Checksum := Chk;
2388 -- Acquire (sub)unit and reference file name entries
2390 Sdep.Table (Sdep.Last).Subunit_Name := No_Name;
2391 Sdep.Table (Sdep.Last).Unit_Name := No_Name;
2392 Sdep.Table (Sdep.Last).Rfile :=
2393 Sdep.Table (Sdep.Last).Sfile;
2394 Sdep.Table (Sdep.Last).Start_Line := 1;
2399 -- Here for (sub)unit name
2401 if Nextc not in '0' .. '9' then
2403 while not At_End_Of_Field loop
2404 Add_Char_To_Name_Buffer (Getc);
2407 -- Set the (sub)unit name. Note that we use Name_Find rather
2408 -- than Name_Enter here as the subunit name may already
2409 -- have been put in the name table by the Project Manager.
2412 or else Name_Buffer (Name_Len - 1) /= '%'
2414 Sdep.Table (Sdep.Last).Subunit_Name := Name_Find;
2416 Name_Len := Name_Len - 2;
2417 Sdep.Table (Sdep.Last).Unit_Name := Name_Find;
2423 -- Here for reference file name entry
2425 if Nextc in '0' .. '9' then
2426 Sdep.Table (Sdep.Last).Start_Line := Get_Nat;
2431 while not At_End_Of_Field loop
2432 Add_Char_To_Name_Buffer (Getc);
2435 Sdep.Table (Sdep.Last).Rfile := Name_Enter;
2445 ALIs.Table (Id).Last_Sdep := Sdep.Last;
2447 -- We must at this stage be at an Xref line or the end of file
2459 -- If we are ignoring Xref sections we are done (we ignore all
2460 -- remaining lines since only xref related lines follow X).
2462 if Ignore ('X') and then not Debug_Flag_X then
2466 -- Loop through Xref sections
2470 exit X_Loop when C /= 'X';
2472 -- Make new entry in section table
2474 Xref_Section.Increment_Last;
2476 Read_Refs_For_One_File : declare
2477 XS : Xref_Section_Record renames
2478 Xref_Section.Table (Xref_Section.Last);
2480 Current_File_Num : Sdep_Id;
2481 -- Keeps track of the current file number (changed by nn|)
2484 XS.File_Num := Sdep_Id (Get_Nat + Nat (First_Sdep_Entry) - 1);
2485 XS.File_Name := Get_File_Name;
2486 XS.First_Entity := Xref_Entity.Last + 1;
2488 Current_File_Num := XS.File_Num;
2495 -- Loop through Xref entities
2497 while C /= 'X' and then C /= EOF loop
2498 Xref_Entity.Increment_Last;
2500 Read_Refs_For_One_Entity : declare
2501 XE : Xref_Entity_Record renames
2502 Xref_Entity.Table (Xref_Entity.Last);
2505 procedure Read_Instantiation_Reference;
2506 -- Acquire instantiation reference. Caller has checked
2507 -- that current character is '[' and on return the cursor
2508 -- is skipped past the corresponding closing ']'.
2510 ----------------------------------
2511 -- Read_Instantiation_Reference --
2512 ----------------------------------
2514 procedure Read_Instantiation_Reference is
2515 Local_File_Num : Sdep_Id := Current_File_Num;
2518 Xref.Increment_Last;
2521 XR : Xref_Record renames Xref.Table (Xref.Last);
2524 P := P + 1; -- skip [
2529 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2530 Local_File_Num := XR.File_Num;
2535 XR.File_Num := Local_File_Num;
2542 -- Recursive call for next reference
2545 pragma Warnings (Off); -- kill recursion warning
2546 Read_Instantiation_Reference;
2547 pragma Warnings (On);
2550 -- Skip closing bracket after recursive call
2554 end Read_Instantiation_Reference;
2556 -- Start of processing for Read_Refs_For_One_Entity
2565 XE.Visibility := Global;
2567 XE.Visibility := Static;
2569 XE.Visibility := Other;
2572 XE.Entity := Get_Name;
2574 -- Handle the information about generic instantiations
2577 Skipc; -- Opening '['
2580 if Nextc /= '|' then
2581 XE.Iref_File_Num := Current_File_Num;
2585 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2587 XE.Iref_Line := Get_Nat;
2595 XE.Iref_File_Num := No_Sdep_Id;
2599 Current_File_Num := XS.File_Num;
2601 -- Renaming reference is present
2605 XE.Rref_Line := Get_Nat;
2611 XE.Rref_Col := Get_Nat;
2613 -- No renaming reference present
2622 XE.Oref_File_Num := No_Sdep_Id;
2623 XE.Tref_File_Num := No_Sdep_Id;
2624 XE.Tref := Tref_None;
2625 XE.First_Xref := Xref.Last + 1;
2627 -- Loop to check for additional info present
2640 (Current_File_Num, Ref, File, Line, Typ, Col, Std);
2641 exit when Ref = Tref_None;
2643 -- Do we have an overriding procedure?
2645 if Ref = Tref_Derived and then Typ = 'p' then
2646 XE.Oref_File_Num := File;
2647 XE.Oref_Line := Line;
2650 -- Arrays never override anything, and <> points to
2651 -- the index types instead
2653 elsif Ref = Tref_Derived and then XE.Etype = 'A' then
2655 -- Index types are stored in the list of references
2657 Xref.Increment_Last;
2660 XR : Xref_Record renames Xref.Table (Xref.Last);
2662 XR.File_Num := File;
2664 XR.Rtype := Array_Index_Reference;
2669 -- Interfaces are stored in the list of references,
2670 -- although the parent type itself is stored in XE.
2671 -- The first interface (when there are only
2672 -- interfaces) is stored in XE.Tref*)
2674 elsif Ref = Tref_Derived
2676 and then XE.Tref_File_Num /= No_Sdep_Id
2678 Xref.Increment_Last;
2681 XR : Xref_Record renames Xref.Table (Xref.Last);
2683 XR.File_Num := File;
2685 XR.Rtype := Interface_Reference;
2692 XE.Tref_File_Num := File;
2693 XE.Tref_Line := Line;
2694 XE.Tref_Type := Typ;
2696 XE.Tref_Standard_Entity := Std;
2701 -- Loop through cross-references for this entity
2708 exit when Nextc /= '.';
2712 Xref.Increment_Last;
2715 XR : Xref_Record renames Xref.Table (Xref.Last);
2722 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2723 Current_File_Num := XR.File_Num;
2727 XR.File_Num := Current_File_Num;
2733 -- Imported entities reference as in:
2734 -- 494b<c,__gnat_copy_attribs>25
2738 XR.Imported_Lang := Get_Name;
2740 pragma Assert (Nextc = ',');
2743 XR.Imported_Name := Get_Name;
2745 pragma Assert (Nextc = '>');
2749 XR.Imported_Lang := No_Name;
2750 XR.Imported_Name := No_Name;
2756 Read_Instantiation_Reference;
2761 -- Record last cross-reference
2763 XE.Last_Xref := Xref.Last;
2767 when Bad_ALI_Format =>
2769 -- If ignoring errors, then we skip a line with an
2770 -- unexpected error, and try to continue subsequent
2773 if Ignore_Errors then
2774 Xref_Entity.Decrement_Last;
2778 -- Otherwise, we reraise the fatal exception
2783 end Read_Refs_For_One_Entity;
2786 -- Record last entity
2788 XS.Last_Entity := Xref_Entity.Last;
2790 end Read_Refs_For_One_File;
2795 -- Here after dealing with xref sections
2797 -- Ignore remaining lines, which belong to an additional section of the
2798 -- ALI file not considered here (like SCO or SPARK information).
2805 when Bad_ALI_Format =>
2813 function SEq (F1, F2 : String_Ptr) return Boolean is
2815 return F1.all = F2.all;
2822 function SHash (S : String_Ptr) return Vindex is
2827 for J in S.all'Range loop
2828 H := H * 2 + Character'Pos (S (J));
2831 return Vindex (Vindex'First + Vindex (H mod Vindex'Range_Length));