+ end Check_Bad_Body;
+
+ -------------------------
+ -- Check_Library_Items --
+ -------------------------
+
+ -- Walk_Library_Items has plenty of assertions, so all we need to do is
+ -- call it, just for these assertions, not actually doing anything else.
+
+ procedure Check_Library_Items is
+
+ procedure Action (Item : Node_Id);
+ -- Action passed to Walk_Library_Items to do nothing
+
+ ------------
+ -- Action --
+ ------------
+
+ procedure Action (Item : Node_Id) is
+ begin
+ null;
+ end Action;
+
+ procedure Walk is new Sem.Walk_Library_Items (Action);
+
+ -- Start of processing for Check_Library_Items
+
+ begin
+ Walk;
+ end Check_Library_Items;
+
+ --------------------
+ -- Check_Rep_Info --
+ --------------------
+
+ procedure Check_Rep_Info is
+ begin
+ if List_Representation_Info /= 0
+ or else List_Representation_Info_Mechanisms
+ then
+ Set_Standard_Error;
+ Write_Eol;
+ Write_Str
+ ("cannot generate representation information, no code generated");
+ Write_Eol;
+ Write_Eol;
+ Set_Standard_Output;
+ end if;
+ end Check_Rep_Info;
+
+-- Start of processing for Gnat1drv
+
+begin
+ -- This inner block is set up to catch assertion errors and constraint
+ -- errors. Since the code for handling these errors can cause another
+ -- exception to be raised (namely Unrecoverable_Error), we need two
+ -- nested blocks, so that the outer one handles unrecoverable error.
+
+ begin
+ -- Initialize all packages. For the most part, these initialization
+ -- calls can be made in any order. Exceptions are as follows:
+
+ -- Lib.Initialize need to be called before Scan_Compiler_Arguments,
+ -- because it initializes a table filled by Scan_Compiler_Arguments.
+
+ Osint.Initialize;
+ Fmap.Reset_Tables;
+ Lib.Initialize;
+ Lib.Xref.Initialize;
+ Scan_Compiler_Arguments;
+ Osint.Add_Default_Search_Dirs;
+
+ Nlists.Initialize;
+ Sinput.Initialize;
+ Sem.Initialize;
+ Csets.Initialize;
+ Uintp.Initialize;
+ Urealp.Initialize;
+ Errout.Initialize;
+ Namet.Initialize;
+ SCOs.Initialize;
+ Snames.Initialize;
+ Stringt.Initialize;
+ Inline.Initialize;
+ Par_SCO.Initialize;
+ Sem_Ch8.Initialize;
+ Sem_Ch12.Initialize;
+ Sem_Ch13.Initialize;
+ Sem_Elim.Initialize;
+ Sem_Eval.Initialize;
+ Sem_Type.Init_Interp_Tables;
+
+ -- Acquire target parameters from system.ads (source of package System)
+
+ declare
+ use Sinput;
+
+ S : Source_File_Index;
+ N : File_Name_Type;
+
+ begin
+ Name_Buffer (1 .. 10) := "system.ads";
+ Name_Len := 10;
+ N := Name_Find;
+ S := Load_Source_File (N);
+
+ if S = No_Source_File then
+ Write_Line
+ ("fatal error, run-time library not installed correctly");
+ Write_Line
+ ("cannot locate file system.ads");
+ raise Unrecoverable_Error;
+
+ -- Remember source index of system.ads (which was read successfully)
+
+ else
+ System_Source_File_Index := S;
+ end if;
+
+ Targparm.Get_Target_Parameters
+ (System_Text => Source_Text (S),
+ Source_First => Source_First (S),
+ Source_Last => Source_Last (S));
+
+ -- Acquire configuration pragma information from Targparm
+
+ Restrict.Restrictions := Targparm.Restrictions_On_Target;
+ end;
+
+ Adjust_Global_Switches;
+
+ -- Output copyright notice if full list mode unless we have a list
+ -- file, in which case we defer this so that it is output in the file
+
+ if (Verbose_Mode or else (Full_List and then Full_List_File_Name = null))
+ and then not Debug_Flag_7
+ then
+ Write_Eol;
+ Write_Str ("GNAT ");
+ Write_Str (Gnat_Version_String);
+ Write_Eol;
+ Write_Str ("Copyright 1992-" &
+ Current_Year &
+ ", Free Software Foundation, Inc.");
+ Write_Eol;
+ end if;
+
+ -- Check we do not have more than one source file, this happens only in
+ -- the case where the driver is called directly, it cannot happen when
+ -- gnat1 is invoked from gcc in the normal case.
+
+ if Osint.Number_Of_Files /= 1 then
+ Usage;
+ Write_Eol;
+ Osint.Fail ("you must provide one source file");
+
+ elsif Usage_Requested then
+ Usage;
+ end if;
+
+ Original_Operating_Mode := Operating_Mode;
+ Frontend;
+
+ -- Exit with errors if the main source could not be parsed
+
+ if Sinput.Main_Source_File = No_Source_File then
+ Errout.Finalize (Last_Call => True);
+ Errout.Output_Messages;
+ Exit_Program (E_Errors);
+ end if;
+
+ Main_Unit_Node := Cunit (Main_Unit);
+ Main_Kind := Nkind (Unit (Main_Unit_Node));
+ Check_Bad_Body;