aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-04 18:36:35 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-04 18:36:35 +0100
commit2361fe47fa6bdb23f0b801ca646bf6c5983de5f8 (patch)
tree4479d68930936cd6ba3bb9d7ee4a6f5839485244 /src/ghdldrv
parent05b8fe710d53d0db9c8d956bf9aa8bec526ac079 (diff)
downloadghdl-2361fe47fa6bdb23f0b801ca646bf6c5983de5f8.tar.gz
ghdl-2361fe47fa6bdb23f0b801ca646bf6c5983de5f8.tar.bz2
ghdl-2361fe47fa6bdb23f0b801ca646bf6c5983de5f8.zip
Warn on unexpected options for command '-a'. Fix #1066
Diffstat (limited to 'src/ghdldrv')
-rw-r--r--src/ghdldrv/ghdlcomp.adb2
-rw-r--r--src/ghdldrv/ghdldrv.adb3
-rw-r--r--src/ghdldrv/ghdllocal.adb14
-rw-r--r--src/ghdldrv/ghdllocal.ads4
4 files changed, 23 insertions, 0 deletions
diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb
index 5a5ae3536..c0915af98 100644
--- a/src/ghdldrv/ghdlcomp.adb
+++ b/src/ghdldrv/ghdlcomp.adb
@@ -444,6 +444,8 @@ package body Ghdlcomp is
raise Compilation_Error;
end if;
+ Expect_Filenames (Args);
+
Hooks.Compile_Init.all (True);
-- Parse all files.
diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index 4d4ebfa61..c382f22bf 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -907,6 +907,9 @@ package body Ghdldrv is
Error ("no file to analyze");
raise Option_Error;
end if;
+
+ Expect_Filenames (Args);
+
Setup_Compiler (False);
for I in Args'Range loop
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index 40f2eb984..3baea8889 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -1707,6 +1707,20 @@ package body Ghdllocal is
end if;
end Extract_Elab_Unit;
+ procedure Expect_Filenames (Args : Argument_List)
+ is
+ use Errorout;
+ begin
+ for I in Args'Range loop
+ if Args (I)(Args (I)'First) = '-' then
+ Warning_Msg_Option
+ (Warnid_Unexpected_Option,
+ "no option expected after files, use ./" & Args (I).all);
+ exit;
+ end if;
+ end loop;
+ end Expect_Filenames;
+
-- Command Elab_Order.
type Command_Elab_Order is new Command_Lib with null record;
function Decode_Command (Cmd : Command_Elab_Order; Name : String)
diff --git a/src/ghdldrv/ghdllocal.ads b/src/ghdldrv/ghdllocal.ads
index 042c51d87..230ddd7f5 100644
--- a/src/ghdldrv/ghdllocal.ads
+++ b/src/ghdldrv/ghdllocal.ads
@@ -156,5 +156,9 @@ package Ghdllocal is
-- name is incorrect.
function Decode_Generic_Override_Option (Opt : String) return Option_State;
+ -- Emit a warning if an argument is not a filename (ie looks like an
+ -- option).
+ procedure Expect_Filenames (Args : Argument_List);
+
procedure Register_Commands;
end Ghdllocal;