From 2abbd5c1457437834c90c6dfe9183ee97740241b Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 22 Aug 2020 16:37:49 -0400 Subject: [PATCH] Convert unnamed error to new PKGNODECL error. --- bin/verilator | 6 ++++++ src/V3Error.h | 3 ++- src/V3ParseImp.cpp | 6 +++--- test_regress/t/t_lint_import_name2_bad.out | 2 +- test_regress/t/t_lint_pkg_colon_bad.out | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bin/verilator b/bin/verilator index 52076f381..96f58771e 100755 --- a/bin/verilator +++ b/bin/verilator @@ -4645,6 +4645,12 @@ signal. Disabled by default as this is a code style warning; it will simulate 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 Error that a procedural assignment is setting a wire. According to IEEE, a diff --git a/src/V3Error.h b/src/V3Error.h index 8555e8b9b..9ff7d6a95 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -51,6 +51,7 @@ public: I_DEF_NETTYPE_WIRE, // `default_nettype is WIRE (false=NONE) // Error codes: 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_UNSUPPORTED, // Error: Unsupported (generally) E_TASKNSVAR, // Error: Task I/O not simple @@ -145,7 +146,7 @@ public: // Boolean " I_CELLDEFINE", " I_COVERAGE", " I_TRACING", " I_LINT", " I_DEF_NETTYPE_WIRE", // Errors - "DETECTARRAY", "PORTSHORT", "UNSUPPORTED", "TASKNSVAR", + "DETECTARRAY", "PKGNODECL", "PORTSHORT", "UNSUPPORTED", "TASKNSVAR", // Warnings " EC_FIRST_WARN", "ALWCOMBORDER", "ASSIGNDLY", "ASSIGNIN", diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index e53135a0e..f3ba4c5c3 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -531,9 +531,9 @@ void V3ParseImp::tokenPipelineSym() { // is missing package, and this confuses people static int warned = false; if (!warned++) { - yylval.fl->v3error( - "Package/class '" + *yylval.strp - + "' not found, and needs to be predeclared (IEEE 1800-2017 26.3)"); + yylval.fl->v3warn(E_PKGNODECL, "Package/class '" + *yylval.strp + + "' not found, and needs to be " + "predeclared (IEEE 1800-2017 26.3)"); } } } else if (token == yaID__LEX) { diff --git a/test_regress/t/t_lint_import_name2_bad.out b/test_regress/t/t_lint_import_name2_bad.out index 21eace02e..2bcdce56d 100644 --- a/test_regress/t/t_lint_import_name2_bad.out +++ b/test_regress/t/t_lint_import_name2_bad.out @@ -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; | ^~~~~~~ %Error: t/t_lint_import_name2_bad.v:7:8: Importing from missing package 'missing' diff --git a/test_regress/t/t_lint_pkg_colon_bad.out b/test_regress/t/t_lint_pkg_colon_bad.out index 51ef13962..f6a9c2149 100644 --- a/test_regress/t/t_lint_pkg_colon_bad.out +++ b/test_regress/t/t_lint_pkg_colon_bad.out @@ -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); | ^~~~~~ %Error: t/t_lint_pkg_colon_bad.v:7:25: syntax error, unexpected IDENTIFIER, expecting TYPE-IDENTIFIER