From 82b1fcbef441a0da9f649cf70c9aaad0f431decd Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 21 Nov 2007 11:07:40 -0800 Subject: [PATCH] Make min/typ/max default warning message universal. The min/typ/max default warning was not being produced in all locations a min/typ/max expression could be used. This patch adds the default warning code to all locations. It also modifies the manual page to explicitly state that only the first ten warnings are printed. --- driver/iverilog.man | 6 +++--- parse.y | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/driver/iverilog.man b/driver/iverilog.man index e71013bab..2d8a253c8 100644 --- a/driver/iverilog.man +++ b/driver/iverilog.man @@ -135,9 +135,9 @@ they will be used as root modules instead. .B -T\fImin|typ|max\fP Use this switch to select min, typ or max times from min:typ:max expressions. Normally, the compiler will simply use the typ value from -these expressions (with a warning) but this switch will tell the -compiler explicitly which value to use. This will suppress the -warning that the compiler is making a choice. +these expressions (printing a warning for the first ten it finds) but +this switch will tell the compiler explicitly which value to use. This +will suppress the warning that the compiler is making a choice. .TP 8 .B -t\fItarget\fP Use this switch to specify the target output format. See the diff --git a/parse.y b/parse.y index dfd6f39e5..c2614ce86 100644 --- a/parse.y +++ b/parse.y @@ -977,6 +977,22 @@ expr_mintypmax $$ = $5; break; } + if (min_typ_max_warn > 0) { + cerr << $$->get_line() << ": warning: choosing "; + switch (min_typ_max_flag) { + case MIN: + cerr << "min"; + break; + case TYP: + cerr << "typ"; + break; + case MAX: + cerr << "max"; + break; + } + cerr << " expression." << endl; + min_typ_max_warn -= 1; + } } ; @@ -2840,6 +2856,22 @@ specparam tmp = $7; break; } + if (min_typ_max_warn > 0) { + cerr << tmp->get_line() << ": warning: choosing "; + switch (min_typ_max_flag) { + case MIN: + cerr << "min"; + break; + case TYP: + cerr << "typ"; + break; + case MAX: + cerr << "max"; + break; + } + cerr << " expression." << endl; + min_typ_max_warn -= 1; + } pform_set_specparam(lex_strings.make($1), tmp); delete $1; }