From 285277a50bd089de70c0f6ceeca149e18776bb45 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 25 Dec 2010 15:28:13 -0500 Subject: [PATCH] Add -Wall; move VARHIDDEN to style warnings --- Changes | 8 +++++--- bin/verilator | 25 +++++++++++++++---------- src/V3Error.h | 5 +++-- src/V3Options.cpp | 4 ++++ test_regress/t/t_var_bad_hide.pl | 2 +- test_regress/t/t_var_bad_hide2.pl | 2 +- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Changes b/Changes index ee465d9af..a2e71d303 100644 --- a/Changes +++ b/Changes @@ -7,8 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! ** Add limited support for VPI access to public signals, see docs. -** Add -Wwarn-style, -Wno-style to enable code style warnings that are - added to this release and disabled by default. +** Add -Wall, -Wwarn-style, -Wno-style to enable code style warnings + that have been added to this release, and disabled by default. *** Add -F option to read relative option files, bug297. [Neil Hamilton] @@ -16,10 +16,12 @@ indicates the contributor was also the author of the fix; Thanks! *** Suppress WIDTH warnings when adding/subtracting 1'b1. -*** Add optional DEFPARAM warning to find deprecated defparam statements. +*** With --Wall, add DEFPARAM warning to find deprecated defparam statements. **** When running with VERILATOR_ROOT, optionally find binaries under bin. +**** The VARHIDDEN warning is now disabled by default, use -Wall to enable. + * Verilator 3.805 2010/11/02 **** Add warning when directory contains spaces, msg378. [Salman Sheikh] diff --git a/bin/verilator b/bin/verilator index ee4deb605..5210910b5 100755 --- a/bin/verilator +++ b/bin/verilator @@ -609,8 +609,8 @@ fairly standard across Verilog tools. Check the files for lint violations only, do not create any other output. -You may also want the -Wwarn-style option to enable messages that are -considered stylistic and not enabled by default. +You may also want the -Wall option to enable messages that are considered +stylistic and not enabled by default. If the design is not to be completely Verilated see also the --bbox-sys and --bbox-unsup options. @@ -839,6 +839,11 @@ Read the filename as a Verilog library. Any modules in the file may be used to resolve cell instantiations in the top level module, else ignored. Note -v is fairly standard across Verilog tools. +=item -Wall + +Enable all warnings, including code style warnings that are normally +disabled by default. + =item -Werror-I Convert the specified warning message into a error message. This is @@ -862,7 +867,7 @@ Disable the specified warning message. Disable all lint related warning messages, and all style warnings. This is equivalent to "-Wno-CASEINCOMPLETE -Wno-CASEOVERLAP -Wno-CASEX -Wno-CASEWITHX -Wno-CMPCONST -Wno-IMPLICIT -Wno-LITENDIAN -Wno-UNDRIVEN --Wno-UNSIGNED -Wno-UNUSED -Wno-VARHIDDEN -Wno-WIDTH" plus the list shown +-Wno-UNSIGNED -Wno-UNUSED -Wno-WIDTH" plus the list shown for Wno-style. It is strongly recommended you cleanup your code rather than using this @@ -871,8 +876,8 @@ received from third parties. =item -Wno-style -Disable all code style related warning messages (note by default they are already disabled). This is equivalent to -"-Wno-DEFPARAM". +Disable all code style related warning messages (note by default they are +already disabled). This is equivalent to "-Wno-DEFPARAM -Wno-VARHIDDEN". =item -Wwarn-I @@ -884,12 +889,12 @@ Enable all lint related warning messages (note by default they are already enabled), but do not affect style messages. This is equivalent to "-Wwarn-CASEINCOMPLETE -Wwarn-CASEOVERLAP -Wwarn-CASEX -Wwarn-CASEWITHX -Wwarn-CMPCONST -Wwarn-IMPLICIT -Wwarn-LITENDIAN -Wwarn-UNDRIVEN --Wwarn-UNSIGNED -Wwarn-UNUSED -Wwarn-VARHIDDEN -Wwarn-WIDTH". +-Wwarn-UNSIGNED -Wwarn-UNUSED -Wwarn-WIDTH". =item -Wwarn-style Enable all code style related warning messages. This is equivalent to -"-WDEFPARAM". +"-Wwarn-DEFPARAM -Wwarn-VARHIDDEN". =item -x-assign 0 @@ -951,7 +956,7 @@ We'll compile this example into C++. Now we run Verilator on our little example. export VERILATOR_ROOT=/path/to/where/verilator/was/installed - $VERILATOR_ROOT/bin/verilator --cc our.v --exe sim_main.cpp + $VERILATOR_ROOT/bin/verilator -Wall --cc our.v --exe sim_main.cpp We can see the source code under the "obj_dir" directory. See the FILES section below for descriptions of some of the files that were created. @@ -1013,7 +1018,7 @@ This is an example similar to the above, but using SystemPerl. Now we run Verilator on our little example. export VERILATOR_ROOT=/path/to/where/verilator/was/installed - $VERILATOR_ROOT/bin/verilator --sp our.v + $VERILATOR_ROOT/bin/verilator -Wall --sp our.v Then we convert the SystemPerl output to SystemC. @@ -2626,7 +2631,7 @@ the same name as a variable in the upper level module or begin/end block (thus hiding the upper variable from being able to be used.) Rename the variable to avoid confusion when reading the code. -Ignoring this warning will only suppress the lint check, it will simulate +Disabled by default as this is a code style warning, it will simulate correctly. =item WIDTH diff --git a/src/V3Error.h b/src/V3Error.h index eaeb82d85..922d1bfd4 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -128,10 +128,11 @@ public: || m_e==IMPLICIT || m_e==LITENDIAN || m_e==UNDRIVEN || m_e==UNSIGNED - || m_e==UNUSED || m_e==VARHIDDEN + || m_e==UNUSED || m_e==WIDTH); } // Warnings that are style only - bool styleError() const { return ( m_e==DEFPARAM); } + bool styleError() const { return ( m_e==DEFPARAM + || m_e==VARHIDDEN ); } }; inline bool operator== (V3ErrorCode lhs, V3ErrorCode rhs) { return (lhs.m_e == rhs.m_e); } inline bool operator== (V3ErrorCode lhs, V3ErrorCode::en rhs) { return (lhs.m_e == rhs); } diff --git a/src/V3Options.cpp b/src/V3Options.cpp index e87ba1db2..50d1ea338 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -772,6 +772,10 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char showVersion(false); exit(0); } + else if ( !strcmp (sw, "-Wall") ) { + FileLine::globalWarnLintOff(false); + FileLine::globalWarnStyleOff(false); + } else if ( !strncmp (sw, "-Werror-",strlen("-Werror-")) ) { string msg = sw+strlen("-Werror-"); V3ErrorCode code (msg.c_str()); diff --git a/test_regress/t/t_var_bad_hide.pl b/test_regress/t/t_var_bad_hide.pl index d30dd3d9a..759101b77 100755 --- a/test_regress/t/t_var_bad_hide.pl +++ b/test_regress/t/t_var_bad_hide.pl @@ -8,7 +8,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Version 2.0. compile ( - v_flags2 => ["--lint-only"], + v_flags2 => ["--lint-only -Wall"], fails=>$Self->{v3}, expect=> '%Warning-VARHIDDEN: t/t_var_bad_hide.v:\d+: Declaration of signal hides declaration in upper scope: top diff --git a/test_regress/t/t_var_bad_hide2.pl b/test_regress/t/t_var_bad_hide2.pl index 3503ede3c..a87517e62 100755 --- a/test_regress/t/t_var_bad_hide2.pl +++ b/test_regress/t/t_var_bad_hide2.pl @@ -8,7 +8,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Version 2.0. compile ( - v_flags2 => ["--lint-only"], + v_flags2 => ["--lint-only -Wall"], fails=>$Self->{v3}, expect=> '%Warning-VARHIDDEN: t/t_var_bad_hide2.v:\d+: Declaration of signal hides declaration in upper scope: t