Skip to content

Commit 23cda0c

Browse files
authored
Merge pull request #2195 from sconwayaus/proper_package_localparam
[proper-parameter-declaration] change default behaviour
2 parents 48a03f3 + 7093960 commit 23cda0c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

verilog/analysis/checkers/proper_parameter_declaration_rule.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ const LintRuleDescriptor &ProperParameterDeclarationRule::GetDescriptor() {
7070
.param = {
7171
{
7272
.name = "package_allow_parameter",
73-
.default_value = "true",
73+
.default_value = "false",
7474
.description = "Allow parameters in packages (treated as a "
7575
"synonym for localparam).",
7676
},
7777
{
7878
.name = "package_allow_localparam",
79-
.default_value = "false",
79+
.default_value = "true",
8080
.description = "Allow localparams in packages.",
8181
},
8282
}};

verilog/analysis/checkers/proper_parameter_declaration_rule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class ProperParameterDeclarationRule : public verible::SyntaxTreeLintRule {
4747
private:
4848
std::set<verible::LintViolation> violations_;
4949

50-
bool package_allow_parameter_ = true;
51-
bool package_allow_localparam_ = false;
50+
bool package_allow_parameter_ = false;
51+
bool package_allow_localparam_ = true;
5252
};
5353

5454
} // namespace analysis

verilog/analysis/checkers/proper_parameter_declaration_rule_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ TEST(ProperParameterDeclarationRuleTest, RejectPackageParameters) {
8989
"endmodule"},
9090
};
9191

92-
RunConfiguredLintTestCases<VerilogAnalyzer, ProperParameterDeclarationRule>(
93-
kTestCases,
94-
"package_allow_parameter:false;package_allow_localparam:true");
92+
RunLintTestCases<VerilogAnalyzer, ProperParameterDeclarationRule>(kTestCases);
9593
}
9694

9795
// Tests that the expected number of localparam usage violations are found.
@@ -221,7 +219,9 @@ TEST(ProperParameterDeclarationRuleTest, AllowPackageParameters) {
221219
"endpackage"},
222220
};
223221

224-
RunLintTestCases<VerilogAnalyzer, ProperParameterDeclarationRule>(kTestCases);
222+
RunConfiguredLintTestCases<VerilogAnalyzer, ProperParameterDeclarationRule>(
223+
kTestCases,
224+
"package_allow_parameter:true;package_allow_localparam:false");
225225
}
226226

227227
} // namespace
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package endif_comment;
22
`ifdef FOOBAR
3-
parameter int P = 4;
3+
localparam int P = 4;
44
`endif
55
endpackage

0 commit comments

Comments
 (0)