Convert unnamed error to new PKGNODECL error.

This commit is contained in:
Wilson Snyder 2020-08-22 16:37:49 -04:00
parent 583605b218
commit 2abbd5c145
5 changed files with 13 additions and 6 deletions

View File

@ -4645,6 +4645,12 @@ signal.
Disabled by default as this is a code style warning; it will simulate Disabled by default as this is a code style warning; it will simulate
correctly. correctly.
=item PKGNODECL
Error that a package/class appears to have been referenced that has not yet
been declared. According to IEEE 1800-2017 26.3 all packages must be
declared before being used.
=item PROCASSWIRE =item PROCASSWIRE
Error that a procedural assignment is setting a wire. According to IEEE, a Error that a procedural assignment is setting a wire. According to IEEE, a

View File

@ -51,6 +51,7 @@ public:
I_DEF_NETTYPE_WIRE, // `default_nettype is WIRE (false=NONE) I_DEF_NETTYPE_WIRE, // `default_nettype is WIRE (false=NONE)
// Error codes: // Error codes:
E_DETECTARRAY, // Error: Unsupported: Can't detect changes on arrayed variable E_DETECTARRAY, // Error: Unsupported: Can't detect changes on arrayed variable
E_PKGNODECL, // Error: Package/class needs to be predeclared
E_PORTSHORT, // Error: Output port is connected to a constant, electrical short E_PORTSHORT, // Error: Output port is connected to a constant, electrical short
E_UNSUPPORTED, // Error: Unsupported (generally) E_UNSUPPORTED, // Error: Unsupported (generally)
E_TASKNSVAR, // Error: Task I/O not simple E_TASKNSVAR, // Error: Task I/O not simple
@ -145,7 +146,7 @@ public:
// Boolean // Boolean
" I_CELLDEFINE", " I_COVERAGE", " I_TRACING", " I_LINT", " I_DEF_NETTYPE_WIRE", " I_CELLDEFINE", " I_COVERAGE", " I_TRACING", " I_LINT", " I_DEF_NETTYPE_WIRE",
// Errors // Errors
"DETECTARRAY", "PORTSHORT", "UNSUPPORTED", "TASKNSVAR", "DETECTARRAY", "PKGNODECL", "PORTSHORT", "UNSUPPORTED", "TASKNSVAR",
// Warnings // Warnings
" EC_FIRST_WARN", " EC_FIRST_WARN",
"ALWCOMBORDER", "ASSIGNDLY", "ASSIGNIN", "ALWCOMBORDER", "ASSIGNDLY", "ASSIGNIN",

View File

@ -531,9 +531,9 @@ void V3ParseImp::tokenPipelineSym() {
// is missing package, and this confuses people // is missing package, and this confuses people
static int warned = false; static int warned = false;
if (!warned++) { if (!warned++) {
yylval.fl->v3error( yylval.fl->v3warn(E_PKGNODECL, "Package/class '" + *yylval.strp
"Package/class '" + *yylval.strp + "' not found, and needs to be "
+ "' not found, and needs to be predeclared (IEEE 1800-2017 26.3)"); "predeclared (IEEE 1800-2017 26.3)");
} }
} }
} else if (token == yaID__LEX) { } else if (token == yaID__LEX) {

View File

@ -1,4 +1,4 @@
%Error: t/t_lint_import_name2_bad.v:7:8: Package/class 'missing' not found, and needs to be predeclared (IEEE 1800-2017 26.3) %Error-PKGNODECL: t/t_lint_import_name2_bad.v:7:8: Package/class 'missing' not found, and needs to be predeclared (IEEE 1800-2017 26.3)
7 | import missing::sigs; 7 | import missing::sigs;
| ^~~~~~~ | ^~~~~~~
%Error: t/t_lint_import_name2_bad.v:7:8: Importing from missing package 'missing' %Error: t/t_lint_import_name2_bad.v:7:8: Importing from missing package 'missing'

View File

@ -1,4 +1,4 @@
%Error: t/t_lint_pkg_colon_bad.v:7:17: Package/class 'mispkg' not found, and needs to be predeclared (IEEE 1800-2017 26.3) %Error-PKGNODECL: t/t_lint_pkg_colon_bad.v:7:17: Package/class 'mispkg' not found, and needs to be predeclared (IEEE 1800-2017 26.3)
7 | module t (input mispkg::foo_t a); 7 | module t (input mispkg::foo_t a);
| ^~~~~~ | ^~~~~~
%Error: t/t_lint_pkg_colon_bad.v:7:25: syntax error, unexpected IDENTIFIER, expecting TYPE-IDENTIFIER %Error: t/t_lint_pkg_colon_bad.v:7:25: syntax error, unexpected IDENTIFIER, expecting TYPE-IDENTIFIER