aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-09-16 08:07:36 +0200
committerTristan Gingold <tgingold@free.fr>2018-09-16 08:18:50 +0200
commit9ed21dea7e8c7c5a07d1438ec89ecc98ac7f399d (patch)
tree4528ee0f3bf6fffdaf3f210fc1a9c6fb7ae82bbc /src
parent7303c1068a75001365f77f2569382cc093fa9ac2 (diff)
downloadghdl-9ed21dea7e8c7c5a07d1438ec89ecc98ac7f399d.tar.gz
ghdl-9ed21dea7e8c7c5a07d1438ec89ecc98ac7f399d.tar.bz2
ghdl-9ed21dea7e8c7c5a07d1438ec89ecc98ac7f399d.zip
grt: adjust grt-wave_opt error API.
Diffstat (limited to 'src')
-rw-r--r--src/grt/grt-wave_opt-design.adb6
-rw-r--r--src/grt/grt-wave_opt-file.adb23
-rw-r--r--src/grt/grt-wave_opt.adb37
-rw-r--r--src/grt/grt-wave_opt.ads12
4 files changed, 32 insertions, 46 deletions
diff --git a/src/grt/grt-wave_opt-design.adb b/src/grt/grt-wave_opt-design.adb
index 8ef0a73cd..37291a84c 100644
--- a/src/grt/grt-wave_opt-design.adb
+++ b/src/grt/grt-wave_opt-design.adb
@@ -206,13 +206,15 @@ package body Grt.Wave_Opt.Design is
Cursor := Previous_Cursor;
while Cursor /= null loop
if Cursor.Kind = Not_Found then
- Print_Context (Cursor, Warning);
+ Warning_S;
+ Diag_C_Context (Cursor);
Diag_C (Cursor.Expr.all);
Diag_C (" : first element of the path not found in design.");
Diag_C (" More references may follow");
Warning_E;
elsif Cursor.Next_Child = null and then Cursor.Kind = Pkg_Entity then
- Print_Context (Cursor, Warning);
+ Warning_S;
+ Diag_C_Context (Cursor);
Diag_C (Cursor.Expr.all);
Diag_C (" is not a signal");
Warning_E;
diff --git a/src/grt/grt-wave_opt-file.adb b/src/grt/grt-wave_opt-file.adb
index 32f70593a..a753691d1 100644
--- a/src/grt/grt-wave_opt-file.adb
+++ b/src/grt/grt-wave_opt-file.adb
@@ -68,7 +68,7 @@ package body Grt.Wave_Opt.File is
procedure Parse_Version (Line : String; Lineno : Positive);
-- Print the version variable given as parameter
- procedure Print_Version (Version : Version_Type);
+ procedure Diag_C_Version (Version : Version_Type);
-- Parse a line where a signal path is set
procedure Parse_Path (Line : in out String; Lineno : Positive);
@@ -127,7 +127,7 @@ package body Grt.Wave_Opt.File is
if Version.Major = -1 then
Warning_S ("version wasn't set at the beginning of the" &
" file; currently supported version is ");
- Print_Version (Current_Version);
+ Diag_C_Version (Current_Version);
Warning_E;
end if;
@@ -197,25 +197,26 @@ package body Grt.Wave_Opt.File is
if Version.Major /= Current_Version.Major
or else Version.Minor > Current_Version.Minor
then
- Print_Context (Line'First, Lineno, Error);
- Error_S ("unsupported format version; it must be ");
+ Error_S;
+ Diag_C_Context (Line'First, Lineno);
+ Diag_C ("unsupported format version; it must be ");
if Current_Version.Minor /= 0 then
Diag_C ("between ");
- Print_Version (Version_Type'(Current_Version.Major, 0));
+ Diag_C_Version (Version_Type'(Current_Version.Major, 0));
Diag_C (" and ");
end if;
- Print_Version (Current_Version);
+ Diag_C_Version (Current_Version);
Error_E;
end if;
end Parse_Version;
- procedure Print_Version (Version : Version_Type) is
+ procedure Diag_C_Version (Version : Version_Type) is
begin
Diag_C (Version.Major);
Diag_C ('.');
Diag_C (Version.Minor);
- end Print_Version;
+ end Diag_C_Version;
procedure Initialize_Tree is
begin
@@ -305,7 +306,8 @@ package body Grt.Wave_Opt.File is
-- 2nd line, a is a signal but it isn't according to the 1st line.
-- Then /top/a will supercede /top/a/b.
if not Tree_Updated and Tree_Cursor.Next_Child /= null then
- Print_Context (Lineno, Line'First, Warning);
+ Warning_S;
+ Diag_C_Context (Lineno, Line'First);
Diag_C ("supercedes line ");
Diag_C (Tree_Cursor.Lineno);
Diag_C (" and possibly more lines in between");
@@ -359,7 +361,8 @@ package body Grt.Wave_Opt.File is
-- the 1st line, a is a signal but it isn't according to the 2nd
-- line. Then /top/a will supercede /top/a/b.
if Level > 1 and not Last_Updated then
- Print_Context (Lineno, Elem_Expr'First, Warning);
+ Warning_S;
+ Diag_C_Context (Lineno, Elem_Expr'First);
Diag_C ("superceded by line ");
Diag_C (Cursor.Lineno);
Warning_E;
diff --git a/src/grt/grt-wave_opt.adb b/src/grt/grt-wave_opt.adb
index f976c42bd..5bc1524b3 100644
--- a/src/grt/grt-wave_opt.adb
+++ b/src/grt/grt-wave_opt.adb
@@ -29,48 +29,33 @@ with Grt.Errors; use Grt.Errors;
package body Grt.Wave_Opt is
- procedure Print_Context
- (Lineno, Column : Positive; Severity : Severity_Type) is
+ procedure Diag_C_Context (Lineno, Column : Positive) is
begin
- case Severity is
- when Error =>
- Error_S;
- when Warning =>
- Warning_S;
- end case;
Diag_C (File_Path.all);
Diag_C (':');
Diag_C (Lineno);
Diag_C (':');
Diag_C (Column);
Diag_C (": ");
- end Print_Context;
+ end Diag_C_Context;
- procedure Print_Context (Element : Elem_Acc; Severity : Severity_Type) is
+ procedure Diag_C_Context (Element : Elem_Acc) is
begin
- Print_Context
- (Element.Lineno, Element.Column, Severity);
- end Print_Context;
+ Diag_C_Context (Element.Lineno, Element.Column);
+ end Diag_C_Context;
procedure Error_Context (Msg : String;
- Lineno, Column : Positive;
- Severity : Severity_Type := Error) is
+ Lineno, Column : Positive) is
begin
- Print_Context (Lineno, Column, Severity);
+ Error_S;
+ Diag_C_Context (Lineno, Column);
Diag_C (Msg);
- case Severity is
- when Error =>
- Error_E;
- when Warning =>
- Warning_E;
- end case;
+ Error_E;
end Error_Context;
- procedure Error_Context
- (Msg : String; Element : Elem_Acc; Severity : Severity_Type := Error) is
+ procedure Error_Context (Msg : String; Element : Elem_Acc) is
begin
- Error_Context
- (Msg, Element.Lineno, Element.Column, Severity);
+ Error_Context (Msg, Element.Lineno, Element.Column);
end Error_Context;
end Grt.Wave_Opt;
diff --git a/src/grt/grt-wave_opt.ads b/src/grt/grt-wave_opt.ads
index 5d7ed2ee1..62a6179b1 100644
--- a/src/grt/grt-wave_opt.ads
+++ b/src/grt/grt-wave_opt.ads
@@ -70,15 +70,11 @@ private
-- An error/warning message start with the context or the error/warning.
-- This procedure print this context
- procedure Print_Context
- (Lineno, Column : Positive; Severity : Severity_Type);
- procedure Print_Context (Element : Elem_Acc; Severity : Severity_Type);
+ procedure Diag_C_Context (Lineno, Column : Positive);
+ procedure Diag_C_Context (Element : Elem_Acc);
-- Print an error/warning with it's context
- procedure Error_Context (Msg : String;
- Lineno, Column : Positive;
- Severity : Severity_Type := Error);
- procedure Error_Context
- (Msg : String; Element : Elem_Acc; Severity : Severity_Type := Error);
+ procedure Error_Context (Msg : String; Lineno, Column : Positive);
+ procedure Error_Context (Msg : String; Element : Elem_Acc);
end Grt.Wave_Opt;