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:
parent
fa0ecb3761
commit
ef814a9ef4
|
|
@ -82,6 +82,9 @@ extern bool warn_timescale;
|
||||||
/* Warn about legal but questionable module port bindings. */
|
/* Warn about legal but questionable module port bindings. */
|
||||||
extern bool warn_portbinding;
|
extern bool warn_portbinding;
|
||||||
|
|
||||||
|
/* Warn about constant out of bound selects. */
|
||||||
|
extern bool warn_ob_select;
|
||||||
|
|
||||||
/* Warn about structures that may have infinite loops. */
|
/* Warn about structures that may have infinite loops. */
|
||||||
extern bool warn_inf_loop;
|
extern bool warn_inf_loop;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,8 @@ after a \fB-Wall\fP argument to suppress isolated warning types.
|
||||||
|
|
||||||
.TP 8
|
.TP 8
|
||||||
.B all
|
.B all
|
||||||
This enables all supported warning categories.
|
This enables the implicit, portbind, select-range and timescale warning
|
||||||
|
categories.
|
||||||
|
|
||||||
.TP 8
|
.TP 8
|
||||||
.B implicit
|
.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,
|
connected but probably should be. Dangling input ports, for example,
|
||||||
will generate a warning.
|
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
|
.TP 8
|
||||||
.B timescale
|
.B timescale
|
||||||
This enables warnings for inconsistent use of the timescale
|
This enables warnings for inconsistent use of the timescale
|
||||||
|
|
|
||||||
|
|
@ -469,6 +469,7 @@ static void process_warning_switch(const char*name)
|
||||||
if (strcmp(name,"all") == 0) {
|
if (strcmp(name,"all") == 0) {
|
||||||
process_warning_switch("implicit");
|
process_warning_switch("implicit");
|
||||||
process_warning_switch("portbind");
|
process_warning_switch("portbind");
|
||||||
|
process_warning_switch("select-range");
|
||||||
process_warning_switch("timescale");
|
process_warning_switch("timescale");
|
||||||
} else if (strcmp(name,"implicit") == 0) {
|
} else if (strcmp(name,"implicit") == 0) {
|
||||||
if (! strchr(warning_flags, 'i'))
|
if (! strchr(warning_flags, 'i'))
|
||||||
|
|
@ -476,6 +477,9 @@ static void process_warning_switch(const char*name)
|
||||||
} else if (strcmp(name,"portbind") == 0) {
|
} else if (strcmp(name,"portbind") == 0) {
|
||||||
if (! strchr(warning_flags, 'p'))
|
if (! strchr(warning_flags, 'p'))
|
||||||
strcat(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) {
|
} else if (strcmp(name,"timescale") == 0) {
|
||||||
if (! strchr(warning_flags, 't'))
|
if (! strchr(warning_flags, 't'))
|
||||||
strcat(warning_flags, "t");
|
strcat(warning_flags, "t");
|
||||||
|
|
@ -496,6 +500,12 @@ static void process_warning_switch(const char*name)
|
||||||
cp[0] = cp[1];
|
cp[0] = cp[1];
|
||||||
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) {
|
} else if (strcmp(name,"no-timescale") == 0) {
|
||||||
char*cp = strchr(warning_flags, 't');
|
char*cp = strchr(warning_flags, 't');
|
||||||
if (cp) while (*cp) {
|
if (cp) while (*cp) {
|
||||||
|
|
|
||||||
4
main.cc
4
main.cc
|
|
@ -115,6 +115,7 @@ bool warn_implicit = false;
|
||||||
bool warn_timescale = false;
|
bool warn_timescale = false;
|
||||||
bool warn_portbinding = false;
|
bool warn_portbinding = false;
|
||||||
bool warn_inf_loop = false;
|
bool warn_inf_loop = false;
|
||||||
|
bool warn_ob_select = false;
|
||||||
|
|
||||||
bool error_implicit = false;
|
bool error_implicit = false;
|
||||||
|
|
||||||
|
|
@ -491,6 +492,9 @@ static void read_iconfig_file(const char*ipath)
|
||||||
case 'l':
|
case 'l':
|
||||||
warn_inf_loop = true;
|
warn_inf_loop = true;
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
warn_ob_select = true;
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
warn_portbinding = true;
|
warn_portbinding = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue