aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/errorout.adb
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2015-12-21 04:59:42 +0100
committerTristan Gingold <gingold@adacore.com>2015-12-21 04:59:42 +0100
commitcc5bab599435c1a02a57ef3a80bdb777addb4710 (patch)
treead8dd09ac429aae609be5bac65fdccaa8433ad68 /src/vhdl/errorout.adb
parent94995e112356d91e513cf583213d2644f01865a3 (diff)
downloadghdl-cc5bab599435c1a02a57ef3a80bdb777addb4710.tar.gz
ghdl-cc5bab599435c1a02a57ef3a80bdb777addb4710.tar.bz2
ghdl-cc5bab599435c1a02a57ef3a80bdb777addb4710.zip
cleanup in errorout.
Diffstat (limited to 'src/vhdl/errorout.adb')
-rw-r--r--src/vhdl/errorout.adb77
1 files changed, 34 insertions, 43 deletions
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb
index 531dda469..5f55222d1 100644
--- a/src/vhdl/errorout.adb
+++ b/src/vhdl/errorout.adb
@@ -89,35 +89,6 @@ package body Errorout is
Put (':');
end Disp_Location;
- procedure Disp_Current_Location is
- begin
- Disp_Location (Scanner.Get_Current_File,
- Scanner.Get_Current_Line,
- Scanner.Get_Current_Column);
- end Disp_Current_Location;
-
- procedure Disp_Token_Location is
- begin
- Disp_Location (Scanner.Get_Current_File,
- Scanner.Get_Current_Line,
- Scanner.Get_Token_Column);
- end Disp_Token_Location;
-
- procedure Disp_Location (Loc : Location_Type)
- is
- Name : Name_Id;
- Line : Natural;
- Col : Natural;
- begin
- if Loc = Location_Nil then
- -- Avoid a crash, but should not happen.
- Put ("??:??:??:");
- else
- Location_To_Position (Loc, Name, Line, Col);
- Disp_Location (Name, Line, Col);
- end if;
- end Disp_Location;
-
procedure Disp_Program_Name is
begin
Put (Ada.Command_Line.Command_Name);
@@ -127,34 +98,59 @@ package body Errorout is
procedure Report_Msg (Level : Report_Level;
Origin : Report_Origin;
Loc : Location_Type;
- Msg : String) is
+ Msg : String)
+ is
+ File : Name_Id;
+ Line : Natural;
+ Col : Natural;
+ Progname : Boolean;
begin
+ -- By default, no location.
+ File := Null_Identifier;
+ Line := 0;
+ Col := 0;
+
+ -- And no program name.
+ Progname := False;
+
case Origin is
when Option
| Library =>
- Disp_Program_Name;
+ Progname := True;
when Elaboration =>
if Loc = No_Location then
- Disp_Program_Name;
+ Progname := True;
else
- Disp_Location (Loc);
+ Location_To_Position (Loc, File, Line, Col);
end if;
when Scan =>
if Loc = No_Location then
- Disp_Current_Location;
+ File := Scanner.Get_Current_File;
+ Line := Scanner.Get_Current_Line;
+ Col := Scanner.Get_Current_Column;
else
- Disp_Location (Loc);
+ Location_To_Position (Loc, File, Line, Col);
end if;
when Parse =>
if Loc = No_Location then
- Disp_Token_Location;
+ File := Scanner.Get_Current_File;
+ Line := Scanner.Get_Current_Line;
+ Col := Scanner.Get_Token_Column;
else
- Disp_Location (Loc);
+ Location_To_Position (Loc, File, Line, Col);
end if;
when Semantic =>
- Disp_Location (Loc);
+ Location_To_Position (Loc, File, Line, Col);
end case;
+ if Progname then
+ Disp_Program_Name;
+ elsif File /= Null_Identifier then
+ Disp_Location (File, Line, Col);
+ else
+ Put ("??:??:??:");
+ end if;
+
case Level is
when Note =>
Put ("note:");
@@ -194,11 +190,6 @@ package body Errorout is
end if;
end Get_Location_Safe;
- procedure Disp_Iir_Location (An_Iir: Iir) is
- begin
- Disp_Location (Get_Location_Safe (An_Iir));
- end Disp_Iir_Location;
-
procedure Warning_Msg_Sem (Msg: String; Loc : Location_Type) is
begin
if Flags.Flag_Only_Elab_Warnings then