From a03179ad2abff33d21fb5d18bcb13b2d8aa11c21 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 16 Sep 2018 07:46:55 +0200 Subject: grt: rework error API (WIP). --- src/grt/grt-change_generics.adb | 10 ++-- src/grt/grt-errors.adb | 105 +++++++++++++++------------------------- src/grt/grt-errors.ads | 38 +++++++++++---- src/grt/grt-files.adb | 25 +++++----- src/grt/grt-fst.adb | 2 +- src/grt/grt-lib.adb | 46 +++++++++--------- src/grt/grt-options.adb | 28 +++++------ src/grt/grt-psl.adb | 2 +- src/grt/grt-sdf.adb | 33 ++++++------- src/grt/grt-signals.adb | 10 ++-- src/grt/grt-values.adb | 16 +++--- src/grt/grt-vcd.adb | 2 +- src/grt/grt-vcdz.adb | 2 +- src/grt/grt-vital_annotate.adb | 10 ++-- src/grt/grt-vpi.adb | 8 +-- src/grt/grt-wave_opt-file.adb | 22 ++++----- src/grt/grt-wave_opt.adb | 2 +- src/grt/grt-waves.adb | 2 +- 18 files changed, 177 insertions(+), 186 deletions(-) (limited to 'src') diff --git a/src/grt/grt-change_generics.adb b/src/grt/grt-change_generics.adb index dc273c50f..f0fba3fa5 100644 --- a/src/grt/grt-change_generics.adb +++ b/src/grt/grt-change_generics.adb @@ -37,9 +37,9 @@ with Grt.Values; package body Grt.Change_Generics is procedure Error_Override (Msg : String; Over : Generic_Override_Acc) is begin - Error_C (Msg); - Error_C (" '"); - Error_C (Over.Name.all); + Error_S (Msg); + Diag_C (" '"); + Diag_C (Over.Name.all); Error_E ("'"); end Error_Override; @@ -364,8 +364,8 @@ package body Grt.Change_Generics is Uc_Array := To_Ghdl_Uc_Array_Acc (Loc_To_Addr (Obj_Rti.Common.Depth, Obj_Rti.Loc, Ctxt)); if Uc_Array.Base = Null_Address then - Error_C ("top-level generic '"); - Error_C (Obj_Rti.Name); + Error_S ("top-level generic '"); + Diag_C (Obj_Rti.Name); Error_E ("' must be overriden (use -gGEN=VAL)"); end if; end; diff --git a/src/grt/grt-errors.adb b/src/grt/grt-errors.adb index 0101dd20a..325059469 100644 --- a/src/grt/grt-errors.adb +++ b/src/grt/grt-errors.adb @@ -85,25 +85,37 @@ package body Grt.Errors is end if; end Fatal_Error; - procedure Put_Err (Str : String) is + procedure Diag_C (Str : String) is begin Put (Error_Stream, Str); - end Put_Err; + end Diag_C; - procedure Put_Err (C : Character) is + procedure Diag_C (N : Integer) is begin - Put (Error_Stream, C); - end Put_Err; + Put_I32 (Error_Stream, Ghdl_I32 (N)); + end Diag_C; - procedure Put_Err (Str : Ghdl_C_String) is + procedure Diag_C (N : Ghdl_I32) is + begin + Put_I32 (Error_Stream, N); + end Diag_C; + + procedure Diag_C (Str : Ghdl_C_String) is begin Put (Error_Stream, Str); - end Put_Err; + end Diag_C; - procedure Put_Err (N : Integer) is + procedure Diag_C_Std (Str : Std_String_Uncons) + is + subtype Str_Subtype is String (1 .. Str'Length); begin - Put_I32 (Error_Stream, Ghdl_I32 (N)); - end Put_Err; + Put (Error_Stream, Str_Subtype (Str)); + end Diag_C_Std; + + procedure Diag_C (C : Character) is + begin + Put (Error_Stream, C); + end Diag_C; procedure Newline_Err is begin @@ -171,42 +183,13 @@ package body Grt.Errors is Newline_Err; end Report_E; - procedure Error_H is + procedure Error_S (Str : String := "") is begin Put_Err (Progname); Put_Err (":error: "); - end Error_H; - - Cont : Boolean := False; - procedure Error_C (Str : String) is - begin - if not Cont then - Error_H; - Cont := True; - end if; - Put_Err (Str); - end Error_C; - - procedure Error_C (Str : Ghdl_C_String) - is - Len : constant Natural := strlen (Str); - begin - if not Cont then - Error_H; - Cont := True; - end if; - Put_Err (Str (1 .. Len)); - end Error_C; - - procedure Error_C (N : Integer) is - begin - if not Cont then - Error_H; - Cont := True; - end if; - Put_Err (N); - end Error_C; + Diag_C (Str); + end Error_S; -- procedure Error_C (Inst : Ghdl_Instance_Name_Acc) -- is @@ -233,25 +216,15 @@ package body Grt.Errors is procedure Error_E (Str : String := "") is begin - Put_Err (Str); + Diag_C (Str); Newline_Err; - Cont := False; Fatal_Error; end Error_E; - procedure Error_C_Std (Str : Std_String_Uncons) - is - subtype Str_Subtype is String (1 .. Str'Length); - begin - Error_C (Str_Subtype (Str)); - end Error_C_Std; - procedure Error (Str : String) is begin - Error_H; - Put_Err (Str); - Newline_Err; - Fatal_Error; + Error_S (Str); + Error_E; end Error; procedure Error_Call_Stack (Str : String; Skip : Natural) @@ -259,7 +232,7 @@ package body Grt.Errors is Bt : Backtrace_Addrs; begin Save_Backtrace (Bt, Skip + 1); - Error_C (Str); + Diag_C (Str); Error_E_Call_Stack (Bt); end Error_Call_Stack; @@ -267,14 +240,12 @@ package body Grt.Errors is Filename : Ghdl_C_String; Line : Ghdl_I32) is begin - Error_H; - Put_Err (Str); - Put_Err (" at "); - Put_Err (Filename); - Put_Err (" line "); - Put_I32 (Error_Stream, Line); - Newline_Err; - Fatal_Error; + Error_S (Str); + Diag_C (" at "); + Diag_C (Filename); + Diag_C (" line "); + Diag_C (Line); + Error_E; end Error; procedure Info (Str : String) is @@ -308,7 +279,7 @@ package body Grt.Errors is Grt.Backtraces.Put_Err_Backtrace (Bt); - Cont := False; + -- Should be able to call Error_E, but we don't want the newline. Fatal_Error; end Error_E_Call_Stack; @@ -323,13 +294,13 @@ package body Grt.Errors is procedure Grt_Overflow_Error (Bt : Backtrace_Addrs_Acc) is begin - Error_C ("overflow detected"); + Error_S ("overflow detected"); Error_E_Call_Stack (Bt); end Grt_Overflow_Error; procedure Grt_Null_Access_Error (Bt : Backtrace_Addrs_Acc) is begin - Error_C ("NULL access dereferenced"); + Error_S ("NULL access dereferenced"); Error_E_Call_Stack (Bt); end Grt_Null_Access_Error; end Grt.Errors; diff --git a/src/grt/grt-errors.ads b/src/grt/grt-errors.ads index c0d96ce02..976f2291c 100644 --- a/src/grt/grt-errors.ads +++ b/src/grt/grt-errors.ads @@ -34,13 +34,33 @@ package Grt.Errors is procedure Set_Error_Stream (Stream : Grt.Stdio.FILEs); function Get_Error_Stream return Grt.Stdio.FILEs; + -- Use of diagnostics: + -- Use Error_S/Report_S/Info_S to start a message. + -- Use Diag_C to continue the message (to display arguments) + -- Use Error_E/Report_E/Info_E to finish the message. + -- + -- The XXX_S and XXX_E must match. Diag_C calls are optional. + -- 'S' stands for start, 'C' for continue and 'E' for end. + -- + -- Example: + -- Error_S ("option '"); + -- Diag_C (Name); + -- Error_E ("' needs an argument"); + -- + -- The reason to have 3+ steps is that XXX_S display a different header + -- (like 'filename:error:'), while XXX_E may return or not. + + -- Continue to display a message during a diagnostic. + procedure Diag_C (Str : String); + procedure Diag_C (C : Character); + procedure Diag_C (N : Integer); + procedure Diag_C (N : Ghdl_I32); + procedure Diag_C (Str : Ghdl_C_String); + procedure Diag_C_Std (Str : Std_String_Uncons); + -- Multi-call error procedure. -- Start and continue with Error_C, finish by an Error_E. - procedure Error_C (Str : String); - procedure Error_C (N : Integer); - procedure Error_C (Str : Ghdl_C_String); - procedure Error_C_Std (Str : Std_String_Uncons); - --procedure Error_C (Inst : Ghdl_Instance_Name_Acc); + procedure Error_S (Str : String := ""); procedure Error_E (Str : String := ""); pragma No_Return (Error_E); @@ -143,10 +163,10 @@ package Grt.Errors is Expect_Failure : Boolean := False; -- Internal subprograms, to be called only by the symbolizer. - procedure Put_Err (C : Character); - procedure Put_Err (Str : String); - procedure Put_Err (Str : Ghdl_C_String); - procedure Put_Err (N : Integer); + procedure Put_Err (C : Character) renames Diag_C; + procedure Put_Err (Str : String) renames Diag_C; + procedure Put_Err (Str : Ghdl_C_String) renames Diag_C; + procedure Put_Err (N : Integer) renames Diag_C; procedure Newline_Err; private pragma Export (C, Grt_Overflow_Error, "grt_overflow_error"); diff --git a/src/grt/grt-files.adb b/src/grt/grt-files.adb index 3e8e12165..5ab74f127 100644 --- a/src/grt/grt-files.adb +++ b/src/grt/grt-files.adb @@ -317,22 +317,28 @@ package body Grt.Files is return Open_Ok; end File_Open; + procedure Error_Open (Str : Std_String_Ptr) + is + Bt : Backtrace_Addrs; + begin + Save_Backtrace (Bt, 2); + Error_S ("cannot open file """); + Diag_C_Std (Str.Base (0 .. Str.Bounds.Dim_1.Length - 1)); + Diag_C ('"'); + Error_E_Call_Stack (Bt); + end Error_Open; + procedure Ghdl_Text_File_Open (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr) is Res : Ghdl_I32; - Bt : Backtrace_Addrs; begin Check_File_Mode (File, True); Res := File_Open (File, Mode, Str); if Res /= Open_Ok then - Save_Backtrace (Bt, 1); - Error_C ("cannot open text file """); - Error_C_Std (Str.Base (0 .. Str.Bounds.Dim_1.Length - 1)); - Error_C (""""); - Error_E_Call_Stack (Bt); + Error_Open (Str); end if; end Ghdl_Text_File_Open; @@ -340,18 +346,13 @@ package body Grt.Files is (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr) is Res : Ghdl_I32; - Bt : Backtrace_Addrs; begin Check_File_Mode (File, False); Res := File_Open (File, Mode, Str); if Res /= Open_Ok then - Save_Backtrace (Bt, 1); - Error_C ("cannot open file """); - Error_C_Std (Str.Base (0 .. Str.Bounds.Dim_1.Length - 1)); - Error_C (""""); - Error_E_Call_Stack (Bt); + Error_Open (Str); end if; end Ghdl_File_Open; diff --git a/src/grt/grt-fst.adb b/src/grt/grt-fst.adb index 8358967e0..10a8a1eed 100644 --- a/src/grt/grt-fst.adb +++ b/src/grt/grt-fst.adb @@ -91,7 +91,7 @@ package body Grt.Fst is Context := fstWriterCreate (To_Ghdl_C_String (Fst_Filename.all'Address), 1); if Context = Null_fstContext then - Error_C ("fst: cannot open "); + Error_S ("fst: cannot open "); Error_E (Fst_Filename (Fst_Filename'First .. Fst_Filename'Last - 1)); end if; return True; diff --git a/src/grt/grt-lib.adb b/src/grt/grt-lib.adb index c05e97ba3..01c958c42 100644 --- a/src/grt/grt-lib.adb +++ b/src/grt/grt-lib.adb @@ -82,8 +82,8 @@ package body Grt.Lib is end if; if Level >= Grt.Options.Severity_Level then Save_Backtrace (Bt, 2); - Error_C (Msg); - Error_C (" failed"); + Error_S (Msg); + Diag_C (" failed"); Error_E_Call_Stack (Bt); end if; end Do_Report; @@ -139,29 +139,29 @@ package body Grt.Lib is procedure Ghdl_Program_Error (Filename : Ghdl_C_String; Line : Ghdl_I32; - Code : Ghdl_Index_Type) - is + Code : Ghdl_Index_Type) is begin + Error_S; case Code is when 1 => - Error_C ("missing return in function"); + Diag_C ("missing return in function"); when 2 => - Error_C ("block already configured"); + Diag_C ("block already configured"); when 3 => - Error_C ("bad configuration"); + Diag_C ("bad configuration"); when others => - Error_C ("unknown error code "); - Error_C (Integer (Code)); + Diag_C ("unknown error code "); + Diag_C (Integer (Code)); end case; - Error_C (" at "); + Diag_C (" at "); if Filename = null then - Error_C ("*unknown*"); + Diag_C ("*unknown*"); else - Error_C (Filename); + Diag_C (Filename); end if; - Error_C (":"); - Error_C (Integer(Line)); - Error_E (""); + Diag_C (":"); + Diag_C (Line); + Error_E; end Ghdl_Program_Error; procedure Ghdl_Bound_Check_Failed (Filename : Ghdl_C_String; @@ -170,10 +170,10 @@ package body Grt.Lib is Bt : Backtrace_Addrs; begin Save_Backtrace (Bt, 1); - Error_C ("bound check failure at "); - Error_C (Filename); - Error_C (":"); - Error_C (Integer (Line)); + Error_S ("bound check failure at "); + Diag_C (Filename); + Diag_C (":"); + Diag_C (Line); Error_E_Call_Stack (Bt); end Ghdl_Bound_Check_Failed; @@ -183,10 +183,10 @@ package body Grt.Lib is Bt : Backtrace_Addrs; begin Save_Backtrace (Bt, 1); - Error_C ("slice direction doesn't match index direction at "); - Error_C (Filename); - Error_C (":"); - Error_C (Integer (Line)); + Error_S ("slice direction doesn't match index direction at "); + Diag_C (Filename); + Diag_C (":"); + Diag_C (Line); Error_E_Call_Stack (Bt); end Ghdl_Direction_Check_Failed; diff --git a/src/grt/grt-options.adb b/src/grt/grt-options.adb index 3362e5ac1..cdf6c2886 100644 --- a/src/grt/grt-options.adb +++ b/src/grt/grt-options.adb @@ -129,8 +129,8 @@ package body Grt.Options is elsif Str'Last = Pos + 2 then Unit (3) := To_Lower (Str (Pos + 2)); else - Error_C ("bad unit for '"); - Error_C (Str); + Error_S ("bad unit for '"); + Diag_C (Str); Error_E ("'"); return -1; end if; @@ -154,8 +154,8 @@ package body Grt.Options is elsif Unit = "hr " then Time := Time * (10 ** 15) * 3600; else - Error_C ("bad unit name for '"); - Error_C (Str); + Error_S ("bad unit name for '"); + Diag_C (Str); Error_E ("'"); return -1; end if; @@ -224,8 +224,8 @@ package body Grt.Options is begin Extract_Integer (Option (14 .. Len), Ok, Time, Pos); if not Ok or else Pos <= Len then - Error_C ("bad value in '"); - Error_C (Option); + Error_S ("bad value in '"); + Diag_C (Option); Error_E ("'"); else if Time > Integer_64 (Integer'Last) then @@ -283,8 +283,8 @@ package body Grt.Options is begin Extract_Integer (Option (11 .. Len), Ok, Val, Pos); if not Ok or else Pos <= Len then - Error_C ("bad value in '"); - Error_C (Option); + Error_S ("bad value in '"); + Diag_C (Option); Error_E ("'"); else Nbr_Threads := Integer (Val); @@ -292,8 +292,8 @@ package body Grt.Options is end; elsif Len > 4 and then Option (1 .. 2) = "-g" then if Option (3) = '=' then - Error_C ("missing generic name in '"); - Error_C (Option); + Error_S ("missing generic name in '"); + Diag_C (Option); Error_E ("'"); return; end if; @@ -315,8 +315,8 @@ package body Grt.Options is end if; end loop; if Eq_Pos = 0 then - Error_C ("missing '=' after generic name in '"); - Error_C (Option); + Error_S ("missing '=' after generic name in '"); + Diag_C (Option); Error_E ("'"); end if; Name := new String (1 .. Eq_Pos - 3); @@ -349,8 +349,8 @@ package body Grt.Options is Wave_Opt.File.Start (Option (18 .. Option'Last), To_Be_Created => True); elsif not Grt.Hooks.Call_Option_Hooks (Option) then - Error_C ("unknown option '"); - Error_C (Option); + Error_S ("unknown option '"); + Diag_C (Option); Error_E ("', try --help"); end if; end Decode_Option; diff --git a/src/grt/grt-psl.adb b/src/grt/grt-psl.adb index 04c338a21..cf603a097 100644 --- a/src/grt/grt-psl.adb +++ b/src/grt/grt-psl.adb @@ -161,7 +161,7 @@ package body Grt.Psl is F := fopen (Report_Filename.all'Address, Mode'Address); if F = NULL_Stream then - Error_C ("cannot open "); + Error_S ("cannot open "); Error_E (Report_Filename (Report_Filename'First .. Report_Filename'Last - 1)); return; diff --git a/src/grt/grt-sdf.adb b/src/grt/grt-sdf.adb index 1cb04e5e1..8ee793f17 100644 --- a/src/grt/grt-sdf.adb +++ b/src/grt/grt-sdf.adb @@ -76,8 +76,8 @@ package body Grt.Sdf is N_Filename (N_Filename'Last) := ASCII.NUL; Sdf_Stream := fopen (N_Filename'Address, Mode'Address); if Sdf_Stream = NULL_Stream then - Error_C ("cannot open SDF file '"); - Error_C (Filename); + Error_S ("cannot open SDF file '"); + Diag_C (Filename); Error_E ("'"); return False; end if; @@ -127,8 +127,8 @@ package body Grt.Sdf is begin Len := Pos - Ident_Start; if Ident_Start = 1 or Len >= 1024 then - Error_C ("SDF line "); - Error_C (Sdf_Line); + Error_S ("SDF line "); + Diag_C (Sdf_Line); Error_E (" is too long"); return; end if; @@ -138,19 +138,19 @@ package body Grt.Sdf is Read_Sdf; end Read_Append; - procedure Error_Sdf_C is + procedure Error_S_Sdf is begin - Error_C (Sdf_Filename.all); - Error_C (":"); - Error_C (Sdf_Line); - Error_C (":"); - Error_C (Pos - Line_Start); - Error_C (": "); - end Error_Sdf_C; + Error_S (Sdf_Filename.all); + Diag_C (':'); + Diag_C (Sdf_Line); + Diag_C (':'); + Diag_C (Pos - Line_Start); + Diag_C (": "); + end Error_S_Sdf; procedure Error_Sdf (Msg : String) is begin - Error_Sdf_C; + Error_S_Sdf; Error_E (Msg); end Error_Sdf; @@ -159,8 +159,7 @@ package body Grt.Sdf is Error_Sdf ("bad character in SDF file"); end Error_Bad_Character; - procedure Scan_Identifier - is + procedure Scan_Identifier is begin Ident_Start := Pos; loop @@ -993,8 +992,8 @@ package body Grt.Sdf is end if; Vital_Annotate.Sdf_Generic (Sdf_Context.all, Name (1 .. Len), Ok); if not Ok then - Error_Sdf_C; - Error_C ("could not annotate generic "); + Error_S_Sdf; + Diag_C ("could not annotate generic "); Error_E (Name (1 .. Len)); return False; end if; diff --git a/src/grt/grt-signals.adb b/src/grt/grt-signals.adb index ffe53ea74..aad67dfdc 100644 --- a/src/grt/grt-signals.adb +++ b/src/grt/grt-signals.adb @@ -535,11 +535,11 @@ package body Grt.Signals is procedure Error_Trans_Error (Trans : Transaction_Acc) is begin - Error_C ("range check error on signal at "); - Error_C (Trans.File); - Error_C (":"); - Error_C (Natural (Trans.Line)); - Error_E (""); + Error_S ("range check error on signal at "); + Diag_C (Trans.File); + Diag_C (':'); + Diag_C (Trans.Line); + Error_E; end Error_Trans_Error; function Find_Driver (Sig : Ghdl_Signal_Ptr) return Ghdl_Index_Type diff --git a/src/grt/grt-values.adb b/src/grt/grt-values.adb index e64e7b943..df52eebe1 100644 --- a/src/grt/grt-values.adb +++ b/src/grt/grt-values.adb @@ -102,10 +102,10 @@ package body Grt.Values is return I; end if; end loop; - Error_C ("'value: '"); - Error_C_Std (S (Pos .. L - 1)); - Error_C ("' not in enumeration '"); - Error_C (Enum_Rti.Name); + Error_S ("'value: '"); + Diag_C_Std (S (Pos .. L - 1)); + Diag_C ("' not in enumeration '"); + Diag_C (Enum_Rti.Name); Error_E ("'"); end Value_Enum; @@ -612,10 +612,10 @@ package body Grt.Values is end if; end loop; if Multiple = null then - Error_C ("'value: unit '"); - Error_C_Std (S (Unit_Pos .. Len - 1)); - Error_C ("' not in physical type '"); - Error_C (Phys_Rti.Name); + Error_S ("'value: unit '"); + Diag_C_Std (S (Unit_Pos .. Len - 1)); + Diag_C ("' not in physical type '"); + Diag_C (Phys_Rti.Name); Error_E ("'"); end if; diff --git a/src/grt/grt-vcd.adb b/src/grt/grt-vcd.adb index 1337fdc76..180bfeeb9 100644 --- a/src/grt/grt-vcd.adb +++ b/src/grt/grt-vcd.adb @@ -121,7 +121,7 @@ package body Grt.Vcd is else Stream := fopen (Vcd_Filename.all'Address, Mode'Address); if Stream = NULL_Stream then - Error_C ("cannot open "); + Error_S ("cannot open "); Error_E (Vcd_Filename (Vcd_Filename'First .. Vcd_Filename'Last - 1)); return True; diff --git a/src/grt/grt-vcdz.adb b/src/grt/grt-vcdz.adb index b15a3c1b3..50446892b 100644 --- a/src/grt/grt-vcdz.adb +++ b/src/grt/grt-vcdz.adb @@ -82,7 +82,7 @@ package body Grt.Vcdz is Stream := gzopen (Vcd_Filename.all'Address, Mode'Address); if Stream = NULL_gzFile then - Error_C ("cannot open "); + Error_S ("cannot open "); Error_E (Vcd_Filename (Vcd_Filename'First .. Vcd_Filename'Last - 1)); return True; diff --git a/src/grt/grt-vital_annotate.adb b/src/grt/grt-vital_annotate.adb index 02c0beb02..ca0d9231a 100644 --- a/src/grt/grt-vital_annotate.adb +++ b/src/grt/grt-vital_annotate.adb @@ -447,7 +447,7 @@ package body Grt.Vital_Annotate is Ok := Write_Td_Delay_Generic (Context, Gen_El); end; else - Errors.Error_C ("vital: unhandled generic type for generic "); + Errors.Error_S ("vital: unhandled generic type for generic "); Errors.Error_E (Name); end if; end Sdf_Generic; @@ -487,8 +487,8 @@ package body Grt.Vital_Annotate is if E - 1 >= S then Find_Instance (Sdf_Top, Sdf_Top, Arg (S .. E - 1), Ok); if not Ok then - Error_C ("cannot find instance '"); - Error_C (Arg (S .. E - 1)); + Error_S ("cannot find instance '"); + Diag_C (Arg (S .. E - 1)); Error_E ("' for sdf annotation"); return; end if; @@ -497,8 +497,8 @@ package body Grt.Vital_Annotate is -- start annotation. if E >= Arg'Last or else Arg (E) /= '=' then - Error_C ("no filename in sdf option '"); - Error_C (Arg); + Error_S ("no filename in sdf option '"); + Diag_C (Arg); Error_E ("'"); return; end if; diff --git a/src/grt/grt-vpi.adb b/src/grt/grt-vpi.adb index 6b69d68c3..4efa39584 100644 --- a/src/grt/grt-vpi.adb +++ b/src/grt/grt-vpi.adb @@ -1683,8 +1683,8 @@ package body Grt.Vpi is Filename (Filename'Last) := NUL; Trace_File := fopen (Filename'Address, Mode'Address); if Trace_File = NULL_Stream then - Error_C ("cannot open vpi trace file '"); - Error_C (Opt (F + 12 .. Opt'Last)); + Error_S ("cannot open vpi trace file '"); + Diag_C (Opt (F + 12 .. Opt'Last)); Error_E ("'"); return False; end if; @@ -1692,8 +1692,8 @@ package body Grt.Vpi is elsif Opt'Length = 11 then Trace_File := stdout; else - Error_C ("incorrect option '"); - Error_C (Opt); + Error_S ("incorrect option '"); + Diag_C (Opt); Error_E ("'"); return False; end if; diff --git a/src/grt/grt-wave_opt-file.adb b/src/grt/grt-wave_opt-file.adb index da3e1f8ca..109dd98c7 100644 --- a/src/grt/grt-wave_opt-file.adb +++ b/src/grt/grt-wave_opt-file.adb @@ -197,11 +197,11 @@ package body Grt.Wave_Opt.File is or else Version.Minor > Current_Version.Minor then Print_Context (Line'First, Lineno, Error); - Error_C ("unsupported format version; it must be "); + Error_S ("unsupported format version; it must be "); if Current_Version.Minor /= 0 then - Error_C ("between "); + Diag_C ("between "); Print_Version (Version_Type'(Current_Version.Major, 0)); - Error_C (" and "); + Diag_C (" and "); end if; Print_Version (Current_Version); Error_E; @@ -417,22 +417,22 @@ package body Grt.Wave_Opt.File is if To_Be_Created then if Stream /= NULL_Stream then fclose (Stream); - Error_C ("'"); - Error_C (Option_File); + Error_S ("'"); + Diag_C (Option_File); Error_E ("' already exists and it won't be erased."); end if; State := Write_File; Stream := fopen (Option_File_C'Address, Write_Mode'Address); if Stream = NULL_Stream then - Error_C ("cannot create '"); - Error_C (Option_File); - Error_E ("'."); + Error_S ("cannot create '"); + Diag_C (Option_File); + Error_E ("'"); end if; Write_Version (Stream); elsif Stream = NULL_Stream then - Error_C ("cannot read '"); - Error_C (Option_File); - Error_E ("'."); + Error_S ("cannot read '"); + Diag_C (Option_File); + Error_E ("'"); end if; Initialize_Tree; diff --git a/src/grt/grt-wave_opt.adb b/src/grt/grt-wave_opt.adb index 65391e05d..4e94ee300 100644 --- a/src/grt/grt-wave_opt.adb +++ b/src/grt/grt-wave_opt.adb @@ -34,7 +34,7 @@ package body Grt.Wave_Opt is begin case Severity is when Error => - Error_C (""); + Error_S; when Warning => Report_C ("warning: "); end case; diff --git a/src/grt/grt-waves.adb b/src/grt/grt-waves.adb index ffb41e12c..74d764e67 100644 --- a/src/grt/grt-waves.adb +++ b/src/grt/grt-waves.adb @@ -310,7 +310,7 @@ package body Grt.Waves is else Wave_Stream := fopen (Wave_Filename.all'Address, Mode'Address); if Wave_Stream = NULL_Stream then - Error_C ("cannot open "); + Error_S ("cannot open "); Error_E (Wave_Filename (Wave_Filename'First .. Wave_Filename'Last - 1)); return; -- cgit v1.2.3