Add a -Wselect-range warning class.

This patch adds support for a -Wselect-range warning class to the
driver and ivl programs. This is part of -Wall. The actual checks
will be added in a later patch.

Cherry-picked from e576e1eb2c
This commit is contained in:
Cary R 2009-08-25 10:31:08 -07:00 committed by Stephen Williams
parent fa0ecb3761
commit ef814a9ef4
4 changed files with 25 additions and 1 deletions

View File

@ -82,6 +82,9 @@ extern bool warn_timescale;
/* Warn about legal but questionable module port bindings. */
extern bool warn_portbinding;
/* Warn about constant out of bound selects. */
extern bool warn_ob_select;
/* Warn about structures that may have infinite loops. */
extern bool warn_inf_loop;

View File

@ -254,7 +254,8 @@ after a \fB-Wall\fP argument to suppress isolated warning types.
.TP 8
.B all
This enables all supported warning categories.
This enables the implicit, portbind, select-range and timescale warning
categories.
.TP 8
.B implicit
@ -268,6 +269,12 @@ This enables warnings for ports of module instantiations that are not
connected but probably should be. Dangling input ports, for example,
will generate a warning.
.TP 8
.B select-range
This enables warnings for constant out of bound selects. This includes
partial or fully out of bound selects as well as a select using 'bx as
an index.
.TP 8
.B timescale
This enables warnings for inconsistent use of the timescale

View File

@ -469,6 +469,7 @@ static void process_warning_switch(const char*name)
if (strcmp(name,"all") == 0) {
process_warning_switch("implicit");
process_warning_switch("portbind");
process_warning_switch("select-range");
process_warning_switch("timescale");
} else if (strcmp(name,"implicit") == 0) {
if (! strchr(warning_flags, 'i'))
@ -476,6 +477,9 @@ static void process_warning_switch(const char*name)
} else if (strcmp(name,"portbind") == 0) {
if (! strchr(warning_flags, 'p'))
strcat(warning_flags, "p");
} else if (strcmp(name,"select-range") == 0) {
if (! strchr(warning_flags, 's'))
strcat(warning_flags, "s");
} else if (strcmp(name,"timescale") == 0) {
if (! strchr(warning_flags, 't'))
strcat(warning_flags, "t");
@ -496,6 +500,12 @@ static void process_warning_switch(const char*name)
cp[0] = cp[1];
cp += 1;
}
} else if (strcmp(name,"no-select-range") == 0) {
char*cp = strchr(warning_flags, 's');
if (cp) while (*cp) {
cp[0] = cp[1];
cp += 1;
}
} else if (strcmp(name,"no-timescale") == 0) {
char*cp = strchr(warning_flags, 't');
if (cp) while (*cp) {

View File

@ -115,6 +115,7 @@ bool warn_implicit = false;
bool warn_timescale = false;
bool warn_portbinding = false;
bool warn_inf_loop = false;
bool warn_ob_select = false;
bool error_implicit = false;
@ -491,6 +492,9 @@ static void read_iconfig_file(const char*ipath)
case 'l':
warn_inf_loop = true;
break;
case 's':
warn_ob_select = true;
break;
case 'p':
warn_portbinding = true;
break;