diff --git a/Changes b/Changes index e7e34cb15..9ec04f4ca 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks! * Verilator 4.015 devel +*** Add --quiet-exit, bug1436. [Todd Strader] + **** Support VerilatedFstC set_time_unit, bug1433. [Pieter Kapsenberg] **** Fix sign-compare warning in verilated.cpp, bug1437. [Sergey Kvachonok] diff --git a/bin/verilator b/bin/verilator index f59a41fde..5535b1417 100755 --- a/bin/verilator +++ b/bin/verilator @@ -42,6 +42,7 @@ autoflush STDERR 1; $Debug = 0; my $opt_gdb; my $opt_gdbbt; +my $opt_quiet_exit; # No arguments can't do anything useful. Give help if ($#ARGV < 0) { @@ -58,7 +59,7 @@ foreach my $sw (@ARGV) { } Getopt::Long::config("no_auto_abbrev","pass_through"); -if (! GetOptions( +if (! GetOptions ( # Major operating modes "help" => \&usage, "debug:s" => \&debug, @@ -66,6 +67,7 @@ if (! GetOptions( # Switches "gdb!" => \$opt_gdb, "gdbbt!" => \$opt_gdbbt, + "quiet-exit!" => \$opt_quiet_exit, # Additional parameters "<>" => sub {}, # Ignored )) { @@ -195,7 +197,14 @@ sub run { warn "%Error: Verilator threw signal $status. Consider trying --debug --gdbbt\n" if !$Debug; } } - die "%Error: Command Failed $command\n"; + if ($opt_quiet_exit) { + # Same return code as die + exit $! if $!; # errno + exit $? >> 8 if $? >> 8; # child exit status + exit 255; # last resort + } else { + die "%Error: Command Failed $command\n"; + } } } @@ -346,6 +355,7 @@ detailed descriptions in L for more information. --private Debugging; see docs --public Debugging; see docs -pvalue+= Overwrite toplevel parameter + --quiet-exit Don't print the command on failure --relative-includes Resolve includes relative to current file --no-relative-cfuncs Disallow 'this->' in generated functions --report-unoptflat Extra diagnostics for UNOPTFLAT @@ -1157,6 +1167,10 @@ inlining. This will also turn off inlining as if all modules had a Overwrites the given parameter(s) of the toplevel module. See -G for a detailed description. +=item --quiet-exit + +When exiting due to an error, do not display the "Command Failed" message. + =item --relative-includes When a file references an include file, resolve the filename relative to diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 6bfdc3a76..03422d7a8 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1014,6 +1014,9 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char else if ( !strcmp (sw, "-gdbbt")) { // Used only in perl shell } + else if ( !strcmp (sw, "-quiet-exit")) { + // Used only in perl shell + } else if ( !strcmp (sw, "-mod-prefix") && (i+1) 1); + +top_filename("t/t_file_does_not_exist.v"); + +# Tests for the error message and then the absence of the +# "Command Failed" line +compile( + v_flags2 => ["--quiet-exit"], + fails => 1, + expect => +'%Error: Exiting due to \d+ error\(s\) +((?!Command Failed).)*$', + ); + +ok(1); +1;