aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ghdldrv/ghdldrv.adb11
-rw-r--r--src/ghdldrv/ghdllocal.adb5
-rw-r--r--src/ghdldrv/ghdllocal.ads2
-rw-r--r--src/options.adb5
-rw-r--r--src/options.ads2
-rw-r--r--src/vhdl/errorout.adb5
-rw-r--r--src/vhdl/translate/ortho_front.adb15
7 files changed, 30 insertions, 15 deletions
diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index a15736222..3cd7c1f74 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -603,8 +603,8 @@ package body Ghdldrv is
Arg : String;
Res : out Option_Res)
is
- Str : String_Access;
Opt : constant String (1 .. Option'Length) := Option;
+ Str : String_Access;
begin
Res := Option_Bad;
if Opt = "-v" and then Flag_Verbose = False then
@@ -687,7 +687,14 @@ package body Ghdldrv is
-- compiler_args.
null;
else
- Add_Argument (Compiler_Args, new String'(Opt));
+ if Backend = Backend_Gcc then
+ -- Prefix options for gcc so that lang.opt does need to be
+ -- updated when a new option is added.
+ Str := new String'("--ghdl" & Opt);
+ else
+ Str := new String'(Opt);
+ end if;
+ Add_Argument (Compiler_Args, Str);
end if;
Res := Option_Ok;
elsif Opt'Length > 18
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index 030cf118e..5841f1b4f 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -56,10 +56,9 @@ package body Ghdllocal is
Compile_Init;
end Init;
- function Decode_Driver_Option (Option : String) return Boolean
+ function Decode_Driver_Option (Opt : String) return Boolean
is
- subtype Opt_String is String (1 .. Option'Length);
- Opt : Opt_String renames Option;
+ pragma Assert (Opt'First = 1);
begin
if Opt = "-v" and then Flag_Verbose = False then
Flag_Verbose := True;
diff --git a/src/ghdldrv/ghdllocal.ads b/src/ghdldrv/ghdllocal.ads
index ff66c4d59..3189c58cc 100644
--- a/src/ghdldrv/ghdllocal.ads
+++ b/src/ghdldrv/ghdllocal.ads
@@ -25,7 +25,7 @@ package Ghdllocal is
-- Handle:
-- --std=xx, --work=xx, -Pxxx, --workdir=x, --ieee=x, -Px, and -v
- function Decode_Driver_Option (Option : String) return Boolean;
+ function Decode_Driver_Option (Opt : String) return Boolean;
type Command_Lib is abstract new Command_Type with null record;
diff --git a/src/options.adb b/src/options.adb
index 98f2352f9..a627bde04 100644
--- a/src/options.adb
+++ b/src/options.adb
@@ -63,10 +63,9 @@ package body Options is
return False;
end Option_Warning;
- function Parse_Option (Option : String) return Boolean
+ function Parse_Option (Opt : String) return Boolean
is
- subtype Option_String is String (1 .. Option'Length);
- Opt : Option_String renames Option;
+ pragma Assert (Opt'First = 1);
begin
if Opt'Last > 5 and then Opt (1 .. 6) = "--std=" then
if Opt'Length = 8 then
diff --git a/src/options.ads b/src/options.ads
index 0567cc200..68acc8c75 100644
--- a/src/options.ads
+++ b/src/options.ads
@@ -20,7 +20,7 @@ package Options is
-- Return true if opt is recognize by flags.
-- Note: std_names.std_names_initialize and files_map.init_paths must have
-- been called before this subprogram.
- function Parse_Option (Option : String) return Boolean;
+ function Parse_Option (Opt : String) return Boolean;
-- Disp help about these options.
procedure Disp_Options_Help;
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