From 0978b48007afe920d8f7000c2c8722327c901259 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 26 Jan 2021 07:49:57 +0100 Subject: grt: add Error_NF to report final error status. Fix #803 --- src/grt/grt-errors.adb | 7 +++++++ src/grt/grt-errors.ads | 4 ++++ src/grt/grt-main.adb | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/grt/grt-errors.adb b/src/grt/grt-errors.adb index 704132368..48cdd1870 100644 --- a/src/grt/grt-errors.adb +++ b/src/grt/grt-errors.adb @@ -202,6 +202,13 @@ package body Grt.Errors is Error_E; end Error; + procedure Error_NF (Str : String) is + begin + Error_S (Str); + Newline_Err; + Exit_Status := 1; + end Error_NF; + procedure Info_S (Str : String := "") is begin Put_Err (Progname); diff --git a/src/grt/grt-errors.ads b/src/grt/grt-errors.ads index f70a77764..371908fad 100644 --- a/src/grt/grt-errors.ads +++ b/src/grt/grt-errors.ads @@ -80,6 +80,10 @@ package Grt.Errors is Line : Ghdl_I32); pragma No_Return (Error); + -- Non-fatal error (for the final message in case of previous error). + -- Set the exit status. + procedure Error_NF (Str : String); + -- Warning message. procedure Warning (Str : String); diff --git a/src/grt/grt-main.adb b/src/grt/grt-main.adb index e97b02eea..71b148467 100644 --- a/src/grt/grt-main.adb +++ b/src/grt/grt-main.adb @@ -180,11 +180,11 @@ package body Grt.Main is if Expect_Failure then if Status >= 0 then Expect_Failure := False; - Error ("error expected, but none occurred"); + Error_NF ("error expected, but none occurred"); end if; else if Status < 0 then - Error ("simulation failed"); + Error_NF ("simulation failed"); end if; end if; end Run_Finish; -- cgit v1.2.3