Fix typos in riscv register save/restore.
[official-gcc.git] / gcc / ada / lib-writ.adb
blob1ee329ee7f1a890e3d1b562d87a0ec6ebb80f77c
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B . W R I T --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
10 -- --
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. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 with ALI; use ALI;
27 with Atree; use Atree;
28 with Casing; use Casing;
29 with Debug; use Debug;
30 with Einfo; use Einfo;
31 with Errout; use Errout;
32 with Fname; use Fname;
33 with Fname.UF; use Fname.UF;
34 with Lib.Util; use Lib.Util;
35 with Lib.Xref; use Lib.Xref;
36 with Nlists; use Nlists;
37 with Gnatvsn; use Gnatvsn;
38 with Opt; use Opt;
39 with Osint; use Osint;
40 with Osint.C; use Osint.C;
41 with Output; use Output;
42 with Par;
43 with Par_SCO; use Par_SCO;
44 with Restrict; use Restrict;
45 with Rident; use Rident;
46 with Stand; use Stand;
47 with Scn; use Scn;
48 with Sem_Eval; use Sem_Eval;
49 with Sinfo; use Sinfo;
50 with Sinput; use Sinput;
51 with Snames; use Snames;
52 with Stringt; use Stringt;
53 with Tbuild; use Tbuild;
54 with Uname; use Uname;
56 with System.Case_Util; use System.Case_Util;
57 with System.WCh_Con; use System.WCh_Con;
59 package body Lib.Writ is
61 -----------------------
62 -- Local Subprograms --
63 -----------------------
65 procedure Write_Unit_Name (N : Node_Id);
66 -- Used to write out the unit name for R (pragma Restriction) lines
67 -- for uses of Restriction (No_Dependence => unit-name).
69 ----------------------------------
70 -- Add_Preprocessing_Dependency --
71 ----------------------------------
73 procedure Add_Preprocessing_Dependency (S : Source_File_Index) is
74 begin
75 Units.Increment_Last;
76 Units.Table (Units.Last) :=
77 (Unit_File_Name => File_Name (S),
78 Unit_Name => No_Unit_Name,
79 Expected_Unit => No_Unit_Name,
80 Source_Index => S,
81 Cunit => Empty,
82 Cunit_Entity => Empty,
83 Dependency_Num => 0,
84 Dynamic_Elab => False,
85 Fatal_Error => None,
86 Generate_Code => False,
87 Has_RACW => False,
88 Filler => False,
89 Ident_String => Empty,
90 Is_Predefined_Renaming => False,
91 Is_Internal_Unit => False,
92 Is_Predefined_Unit => False,
93 Filler2 => False,
94 Loading => False,
95 Main_Priority => -1,
96 Main_CPU => -1,
97 Munit_Index => 0,
98 No_Elab_Code_All => False,
99 Primary_Stack_Count => 0,
100 Sec_Stack_Count => 0,
101 Serial_Number => 0,
102 Version => 0,
103 Error_Location => No_Location,
104 OA_Setting => 'O');
105 end Add_Preprocessing_Dependency;
107 ------------------------------
108 -- Ensure_System_Dependency --
109 ------------------------------
111 procedure Ensure_System_Dependency is
112 System_Uname : Unit_Name_Type;
113 -- Unit name for system spec if needed for dummy entry
115 System_Fname : File_Name_Type;
116 -- File name for system spec if needed for dummy entry
118 begin
119 -- Nothing to do if we already compiled System
121 for Unum in Units.First .. Last_Unit loop
122 if Units.Table (Unum).Source_Index = System_Source_File_Index then
123 return;
124 end if;
125 end loop;
127 -- If no entry for system.ads in the units table, then add a entry
128 -- to the units table for system.ads, which will be referenced when
129 -- the ali file is generated. We need this because every unit depends
130 -- on system as a result of Targparm scanning the system.ads file to
131 -- determine the target dependent parameters for the compilation.
133 Name_Len := 6;
134 Name_Buffer (1 .. 6) := "system";
135 System_Uname := Name_To_Unit_Name (Name_Enter);
136 System_Fname := File_Name (System_Source_File_Index);
138 Units.Increment_Last;
139 Units.Table (Units.Last) :=
140 (Unit_File_Name => System_Fname,
141 Unit_Name => System_Uname,
142 Expected_Unit => System_Uname,
143 Source_Index => System_Source_File_Index,
144 Cunit => Empty,
145 Cunit_Entity => Empty,
146 Dependency_Num => 0,
147 Dynamic_Elab => False,
148 Fatal_Error => None,
149 Generate_Code => False,
150 Has_RACW => False,
151 Filler => False,
152 Ident_String => Empty,
153 Is_Predefined_Renaming => False,
154 Is_Internal_Unit => True,
155 Is_Predefined_Unit => True,
156 Filler2 => False,
157 Loading => False,
158 Main_Priority => -1,
159 Main_CPU => -1,
160 Munit_Index => 0,
161 No_Elab_Code_All => False,
162 Primary_Stack_Count => 0,
163 Sec_Stack_Count => 0,
164 Serial_Number => 0,
165 Version => 0,
166 Error_Location => No_Location,
167 OA_Setting => 'O');
169 -- Parse system.ads so that the checksum is set right. Style checks are
170 -- not applied. The Ekind is set to ensure that this reference is always
171 -- present in the ali file.
173 declare
174 Save_Mindex : constant Nat := Multiple_Unit_Index;
175 Save_Style : constant Boolean := Style_Check;
176 begin
177 Multiple_Unit_Index := 0;
178 Style_Check := False;
179 Initialize_Scanner (Units.Last, System_Source_File_Index);
180 Discard_List (Par (Configuration_Pragmas => False));
181 Set_Ekind (Cunit_Entity (Units.Last), E_Package);
182 Set_Scope (Cunit_Entity (Units.Last), Standard_Standard);
183 Style_Check := Save_Style;
184 Multiple_Unit_Index := Save_Mindex;
185 end;
186 end Ensure_System_Dependency;
188 ---------------
189 -- Write_ALI --
190 ---------------
192 procedure Write_ALI (Object : Boolean) is
194 ----------------
195 -- Local Data --
196 ----------------
198 Last_Unit : constant Unit_Number_Type := Units.Last;
199 -- Record unit number of last unit. We capture this in case we
200 -- have to add a dummy entry to the unit table for package System.
202 With_Flags : array (Units.First .. Last_Unit) of Boolean;
203 -- Array of flags to show which units are with'ed
205 Elab_Flags : array (Units.First .. Last_Unit) of Boolean;
206 -- Array of flags to show which units have pragma Elaborate set
208 Elab_All_Flags : array (Units.First .. Last_Unit) of Boolean;
209 -- Array of flags to show which units have pragma Elaborate All set
211 Elab_Des_Flags : array (Units.First .. Last_Unit) of Boolean;
212 -- Array of flags to show which units have Elaborate_Desirable set
214 Elab_All_Des_Flags : array (Units.First .. Last_Unit) of Boolean;
215 -- Array of flags to show which units have Elaborate_All_Desirable set
217 type Yes_No is (Unknown, Yes, No);
218 Implicit_With : array (Units.First .. Last_Unit) of Yes_No;
219 -- Indicates if an implicit with has been given for the unit. Yes if
220 -- certainly present, no if certainly absent, unkonwn if not known.
222 Sdep_Table : Unit_Ref_Table (1 .. Pos (Last_Unit - Units.First + 2));
223 -- Sorted table of source dependencies. One extra entry in case we
224 -- have to add a dummy entry for System.
226 Num_Sdep : Nat := 0;
227 -- Number of active entries in Sdep_Table
229 flag_compare_debug : Int;
230 pragma Import (C, flag_compare_debug);
231 -- Import from toplev.c
233 -----------------------
234 -- Local Subprograms --
235 -----------------------
237 procedure Collect_Withs (Cunit : Node_Id);
238 -- Collect with lines for entries in the context clause of the
239 -- given compilation unit, Cunit.
241 procedure Update_Tables_From_ALI_File;
242 -- Given an up to date ALI file (see Up_To_Date_ALI_file_Exists
243 -- function), update tables from the ALI information, including
244 -- specifically the Compilation_Switches table.
246 function Up_To_Date_ALI_File_Exists return Boolean;
247 -- If there exists an ALI file that is up to date, then this function
248 -- initializes the tables in the ALI spec to contain information on
249 -- this file (using Scan_ALI) and returns True. If no file exists,
250 -- or the file is not up to date, then False is returned.
252 procedure Write_Unit_Information (Unit_Num : Unit_Number_Type);
253 -- Write out the library information for one unit for which code is
254 -- generated (includes unit line and with lines).
256 procedure Write_With_Lines;
257 -- Write out with lines collected by calls to Collect_Withs
259 -------------------
260 -- Collect_Withs --
261 -------------------
263 procedure Collect_Withs (Cunit : Node_Id) is
264 Item : Node_Id;
265 Unum : Unit_Number_Type;
267 begin
268 Item := First (Context_Items (Cunit));
269 while Present (Item) loop
271 -- Process with clause
273 -- Ada 2005 (AI-50217): limited with_clauses do not create
274 -- dependencies, but must be recorded as components of the
275 -- partition, in case there is no regular with_clause for
276 -- the unit anywhere else.
278 if Nkind (Item) = N_With_Clause then
279 Unum := Get_Cunit_Unit_Number (Library_Unit (Item));
280 With_Flags (Unum) := True;
282 if not Limited_Present (Item) then
283 if Elaborate_Present (Item) then
284 Elab_Flags (Unum) := True;
285 end if;
287 if Elaborate_All_Present (Item) then
288 Elab_All_Flags (Unum) := True;
289 end if;
291 if Elaborate_All_Desirable (Item) then
292 Elab_All_Des_Flags (Unum) := True;
293 end if;
295 if Elaborate_Desirable (Item) then
296 Elab_Des_Flags (Unum) := True;
297 end if;
299 else
300 Set_From_Limited_With (Cunit_Entity (Unum));
301 end if;
303 if Implicit_With (Unum) /= Yes then
304 if Implicit_With_From_Instantiation (Item) then
305 Implicit_With (Unum) := Yes;
306 else
307 Implicit_With (Unum) := No;
308 end if;
309 end if;
310 end if;
312 Next (Item);
313 end loop;
314 end Collect_Withs;
316 --------------------------------
317 -- Up_To_Date_ALI_File_Exists --
318 --------------------------------
320 function Up_To_Date_ALI_File_Exists return Boolean is
321 Name : File_Name_Type;
322 Text : Text_Buffer_Ptr;
323 Id : Sdep_Id;
324 Sind : Source_File_Index;
326 begin
327 Opt.Check_Object_Consistency := True;
328 Read_Library_Info (Name, Text);
330 -- Return if we could not find an ALI file
332 if Text = null then
333 return False;
334 end if;
336 -- Return if ALI file has bad format
338 Initialize_ALI;
340 if Scan_ALI (Name, Text, False, Err => True) = No_ALI_Id then
341 return False;
342 end if;
344 -- If we have an OK ALI file, check if it is up to date
345 -- Note that we assume that the ALI read has all the entries
346 -- we have in our table, plus some additional ones (that can
347 -- come from expansion).
349 Id := First_Sdep_Entry;
350 for J in 1 .. Num_Sdep loop
351 Sind := Units.Table (Sdep_Table (J)).Source_Index;
353 while Sdep.Table (Id).Sfile /= File_Name (Sind) loop
354 if Id = Sdep.Last then
355 return False;
356 else
357 Id := Id + 1;
358 end if;
359 end loop;
361 if Sdep.Table (Id).Stamp /= Time_Stamp (Sind) then
362 return False;
363 end if;
364 end loop;
366 return True;
367 end Up_To_Date_ALI_File_Exists;
369 ---------------------------------
370 -- Update_Tables_From_ALI_File --
371 ---------------------------------
373 procedure Update_Tables_From_ALI_File is
374 begin
375 -- Build Compilation_Switches table
377 Compilation_Switches.Init;
379 for J in First_Arg_Entry .. Args.Last loop
380 Compilation_Switches.Increment_Last;
381 Compilation_Switches.Table (Compilation_Switches.Last) :=
382 Args.Table (J);
383 end loop;
384 end Update_Tables_From_ALI_File;
386 ----------------------------
387 -- Write_Unit_Information --
388 ----------------------------
390 procedure Write_Unit_Information (Unit_Num : Unit_Number_Type) is
391 Unode : constant Node_Id := Cunit (Unit_Num);
392 Ukind : constant Node_Kind := Nkind (Unit (Unode));
393 Uent : constant Entity_Id := Cunit_Entity (Unit_Num);
394 Pnode : Node_Id;
396 begin
397 Write_Info_Initiate ('U');
398 Write_Info_Char (' ');
399 Write_Info_Name (Unit_Name (Unit_Num));
400 Write_Info_Tab (25);
401 Write_Info_Name (Unit_File_Name (Unit_Num));
403 Write_Info_Tab (49);
404 Write_Info_Str (Version_Get (Unit_Num));
406 -- Add BD parameter if Elaborate_Body pragma desirable
408 if Ekind (Uent) = E_Package
409 and then Elaborate_Body_Desirable (Uent)
410 then
411 Write_Info_Str (" BD");
412 end if;
414 -- Add BN parameter if body needed for SAL
416 if (Is_Subprogram (Uent)
417 or else Ekind (Uent) = E_Package
418 or else Is_Generic_Unit (Uent))
419 and then Body_Needed_For_SAL (Uent)
420 then
421 Write_Info_Str (" BN");
422 end if;
424 if Dynamic_Elab (Unit_Num) then
425 Write_Info_Str (" DE");
426 end if;
428 -- Set the Elaborate_Body indication if either an explicit pragma
429 -- was present, or if this is an instantiation.
431 if Has_Pragma_Elaborate_Body (Uent)
432 or else (Ukind = N_Package_Declaration
433 and then Is_Generic_Instance (Uent)
434 and then Present (Corresponding_Body (Unit (Unode))))
435 then
436 Write_Info_Str (" EB");
437 end if;
439 -- Now see if we should tell the binder that an elaboration entity
440 -- is present, which must be set to true during elaboration.
441 -- We generate the indication if the following condition is met:
443 -- If this is a spec ...
445 if (Is_Subprogram (Uent)
446 or else Ekind (Uent) = E_Package
447 or else Is_Generic_Unit (Uent))
449 -- and an elaboration entity was declared ...
451 and then Present (Elaboration_Entity (Uent))
453 -- and either the elaboration flag is required ...
455 and then (Elaboration_Entity_Required (Uent)
457 -- or this unit has elaboration code ...
459 or else not Has_No_Elaboration_Code (Unode)
461 -- or this unit has a separate body and this
462 -- body has elaboration code.
464 or else
465 (Ekind (Uent) = E_Package
466 and then Present (Body_Entity (Uent))
467 and then
468 not Has_No_Elaboration_Code
469 (Parent (Declaration_Node (Body_Entity (Uent))))))
470 then
471 Write_Info_Str (" EE");
472 end if;
474 if Has_No_Elaboration_Code (Unode) then
475 Write_Info_Str (" NE");
476 end if;
478 Write_Info_Str (" O");
479 Write_Info_Char (OA_Setting (Unit_Num));
481 if Ekind_In (Uent, E_Package, E_Package_Body)
482 and then Present (Finalizer (Uent))
483 then
484 Write_Info_Str (" PF");
485 end if;
487 if Is_Preelaborated (Uent) then
488 Write_Info_Str (" PR");
489 end if;
491 if Is_Pure (Uent) then
492 Write_Info_Str (" PU");
493 end if;
495 if Has_RACW (Unit_Num) then
496 Write_Info_Str (" RA");
497 end if;
499 if Is_Remote_Call_Interface (Uent) then
500 Write_Info_Str (" RC");
501 end if;
503 if Is_Remote_Types (Uent) then
504 Write_Info_Str (" RT");
505 end if;
507 if Serious_Errors_Detected /= 0 then
508 Write_Info_Str (" SE");
509 end if;
511 if Is_Shared_Passive (Uent) then
512 Write_Info_Str (" SP");
513 end if;
515 if Ukind = N_Subprogram_Declaration
516 or else Ukind = N_Subprogram_Body
517 then
518 Write_Info_Str (" SU");
520 elsif Ukind = N_Package_Declaration
521 or else
522 Ukind = N_Package_Body
523 then
524 -- If this is a wrapper package for a subprogram instantiation,
525 -- the user view is the subprogram. Note that in this case the
526 -- ali file contains both the spec and body of the instance.
528 if Is_Wrapper_Package (Uent) then
529 Write_Info_Str (" SU");
530 else
531 Write_Info_Str (" PK");
532 end if;
534 elsif Ukind = N_Generic_Package_Declaration then
535 Write_Info_Str (" PK");
537 end if;
539 if Ukind in N_Generic_Declaration
540 or else
541 (Present (Library_Unit (Unode))
542 and then
543 Nkind (Unit (Library_Unit (Unode))) in N_Generic_Declaration)
544 then
545 Write_Info_Str (" GE");
546 end if;
548 if not Is_Internal_Unit (Unit_Num) then
549 case Identifier_Casing (Source_Index (Unit_Num)) is
550 when All_Lower_Case => Write_Info_Str (" IL");
551 when All_Upper_Case => Write_Info_Str (" IU");
552 when others => null;
553 end case;
555 case Keyword_Casing (Source_Index (Unit_Num)) is
556 when Mixed_Case => Write_Info_Str (" KM");
557 when All_Upper_Case => Write_Info_Str (" KU");
558 when others => null;
559 end case;
560 end if;
562 if Initialize_Scalars or else Invalid_Value_Used then
563 Write_Info_Str (" IS");
564 end if;
566 Write_Info_EOL;
568 -- Generate with lines, first those that are directly with'ed
570 for J in With_Flags'Range loop
571 With_Flags (J) := False;
572 Elab_Flags (J) := False;
573 Elab_All_Flags (J) := False;
574 Elab_Des_Flags (J) := False;
575 Elab_All_Des_Flags (J) := False;
576 Implicit_With (J) := Unknown;
577 end loop;
579 Collect_Withs (Unode);
581 -- For a body, we must also check for any subunits which belong to
582 -- it and which have context clauses of their own, since these
583 -- with'ed units are part of its own elaboration dependencies.
585 if Nkind (Unit (Unode)) in N_Unit_Body then
586 for S in Units.First .. Last_Unit loop
588 -- We are only interested in subunits. For preproc. data and
589 -- def. files, Cunit is Empty, so we need to test that first.
591 if Cunit (S) /= Empty
592 and then Nkind (Unit (Cunit (S))) = N_Subunit
593 then
594 Pnode := Library_Unit (Cunit (S));
596 -- In gnatc mode, the errors in the subunits will not have
597 -- been recorded, but the analysis of the subunit may have
598 -- failed. There is no information to add to ALI file in
599 -- this case.
601 if No (Pnode) then
602 exit;
603 end if;
605 -- Find ultimate parent of the subunit
607 while Nkind (Unit (Pnode)) = N_Subunit loop
608 Pnode := Library_Unit (Pnode);
609 end loop;
611 -- See if it belongs to current unit, and if so, include
612 -- its with_clauses.
614 if Pnode = Unode then
615 Collect_Withs (Cunit (S));
616 end if;
617 end if;
618 end loop;
619 end if;
621 Write_With_Lines;
623 -- Generate task stack lines
625 if Primary_Stack_Count (Unit_Num) > 0
626 or else Sec_Stack_Count (Unit_Num) > 0
627 then
628 Write_Info_Initiate ('T');
629 Write_Info_Char (' ');
630 Write_Info_Int (Primary_Stack_Count (Unit_Num));
631 Write_Info_Char (' ');
632 Write_Info_Int (Sec_Stack_Count (Unit_Num));
633 Write_Info_EOL;
634 end if;
636 -- Generate the linker option lines
638 for J in 1 .. Linker_Option_Lines.Last loop
640 -- Pragma Linker_Options is not allowed in predefined generic
641 -- units. This is because they won't be read, due to the fact that
642 -- with lines for generic units lack the file name and lib name
643 -- parameters (see Lib_Writ spec for an explanation).
645 if Is_Generic_Unit (Cunit_Entity (Main_Unit))
646 and then Is_Predefined_Unit (Current_Sem_Unit)
647 and then Linker_Option_Lines.Table (J).Unit = Unit_Num
648 then
649 Set_Standard_Error;
650 Write_Line
651 ("linker options not allowed in predefined generic unit");
652 raise Unrecoverable_Error;
653 end if;
655 -- Output one linker option line
657 declare
658 S : Linker_Option_Entry renames Linker_Option_Lines.Table (J);
659 begin
660 if S.Unit = Unit_Num then
661 Write_Info_Initiate ('L');
662 Write_Info_Char (' ');
663 Write_Info_Slit (S.Option);
664 Write_Info_EOL;
665 end if;
666 end;
667 end loop;
669 -- Output notes
671 for J in 1 .. Notes.Last loop
672 declare
673 N : constant Node_Id := Notes.Table (J);
674 L : constant Source_Ptr := Sloc (N);
675 U : constant Unit_Number_Type :=
676 Unit (Get_Source_File_Index (L));
677 C : Character;
679 Note_Unit : Unit_Number_Type;
680 -- The unit in whose U section this note must be emitted:
681 -- notes for subunits are emitted along with the main unit;
682 -- all other notes are emitted as part of the enclosing
683 -- compilation unit.
685 begin
686 if U /= No_Unit and then Nkind (Unit (Cunit (U))) = N_Subunit
687 then
688 Note_Unit := Main_Unit;
689 else
690 Note_Unit := U;
691 end if;
693 if Note_Unit = Unit_Num then
694 Write_Info_Initiate ('N');
695 Write_Info_Char (' ');
697 case Pragma_Name (N) is
698 when Name_Annotate =>
699 C := 'A';
700 when Name_Comment =>
701 C := 'C';
702 when Name_Ident =>
703 C := 'I';
704 when Name_Title =>
705 C := 'T';
706 when Name_Subtitle =>
707 C := 'S';
708 when others =>
709 raise Program_Error;
710 end case;
712 Write_Info_Char (C);
713 Write_Info_Int (Int (Get_Logical_Line_Number (L)));
714 Write_Info_Char (':');
715 Write_Info_Int (Int (Get_Column_Number (L)));
717 -- Indicate source file of annotation if different from
718 -- compilation unit source file (case of annotation coming
719 -- from a separate).
721 if Get_Source_File_Index (L) /= Source_Index (Unit_Num) then
722 Write_Info_Char (':');
723 Write_Info_Name (File_Name (Get_Source_File_Index (L)));
724 end if;
726 declare
727 A : Node_Id;
729 begin
730 A := First (Pragma_Argument_Associations (N));
731 while Present (A) loop
732 Write_Info_Char (' ');
734 if Chars (A) /= No_Name then
735 Write_Info_Name (Chars (A));
736 Write_Info_Char (':');
737 end if;
739 declare
740 Expr : constant Node_Id := Expression (A);
742 begin
743 if Nkind (Expr) = N_Identifier then
744 Write_Info_Name (Chars (Expr));
746 elsif Nkind (Expr) = N_Integer_Literal
747 and then Is_OK_Static_Expression (Expr)
748 then
749 Write_Info_Uint (Intval (Expr));
751 elsif Nkind (Expr) = N_String_Literal
752 and then Is_OK_Static_Expression (Expr)
753 then
754 Write_Info_Slit (Strval (Expr));
756 else
757 Write_Info_Str ("<expr>");
758 end if;
759 end;
761 Next (A);
762 end loop;
763 end;
765 Write_Info_EOL;
766 end if;
767 end;
768 end loop;
769 end Write_Unit_Information;
771 ----------------------
772 -- Write_With_Lines --
773 ----------------------
775 procedure Write_With_Lines is
776 Pname : constant Unit_Name_Type :=
777 Get_Parent_Spec_Name (Unit_Name (Main_Unit));
778 Body_Fname : File_Name_Type;
779 Body_Index : Nat;
780 Cunit : Node_Id;
781 Fname : File_Name_Type;
782 Num_Withs : Int := 0;
783 Unum : Unit_Number_Type;
784 Uname : Unit_Name_Type;
785 With_Table : Unit_Ref_Table (1 .. Pos (Last_Unit - Units.First + 1));
787 procedure Write_With_File_Names
788 (Nam : in out File_Name_Type;
789 Idx : Nat);
790 -- Write source file name Nam and ALI file name for unit index Idx.
791 -- Possibly change Nam to lowercase (generating a new file name).
793 --------------------------
794 -- Write_With_File_Name --
795 --------------------------
797 procedure Write_With_File_Names
798 (Nam : in out File_Name_Type;
799 Idx : Nat)
801 begin
802 if not File_Names_Case_Sensitive then
803 Get_Name_String (Nam);
804 To_Lower (Name_Buffer (1 .. Name_Len));
805 Nam := Name_Find;
806 end if;
808 Write_Info_Name (Nam);
809 Write_Info_Tab (49);
810 Write_Info_Name (Lib_File_Name (Nam, Idx));
811 end Write_With_File_Names;
813 -- Start of processing for Write_With_Lines
815 begin
816 -- Loop to build the with table. A with on the main unit itself
817 -- is ignored (AARM 10.2(14a)). Such a with-clause can occur if
818 -- the main unit is a subprogram with no spec, and a subunit of
819 -- it unnecessarily withs the parent.
821 for J in Units.First + 1 .. Last_Unit loop
823 -- Add element to with table if it is with'ed or if it is the
824 -- parent spec of the main unit (case of main unit is a child
825 -- unit). The latter with is not needed for semantic purposes,
826 -- but is required by the binder for elaboration purposes. For
827 -- preprocessing data and definition files, there is no Unit_Name,
828 -- check for that first.
830 if Unit_Name (J) /= No_Unit_Name
831 and then (With_Flags (J) or else Unit_Name (J) = Pname)
832 then
833 Num_Withs := Num_Withs + 1;
834 With_Table (Num_Withs) := J;
835 end if;
836 end loop;
838 -- Sort and output the table
840 Sort (With_Table (1 .. Num_Withs));
842 for J in 1 .. Num_Withs loop
843 Unum := With_Table (J);
845 -- Do not generate a with line for an ignored Ghost unit because
846 -- the unit does not have an ALI file.
848 if Is_Ignored_Ghost_Entity (Cunit_Entity (Unum)) then
849 goto Next_With_Line;
850 end if;
852 Cunit := Units.Table (Unum).Cunit;
853 Uname := Units.Table (Unum).Unit_Name;
854 Fname := Units.Table (Unum).Unit_File_Name;
856 if Implicit_With (Unum) = Yes then
857 Write_Info_Initiate ('Z');
859 elsif Ekind (Cunit_Entity (Unum)) = E_Package
860 and then From_Limited_With (Cunit_Entity (Unum))
861 then
862 Write_Info_Initiate ('Y');
864 else
865 Write_Info_Initiate ('W');
866 end if;
868 Write_Info_Char (' ');
869 Write_Info_Name (Uname);
871 -- Now we need to figure out the names of the files that contain
872 -- the with'ed unit. These will usually be the files for the body,
873 -- except in the case of a package that has no body. Note that we
874 -- have a specific exemption here for predefined library generics
875 -- (see comments for Generic_May_Lack_ALI). We do not generate
876 -- dependency upon the ALI file for such units. Older compilers
877 -- used to not support generating code (and ALI) for generics, and
878 -- we want to avoid having different processing (namely, different
879 -- lists of files to be compiled) for different stages of the
880 -- bootstrap.
882 if not ((Nkind (Unit (Cunit)) in N_Generic_Declaration
883 or else
884 Nkind (Unit (Cunit)) in N_Generic_Renaming_Declaration)
885 and then Generic_May_Lack_ALI (Unum))
887 -- In SPARK mode, always generate the dependencies on ALI
888 -- files, which are required to compute frame conditions
889 -- of subprograms.
891 or else GNATprove_Mode
892 then
893 Write_Info_Tab (25);
895 if Is_Spec_Name (Uname) then
896 Body_Fname :=
897 Get_File_Name
898 (Get_Body_Name (Uname),
899 Subunit => False, May_Fail => True);
901 Body_Index :=
902 Get_Unit_Index
903 (Get_Body_Name (Uname));
905 if Body_Fname = No_File then
906 Body_Fname := Get_File_Name (Uname, Subunit => False);
907 Body_Index := Get_Unit_Index (Uname);
908 end if;
910 else
911 Body_Fname := Get_File_Name (Uname, Subunit => False);
912 Body_Index := Get_Unit_Index (Uname);
913 end if;
915 -- A package is considered to have a body if it requires
916 -- a body or if a body is present in Ada 83 mode.
918 if Body_Required (Cunit)
919 or else (Ada_Version = Ada_83
920 and then Full_Source_Name (Body_Fname) /= No_File)
921 then
922 Write_With_File_Names (Body_Fname, Body_Index);
923 else
924 Write_With_File_Names (Fname, Munit_Index (Unum));
925 end if;
927 if Ekind (Cunit_Entity (Unum)) = E_Package
928 and then From_Limited_With (Cunit_Entity (Unum))
929 then
930 null;
931 else
932 if Elab_Flags (Unum) then
933 Write_Info_Str (" E");
934 end if;
936 if Elab_All_Flags (Unum) then
937 Write_Info_Str (" EA");
938 end if;
940 if Elab_Des_Flags (Unum) then
941 Write_Info_Str (" ED");
942 end if;
944 if Elab_All_Des_Flags (Unum) then
945 Write_Info_Str (" AD");
946 end if;
947 end if;
948 end if;
950 Write_Info_EOL;
952 <<Next_With_Line>>
953 null;
954 end loop;
956 -- Finally generate the special lines for cases of Restriction_Set
957 -- with No_Dependence and no restriction present.
959 declare
960 Unam : Unit_Name_Type;
962 begin
963 for J in Restriction_Set_Dependences.First ..
964 Restriction_Set_Dependences.Last
965 loop
966 Unam := Restriction_Set_Dependences.Table (J);
968 -- Don't need an entry if already in the unit table
970 for U in 0 .. Last_Unit loop
971 if Unit_Name (U) = Unam then
972 goto Next_Restriction_Set;
973 end if;
974 end loop;
976 -- Otherwise generate the entry
978 Write_Info_Initiate ('W');
979 Write_Info_Char (' ');
980 Write_Info_Name (Unam);
981 Write_Info_EOL;
983 <<Next_Restriction_Set>>
984 null;
985 end loop;
986 end;
987 end Write_With_Lines;
989 -- Start of processing for Write_ALI
991 begin
992 -- We never write an ALI file if the original operating mode was
993 -- syntax-only (-gnats switch used in compiler invocation line)
995 if Original_Operating_Mode = Check_Syntax
996 or flag_compare_debug /= 0
997 then
998 return;
999 end if;
1001 -- Generation of ALI files may be disabled, e.g. for formal verification
1002 -- back-end.
1004 if Disable_ALI_File then
1005 return;
1006 end if;
1008 -- Build sorted source dependency table. We do this right away, because
1009 -- it is referenced by Up_To_Date_ALI_File_Exists.
1011 for Unum in Units.First .. Last_Unit loop
1012 if Cunit_Entity (Unum) = Empty
1013 or else not From_Limited_With (Cunit_Entity (Unum))
1014 then
1015 -- Units that are not analyzed need not appear in the dependency
1016 -- list. These units are either units appearing in limited_with
1017 -- clauses of other units, or units loaded for inlining that end
1018 -- up not inlined by a later decision of the inlining code, to
1019 -- prevent circularities. We want to exclude these files from the
1020 -- list of dependencies, so that the dependency number of other
1021 -- is correctly set, as that number is used by cross-reference
1022 -- tools to relate entity information to the unit in which they
1023 -- are declared.
1025 if Present (Cunit_Entity (Unum))
1026 and then Ekind (Cunit_Entity (Unum)) = E_Void
1027 and then Nkind (Unit (Cunit (Unum))) /= N_Subunit
1028 and then Serious_Errors_Detected = 0
1029 then
1030 null;
1032 else
1033 Num_Sdep := Num_Sdep + 1;
1034 Sdep_Table (Num_Sdep) := Unum;
1035 end if;
1036 end if;
1037 end loop;
1039 -- Sort the table so that the D lines are in order
1041 Lib.Sort (Sdep_Table (1 .. Num_Sdep));
1043 -- If we are not generating code, and there is an up to date ALI file
1044 -- file accessible, read it, and acquire the compilation arguments from
1045 -- this file. In GNATprove mode, always generate the ALI file, which
1046 -- contains a special section for formal verification.
1048 if Operating_Mode /= Generate_Code and then not GNATprove_Mode then
1049 if Up_To_Date_ALI_File_Exists then
1050 Update_Tables_From_ALI_File;
1051 return;
1052 end if;
1053 end if;
1055 -- Otherwise acquire compilation arguments and prepare to write out a
1056 -- new ali file.
1058 Create_Output_Library_Info;
1060 -- Output version line
1062 Write_Info_Initiate ('V');
1063 Write_Info_Str (" """);
1064 Write_Info_Str (Verbose_Library_Version);
1065 Write_Info_Char ('"');
1067 Write_Info_EOL;
1069 -- Output main program line if this is acceptable main program
1071 Output_Main_Program_Line : declare
1072 U : Node_Id := Unit (Units.Table (Main_Unit).Cunit);
1073 S : Node_Id;
1075 procedure M_Parameters;
1076 -- Output parameters for main program line
1078 ------------------
1079 -- M_Parameters --
1080 ------------------
1082 procedure M_Parameters is
1083 begin
1084 if Main_Priority (Main_Unit) /= Default_Main_Priority then
1085 Write_Info_Char (' ');
1086 Write_Info_Nat (Main_Priority (Main_Unit));
1087 end if;
1089 if Opt.Time_Slice_Set then
1090 Write_Info_Str (" T=");
1091 Write_Info_Nat (Opt.Time_Slice_Value);
1092 end if;
1094 if Main_CPU (Main_Unit) /= Default_Main_CPU then
1095 Write_Info_Str (" C=");
1096 Write_Info_Nat (Main_CPU (Main_Unit));
1097 end if;
1099 Write_Info_Str (" W=");
1100 Write_Info_Char
1101 (WC_Encoding_Letters (Wide_Character_Encoding_Method));
1103 Write_Info_EOL;
1104 end M_Parameters;
1106 -- Start of processing for Output_Main_Program_Line
1108 begin
1109 if Nkind (U) = N_Subprogram_Body
1110 or else
1111 (Nkind (U) = N_Package_Body
1112 and then
1113 Nkind (Original_Node (U)) in N_Subprogram_Instantiation)
1114 then
1115 -- If the unit is a subprogram instance, the entity for the
1116 -- subprogram is the alias of the visible entity, which is the
1117 -- related instance of the wrapper package. We retrieve the
1118 -- subprogram declaration of the desired entity.
1120 if Nkind (U) = N_Package_Body then
1121 U := Parent (Parent (
1122 Alias (Related_Instance (Defining_Unit_Name
1123 (Specification (Unit (Library_Unit (Parent (U)))))))));
1124 end if;
1126 S := Specification (U);
1128 -- A generic subprogram is never a main program
1130 if Nkind (U) = N_Subprogram_Body
1131 and then Present (Corresponding_Spec (U))
1132 and then
1133 Ekind_In (Corresponding_Spec (U), E_Generic_Procedure,
1134 E_Generic_Function)
1135 then
1136 null;
1138 elsif No (Parameter_Specifications (S)) then
1139 if Nkind (S) = N_Procedure_Specification then
1140 Write_Info_Initiate ('M');
1141 Write_Info_Str (" P");
1142 M_Parameters;
1144 else
1145 declare
1146 Nam : Node_Id := Defining_Unit_Name (S);
1148 begin
1149 -- If it is a child unit, get its simple name
1151 if Nkind (Nam) = N_Defining_Program_Unit_Name then
1152 Nam := Defining_Identifier (Nam);
1153 end if;
1155 if Is_Integer_Type (Etype (Nam)) then
1156 Write_Info_Initiate ('M');
1157 Write_Info_Str (" F");
1158 M_Parameters;
1159 end if;
1160 end;
1161 end if;
1162 end if;
1163 end if;
1164 end Output_Main_Program_Line;
1166 -- Write command argument ('A') lines
1168 for A in 1 .. Compilation_Switches.Last loop
1169 Write_Info_Initiate ('A');
1170 Write_Info_Char (' ');
1171 Write_Info_Str (Compilation_Switches.Table (A).all);
1172 Write_Info_Terminate;
1173 end loop;
1175 -- Output parameters ('P') line
1177 Write_Info_Initiate ('P');
1179 if Compilation_Errors then
1180 Write_Info_Str (" CE");
1181 end if;
1183 if Opt.Detect_Blocking then
1184 Write_Info_Str (" DB");
1185 end if;
1187 if Tasking_Used and then not Is_Predefined_Unit (Main_Unit) then
1188 if Locking_Policy /= ' ' then
1189 Write_Info_Str (" L");
1190 Write_Info_Char (Locking_Policy);
1191 end if;
1193 if Queuing_Policy /= ' ' then
1194 Write_Info_Str (" Q");
1195 Write_Info_Char (Queuing_Policy);
1196 end if;
1198 if Task_Dispatching_Policy /= ' ' then
1199 Write_Info_Str (" T");
1200 Write_Info_Char (Task_Dispatching_Policy);
1201 Write_Info_Char (' ');
1202 end if;
1203 end if;
1205 if GNATprove_Mode then
1206 Write_Info_Str (" GP");
1207 end if;
1209 if Partition_Elaboration_Policy /= ' ' then
1210 Write_Info_Str (" E");
1211 Write_Info_Char (Partition_Elaboration_Policy);
1212 end if;
1214 if No_Component_Reordering_Config then
1215 Write_Info_Str (" NC");
1216 end if;
1218 if not Object then
1219 Write_Info_Str (" NO");
1220 end if;
1222 if No_Run_Time_Mode then
1223 Write_Info_Str (" NR");
1224 end if;
1226 if Normalize_Scalars then
1227 Write_Info_Str (" NS");
1228 end if;
1230 if Default_SSO_Config /= ' ' then
1231 Write_Info_Str (" O");
1232 Write_Info_Char (Default_SSO_Config);
1233 end if;
1235 if Sec_Stack_Used then
1236 Write_Info_Str (" SS");
1237 end if;
1239 if Unreserve_All_Interrupts then
1240 Write_Info_Str (" UA");
1241 end if;
1243 if Front_End_Exceptions then
1244 Write_Info_Str (" FX");
1245 end if;
1247 if ZCX_Exceptions then
1248 Write_Info_Str (" ZX");
1249 end if;
1251 Write_Info_EOL;
1253 -- Before outputting the restrictions line, update the setting of
1254 -- the No_Elaboration_Code flag. Violations of this restriction
1255 -- cannot be detected until after the backend has been called since
1256 -- it is the backend that sets this flag. We have to check all units
1257 -- for which we have generated code
1259 for Unit in Units.First .. Last_Unit loop
1260 if Units.Table (Unit).Generate_Code or else Unit = Main_Unit then
1261 if not Has_No_Elaboration_Code (Cunit (Unit)) then
1262 Main_Restrictions.Violated (No_Elaboration_Code) := True;
1263 end if;
1264 end if;
1265 end loop;
1267 -- Positional case (only if debug flag -gnatd.R is set)
1269 if Debug_Flag_Dot_RR then
1271 -- Output first restrictions line
1273 Write_Info_Initiate ('R');
1274 Write_Info_Char (' ');
1276 -- First the information for the boolean restrictions
1278 for R in All_Boolean_Restrictions loop
1279 if Main_Restrictions.Set (R)
1280 and then not Restriction_Warnings (R)
1281 then
1282 Write_Info_Char ('r');
1283 elsif Main_Restrictions.Violated (R) then
1284 Write_Info_Char ('v');
1285 else
1286 Write_Info_Char ('n');
1287 end if;
1288 end loop;
1290 -- And now the information for the parameter restrictions
1292 for RP in All_Parameter_Restrictions loop
1293 if Main_Restrictions.Set (RP)
1294 and then not Restriction_Warnings (RP)
1295 then
1296 Write_Info_Char ('r');
1297 Write_Info_Nat (Nat (Main_Restrictions.Value (RP)));
1298 else
1299 Write_Info_Char ('n');
1300 end if;
1302 if not Main_Restrictions.Violated (RP)
1303 or else RP not in Checked_Parameter_Restrictions
1304 then
1305 Write_Info_Char ('n');
1306 else
1307 Write_Info_Char ('v');
1308 Write_Info_Nat (Nat (Main_Restrictions.Count (RP)));
1310 if Main_Restrictions.Unknown (RP) then
1311 Write_Info_Char ('+');
1312 end if;
1313 end if;
1314 end loop;
1316 Write_Info_EOL;
1318 -- Named case (if debug flag -gnatd.R is not set)
1320 else
1321 declare
1322 C : Character;
1324 begin
1325 -- Write RN header line with preceding blank line
1327 Write_Info_EOL;
1328 Write_Info_Initiate ('R');
1329 Write_Info_Char ('N');
1330 Write_Info_EOL;
1332 -- First the lines for the boolean restrictions
1334 for R in All_Boolean_Restrictions loop
1335 if Main_Restrictions.Set (R)
1336 and then not Restriction_Warnings (R)
1337 then
1338 C := 'R';
1339 elsif Main_Restrictions.Violated (R) then
1340 C := 'V';
1341 else
1342 goto Continue;
1343 end if;
1345 Write_Info_Initiate ('R');
1346 Write_Info_Char (C);
1347 Write_Info_Char (' ');
1348 Write_Info_Str (All_Boolean_Restrictions'Image (R));
1349 Write_Info_EOL;
1351 <<Continue>>
1352 null;
1353 end loop;
1354 end;
1356 -- And now the lines for the parameter restrictions
1358 for RP in All_Parameter_Restrictions loop
1359 if Main_Restrictions.Set (RP)
1360 and then not Restriction_Warnings (RP)
1361 then
1362 Write_Info_Initiate ('R');
1363 Write_Info_Str ("R ");
1364 Write_Info_Str (All_Parameter_Restrictions'Image (RP));
1365 Write_Info_Char ('=');
1366 Write_Info_Nat (Nat (Main_Restrictions.Value (RP)));
1367 Write_Info_EOL;
1368 end if;
1370 if not Main_Restrictions.Violated (RP)
1371 or else RP not in Checked_Parameter_Restrictions
1372 then
1373 null;
1374 else
1375 Write_Info_Initiate ('R');
1376 Write_Info_Str ("V ");
1377 Write_Info_Str (All_Parameter_Restrictions'Image (RP));
1378 Write_Info_Char ('=');
1379 Write_Info_Nat (Nat (Main_Restrictions.Count (RP)));
1381 if Main_Restrictions.Unknown (RP) then
1382 Write_Info_Char ('+');
1383 end if;
1385 Write_Info_EOL;
1386 end if;
1387 end loop;
1388 end if;
1390 -- Output R lines for No_Dependence entries
1392 for J in No_Dependences.First .. No_Dependences.Last loop
1393 if In_Extended_Main_Source_Unit (No_Dependences.Table (J).Unit)
1394 and then not No_Dependences.Table (J).Warn
1395 then
1396 Write_Info_Initiate ('R');
1397 Write_Info_Char (' ');
1398 Write_Unit_Name (No_Dependences.Table (J).Unit);
1399 Write_Info_EOL;
1400 end if;
1401 end loop;
1403 -- Output interrupt state lines
1405 for J in Interrupt_States.First .. Interrupt_States.Last loop
1406 Write_Info_Initiate ('I');
1407 Write_Info_Char (' ');
1408 Write_Info_Nat (Interrupt_States.Table (J).Interrupt_Number);
1409 Write_Info_Char (' ');
1410 Write_Info_Char (Interrupt_States.Table (J).Interrupt_State);
1411 Write_Info_Char (' ');
1412 Write_Info_Nat
1413 (Nat (Get_Logical_Line_Number
1414 (Interrupt_States.Table (J).Pragma_Loc)));
1415 Write_Info_EOL;
1416 end loop;
1418 -- Output priority specific dispatching lines
1420 for J in Specific_Dispatching.First .. Specific_Dispatching.Last loop
1421 Write_Info_Initiate ('S');
1422 Write_Info_Char (' ');
1423 Write_Info_Char (Specific_Dispatching.Table (J).Dispatching_Policy);
1424 Write_Info_Char (' ');
1425 Write_Info_Nat (Specific_Dispatching.Table (J).First_Priority);
1426 Write_Info_Char (' ');
1427 Write_Info_Nat (Specific_Dispatching.Table (J).Last_Priority);
1428 Write_Info_Char (' ');
1429 Write_Info_Nat
1430 (Nat (Get_Logical_Line_Number
1431 (Specific_Dispatching.Table (J).Pragma_Loc)));
1432 Write_Info_EOL;
1433 end loop;
1435 -- Loop through file table to output information for all units for which
1436 -- we have generated code, as marked by the Generate_Code flag.
1438 for Unit in Units.First .. Last_Unit loop
1439 if Units.Table (Unit).Generate_Code
1440 or else Unit = Main_Unit
1441 then
1442 Write_Info_EOL; -- blank line
1443 Write_Unit_Information (Unit);
1444 end if;
1445 end loop;
1447 Write_Info_EOL; -- blank line
1449 -- Output external version reference lines
1451 for J in 1 .. Version_Ref.Last loop
1452 Write_Info_Initiate ('E');
1453 Write_Info_Char (' ');
1455 for K in 1 .. String_Length (Version_Ref.Table (J)) loop
1456 Write_Info_Char_Code (Get_String_Char (Version_Ref.Table (J), K));
1457 end loop;
1459 Write_Info_EOL;
1460 end loop;
1462 -- Prepare to output the source dependency lines
1464 declare
1465 Unum : Unit_Number_Type;
1466 -- Number of unit being output
1468 Sind : Source_File_Index;
1469 -- Index of corresponding source file
1471 Fname : File_Name_Type;
1473 begin
1474 for J in 1 .. Num_Sdep loop
1475 Unum := Sdep_Table (J);
1476 Units.Table (Unum).Dependency_Num := J;
1477 Sind := Units.Table (Unum).Source_Index;
1479 Write_Info_Initiate ('D');
1480 Write_Info_Char (' ');
1482 -- Normal case of a unit entry with a source index
1484 if Sind > No_Source_File then
1485 Fname := File_Name (Sind);
1487 -- Ensure that on platforms where the file names are not case
1488 -- sensitive, the recorded file name is in lower case.
1490 if not File_Names_Case_Sensitive then
1491 Get_Name_String (Fname);
1492 To_Lower (Name_Buffer (1 .. Name_Len));
1493 Fname := Name_Find;
1494 end if;
1496 Write_Info_Name_May_Be_Quoted (Fname);
1497 Write_Info_Tab (25);
1498 Write_Info_Str (String (Time_Stamp (Sind)));
1499 Write_Info_Char (' ');
1500 Write_Info_Str (Get_Hex_String (Source_Checksum (Sind)));
1502 -- If the dependency comes from a limited_with clause, record
1503 -- limited_checksum. This is disabled until full checksum
1504 -- changes are checked.
1506 -- if Present (Cunit_Entity (Unum))
1507 -- and then From_Limited_With (Cunit_Entity (Unum))
1508 -- then
1509 -- Write_Info_Char (' ');
1510 -- Write_Info_Char ('Y');
1511 -- Write_Info_Str (Get_Hex_String (Limited_Chk_Sum (Sind)));
1512 -- end if;
1514 -- If subunit, add unit name, omitting the %b at the end
1516 if Present (Cunit (Unum)) then
1517 Get_Decoded_Name_String (Unit_Name (Unum));
1518 Write_Info_Char (' ');
1520 if Nkind (Unit (Cunit (Unum))) = N_Subunit then
1521 Write_Info_Str (Name_Buffer (1 .. Name_Len - 2));
1522 else
1523 Write_Info_Str (Name_Buffer (1 .. Name_Len));
1524 end if;
1525 end if;
1527 -- If Source_Reference pragma used, output information
1529 if Num_SRef_Pragmas (Sind) > 0 then
1530 Write_Info_Char (' ');
1532 if Num_SRef_Pragmas (Sind) = 1 then
1533 Write_Info_Nat (Int (First_Mapped_Line (Sind)));
1534 else
1535 Write_Info_Nat (0);
1536 end if;
1538 Write_Info_Char (':');
1539 Write_Info_Name (Reference_Name (Sind));
1540 end if;
1542 -- Case where there is no source index (happens for missing
1543 -- files). In this case we write a dummy time stamp.
1545 else
1546 Write_Info_Name (Unit_File_Name (Unum));
1547 Write_Info_Tab (25);
1548 Write_Info_Str (String (Dummy_Time_Stamp));
1549 Write_Info_Char (' ');
1550 Write_Info_Str (Get_Hex_String (0));
1551 end if;
1553 Write_Info_EOL;
1554 end loop;
1555 end;
1557 -- Output cross-references
1559 if Opt.Xref_Active then
1560 Output_References;
1561 end if;
1563 -- Output SCO information if present
1565 if Generate_SCO then
1566 SCO_Record_Filtered;
1567 SCO_Output;
1568 end if;
1570 -- Output final blank line and we are done. This final blank line is
1571 -- probably junk, but we don't feel like making an incompatible change.
1573 Write_Info_Terminate;
1574 Close_Output_Library_Info;
1575 end Write_ALI;
1577 ---------------------
1578 -- Write_Unit_Name --
1579 ---------------------
1581 procedure Write_Unit_Name (N : Node_Id) is
1582 begin
1583 if Nkind (N) = N_Identifier then
1584 Write_Info_Name (Chars (N));
1586 else
1587 pragma Assert (Nkind (N) = N_Selected_Component);
1588 Write_Unit_Name (Prefix (N));
1589 Write_Info_Char ('.');
1590 Write_Unit_Name (Selector_Name (N));
1591 end if;
1592 end Write_Unit_Name;
1594 end Lib.Writ;