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.
This commit is contained in:
Cary R 2007-11-21 11:07:40 -08:00 committed by Stephen Williams
parent 5d80c4856d
commit 82b1fcbef4
2 changed files with 35 additions and 3 deletions

View File

@ -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

32
parse.y
View File

@ -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;
}