with Erroutc;
with Errid; use Errid;
with Namet; use Namet;
+with Osint; use Osint;
with Table;
with Types; use Types;
with Uintp; use Uintp;
-- and must be set True on the last call (a value of True activates some
-- processing that must only be done after all messages are posted).
- procedure Output_Messages;
+ procedure Output_Messages (Exit_Code : Exit_Code_Type);
-- Output list of messages, including messages giving number of detected
- -- errors and warnings.
+ -- errors and warnings and store the exit code used.
procedure Error_Msg
(Msg : String; Flag_Location : Source_Ptr);
-- Local variables
Back_End_Mode : Back_End.Back_End_Mode_Type;
- Ecode : Exit_Code_Type;
+ Ecode : Exit_Code_Type := E_Success;
Main_Unit_Kind : Node_Kind;
-- Kind of main compilation unit node
-- Exit with errors if the main source could not be parsed
if Sinput.Main_Source_File <= No_Source_File then
+ Ecode := E_Errors;
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
- Exit_Program (E_Errors);
+ Errout.Output_Messages (Ecode);
+ Exit_Program (Ecode);
end if;
Main_Unit_Node := Cunit (Main_Unit);
Errout.Finalize (Last_Call => False);
if Compilation_Errors then
+ Ecode := E_Errors;
Treepr.Tree_Dump;
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages (Ecode);
Namet.Finalize;
-- Generate ALI file if specially requested
Write_ALI (Object => False);
end if;
- Exit_Program (E_Errors);
+ Exit_Program (Ecode);
end if;
-- Case of no code required to be generated, exit indicating no error
if Original_Operating_Mode = Check_Syntax then
Treepr.Tree_Dump;
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages (Ecode);
Namet.Finalize;
Check_Rep_Info;
Post_Compilation_Validation_Checks;
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages (Ecode);
Treepr.Tree_Dump;
-- Generate ALI file if specially requested, or for missing subunits,
then
Post_Compilation_Validation_Checks;
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages (Ecode);
Write_ALI (Object => False);
Tree_Dump;
Namet.Finalize;
-- representation information for List_Rep_Info).
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages
+ ((if Compilation_Errors then E_Errors else E_Success));
-- Back annotation of representation info is not done in CodePeer and
-- SPARK modes.
-- there will be no attempt to generate an object file.
if Compilation_Errors then
+ Ecode := E_Errors;
Treepr.Tree_Dump;
- Exit_Program (E_Errors);
+ Exit_Program (Ecode);
end if;
if not GNATprove_Mode then
exception
when Unrecoverable_Error =>
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages (E_Errors);
Set_Standard_Error;
Write_Str ("compilation abandoned");
if Total_Errors_Detected > T then
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages (E_Fatal);
Fail ("errors found in preprocessing data file """
& Get_Name_String (N) & """");
end if;
if T /= Total_Errors_Detected then
Errout.Finalize (Last_Call => True);
- Errout.Output_Messages;
+ Errout.Output_Messages (E_Fatal);
Fail ("errors found in definition file """
& Get_Name_String (N)
& """");