1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2018, 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 used as
39 -- line type markers in the ALI file. This is used in Scan_ALI to detect
40 -- (or skip) invalid lines. The following letters are still available:
44 Known_ALI_Lines
: constant array (Character range 'A' .. 'Z') of Boolean :=
45 ('V' => True, -- version
46 'M' => True, -- main program
47 'A' => True, -- argument
48 'P' => True, -- program
49 'R' => True, -- restriction
50 'I' => True, -- interrupt
53 'L' => True, -- linker option
55 'E' => True, -- external
56 'D' => True, -- dependency
58 'S' => True, -- specific dispatching
59 'Y' => True, -- limited_with
60 'Z' => True, -- implicit with from instantiation
61 'C' => True, -- SCO information
62 'T' => True, -- task stack information
69 procedure Initialize_ALI
is
71 -- When (re)initializing ALI data structures the ALI user expects to
72 -- get a fresh set of data structures. Thus we first need to erase the
73 -- marks put in the name table by the previous set of ALI routine calls.
74 -- These two loops are empty and harmless the first time in.
76 for J
in ALIs
.First
.. ALIs
.Last
loop
77 Set_Name_Table_Int
(ALIs
.Table
(J
).Afile
, 0);
80 for J
in Units
.First
.. Units
.Last
loop
81 Set_Name_Table_Int
(Units
.Table
(J
).Uname
, 0);
84 -- Free argument table strings
86 for J
in Args
.First
.. Args
.Last
loop
87 Free
(Args
.Table
(J
));
90 -- Initialize all tables
104 -- Add dummy zero'th item in Linker_Options and Notes for sort calls
106 Linker_Options
.Increment_Last
;
107 Notes
.Increment_Last
;
109 -- Initialize global variables recording cumulative options in all
110 -- ALI files that are read for a given processing run in gnatbind.
112 Dynamic_Elaboration_Checks_Specified
:= False;
113 Locking_Policy_Specified
:= ' ';
114 No_Normalize_Scalars_Specified
:= False;
115 No_Object_Specified
:= False;
116 No_Component_Reordering_Specified
:= False;
117 GNATprove_Mode_Specified
:= False;
118 Normalize_Scalars_Specified
:= False;
119 Partition_Elaboration_Policy_Specified
:= ' ';
120 Queuing_Policy_Specified
:= ' ';
121 SSO_Default_Specified
:= False;
122 Task_Dispatching_Policy_Specified
:= ' ';
123 Unreserve_All_Interrupts_Specified
:= False;
124 Frontend_Exceptions_Specified
:= False;
125 Zero_Cost_Exceptions_Specified
:= False;
137 Read_Xref
: Boolean := False;
138 Read_Lines
: String := "";
139 Ignore_Lines
: String := "X";
140 Ignore_Errors
: Boolean := False;
141 Directly_Scanned
: Boolean := False) return ALI_Id
143 P
: Text_Ptr
:= T
'First;
144 Line
: Logical_Line_Number
:= 1;
150 Ignore
: array (Character range 'A' .. 'Z') of Boolean;
151 -- Ignore (X) is set to True if lines starting with X are to
152 -- be ignored by Scan_ALI and skipped, and False if the lines
153 -- are to be read and processed.
155 Bad_ALI_Format
: exception;
156 -- Exception raised by Fatal_Error if Err is True
158 function At_Eol
return Boolean;
159 -- Test if at end of line
161 function At_End_Of_Field
return Boolean;
162 -- Test if at end of line, or if at blank or horizontal tab
164 procedure Check_At_End_Of_Field
;
165 -- Check if we are at end of field, fatal error if not
167 procedure Checkc
(C
: Character);
168 -- Check next character is C. If so bump past it, if not fatal error
170 procedure Check_Unknown_Line
;
171 -- If Ignore_Errors mode, then checks C to make sure that it is not
172 -- an unknown ALI line type characters, and if so, skips lines
173 -- until the first character of the line is one of these characters,
174 -- at which point it does a Getc to put that character in C. The
175 -- call has no effect if C is already an appropriate character.
176 -- If not in Ignore_Errors mode, a fatal error is signalled if the
177 -- line is unknown. Note that if C is an EOL on entry, the line is
178 -- skipped (it is assumed that blank lines are never significant).
179 -- If C is EOF on entry, the call has no effect (it is assumed that
180 -- the caller will properly handle this case).
182 procedure Fatal_Error
;
183 -- Generate fatal error message for badly formatted ALI file if
184 -- Err is false, or raise Bad_ALI_Format if Err is True.
186 procedure Fatal_Error_Ignore
;
187 pragma Inline
(Fatal_Error_Ignore
);
188 -- In Ignore_Errors mode, has no effect, otherwise same as Fatal_Error
190 function Getc
return Character;
191 -- Get next character, bumping P past the character obtained
193 function Get_File_Name
194 (Lower
: Boolean := False;
195 May_Be_Quoted
: Boolean := False) return File_Name_Type
;
196 -- Skip blanks, then scan out a file name (name is left in Name_Buffer
197 -- with length in Name_Len, as well as returning a File_Name_Type value.
198 -- If May_Be_Quoted is True and the first non blank character is '"',
199 -- then remove starting and ending quotes and undoubled internal quotes.
200 -- If lower is false, the case is unchanged, if Lower is True then the
201 -- result is forced to all lower case for systems where file names are
202 -- not case sensitive. This ensures that gnatbind works correctly
203 -- regardless of the case of the file name on all systems. The scan
204 -- is terminated by a end of line, space or horizontal tab. Any other
205 -- special characters are included in the returned name.
208 (Ignore_Spaces
: Boolean := False;
209 Ignore_Special
: Boolean := False;
210 May_Be_Quoted
: Boolean := False) return Name_Id
;
211 -- Skip blanks, then scan out a name (name is left in Name_Buffer with
212 -- length in Name_Len, as well as being returned in Name_Id form).
213 -- If Lower is set to True then the Name_Buffer will be converted to
214 -- all lower case, for systems where file names are not case sensitive.
215 -- This ensures that gnatbind works correctly regardless of the case
216 -- of the file name on all systems. The termination condition depends
217 -- on the settings of Ignore_Spaces and Ignore_Special:
219 -- If Ignore_Spaces is False (normal case), then scan is terminated
220 -- by the normal end of field condition (EOL, space, horizontal tab)
222 -- If Ignore_Special is False (normal case), the scan is terminated by
223 -- a typeref bracket or an equal sign except for the special case of
224 -- an operator name starting with a double quote which is terminated
225 -- by another double quote.
227 -- If May_Be_Quoted is True and the first non blank character is '"'
228 -- the name is 'unquoted'. In this case Ignore_Special is ignored and
229 -- assumed to be True.
231 -- It is an error to set both Ignore_Spaces and Ignore_Special to True.
232 -- This function handles wide characters properly.
234 function Get_Nat
return Nat
;
235 -- Skip blanks, then scan out an unsigned integer value in Nat range
236 -- raises ALI_Reading_Error if the encoutered type is not natural.
238 function Get_Stamp
return Time_Stamp_Type
;
239 -- Skip blanks, then scan out a time stamp
241 function Get_Unit_Name
return Unit_Name_Type
;
242 -- Skip blanks, then scan out a file name (name is left in Name_Buffer
243 -- with length in Name_Len, as well as returning a Unit_Name_Type value.
244 -- The case is unchanged and terminated by a normal end of field.
246 function Nextc
return Character;
247 -- Return current character without modifying pointer P
249 procedure Get_Typeref
250 (Current_File_Num
: Sdep_Id
;
252 File_Num
: out Sdep_Id
;
254 Ref_Type
: out Character;
256 Standard_Entity
: out Name_Id
);
257 -- Parse the definition of a typeref (<...>, {...} or (...))
260 -- Skip past spaces, then skip past end of line (fatal error if not
261 -- at end of line). Also skips past any following blank lines.
264 -- Skip rest of current line and any following blank lines
266 procedure Skip_Space
;
267 -- Skip past white space (blanks or horizontal tab)
270 -- Skip past next character, does not affect value in C. This call
271 -- is like calling Getc and ignoring the returned result.
273 ---------------------
274 -- At_End_Of_Field --
275 ---------------------
277 function At_End_Of_Field
return Boolean is
286 function At_Eol
return Boolean is
288 return Nextc
= EOF
or else Nextc
= CR
or else Nextc
= LF
;
291 ---------------------------
292 -- Check_At_End_Of_Field --
293 ---------------------------
295 procedure Check_At_End_Of_Field
is
297 if not At_End_Of_Field
then
298 if Ignore_Errors
then
299 while Nextc
> ' ' loop
306 end Check_At_End_Of_Field
;
308 ------------------------
309 -- Check_Unknown_Line --
310 ------------------------
312 procedure Check_Unknown_Line
is
314 while C
not in 'A' .. 'Z'
315 or else not Known_ALI_Lines
(C
)
317 if C
= CR
or else C
= LF
then
324 elsif Ignore_Errors
then
332 end Check_Unknown_Line
;
338 procedure Checkc
(C
: Character) is
342 elsif Ignore_Errors
then
353 procedure Fatal_Error
is
358 procedure Wchar
(C
: Character);
359 -- Write a single character, replacing horizontal tab by spaces
361 procedure Wchar
(C
: Character) is
366 exit when Col
mod 8 = 0;
375 -- Start of processing for Fatal_Error
379 raise Bad_ALI_Format
;
383 Write_Str
("fatal error: file ");
385 Write_Str
(" is incorrectly formatted");
388 Write_Str
("make sure you are using consistent versions " &
390 -- Split the following line so that it can easily be transformed for
391 -- other back-ends where the compiler might have a different name.
397 -- Find start of line
401 and then T
(Ptr1
- 1) /= CR
402 and then T
(Ptr1
- 1) /= LF
407 Write_Int
(Int
(Line
));
422 and then T
(Ptr2
) /= CR
423 and then T
(Ptr2
) /= LF
435 if T
(Ptr1
) = HT
then
447 Exit_Program
(E_Fatal
);
450 ------------------------
451 -- Fatal_Error_Ignore --
452 ------------------------
454 procedure Fatal_Error_Ignore
is
456 if not Ignore_Errors
then
459 end Fatal_Error_Ignore
;
465 function Get_File_Name
466 (Lower
: Boolean := False;
467 May_Be_Quoted
: Boolean := False) return File_Name_Type
472 F
:= Get_Name
(Ignore_Special
=> True,
473 May_Be_Quoted
=> May_Be_Quoted
);
475 -- Convert file name to all lower case if file names are not case
476 -- sensitive. This ensures that we handle names in the canonical
477 -- lower case format, regardless of the actual case.
479 if Lower
and not File_Names_Case_Sensitive
then
480 Canonical_Case_File_Name
(Name_Buffer
(1 .. Name_Len
));
483 return File_Name_Type
(F
);
492 (Ignore_Spaces
: Boolean := False;
493 Ignore_Special
: Boolean := False;
494 May_Be_Quoted
: Boolean := False) return Name_Id
503 if Ignore_Errors
then
512 -- Deal with quoted characters
514 if May_Be_Quoted
and then Char
= '"' then
517 if Ignore_Errors
then
540 Add_Char_To_Name_Buffer
(Char
);
543 -- Other than case of quoted character
548 Add_Char_To_Name_Buffer
(Getc
);
550 exit when At_End_Of_Field
and then not Ignore_Spaces
;
552 if not Ignore_Special
then
553 if Name_Buffer
(1) = '"' then
554 exit when Name_Len
> 1
555 and then Name_Buffer
(Name_Len
) = '"';
558 -- Terminate on parens or angle brackets or equal sign
560 exit when Nextc
= '(' or else Nextc
= ')'
561 or else Nextc
= '{' or else Nextc
= '}'
562 or else Nextc
= '<' or else Nextc
= '>'
565 -- Terminate on comma
567 exit when Nextc
= ',';
569 -- Terminate if left bracket not part of wide char
570 -- sequence Note that we only recognize brackets
571 -- notation so far ???
573 exit when Nextc
= '[' and then T
(P
+ 1) /= '"';
575 -- Terminate if right bracket not part of wide char
578 exit when Nextc
= ']' and then T
(P
- 1) /= '"';
591 function Get_Unit_Name
return Unit_Name_Type
is
593 return Unit_Name_Type
(Get_Name
);
600 function Get_Nat
return Nat
is
606 -- Check if we are on a number. In the case of bad ALI files, this
609 if not (Nextc
in '0' .. '9') then
615 V
:= V
* 10 + (Character'Pos (Getc
) - Character'Pos ('0'));
617 exit when At_End_Of_Field
;
618 exit when Nextc
< '0' or else Nextc
> '9';
628 function Get_Stamp
return Time_Stamp_Type
is
636 if Ignore_Errors
then
637 return Dummy_Time_Stamp
;
643 -- Following reads old style time stamp missing first two digits
645 if Nextc
in '7' .. '9' then
650 -- Normal case of full year in time stamp
656 for J
in Start
.. T
'Last loop
667 procedure Get_Typeref
668 (Current_File_Num
: Sdep_Id
;
670 File_Num
: out Sdep_Id
;
672 Ref_Type
: out Character;
674 Standard_Entity
: out Name_Id
)
679 when '<' => Ref
:= Tref_Derived
;
680 when '(' => Ref
:= Tref_Access
;
681 when '{' => Ref
:= Tref_Type
;
682 when others => Ref
:= Tref_None
;
685 -- Case of typeref field present
687 if Ref
/= Tref_None
then
688 P
:= P
+ 1; -- skip opening bracket
690 if Nextc
in 'a' .. 'z' then
691 File_Num
:= No_Sdep_Id
;
695 Standard_Entity
:= Get_Name
(Ignore_Spaces
=> True);
700 File_Num
:= Sdep_Id
(N
+ Nat
(First_Sdep_Entry
) - 1);
704 File_Num
:= Current_File_Num
;
710 Standard_Entity
:= No_Name
;
713 -- ??? Temporary workaround for nested generics case:
714 -- 4i4 Directories{1|4I9[4|6[3|3]]}
718 Nested_Brackets
: Natural := 0;
724 Nested_Brackets
:= Nested_Brackets
+ 1;
726 Nested_Brackets
:= Nested_Brackets
- 1;
728 if Nested_Brackets
= 0 then
737 P
:= P
+ 1; -- skip closing bracket
740 -- No typeref entry present
743 File_Num
:= No_Sdep_Id
;
747 Standard_Entity
:= No_Name
;
755 function Getc
return Character is
769 function Nextc
return Character is
778 procedure Skip_Eol
is
783 if Ignore_Errors
then
784 while not At_Eol
loop
792 -- Loop to skip past blank lines (first time through skips this EOL)
794 while Nextc
< ' ' and then Nextc
/= EOF
loop
807 procedure Skip_Line
is
809 while not At_Eol
loop
820 procedure Skip_Space
is
822 while Nextc
= ' ' or else Nextc
= HT
loop
838 -- Start of processing for Scan_ALI
841 First_Sdep_Entry
:= Sdep
.Last
+ 1;
843 -- Acquire lines to be ignored
847 ('T' |
'U' |
'W' |
'Y' |
'Z' |
'D' |
'X' => False, others => True);
849 -- Read_Lines parameter given
851 elsif Read_Lines
/= "" then
852 Ignore
:= ('U' => False, others => True);
854 for J
in Read_Lines
'Range loop
855 Ignore
(Read_Lines
(J
)) := False;
858 -- Process Ignore_Lines parameter
861 Ignore
:= (others => False);
863 for J
in Ignore_Lines
'Range loop
864 pragma Assert
(Ignore_Lines
(J
) /= 'U');
865 Ignore
(Ignore_Lines
(J
)) := True;
869 -- Setup ALI Table entry with appropriate defaults
873 Set_Name_Table_Int
(F
, Int
(Id
));
877 Compile_Errors
=> False,
878 First_Interrupt_State
=> Interrupt_States
.Last
+ 1,
879 First_Sdep
=> No_Sdep_Id
,
880 First_Specific_Dispatching
=> Specific_Dispatching
.Last
+ 1,
881 First_Unit
=> No_Unit_Id
,
882 GNATprove_Mode
=> False,
883 Last_Interrupt_State
=> Interrupt_States
.Last
,
884 Last_Sdep
=> No_Sdep_Id
,
885 Last_Specific_Dispatching
=> Specific_Dispatching
.Last
,
886 Last_Unit
=> No_Unit_Id
,
887 Locking_Policy
=> ' ',
890 Main_Program
=> None
,
891 No_Component_Reordering
=> False,
893 Normalize_Scalars
=> False,
894 Ofile_Full_Name
=> Full_Object_File_Name
,
895 Partition_Elaboration_Policy
=> ' ',
896 Queuing_Policy
=> ' ',
897 Restrictions
=> No_Restrictions
,
898 SAL_Interface
=> False,
901 Task_Dispatching_Policy
=> ' ',
902 Time_Slice_Value
=> -1,
904 Unit_Exception_Table
=> False,
905 Ver
=> (others => ' '),
907 Frontend_Exceptions
=> False,
908 Zero_Cost_Exceptions
=> False);
910 -- Now we acquire the input lines from the ALI file. Note that the
911 -- convention in the following code is that as we enter each section,
912 -- C is set to contain the first character of the following line.
917 -- Acquire library version
921 -- The V line missing really indicates trouble, most likely it
922 -- means we don't have an ALI file at all, so here we give a
923 -- fatal error even if we are in Ignore_Errors mode.
927 elsif Ignore
('V') then
935 for J
in 1 .. Ver_Len_Max
loop
938 ALIs
.Table
(Id
).Ver
(J
) := C
;
939 ALIs
.Table
(Id
).Ver_Len
:= J
;
948 -- Acquire main program line if present
961 ALIs
.Table
(Id
).Main_Program
:= Func
;
963 ALIs
.Table
(Id
).Main_Program
:= Proc
;
973 ALIs
.Table
(Id
).Main_Priority
:= Get_Nat
;
981 ALIs
.Table
(Id
).Time_Slice_Value
:= Get_Nat
;
989 ALIs
.Table
(Id
).Main_CPU
:= Get_Nat
;
996 ALIs
.Table
(Id
).WC_Encoding
:= Getc
;
1005 -- Acquire argument lines
1007 First_Arg
:= Args
.Last
+ 1;
1011 exit A_Loop
when C
/= 'A';
1013 if Ignore
('A') then
1019 -- Scan out argument
1022 while not At_Eol
loop
1023 Add_Char_To_Name_Buffer
(Getc
);
1026 -- If -fstack-check, record that it occurred. Note that an
1027 -- additional string parameter can be specified, in the form of
1028 -- -fstack-check={no|generic|specific}. "no" means no checking,
1029 -- "generic" means force the use of old-style checking, and
1030 -- "specific" means use the best checking method.
1033 and then Name_Buffer
(1 .. 13) = "-fstack-check"
1034 and then Name_Buffer
(1 .. Name_Len
) /= "-fstack-check=no"
1036 Stack_Check_Switch_Set
:= True;
1039 -- Store the argument
1041 Args
.Increment_Last
;
1042 Args
.Table
(Args
.Last
) := new String'(Name_Buffer (1 .. Name_Len));
1055 if Ignore_Errors then
1067 if Ignore ('P
') then
1075 while not At_Eol loop
1080 -- Processing for CE
1084 ALIs.Table (Id).Compile_Errors := True;
1086 -- Processing for DB
1090 Detect_Blocking := True;
1092 -- Processing for Ex
1095 Partition_Elaboration_Policy_Specified := Getc;
1096 ALIs.Table (Id).Partition_Elaboration_Policy :=
1097 Partition_Elaboration_Policy_Specified;
1099 -- Processing for FX
1105 ALIs.Table (Id).Frontend_Exceptions := True;
1106 Frontend_Exceptions_Specified := True;
1111 -- Processing for GP
1115 GNATprove_Mode_Specified := True;
1116 ALIs.Table (Id).GNATprove_Mode := True;
1118 -- Processing for Lx
1121 Locking_Policy_Specified := Getc;
1122 ALIs.Table (Id).Locking_Policy := Locking_Policy_Specified;
1124 -- Processing for flags starting with N
1129 -- Processing for NC
1132 ALIs.Table (Id).No_Component_Reordering := True;
1133 No_Component_Reordering_Specified := True;
1135 -- Processing for NO
1138 ALIs.Table (Id).No_Object := True;
1139 No_Object_Specified := True;
1141 -- Processing for NR
1144 No_Run_Time_Mode := True;
1145 Configurable_Run_Time_Mode := True;
1147 -- Processing for NS
1150 ALIs.Table (Id).Normalize_Scalars := True;
1151 Normalize_Scalars_Specified := True;
1154 -- Invalid switch starting with N
1160 -- Processing for OH/OL
1165 if C = 'L
' or else C = 'H
' then
1166 ALIs.Table (Id).SSO_Default := C;
1167 SSO_Default_Specified := True;
1173 -- Processing for Qx
1176 Queuing_Policy_Specified := Getc;
1177 ALIs.Table (Id).Queuing_Policy := Queuing_Policy_Specified;
1179 -- Processing for flags starting with S
1184 -- Processing for SL
1187 ALIs.Table (Id).SAL_Interface := True;
1189 -- Processing for SS
1192 Opt.Sec_Stack_Used := True;
1194 -- Invalid switch starting with S
1200 -- Processing for Tx
1203 Task_Dispatching_Policy_Specified := Getc;
1204 ALIs.Table (Id).Task_Dispatching_Policy :=
1205 Task_Dispatching_Policy_Specified;
1207 -- Processing for switch starting with U
1212 -- Processing for UA
1215 Unreserve_All_Interrupts_Specified := True;
1217 -- Processing for UX
1220 ALIs.Table (Id).Unit_Exception_Table := True;
1222 -- Invalid switches starting with U
1228 -- Processing for ZX
1234 ALIs.Table (Id).Zero_Cost_Exceptions := True;
1235 Zero_Cost_Exceptions_Specified := True;
1240 -- Invalid parameter
1248 if not NS_Found then
1249 No_Normalize_Scalars_Specified := True;
1258 -- Loop to skip to first restrictions line
1261 if Ignore_Errors then
1273 -- Ignore all 'R
' lines if that is required
1275 if Ignore ('R
') then
1281 -- Here we process the restrictions lines (other than unit name cases)
1284 Scan_Restrictions : declare
1285 Save_R : constant Restrictions_Info := Cumulative_Restrictions;
1286 -- Save cumulative restrictions in case we have a fatal error
1288 Bad_R_Line : exception;
1289 -- Signal bad restrictions line (raised on unexpected character)
1296 -- Named restriction case
1302 -- Loop through RR and RV lines
1304 while C = 'R
' and then Nextc /= ' ' loop
1308 -- Acquire restriction name
1311 while not At_Eol and then Nextc /= '=' loop
1312 Name_Len := Name_Len + 1;
1313 Name_Buffer (Name_Len) := Getc;
1316 -- Now search list of restrictions to find match
1319 RN : String renames Name_Buffer (1 .. Name_Len);
1322 R := Restriction_Id'First;
1323 while R /= Not_A_Restriction_Id loop
1324 if Restriction_Id'Image (R) = RN then
1328 R := Restriction_Id'Succ (R);
1331 -- We don't recognize the restriction. This might be
1332 -- thought of as an error, and it really is, but we
1333 -- want to allow building with inconsistent versions
1334 -- of the binder and ali files (see comments at the
1335 -- start of package System.Rident), so we just ignore
1338 goto Done_With_Restriction_Line;
1345 -- Boolean restriction case
1347 when All_Boolean_Restrictions =>
1350 ALIs.Table (Id).Restrictions.Violated (R) :=
1352 Cumulative_Restrictions.Violated (R) := True;
1355 ALIs.Table (Id).Restrictions.Set (R) := True;
1356 Cumulative_Restrictions.Set (R) := True;
1362 -- Parameter restriction case
1364 when All_Parameter_Restrictions =>
1365 if At_Eol or else Nextc /= '=' then
1371 N := Natural (Get_Nat);
1378 ALIs.Table (Id).Restrictions.Set (R) := True;
1379 ALIs.Table (Id).Restrictions.Value (R) := N;
1381 if Cumulative_Restrictions.Set (R) then
1382 Cumulative_Restrictions.Value (R) :=
1384 (Cumulative_Restrictions.Value (R), N);
1386 Cumulative_Restrictions.Set (R) := True;
1387 Cumulative_Restrictions.Value (R) := N;
1390 -- Restriction violated
1393 ALIs.Table (Id).Restrictions.Violated (R) :=
1395 Cumulative_Restrictions.Violated (R) := True;
1396 ALIs.Table (Id).Restrictions.Count (R) := N;
1398 -- Checked Max_Parameter case
1400 if R in Checked_Max_Parameter_Restrictions then
1401 Cumulative_Restrictions.Count (R) :=
1403 (Cumulative_Restrictions.Count (R), N);
1405 -- Other checked parameter cases
1409 pragma Unsuppress (Overflow_Check);
1412 Cumulative_Restrictions.Count (R) :=
1413 Cumulative_Restrictions.Count (R) + N;
1416 when Constraint_Error =>
1418 -- A constraint error comes from the
1419 -- addition. We reset to the maximum
1420 -- and indicate that the real value
1423 Cumulative_Restrictions.Value (R) :=
1425 Cumulative_Restrictions.Unknown (R) :=
1434 ALIs.Table (Id).Restrictions.Unknown (R) :=
1436 Cumulative_Restrictions.Unknown (R) := True;
1439 -- Other than 'R
' or 'V
'
1449 -- Bizarre error case NOT_A_RESTRICTION
1451 when Not_A_Restriction_Id =>
1459 <<Done_With_Restriction_Line>>
1464 -- Positional restriction case
1470 -- Acquire information for boolean restrictions
1472 for R in All_Boolean_Restrictions loop
1477 ALIs.Table (Id).Restrictions.Violated (R) := True;
1478 Cumulative_Restrictions.Violated (R) := True;
1481 ALIs.Table (Id).Restrictions.Set (R) := True;
1482 Cumulative_Restrictions.Set (R) := True;
1492 -- Acquire information for parameter restrictions
1494 for RP in All_Parameter_Restrictions loop
1500 ALIs.Table (Id).Restrictions.Set (RP) := True;
1503 N : constant Integer := Integer (Get_Nat);
1505 ALIs.Table (Id).Restrictions.Value (RP) := N;
1507 if Cumulative_Restrictions.Set (RP) then
1508 Cumulative_Restrictions.Value (RP) :=
1510 (Cumulative_Restrictions.Value (RP), N);
1512 Cumulative_Restrictions.Set (RP) := True;
1513 Cumulative_Restrictions.Value (RP) := N;
1521 -- Acquire restrictions violations information
1529 ALIs.Table (Id).Restrictions.Violated (RP) := True;
1530 Cumulative_Restrictions.Violated (RP) := True;
1533 N : constant Integer := Integer (Get_Nat);
1536 ALIs.Table (Id).Restrictions.Count (RP) := N;
1538 if RP in Checked_Max_Parameter_Restrictions then
1539 Cumulative_Restrictions.Count (RP) :=
1541 (Cumulative_Restrictions.Count (RP), N);
1545 pragma Unsuppress (Overflow_Check);
1548 Cumulative_Restrictions.Count (RP) :=
1549 Cumulative_Restrictions.Count (RP) + N;
1552 when Constraint_Error =>
1554 -- A constraint error comes from the add. We
1555 -- reset to the maximum and indicate that the
1556 -- real value is now unknown.
1558 Cumulative_Restrictions.Value (RP) :=
1560 Cumulative_Restrictions.Unknown (RP) := True;
1566 ALIs.Table (Id).Restrictions.Unknown (RP) := True;
1567 Cumulative_Restrictions.Unknown (RP) := True;
1584 -- Here if error during scanning of restrictions line
1589 -- In Ignore_Errors mode, undo any changes to restrictions
1590 -- from this unit, and continue on, skipping remaining R
1591 -- lines for this unit.
1593 if Ignore_Errors then
1594 Cumulative_Restrictions := Save_R;
1595 ALIs.Table (Id).Restrictions := No_Restrictions;
1603 -- In normal mode, this is a fatal error
1608 end Scan_Restrictions;
1611 -- Acquire additional restrictions (No_Dependence) lines if present
1614 if Ignore ('R
') then
1618 No_Deps.Append ((Id, Get_Name));
1625 -- Acquire 'I
' lines if present
1630 if Ignore ('I
') then
1636 I_State : Character;
1645 Interrupt_States.Append (
1646 (Interrupt_Id => Int_Num,
1647 Interrupt_State => I_State,
1648 IS_Pragma_Line => Line_No));
1650 ALIs.Table (Id).Last_Interrupt_State := Interrupt_States.Last;
1658 -- Acquire 'S
' lines if present
1663 if Ignore ('S
') then
1679 First_Prio := Get_Nat;
1680 Last_Prio := Get_Nat;
1683 Specific_Dispatching.Append (
1684 (Dispatching_Policy => Policy,
1685 First_Priority => First_Prio,
1686 Last_Priority => Last_Prio,
1687 PSD_Pragma_Line => Line_No));
1689 ALIs.Table (Id).Last_Specific_Dispatching :=
1690 Specific_Dispatching.Last;
1699 -- Loop to acquire unit entries
1703 exit U_Loop when C /= 'U
';
1705 -- Note: as per spec, we never ignore U lines
1709 Units.Increment_Last;
1711 if ALIs.Table (Id).First_Unit = No_Unit_Id then
1712 ALIs.Table (Id).First_Unit := Units.Last;
1716 UL : Unit_Record renames Units.Table (Units.Last);
1719 UL.Uname := Get_Unit_Name;
1720 UL.Predefined := Is_Predefined_Unit;
1721 UL.Internal := Is_Internal_Unit;
1723 UL.Sfile := Get_File_Name (Lower => True);
1725 UL.Preelab := False;
1726 UL.No_Elab := False;
1727 UL.Shared_Passive := False;
1729 UL.Remote_Types := False;
1730 UL.Serious_Errors := False;
1731 UL.Has_RACW := False;
1732 UL.Init_Scalars := False;
1733 UL.Is_Generic := False;
1734 UL.Icasing := Mixed_Case;
1735 UL.Kcasing := All_Lower_Case;
1736 UL.Dynamic_Elab := False;
1737 UL.Elaborate_Body := False;
1738 UL.Set_Elab_Entity := False;
1739 UL.Version := "00000000";
1740 UL.First_With := Withs.Last + 1;
1741 UL.First_Arg := First_Arg;
1742 UL.Elab_Position := 0;
1743 UL.SAL_Interface := ALIs.Table (Id).SAL_Interface;
1744 UL.Directly_Scanned := Directly_Scanned;
1745 UL.Body_Needed_For_SAL := False;
1746 UL.Elaborate_Body_Desirable := False;
1747 UL.Optimize_Alignment := 'O
';
1748 UL.Has_Finalizer := False;
1749 UL.Primary_Stack_Count := 0;
1750 UL.Sec_Stack_Count := 0;
1752 if Debug_Flag_U then
1753 Write_Str (" ----> reading unit ");
1754 Write_Int (Int (Units.Last));
1756 Write_Unit_Name (UL.Uname);
1757 Write_Str (" from file ");
1758 Write_Name (UL.Sfile);
1763 -- Check for duplicated unit in different files
1766 Info : constant Int := Get_Name_Table_Int
1767 (Units.Table (Units.Last).Uname);
1770 and then Units.Table (Units.Last).Sfile /=
1771 Units.Table (Unit_Id (Info)).Sfile
1773 -- If Err is set then ignore duplicate unit name. This is the
1774 -- case of a call from gnatmake, where the situation can arise
1775 -- from substitution of source files. In such situations, the
1776 -- processing in gnatmake will always result in any required
1777 -- recompilations in any case, and if we consider this to be
1778 -- an error we get strange cases (for example when a generic
1779 -- instantiation is replaced by a normal package) where we
1780 -- read the old ali file, decide to recompile, and then decide
1781 -- that the old and new ali files are incompatible.
1786 -- If Err is not set, then this is a fatal error. This is
1787 -- the case of being called from the binder, where we must
1788 -- definitely diagnose this as an error.
1792 Write_Str ("error: duplicate unit name: ");
1795 Write_Str ("error: unit """);
1796 Write_Unit_Name (Units.Table (Units.Last).Uname);
1797 Write_Str (""" found in file """);
1798 Write_Name_Decoded (Units.Table (Units.Last).Sfile);
1802 Write_Str ("error
: unit
""");
1803 Write_Unit_Name (Units.Table (Unit_Id (Info)).Uname);
1804 Write_Str (""" found
in file
""");
1805 Write_Name_Decoded (Units.Table (Unit_Id (Info)).Sfile);
1809 Exit_Program (E_Fatal);
1815 (Units.Table (Units.Last).Uname, Int (Units.Last));
1817 -- Scan out possible version and other parameters
1826 if C in '0' .. '9' or else C in 'a
' .. 'f
' then
1827 Units.Table (Units.Last).Version (1) := C;
1829 for J in 2 .. 8 loop
1831 Units.Table (Units.Last).Version (J) := C;
1840 Check_At_End_Of_Field;
1841 Units.Table (Units.Last).Elaborate_Body_Desirable := True;
1844 Check_At_End_Of_Field;
1845 Units.Table (Units.Last).Body_Needed_For_SAL := True;
1851 -- DE parameter (Dynamic elaboration checks)
1857 Check_At_End_Of_Field;
1858 Units.Table (Units.Last).Dynamic_Elab := True;
1859 Dynamic_Elaboration_Checks_Specified := True;
1870 Units.Table (Units.Last).Elaborate_Body := True;
1872 Units.Table (Units.Last).Set_Elab_Entity := True;
1877 Check_At_End_Of_Field;
1879 -- GE parameter (generic)
1885 Check_At_End_Of_Field;
1886 Units.Table (Units.Last).Is_Generic := True;
1891 -- IL/IS/IU parameters
1897 Units.Table (Units.Last).Icasing := All_Lower_Case;
1899 Units.Table (Units.Last).Init_Scalars := True;
1900 Initialize_Scalars_Used := True;
1902 Units.Table (Units.Last).Icasing := All_Upper_Case;
1907 Check_At_End_Of_Field;
1915 Units.Table (Units.Last).Kcasing := Mixed_Case;
1917 Units.Table (Units.Last).Kcasing := All_Upper_Case;
1922 Check_At_End_Of_Field;
1930 Units.Table (Units.Last).No_Elab := True;
1931 Check_At_End_Of_Field;
1936 -- PF/PR/PU/PK parameters
1942 Units.Table (Units.Last).Has_Finalizer := True;
1944 Units.Table (Units.Last).Preelab := True;
1946 Units.Table (Units.Last).Pure := True;
1948 Units.Table (Units.Last).Unit_Kind := 'p
';
1953 Check_At_End_Of_Field;
1955 -- OL/OO/OS/OT parameters
1960 if C = 'L
' or else C = 'O
' or else C = 'S
' or else C = 'T
' then
1961 Units.Table (Units.Last).Optimize_Alignment := C;
1966 Check_At_End_Of_Field;
1974 Units.Table (Units.Last).RCI := True;
1976 Units.Table (Units.Last).Remote_Types := True;
1978 Units.Table (Units.Last).Has_RACW := True;
1983 Check_At_End_Of_Field;
1985 -- SE/SP/SU parameters
1991 Units.Table (Units.Last).Serious_Errors := True;
1993 Units.Table (Units.Last).Shared_Passive := True;
1995 Units.Table (Units.Last).Unit_Kind := 's
';
2000 Check_At_End_Of_Field;
2012 -- Scan out With lines for this unit
2016 exit With_Loop when C /= 'W
' and then C /= 'Y
' and then C /= 'Z
';
2018 if Ignore ('W
') then
2024 Withs.Increment_Last;
2025 Withs.Table (Withs.Last).Uname := Get_Unit_Name;
2026 Withs.Table (Withs.Last).Elaborate := False;
2027 Withs.Table (Withs.Last).Elaborate_All := False;
2028 Withs.Table (Withs.Last).Elab_Desirable := False;
2029 Withs.Table (Withs.Last).Elab_All_Desirable := False;
2030 Withs.Table (Withs.Last).SAL_Interface := False;
2031 Withs.Table (Withs.Last).Limited_With := (C = 'Y
');
2032 Withs.Table (Withs.Last).Implicit_With := (C = 'Z
');
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));