diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | src/grt/grt-errors.adb | 20 | ||||
-rw-r--r-- | src/grt/grt-errors.ads | 5 | ||||
-rw-r--r-- | src/grt/grt-main.adb | 4 | ||||
-rwxr-xr-x | testsuite/gna/issue228/testsuite.sh | 2 |
5 files changed, 28 insertions, 8 deletions
@@ -1,6 +1,9 @@ NEWS for ghdl (Dunoon Edition) -New in 0.34 (XXXX-XX-XX) +New in 0.35 (XXXX-XX-XX) +* Assert and report messages are sent to stdout (#394) + +New in 0.34 (2017-08-15) * Display stack backtraces on errors or assert failures * Compile scripts for vendor libraries (Xilinx, Altera, osvvm, vunit) * Use SSE2 for mcode backend diff --git a/src/grt/grt-errors.adb b/src/grt/grt-errors.adb index 9a48de48e..28ee85963 100644 --- a/src/grt/grt-errors.adb +++ b/src/grt/grt-errors.adb @@ -29,6 +29,14 @@ with Grt.Hooks; use Grt.Hooks; with Grt.Backtraces; package body Grt.Errors is + -- Output stream to send error messages + Out_Stream : FILEs; + + procedure Set_Out_Stream (Stream : Grt.Stdio.FILEs) is + begin + Out_Stream := Stream; + end Set_Out_Stream; + -- Called in case of premature exit. -- CODE is 0 for success, 1 for failure. procedure Ghdl_Exit (Code : Integer); @@ -74,27 +82,27 @@ package body Grt.Errors is procedure Put_Err (Str : String) is begin - Put (stderr, Str); + Put (Out_Stream, Str); end Put_Err; procedure Put_Err (C : Character) is begin - Put (stderr, C); + Put (Out_Stream, C); end Put_Err; procedure Put_Err (Str : Ghdl_C_String) is begin - Put (stderr, Str); + Put (Out_Stream, Str); end Put_Err; procedure Put_Err (N : Integer) is begin - Put_I32 (stderr, Ghdl_I32 (N)); + Put_I32 (Out_Stream, Ghdl_I32 (N)); end Put_Err; procedure Newline_Err is begin - New_Line (stderr); + New_Line (Out_Stream); end Newline_Err; -- procedure Put_Err (Str : Ghdl_Str_Len_Type) @@ -133,7 +141,7 @@ package body Grt.Errors is procedure Report_Now_C is begin - Put_Time (stderr, Grt.Types.Current_Time); + Put_Time (Out_Stream, Grt.Types.Current_Time); end Report_Now_C; procedure Report_E (Str : String) is diff --git a/src/grt/grt-errors.ads b/src/grt/grt-errors.ads index 974ef3820..b7ee4c24d 100644 --- a/src/grt/grt-errors.ads +++ b/src/grt/grt-errors.ads @@ -24,10 +24,15 @@ -- covered by the GNU Public License. with Grt.Types; use Grt.Types; with Grt.Hooks; +with Grt.Stdio; package Grt.Errors is pragma Preelaborate (Grt.Errors); + -- Set the stream for error messages. Must be called before using this + -- package. + procedure Set_Out_Stream (Stream : Grt.Stdio.FILEs); + -- Multi-call error procedure. -- Start and continue with Error_C, finish by an Error_E. procedure Error_C (Str : String); diff --git a/src/grt/grt-main.adb b/src/grt/grt-main.adb index 4c37e1da7..7bc2bd57f 100644 --- a/src/grt/grt-main.adb +++ b/src/grt/grt-main.adb @@ -25,6 +25,7 @@ with System.Storage_Elements; -- Work around GNAT bug. pragma Unreferenced (System.Storage_Elements); with Grt.Types; use Grt.Types; +with Grt.Stdio; with Grt.Errors; with Grt.Processes; with Grt.Signals; @@ -110,6 +111,9 @@ package body Grt.Main is Stop : Boolean; Status : Integer; begin + -- Set stream for error messages + Grt.Errors.Set_Out_Stream (Grt.Stdio.stdout); + -- Register modules. -- They may insert hooks. Grt.Modules.Register_Modules; diff --git a/testsuite/gna/issue228/testsuite.sh b/testsuite/gna/issue228/testsuite.sh index 437efa718..02c617f6c 100755 --- a/testsuite/gna/issue228/testsuite.sh +++ b/testsuite/gna/issue228/testsuite.sh @@ -4,7 +4,7 @@ GHDL_STD_FLAGS=-fpsl analyze tb.vhdl -elab_simulate foo_tb 2>sim_log.txt +elab_simulate foo_tb >sim_log.txt run "grep -q 'falling_a0 custom report' sim_log.txt" run_failure "grep -q 'sequence covered' sim_log.txt" |