From 577172e2a52076f4099fcdf4bf8a69649488f514 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 4 Jan 2019 16:37:07 +0100 Subject: errorout: discard disabled warnings. Fix #729 --- src/vhdl/errorout.adb | 5 +++++ src/vhdl/translate/ortho_front.adb | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb index 5c79be69c..90d30e138 100644 --- a/src/vhdl/errorout.adb +++ b/src/vhdl/errorout.adb @@ -212,6 +212,11 @@ package body Errorout is Line_Pos : Source_Ptr; pragma Unreferenced (Line_Pos); begin + -- Discard warnings that aren't enabled. + if Id in Msgid_Warnings and then not Is_Warning_Enabled (Id) then + return; + end if; + -- Reclassify warnings to errors if -Werror. if Flags.Warn_Error and then (Id = Msgid_Warning or Id in Msgid_Warnings) diff --git a/src/vhdl/translate/ortho_front.adb b/src/vhdl/translate/ortho_front.adb index f17713b0f..09c44c7aa 100644 --- a/src/vhdl/translate/ortho_front.adb +++ b/src/vhdl/translate/ortho_front.adb @@ -221,11 +221,16 @@ package body Ortho_Front is Flag_Expect_Failure := True; return 1; elsif Opt'Length > 7 and then Opt (1 .. 7) = "--ghdl-" then - if Options.Parse_Option (Opt (7 .. Opt'Last)) then - return 1; - else - return 0; - end if; + declare + subtype Str_Type is String (1 .. Opt'Last - 6); + begin + -- The option paraeter must be normalized (starts at index 1). + if Options.Parse_Option (Str_Type (Opt (7 .. Opt'Last))) then + return 1; + else + return 0; + end if; + end; elsif Options.Parse_Option (Opt.all) then return 1; else -- cgit v1.2.3