Skip to content

Commit e7428ec

Browse files
committed
Move --ieee-warnings to global options. Issue #1151
1 parent 9978205 commit e7428ec

File tree

6 files changed

+67
-26
lines changed

6 files changed

+67
-26
lines changed

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
original spelling of VHDL identifiers (#723).
3030
- Fixed wrong result of VHDL-2019 `std.env.file_path` when the source
3131
file was analysed using a relative path (#1162).
32+
- `--ieee-warnings` is now a global option and should be placed before
33+
the `-r` command. Passing it to the `-r` command is still supported
34+
but deprecated and may not take effect in some situations (#1151).
3235

3336
## Version 1.15.1 - 2025-01-22
3437
- Fixed a crash when a subprogram is called with too many named arguments

contrib/nvc.bash

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ _nvc () {
4242

4343
local global_opts='-L -h --help --messages= --std= -v --version --init --list
4444
--install --work= -a -e -r -i --dump --print-deps --load=
45-
--map= --do --cover-report --cover-export --cover-merge'
45+
--map= --do --cover-report --cover-export --cover-merge
46+
--ieee-warnings='
4647
local analyse_opts='-D --define= --error-limit= --relaxed --psl --error-limit=
47-
-f --files --no-save'
48+
-f --files --no-save --preserve-case'
4849
local elab_opts='--cover --disable-opt --dump-llvm --dump-vcode --jit --no-save
4950
--native -V --verbose'
50-
local run_opts='--trace --stop-time= --ieee-warnings= --stats= --stop-delta=
51+
local run_opts='--trace --stop-time= --stats= --stop-delta=
5152
-w --wave --format='
5253
local export_opts='--format= -o --output='
5354
local merge_opts='-o --output='

nvc.1

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ operator. The
113113
parameter takes an optional k, m, or g suffix to indicate kilobytes,
114114
megabytes, and gigabytes respectively. The default size is 16
115115
megabytes.
116+
.\" --ieee-warnings
117+
.It Fl \-ieee-warnings= Ns Bo Cm on Ns | Ns Cm off Bc
118+
Enable or disable warning messages from the standard IEEE packages. The
119+
default is warnings enabled.
116120
.\" --ignore-time
117121
.It Fl \-ignore-time
118122
Do not check the timestamps of source files when the corresponding
@@ -392,10 +396,6 @@ order with separators for each scope.
392396
This only makes sense in combination with the
393397
.Fl \-wave
394398
option.
395-
.\" --ieee-warnings
396-
.It Fl \-ieee-warnings= Ns Bo Cm on Ns | Ns Cm off Bc
397-
Enable or disable warning messages from the standard IEEE packages. The
398-
default is warnings enabled.
399399
.\" --include, --exclude
400400
.It Fl \-include= Ns Ar glob , Fl \-exclude= Ns Ar glob
401401
Signals that match

src/nvc.c

+33-19
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ static int run_cmd(int argc, char **argv, cmd_state_t *state)
755755
{ "stop-delta", required_argument, 0, 'd' },
756756
{ "format", required_argument, 0, 'f' },
757757
{ "include", required_argument, 0, 'i' },
758-
{ "ieee-warnings", required_argument, 0, 'I' },
758+
{ "ieee-warnings", required_argument, 0, 'I' }, // DEPRECATED 1.16
759759
{ "exclude", required_argument, 0, 'e' },
760760
{ "exit-severity", required_argument, 0, 'x' },
761761
{ "dump-arrays", optional_argument, 0, 'a' },
@@ -847,7 +847,17 @@ static int run_cmd(int argc, char **argv, cmd_state_t *state)
847847
parse_exit_severity(optarg);
848848
break;
849849
case 'I':
850-
opt_set_int(OPT_IEEE_WARNINGS, parse_on_off(optarg));
850+
{
851+
const bool on = parse_on_off(optarg);
852+
853+
// TODO: add an unconditional warning after 1.16
854+
if (state->jit != NULL && opt_get_int(OPT_IEEE_WARNINGS) != on)
855+
warnf("the $bold$--ieee-warnings$$ option may have no affect "
856+
"as the IEEE packages have already been initialised, pass "
857+
"$bold$--ieee-warnings$$ as a global option instead");
858+
859+
opt_set_int(OPT_IEEE_WARNINGS, on);
860+
}
851861
break;
852862
case 'a':
853863
if (optarg == NULL)
@@ -862,7 +872,7 @@ static int run_cmd(int argc, char **argv, cmd_state_t *state)
862872
opt_set_int(OPT_SHUFFLE_PROCS, 1);
863873
break;
864874
default:
865-
abort();
875+
should_not_reach_here();
866876
}
867877
}
868878

@@ -2069,6 +2079,8 @@ static void usage(void)
20692079
"Global options may be placed before COMMAND:\n"
20702080
" -h, --help\t\tDisplay this message and exit\n"
20712081
" -H SIZE\t\tSet the maximum heap size to SIZE bytes\n"
2082+
" --ieee-warnings=\tEnable ('on') or disable ('off') warnings\n"
2083+
" \tfrom IEEE packages\n"
20722084
" --ignore-time\tSkip source file timestamp check\n"
20732085
" --load=PLUGIN\tLoad VHPI plugin at startup\n"
20742086
" -L PATH\t\tAdd PATH to library search paths\n"
@@ -2116,8 +2128,6 @@ static void usage(void)
21162128
" --exit-severity=\tExit after assertion failure of "
21172129
"this severity\n"
21182130
" --format=FMT\tWaveform format is either fst or vcd\n"
2119-
" --ieee-warnings=\tEnable ('on') or disable ('off') warnings\n"
2120-
" \tfrom IEEE packages\n"
21212131
" --include=GLOB\tInclude signals matching GLOB in wave dump\n"
21222132
" --shuffle\t\tRun processes in random order\n"
21232133
" --stats\t\tPrint time and memory usage at end of run\n"
@@ -2331,19 +2341,20 @@ int main(int argc, char **argv)
23312341
atexit(fbuf_cleanup);
23322342

23332343
static struct option long_options[] = {
2334-
{ "help", no_argument, 0, 'h' },
2335-
{ "version", no_argument, 0, 'v' },
2336-
{ "work", required_argument, 0, 'w' },
2337-
{ "std", required_argument, 0, 's' },
2338-
{ "messages", required_argument, 0, 'I' },
2339-
{ "native", no_argument, 0, 'n' }, // DEPRECATED 1.4
2340-
{ "map", required_argument, 0, 'p' },
2341-
{ "ignore-time", no_argument, 0, 'i' },
2342-
{ "force-init", no_argument, 0, 'f' }, // DEPRECATED 1.7
2343-
{ "stderr", required_argument, 0, 'E' },
2344-
{ "load", required_argument, 0, 'l' },
2345-
{ "vhpi-debug", no_argument, 0, 'D' },
2346-
{ "vhpi-trace", no_argument, 0, 'T' },
2344+
{ "help", no_argument, 0, 'h' },
2345+
{ "version", no_argument, 0, 'v' },
2346+
{ "work", required_argument, 0, 'w' },
2347+
{ "std", required_argument, 0, 's' },
2348+
{ "messages", required_argument, 0, 'I' },
2349+
{ "native", no_argument, 0, 'n' }, // DEPRECATED 1.4
2350+
{ "map", required_argument, 0, 'p' },
2351+
{ "ieee-warnings", required_argument, 0, 'W' },
2352+
{ "ignore-time", no_argument, 0, 'i' },
2353+
{ "force-init", no_argument, 0, 'f' }, // DEPRECATED 1.7
2354+
{ "stderr", required_argument, 0, 'E' },
2355+
{ "load", required_argument, 0, 'l' },
2356+
{ "vhpi-debug", no_argument, 0, 'D' },
2357+
{ "vhpi-trace", no_argument, 0, 'T' },
23472358
{ 0, 0, 0, 0 }
23482359
};
23492360

@@ -2415,12 +2426,15 @@ int main(int argc, char **argv)
24152426
case 'D':
24162427
opt_set_int(OPT_PLI_DEBUG, 1);
24172428
break;
2429+
case 'W':
2430+
opt_set_int(OPT_IEEE_WARNINGS, parse_on_off(optarg));
2431+
break;
24182432
case '?':
24192433
bad_option("global", argv);
24202434
case ':':
24212435
missing_argument("global", argv);
24222436
default:
2423-
abort();
2437+
should_not_reach_here();
24242438
}
24252439
}
24262440

test/regress/cmdline14.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
set -xe
2+
3+
nvc -a - <<-EOF
4+
library ieee;
5+
use ieee.std_logic_1164.all;
6+
use ieee.numeric_std.all;
7+
entity cmdline14 is
8+
end entity;
9+
architecture test of cmdline14 is
10+
signal x : integer;
11+
signal y : unsigned(7 downto 0) := to_unsigned(42, 8);
12+
begin
13+
y <= (others => 'X');
14+
x <= to_integer(y);
15+
end architecture;
16+
EOF
17+
18+
nvc --ieee-warnings=on -e cmdline14 --jit --no-save -r cmdline14 2>err
19+
grep "NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0" err
20+
21+
nvc --ieee-warnings=off -e cmdline14 --jit --no-save -r cmdline14 2>err
22+
! grep "NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0" err

test/regress/testlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1101,3 +1101,4 @@ debug4 normal,gold
11011101
issue1150 normal,psl
11021102
order4 shell
11031103
issue1161 normal,vhpi,2008
1104+
cmdline14 shell

0 commit comments

Comments
 (0)