1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2015, 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 Static_Elaboration_Model_Used
:= False;
120 Task_Dispatching_Policy_Specified
:= ' ';
121 Unreserve_All_Interrupts_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 -- e.g. JVM/.NET back-ends where the compiler has 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 Zero_Cost_Exceptions
=> False);
905 -- Now we acquire the input lines from the ALI file. Note that the
906 -- convention in the following code is that as we enter each section,
907 -- C is set to contain the first character of the following line.
912 -- Acquire library version
916 -- The V line missing really indicates trouble, most likely it
917 -- means we don't have an ALI file at all, so here we give a
918 -- fatal error even if we are in Ignore_Errors mode.
922 elsif Ignore
('V') then
930 for J
in 1 .. Ver_Len_Max
loop
933 ALIs
.Table
(Id
).Ver
(J
) := C
;
934 ALIs
.Table
(Id
).Ver_Len
:= J
;
943 -- Acquire main program line if present
956 ALIs
.Table
(Id
).Main_Program
:= Func
;
958 ALIs
.Table
(Id
).Main_Program
:= Proc
;
968 ALIs
.Table
(Id
).Main_Priority
:= Get_Nat
;
976 ALIs
.Table
(Id
).Time_Slice_Value
:= Get_Nat
;
984 ALIs
.Table
(Id
).Main_CPU
:= Get_Nat
;
991 ALIs
.Table
(Id
).WC_Encoding
:= Getc
;
1000 -- Acquire argument lines
1002 First_Arg
:= Args
.Last
+ 1;
1006 exit A_Loop
when C
/= 'A';
1008 if Ignore
('A') then
1014 -- Scan out argument
1017 while not At_Eol
loop
1018 Add_Char_To_Name_Buffer
(Getc
);
1021 -- If -fstack-check, record that it occurred. Note that an
1022 -- additional string parameter can be specified, in the form of
1023 -- -fstack-check={no|generic|specific}. "no" means no checking,
1024 -- "generic" means force the use of old-style checking, and
1025 -- "specific" means use the best checking method.
1028 and then Name_Buffer
(1 .. 13) = "-fstack-check"
1029 and then Name_Buffer
(1 .. Name_Len
) /= "-fstack-check=no"
1031 Stack_Check_Switch_Set
:= True;
1034 -- Store the argument
1036 Args
.Increment_Last
;
1037 Args
.Table
(Args
.Last
) := new String'(Name_Buffer (1 .. Name_Len));
1050 if Ignore_Errors then
1062 if Ignore ('P
') then
1070 while not At_Eol loop
1075 -- Processing for CE
1079 ALIs.Table (Id).Compile_Errors := True;
1081 -- Processing for DB
1085 Detect_Blocking := True;
1087 -- Processing for Ex
1090 Partition_Elaboration_Policy_Specified := Getc;
1091 ALIs.Table (Id).Partition_Elaboration_Policy :=
1092 Partition_Elaboration_Policy_Specified;
1094 -- Processing for GP
1098 GNATprove_Mode_Specified := True;
1099 ALIs.Table (Id).GNATprove_Mode := True;
1101 -- Processing for Lx
1104 Locking_Policy_Specified := Getc;
1105 ALIs.Table (Id).Locking_Policy := Locking_Policy_Specified;
1107 -- Processing for flags starting with N
1112 -- Processing for NO
1115 ALIs.Table (Id).No_Object := True;
1116 No_Object_Specified := True;
1118 -- Processing for NR
1121 No_Run_Time_Mode := True;
1122 Configurable_Run_Time_Mode := True;
1124 -- Processing for NS
1127 ALIs.Table (Id).Normalize_Scalars := True;
1128 Normalize_Scalars_Specified := True;
1131 -- Invalid switch starting with N
1137 -- Processing for OH/OL
1142 if C = 'L
' or else C = 'H
' then
1143 ALIs.Table (Id).SSO_Default := C;
1144 SSO_Default_Specified := True;
1150 -- Processing for Qx
1153 Queuing_Policy_Specified := Getc;
1154 ALIs.Table (Id).Queuing_Policy := Queuing_Policy_Specified;
1156 -- Processing for flags starting with S
1161 -- Processing for SL
1164 ALIs.Table (Id).SAL_Interface := True;
1166 -- Processing for SS
1169 Opt.Sec_Stack_Used := True;
1171 -- Invalid switch starting with S
1177 -- Processing for Tx
1180 Task_Dispatching_Policy_Specified := Getc;
1181 ALIs.Table (Id).Task_Dispatching_Policy :=
1182 Task_Dispatching_Policy_Specified;
1184 -- Processing for switch starting with U
1189 -- Processing for UA
1192 Unreserve_All_Interrupts_Specified := True;
1194 -- Processing for UX
1197 ALIs.Table (Id).Unit_Exception_Table := True;
1199 -- Invalid switches starting with U
1205 -- Processing for ZX
1211 ALIs.Table (Id).Zero_Cost_Exceptions := True;
1212 Zero_Cost_Exceptions_Specified := True;
1217 -- Invalid parameter
1225 if not NS_Found then
1226 No_Normalize_Scalars_Specified := True;
1235 -- Loop to skip to first restrictions line
1238 if Ignore_Errors then
1250 -- Ignore all 'R
' lines if that is required
1252 if Ignore ('R
') then
1258 -- Here we process the restrictions lines (other than unit name cases)
1261 Scan_Restrictions : declare
1262 Save_R : constant Restrictions_Info := Cumulative_Restrictions;
1263 -- Save cumulative restrictions in case we have a fatal error
1265 Bad_R_Line : exception;
1266 -- Signal bad restrictions line (raised on unexpected character)
1273 -- Named restriction case
1279 -- Loop through RR and RV lines
1281 while C = 'R
' and then Nextc /= ' ' loop
1285 -- Acquire restriction name
1288 while not At_Eol and then Nextc /= '=' loop
1289 Name_Len := Name_Len + 1;
1290 Name_Buffer (Name_Len) := Getc;
1293 -- Now search list of restrictions to find match
1296 RN : String renames Name_Buffer (1 .. Name_Len);
1299 R := Restriction_Id'First;
1300 while R /= Not_A_Restriction_Id loop
1301 if Restriction_Id'Image (R) = RN then
1305 R := Restriction_Id'Succ (R);
1308 -- We don't recognize the restriction. This might be
1309 -- thought of as an error, and it really is, but we
1310 -- want to allow building with inconsistent versions
1311 -- of the binder and ali files (see comments at the
1312 -- start of package System.Rident), so we just ignore
1315 goto Done_With_Restriction_Line;
1322 -- Boolean restriction case
1324 when All_Boolean_Restrictions =>
1327 ALIs.Table (Id).Restrictions.Violated (R) :=
1329 Cumulative_Restrictions.Violated (R) := True;
1332 ALIs.Table (Id).Restrictions.Set (R) := True;
1333 Cumulative_Restrictions.Set (R) := True;
1339 -- Parameter restriction case
1341 when All_Parameter_Restrictions =>
1342 if At_Eol or else Nextc /= '=' then
1348 N := Natural (Get_Nat);
1355 ALIs.Table (Id).Restrictions.Set (R) := True;
1356 ALIs.Table (Id).Restrictions.Value (R) := N;
1358 if Cumulative_Restrictions.Set (R) then
1359 Cumulative_Restrictions.Value (R) :=
1361 (Cumulative_Restrictions.Value (R), N);
1363 Cumulative_Restrictions.Set (R) := True;
1364 Cumulative_Restrictions.Value (R) := N;
1367 -- Restriction violated
1370 ALIs.Table (Id).Restrictions.Violated (R) :=
1372 Cumulative_Restrictions.Violated (R) := True;
1373 ALIs.Table (Id).Restrictions.Count (R) := N;
1375 -- Checked Max_Parameter case
1377 if R in Checked_Max_Parameter_Restrictions then
1378 Cumulative_Restrictions.Count (R) :=
1380 (Cumulative_Restrictions.Count (R), N);
1382 -- Other checked parameter cases
1386 pragma Unsuppress (Overflow_Check);
1389 Cumulative_Restrictions.Count (R) :=
1390 Cumulative_Restrictions.Count (R) + N;
1393 when Constraint_Error =>
1395 -- A constraint error comes from the
1396 -- addition. We reset to the maximum
1397 -- and indicate that the real value
1400 Cumulative_Restrictions.Value (R) :=
1402 Cumulative_Restrictions.Unknown (R) :=
1411 ALIs.Table (Id).Restrictions.Unknown (R) :=
1413 Cumulative_Restrictions.Unknown (R) := True;
1416 -- Other than 'R
' or 'V
'
1426 -- Bizarre error case NOT_A_RESTRICTION
1428 when Not_A_Restriction_Id =>
1436 <<Done_With_Restriction_Line>>
1441 -- Positional restriction case
1447 -- Acquire information for boolean restrictions
1449 for R in All_Boolean_Restrictions loop
1454 ALIs.Table (Id).Restrictions.Violated (R) := True;
1455 Cumulative_Restrictions.Violated (R) := True;
1458 ALIs.Table (Id).Restrictions.Set (R) := True;
1459 Cumulative_Restrictions.Set (R) := True;
1469 -- Acquire information for parameter restrictions
1471 for RP in All_Parameter_Restrictions loop
1477 ALIs.Table (Id).Restrictions.Set (RP) := True;
1480 N : constant Integer := Integer (Get_Nat);
1482 ALIs.Table (Id).Restrictions.Value (RP) := N;
1484 if Cumulative_Restrictions.Set (RP) then
1485 Cumulative_Restrictions.Value (RP) :=
1487 (Cumulative_Restrictions.Value (RP), N);
1489 Cumulative_Restrictions.Set (RP) := True;
1490 Cumulative_Restrictions.Value (RP) := N;
1498 -- Acquire restrictions violations information
1506 ALIs.Table (Id).Restrictions.Violated (RP) := True;
1507 Cumulative_Restrictions.Violated (RP) := True;
1510 N : constant Integer := Integer (Get_Nat);
1513 ALIs.Table (Id).Restrictions.Count (RP) := N;
1515 if RP in Checked_Max_Parameter_Restrictions then
1516 Cumulative_Restrictions.Count (RP) :=
1518 (Cumulative_Restrictions.Count (RP), N);
1522 pragma Unsuppress (Overflow_Check);
1525 Cumulative_Restrictions.Count (RP) :=
1526 Cumulative_Restrictions.Count (RP) + N;
1529 when Constraint_Error =>
1531 -- A constraint error comes from the add. We
1532 -- reset to the maximum and indicate that the
1533 -- real value is now unknown.
1535 Cumulative_Restrictions.Value (RP) :=
1537 Cumulative_Restrictions.Unknown (RP) := True;
1543 ALIs.Table (Id).Restrictions.Unknown (RP) := True;
1544 Cumulative_Restrictions.Unknown (RP) := True;
1561 -- Here if error during scanning of restrictions line
1566 -- In Ignore_Errors mode, undo any changes to restrictions
1567 -- from this unit, and continue on, skipping remaining R
1568 -- lines for this unit.
1570 if Ignore_Errors then
1571 Cumulative_Restrictions := Save_R;
1572 ALIs.Table (Id).Restrictions := No_Restrictions;
1580 -- In normal mode, this is a fatal error
1585 end Scan_Restrictions;
1588 -- Acquire additional restrictions (No_Dependence) lines if present
1591 if Ignore ('R
') then
1595 No_Deps.Append ((Id, Get_Name));
1602 -- Acquire 'I
' lines if present
1607 if Ignore ('I
') then
1613 I_State : Character;
1622 Interrupt_States.Append (
1623 (Interrupt_Id => Int_Num,
1624 Interrupt_State => I_State,
1625 IS_Pragma_Line => Line_No));
1627 ALIs.Table (Id).Last_Interrupt_State := Interrupt_States.Last;
1635 -- Acquire 'S
' lines if present
1640 if Ignore ('S
') then
1656 First_Prio := Get_Nat;
1657 Last_Prio := Get_Nat;
1660 Specific_Dispatching.Append (
1661 (Dispatching_Policy => Policy,
1662 First_Priority => First_Prio,
1663 Last_Priority => Last_Prio,
1664 PSD_Pragma_Line => Line_No));
1666 ALIs.Table (Id).Last_Specific_Dispatching :=
1667 Specific_Dispatching.Last;
1676 -- Loop to acquire unit entries
1680 exit U_Loop when C /= 'U
';
1682 -- Note: as per spec, we never ignore U lines
1686 Units.Increment_Last;
1688 if ALIs.Table (Id).First_Unit = No_Unit_Id then
1689 ALIs.Table (Id).First_Unit := Units.Last;
1693 UL : Unit_Record renames Units.Table (Units.Last);
1696 UL.Uname := Get_Unit_Name;
1697 UL.Predefined := Is_Predefined_Unit;
1698 UL.Internal := Is_Internal_Unit;
1700 UL.Sfile := Get_File_Name (Lower => True);
1702 UL.Preelab := False;
1703 UL.No_Elab := False;
1704 UL.Shared_Passive := False;
1706 UL.Remote_Types := False;
1707 UL.Serious_Errors := False;
1708 UL.Has_RACW := False;
1709 UL.Init_Scalars := False;
1710 UL.Is_Generic := False;
1711 UL.Icasing := Mixed_Case;
1712 UL.Kcasing := All_Lower_Case;
1713 UL.Dynamic_Elab := False;
1714 UL.Elaborate_Body := False;
1715 UL.Set_Elab_Entity := False;
1716 UL.Version := "00000000";
1717 UL.First_With := Withs.Last + 1;
1718 UL.First_Arg := First_Arg;
1719 UL.Elab_Position := 0;
1720 UL.SAL_Interface := ALIs.Table (Id).SAL_Interface;
1721 UL.Directly_Scanned := Directly_Scanned;
1722 UL.Body_Needed_For_SAL := False;
1723 UL.Elaborate_Body_Desirable := False;
1724 UL.Optimize_Alignment := 'O
';
1725 UL.Has_Finalizer := False;
1727 if Debug_Flag_U then
1728 Write_Str (" ----> reading unit ");
1729 Write_Int (Int (Units.Last));
1731 Write_Unit_Name (UL.Uname);
1732 Write_Str (" from file ");
1733 Write_Name (UL.Sfile);
1738 -- Check for duplicated unit in different files
1741 Info : constant Int := Get_Name_Table_Int
1742 (Units.Table (Units.Last).Uname);
1745 and then Units.Table (Units.Last).Sfile /=
1746 Units.Table (Unit_Id (Info)).Sfile
1748 -- If Err is set then ignore duplicate unit name. This is the
1749 -- case of a call from gnatmake, where the situation can arise
1750 -- from substitution of source files. In such situations, the
1751 -- processing in gnatmake will always result in any required
1752 -- recompilations in any case, and if we consider this to be
1753 -- an error we get strange cases (for example when a generic
1754 -- instantiation is replaced by a normal package) where we
1755 -- read the old ali file, decide to recompile, and then decide
1756 -- that the old and new ali files are incompatible.
1761 -- If Err is not set, then this is a fatal error. This is
1762 -- the case of being called from the binder, where we must
1763 -- definitely diagnose this as an error.
1767 Write_Str ("error: duplicate unit name: ");
1770 Write_Str ("error: unit """);
1771 Write_Unit_Name (Units.Table (Units.Last).Uname);
1772 Write_Str (""" found in file """);
1773 Write_Name_Decoded (Units.Table (Units.Last).Sfile);
1777 Write_Str ("error
: unit
""");
1778 Write_Unit_Name (Units.Table (Unit_Id (Info)).Uname);
1779 Write_Str (""" found
in file
""");
1780 Write_Name_Decoded (Units.Table (Unit_Id (Info)).Sfile);
1784 Exit_Program (E_Fatal);
1790 (Units.Table (Units.Last).Uname, Int (Units.Last));
1792 -- Scan out possible version and other parameters
1801 if C in '0' .. '9' or else C in 'a
' .. 'f
' then
1802 Units.Table (Units.Last).Version (1) := C;
1804 for J in 2 .. 8 loop
1806 Units.Table (Units.Last).Version (J) := C;
1815 Check_At_End_Of_Field;
1816 Units.Table (Units.Last).Elaborate_Body_Desirable := True;
1819 Check_At_End_Of_Field;
1820 Units.Table (Units.Last).Body_Needed_For_SAL := True;
1826 -- DE parameter (Dynamic elaboration checks)
1832 Check_At_End_Of_Field;
1833 Units.Table (Units.Last).Dynamic_Elab := True;
1834 Dynamic_Elaboration_Checks_Specified := True;
1845 Units.Table (Units.Last).Elaborate_Body := True;
1847 Units.Table (Units.Last).Set_Elab_Entity := True;
1852 Check_At_End_Of_Field;
1854 -- GE parameter (generic)
1860 Check_At_End_Of_Field;
1861 Units.Table (Units.Last).Is_Generic := True;
1866 -- IL/IS/IU parameters
1872 Units.Table (Units.Last).Icasing := All_Lower_Case;
1874 Units.Table (Units.Last).Init_Scalars := True;
1875 Initialize_Scalars_Used := True;
1877 Units.Table (Units.Last).Icasing := All_Upper_Case;
1882 Check_At_End_Of_Field;
1890 Units.Table (Units.Last).Kcasing := Mixed_Case;
1892 Units.Table (Units.Last).Kcasing := All_Upper_Case;
1897 Check_At_End_Of_Field;
1905 Units.Table (Units.Last).No_Elab := True;
1906 Check_At_End_Of_Field;
1911 -- PF/PR/PU/PK parameters
1917 Units.Table (Units.Last).Has_Finalizer := True;
1919 Units.Table (Units.Last).Preelab := True;
1921 Units.Table (Units.Last).Pure := True;
1923 Units.Table (Units.Last).Unit_Kind := 'p
';
1928 Check_At_End_Of_Field;
1930 -- OL/OO/OS/OT parameters
1935 if C = 'L
' or else C = 'O
' or else C = 'S
' or else C = 'T
' then
1936 Units.Table (Units.Last).Optimize_Alignment := C;
1941 Check_At_End_Of_Field;
1949 Units.Table (Units.Last).RCI := True;
1951 Units.Table (Units.Last).Remote_Types := True;
1953 Units.Table (Units.Last).Has_RACW := True;
1958 Check_At_End_Of_Field;
1960 -- SE/SP/SU parameters
1966 Units.Table (Units.Last).Serious_Errors := True;
1968 Units.Table (Units.Last).Shared_Passive := True;
1970 Units.Table (Units.Last).Unit_Kind := 's
';
1975 Check_At_End_Of_Field;
1985 -- Check if static elaboration model used
1987 if not Units.Table (Units.Last).Dynamic_Elab
1988 and then not Units.Table (Units.Last).Internal
1990 Static_Elaboration_Model_Used := True;
1995 -- Scan out With lines for this unit
1999 exit With_Loop when C /= 'W
' and then C /= 'Y
' and then C /= 'Z
';
2001 if Ignore ('W
') then
2007 Withs.Increment_Last;
2008 Withs.Table (Withs.Last).Uname := Get_Unit_Name;
2009 Withs.Table (Withs.Last).Elaborate := False;
2010 Withs.Table (Withs.Last).Elaborate_All := False;
2011 Withs.Table (Withs.Last).Elab_Desirable := False;
2012 Withs.Table (Withs.Last).Elab_All_Desirable := False;
2013 Withs.Table (Withs.Last).SAL_Interface := False;
2014 Withs.Table (Withs.Last).Limited_With := (C = 'Y
');
2015 Withs.Table (Withs.Last).Implicit_With_From_Instantiation
2018 -- Generic case with no object file available
2021 Withs.Table (Withs.Last).Sfile := No_File;
2022 Withs.Table (Withs.Last).Afile := No_File;
2027 Withs.Table (Withs.Last).Sfile := Get_File_Name
2029 Withs.Table (Withs.Last).Afile := Get_File_Name
2032 -- Scan out possible E, EA, ED, and AD parameters
2034 while not At_Eol loop
2040 Check_At_End_Of_Field;
2042 -- Store AD indication unless ignore required
2044 if not Ignore_ED then
2045 Withs.Table (Withs.Last).Elab_All_Desirable :=
2049 elsif Nextc = 'E
' then
2052 if At_End_Of_Field then
2053 Withs.Table (Withs.Last).Elaborate := True;
2055 elsif Nextc = 'A
' then
2057 Check_At_End_Of_Field;
2058 Withs.Table (Withs.Last).Elaborate_All := True;
2062 Check_At_End_Of_Field;
2064 -- Store ED indication unless ignore required
2066 if not Ignore_ED then
2067 Withs.Table (Withs.Last).Elab_Desirable :=
2084 Units.Table (Units.Last).Last_With := Withs.Last;
2085 Units.Table (Units.Last).Last_Arg := Args.Last;
2087 -- If there are linker options lines present, scan them
2091 Linker_Options_Loop : loop
2093 exit Linker_Options_Loop when C /= 'L
';
2095 if Ignore ('L
') then
2106 if C < Character'Val (16#20#)
2107 or else C > Character'Val (16#7E#)
2112 C := Character'Val (0);
2119 for J in 1 .. 2 loop
2122 if C in '0' .. '9' then
2125 Character'Pos ('0');
2127 elsif C in 'A' .. 'F' then
2130 Character'Pos ('A') +
2139 Add_Char_To_Name_Buffer (Character'Val (V));
2144 exit when Nextc /= '"';
2148 Add_Char_To_Name_Buffer (C);
2152 Add_Char_To_Name_Buffer (NUL);
2157 end loop Linker_Options_Loop;
2159 -- Store the linker options entry if one was found
2161 if Name_Len /= 0 then
2162 Linker_Options.Increment_Last;
2164 Linker_Options.Table (Linker_Options.Last).Name :=
2167 Linker_Options.Table (Linker_Options.Last).Unit :=
2170 Linker_Options.Table (Linker_Options.Last).Internal_File :=
2171 Is_Internal_File_Name (F);
2173 Linker_Options.Table (Linker_Options.Last).Original_Pos :=
2174 Linker_Options.Last;
2177 -- If there are notes present, scan them
2181 exit Notes_Loop when C /= 'N';
2183 if Ignore ('N') then
2189 Notes.Increment_Last;
2190 Notes.Table (Notes.Last).Pragma_Type := Getc;
2191 Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
2193 Notes.Table (Notes.Last).Pragma_Col := Get_Nat;
2195 if not At_Eol and then Nextc = ':' then
2197 Notes.Table (Notes.Last).Pragma_Source_File :=
2198 Get_File_Name (Lower => True);
2200 Notes.Table (Notes.Last).Pragma_Source_File :=
2201 Units.Table (Units.Last).Sfile;
2205 Notes.Table (Notes.Last).Pragma_Args := No_Name;
2208 -- Note: can't use Get_Name here as the remainder of the
2209 -- line is unstructured text whose syntax depends on the
2210 -- particular pragma used.
2215 while not At_Eol loop
2216 Add_Char_To_Name_Buffer (Getc);
2224 end loop Notes_Loop;
2227 -- End loop through units for one ALI file
2229 ALIs.Table (Id).Last_Unit := Units.Last;
2230 ALIs.Table (Id).Sfile := Units.Table (ALIs.Table (Id).First_Unit).Sfile;
2232 -- Set types of the units (there can be at most 2 of them)
2234 if ALIs.Table (Id).First_Unit /= ALIs.Table (Id).Last_Unit then
2235 Units.Table (ALIs.Table (Id).First_Unit).Utype := Is_Body;
2236 Units.Table (ALIs.Table (Id).Last_Unit).Utype := Is_Spec;
2239 -- Deal with body only and spec only cases, note that the reason we
2240 -- do our own checking of the name (rather than using Is_Body_Name)
2241 -- is that Uname drags in far too much compiler junk.
2243 Get_Name_String (Units.Table (Units.Last).Uname);
2245 if Name_Buffer (Name_Len) = 'b' then
2246 Units.Table (Units.Last).Utype := Is_Body_Only;
2248 Units.Table (Units.Last).Utype := Is_Spec_Only;
2252 -- Scan out external version references and put in hash table
2256 exit E_Loop when C /= 'E';
2258 if Ignore ('E') then
2274 exit when At_End_Of_Field;
2275 Add_Char_To_Name_Buffer (C);
2278 Version_Ref.Set (new String'(Name_Buffer (1 .. Name_Len)), True);
2285 -- Scan out source dependency lines for this ALI file
2287 ALIs.Table (Id).First_Sdep := Sdep.Last + 1;
2291 exit D_Loop when C /= 'D';
2293 if Ignore ('D') then
2299 Sdep.Increment_Last;
2301 -- In the following call, Lower is not set to True, this is either
2302 -- a bug, or it deserves a special comment as to why this is so???
2304 -- The file/path name may be quoted
2306 Sdep.Table (Sdep.Last).Sfile :=
2307 Get_File_Name (May_Be_Quoted => True);
2309 Sdep.Table (Sdep.Last).Stamp := Get_Stamp;
2310 Sdep.Table (Sdep.Last).Dummy_Entry :=
2311 (Sdep.Table (Sdep.Last).Stamp = Dummy_Time_Stamp);
2313 -- Acquire checksum value
2326 exit when At_Eol or else Ctr = 8;
2328 if Nextc in '0' .. '9' then
2330 Character'Pos (Nextc) - Character'Pos ('0');
2332 elsif Nextc in 'a' .. 'f' then
2334 Character'Pos (Nextc) - Character'Pos ('a') + 10;
2344 if Ctr = 8 and then At_End_Of_Field then
2345 Sdep.Table (Sdep.Last).Checksum := Chk;
2351 -- Acquire (sub)unit and reference file name entries
2353 Sdep.Table (Sdep.Last).Subunit_Name := No_Name;
2354 Sdep.Table (Sdep.Last).Unit_Name := No_Name;
2355 Sdep.Table (Sdep.Last).Rfile :=
2356 Sdep.Table (Sdep.Last).Sfile;
2357 Sdep.Table (Sdep.Last).Start_Line := 1;
2362 -- Here for (sub)unit name
2364 if Nextc not in '0' .. '9' then
2366 while not At_End_Of_Field loop
2367 Add_Char_To_Name_Buffer (Getc);
2370 -- Set the (sub)unit name. Note that we use Name_Find rather
2371 -- than Name_Enter here as the subunit name may already
2372 -- have been put in the name table by the Project Manager.
2375 or else Name_Buffer (Name_Len - 1) /= '%'
2377 Sdep.Table (Sdep.Last).Subunit_Name := Name_Find;
2379 Name_Len := Name_Len - 2;
2380 Sdep.Table (Sdep.Last).Unit_Name := Name_Find;
2386 -- Here for reference file name entry
2388 if Nextc in '0' .. '9' then
2389 Sdep.Table (Sdep.Last).Start_Line := Get_Nat;
2394 while not At_End_Of_Field loop
2395 Add_Char_To_Name_Buffer (Getc);
2398 Sdep.Table (Sdep.Last).Rfile := Name_Enter;
2408 ALIs.Table (Id).Last_Sdep := Sdep.Last;
2410 -- We must at this stage be at an Xref line or the end of file
2422 -- If we are ignoring Xref sections we are done (we ignore all
2423 -- remaining lines since only xref related lines follow X).
2425 if Ignore ('X') and then not Debug_Flag_X then
2429 -- Loop through Xref sections
2433 exit X_Loop when C /= 'X';
2435 -- Make new entry in section table
2437 Xref_Section.Increment_Last;
2439 Read_Refs_For_One_File : declare
2440 XS : Xref_Section_Record renames
2441 Xref_Section.Table (Xref_Section.Last);
2443 Current_File_Num : Sdep_Id;
2444 -- Keeps track of the current file number (changed by nn|)
2447 XS.File_Num := Sdep_Id (Get_Nat + Nat (First_Sdep_Entry) - 1);
2448 XS.File_Name := Get_File_Name;
2449 XS.First_Entity := Xref_Entity.Last + 1;
2451 Current_File_Num := XS.File_Num;
2458 -- Loop through Xref entities
2460 while C /= 'X' and then C /= EOF loop
2461 Xref_Entity.Increment_Last;
2463 Read_Refs_For_One_Entity : declare
2464 XE : Xref_Entity_Record renames
2465 Xref_Entity.Table (Xref_Entity.Last);
2468 procedure Read_Instantiation_Reference;
2469 -- Acquire instantiation reference. Caller has checked
2470 -- that current character is '[' and on return the cursor
2471 -- is skipped past the corresponding closing ']'.
2473 ----------------------------------
2474 -- Read_Instantiation_Reference --
2475 ----------------------------------
2477 procedure Read_Instantiation_Reference is
2478 Local_File_Num : Sdep_Id := Current_File_Num;
2481 Xref.Increment_Last;
2484 XR : Xref_Record renames Xref.Table (Xref.Last);
2487 P := P + 1; -- skip [
2492 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2493 Local_File_Num := XR.File_Num;
2498 XR.File_Num := Local_File_Num;
2505 -- Recursive call for next reference
2508 pragma Warnings (Off); -- kill recursion warning
2509 Read_Instantiation_Reference;
2510 pragma Warnings (On);
2513 -- Skip closing bracket after recursive call
2517 end Read_Instantiation_Reference;
2519 -- Start of processing for Read_Refs_For_One_Entity
2528 XE.Visibility := Global;
2530 XE.Visibility := Static;
2532 XE.Visibility := Other;
2535 XE.Entity := Get_Name;
2537 -- Handle the information about generic instantiations
2540 Skipc; -- Opening '['
2543 if Nextc /= '|' then
2544 XE.Iref_File_Num := Current_File_Num;
2548 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2550 XE.Iref_Line := Get_Nat;
2558 XE.Iref_File_Num := No_Sdep_Id;
2562 Current_File_Num := XS.File_Num;
2564 -- Renaming reference is present
2568 XE.Rref_Line := Get_Nat;
2574 XE.Rref_Col := Get_Nat;
2576 -- No renaming reference present
2585 XE.Oref_File_Num := No_Sdep_Id;
2586 XE.Tref_File_Num := No_Sdep_Id;
2587 XE.Tref := Tref_None;
2588 XE.First_Xref := Xref.Last + 1;
2590 -- Loop to check for additional info present
2603 (Current_File_Num, Ref, File, Line, Typ, Col, Std);
2604 exit when Ref = Tref_None;
2606 -- Do we have an overriding procedure?
2608 if Ref = Tref_Derived and then Typ = 'p' then
2609 XE.Oref_File_Num := File;
2610 XE.Oref_Line := Line;
2613 -- Arrays never override anything, and <> points to
2614 -- the index types instead
2616 elsif Ref = Tref_Derived and then XE.Etype = 'A' then
2618 -- Index types are stored in the list of references
2620 Xref.Increment_Last;
2623 XR : Xref_Record renames Xref.Table (Xref.Last);
2625 XR.File_Num := File;
2627 XR.Rtype := Array_Index_Reference;
2632 -- Interfaces are stored in the list of references,
2633 -- although the parent type itself is stored in XE.
2634 -- The first interface (when there are only
2635 -- interfaces) is stored in XE.Tref*)
2637 elsif Ref = Tref_Derived
2639 and then XE.Tref_File_Num /= No_Sdep_Id
2641 Xref.Increment_Last;
2644 XR : Xref_Record renames Xref.Table (Xref.Last);
2646 XR.File_Num := File;
2648 XR.Rtype := Interface_Reference;
2655 XE.Tref_File_Num := File;
2656 XE.Tref_Line := Line;
2657 XE.Tref_Type := Typ;
2659 XE.Tref_Standard_Entity := Std;
2664 -- Loop through cross-references for this entity
2671 exit when Nextc /= '.';
2675 Xref.Increment_Last;
2678 XR : Xref_Record renames Xref.Table (Xref.Last);
2685 Sdep_Id (N + Nat (First_Sdep_Entry) - 1);
2686 Current_File_Num := XR.File_Num;
2690 XR.File_Num := Current_File_Num;
2696 -- Imported entities reference as in:
2697 -- 494b<c,__gnat_copy_attribs>25
2701 XR.Imported_Lang := Get_Name;
2703 pragma Assert (Nextc = ',');
2706 XR.Imported_Name := Get_Name;
2708 pragma Assert (Nextc = '>');
2712 XR.Imported_Lang := No_Name;
2713 XR.Imported_Name := No_Name;
2719 Read_Instantiation_Reference;
2724 -- Record last cross-reference
2726 XE.Last_Xref := Xref.Last;
2730 when Bad_ALI_Format =>
2732 -- If ignoring errors, then we skip a line with an
2733 -- unexpected error, and try to continue subsequent
2736 if Ignore_Errors then
2737 Xref_Entity.Decrement_Last;
2741 -- Otherwise, we reraise the fatal exception
2746 end Read_Refs_For_One_Entity;
2749 -- Record last entity
2751 XS.Last_Entity := Xref_Entity.Last;
2753 end Read_Refs_For_One_File;
2758 -- Here after dealing with xref sections
2760 -- Ignore remaining lines, which belong to an additional section of the
2761 -- ALI file not considered here (like SCO or SPARK information).
2768 when Bad_ALI_Format =>
2776 function SEq (F1, F2 : String_Ptr) return Boolean is
2778 return F1.all = F2.all;
2785 function SHash (S : String_Ptr) return Vindex is
2790 for J in S.all'Range loop
2791 H := H * 2 + Character'Pos (S (J));
2794 return Vindex (Vindex'First + Vindex (H mod Vindex'Range_Length));