diff --git a/src/V3Error.h b/src/V3Error.h index 98ce5220f..1c1cfae83 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -77,6 +77,7 @@ public: CONTASSREG, // Continuous assignment on reg DEFPARAM, // Style: Defparam DECLFILENAME, // Declaration doesn't match filename + DEPRECATED, // Feature will be deprecated ENDLABEL, // End lable name mismatch GENCLK, // Generated Clock IFDEPTH, // If statements too deep @@ -143,7 +144,7 @@ public: "BLKANDNBLK", "BLKLOOPINIT", "BLKSEQ", "BSSPACE", "CASEINCOMPLETE", "CASEOVERLAP", "CASEWITHX", "CASEX", "CDCRSTLOGIC", "CLKDATA", "CMPCONST", "COLONPLUS", "COMBDLY", "CONTASSREG", - "DEFPARAM", "DECLFILENAME", + "DEFPARAM", "DECLFILENAME", "DEPRECATED", "ENDLABEL", "GENCLK", "IFDEPTH", "IGNOREDRETURN", "IMPERFECTSCH", "IMPLICIT", "IMPORTSTAR", "IMPURE", diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 05b16ebd8..ff99771f7 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -260,6 +260,7 @@ private: } else if (nodep->attrType() == AstAttrType::VAR_CLOCK) { UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable"); + nodep->v3warn(DEPRECATED, "sc_clock is deprecated and will be removed"); m_varp->attrScClocked(true); nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep); } diff --git a/src/verilog.y b/src/verilog.y index d51d675f1..4e34aed7e 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -5599,7 +5599,7 @@ vltOffFront: | yVLT_LINT_OFF yVLT_D_MSG yaID__ETC { $$ = V3ErrorCode((*$3).c_str()); if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<v3info("Deprecated -msg in configuration files, use -rule instead."<v3warn(DEPRECATED, "Deprecated -msg in configuration files, use -rule instead."<v3error("Unknown Error Code: "<<*$3<: | yVLT_LINT_ON yVLT_D_MSG yaID__ETC { $$ = V3ErrorCode((*$3).c_str()); if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<v3info("Deprecated -msg in configuration files, use -rule instead."<v3warn(DEPRECATED, "Deprecated -msg in configuration files, use -rule instead."<v3error("Unknown Error Code: "<<*$3< 1); + +top_filename("t/t_clk_first_deprecated.v"); + +lint( + verilator_flags2 => ["--lint-only"], + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_clk_first_deprecated.pl b/test_regress/t/t_clk_first_deprecated.pl new file mode 100755 index 000000000..01d7bf8d0 --- /dev/null +++ b/test_regress/t/t_clk_first_deprecated.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +scenarios(vlt => 1); + +lint( + verilator_flags2 => ["--lint-only", "-Wno-DEPRECATED"], + ); + +ok(1); +1; diff --git a/test_regress/t/t_clk_first_deprecated.v b/test_regress/t/t_clk_first_deprecated.v new file mode 100644 index 000000000..5c5f5ce12 --- /dev/null +++ b/test_regress/t/t_clk_first_deprecated.v @@ -0,0 +1,13 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2003 by Wilson Snyder. + +module t (/*AUTOARG*/ + // Inputs + clk + ); + + input clk /*verilator sc_clock*/; + +endmodule diff --git a/test_regress/t/t_vlt_warn.vlt b/test_regress/t/t_vlt_warn.vlt index b1b7998aa..4e94fb4cb 100644 --- a/test_regress/t/t_vlt_warn.vlt +++ b/test_regress/t/t_vlt_warn.vlt @@ -5,10 +5,11 @@ `verilator_config -lint_off -msg CASEINCOMPLETE -file "t/t_vlt_warn.v" // Deprecation info about msg +lint_off -rule DEPRECATED -file "t/t_vlt_warn.vlt" -lines 12 +lint_off -rule CASEINCOMPLETE -file "t/t_vlt_warn.v" lint_off -rule WIDTH -file "t/t_vlt_warn.v" -lines 18 // Test wildcard filenames -lint_off -rule WIDTH -file "*/t_vlt_warn.v" -lines 19-19 +lint_off -msg WIDTH -file "*/t_vlt_warn.v" -lines 19-19 // Test global disables lint_off -file "*/t_vlt_warn.v" -lines 20-20 diff --git a/test_regress/t/t_vlt_warn_bad.out b/test_regress/t/t_vlt_warn_bad.out new file mode 100644 index 000000000..0a847a31a --- /dev/null +++ b/test_regress/t/t_vlt_warn_bad.out @@ -0,0 +1,5 @@ +%Warning-DEPRECATED: t/t_vlt_warn_bad.vlt:11: Deprecated -msg in configuration files, use -rule instead. +lint_off -msg WIDTH -file "*/t_vlt_warn.v" -lines 19-19 + ^~~~ + ... Use "/* verilator lint_off DEPRECATED */" and lint_on around source to disable this message. +%Error: Exiting due to diff --git a/test_regress/t/t_vlt_warn_bad.pl b/test_regress/t/t_vlt_warn_bad.pl new file mode 100755 index 000000000..5dd7bae92 --- /dev/null +++ b/test_regress/t/t_vlt_warn_bad.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2008 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +scenarios(vlt => 1); + +top_filename("t/t_vlt_warn.v"); + +lint( + verilator_flags2 => ["--lint-only t/t_vlt_warn_bad.vlt"], + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_vlt_warn_bad.vlt b/test_regress/t/t_vlt_warn_bad.vlt new file mode 100644 index 000000000..b16f429b1 --- /dev/null +++ b/test_regress/t/t_vlt_warn_bad.vlt @@ -0,0 +1,17 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2010 by Wilson Snyder. + +`verilator_config + +lint_off -rule CASEINCOMPLETE -file "t/t_vlt_warn.v" +lint_off -rule WIDTH -file "t/t_vlt_warn.v" -lines 18 +// Test wildcard filenames +lint_off -msg WIDTH -file "*/t_vlt_warn.v" -lines 19-19 +// Test global disables +lint_off -file "*/t_vlt_warn.v" -lines 20-20 + +coverage_off -file "t/t_vlt_warn.v" +// Test --flag is also accepted +tracing_off --file "t/t_vlt_warn.v"