Cleanup/standardize configuration file string handling

This commit is contained in:
Wilson Snyder 2024-11-11 22:22:06 -05:00
parent 1d06364284
commit 779cf9248a
2 changed files with 96 additions and 59 deletions

View File

@ -2088,7 +2088,7 @@ The grammar of configuration commands is as follows:
.. option:: lint_off [-rule <message>] [-file "<filename>" [-lines <line> [ - <line>]]] .. option:: lint_off [-rule <message>] [-file "<filename>" [-lines <line> [ - <line>]]]
.. option:: lint_off [-rule <message>] [-file "<filename>"] [-match "<string>"] .. option:: lint_off [-rule <message>] [-file "<filename>"] [-match "<wildcard>"]
Enable/disables the specified lint warning, in the specified filename Enable/disables the specified lint warning, in the specified filename
(or wildcard with '\*' or '?', or all files if omitted) and range of (or wildcard with '\*' or '?', or all files if omitted) and range of
@ -2097,17 +2097,18 @@ The grammar of configuration commands is as follows:
With lint_off using "\*" will override any lint_on directives in the With lint_off using "\*" will override any lint_on directives in the
source, i.e. the warning will still not be printed. source, i.e. the warning will still not be printed.
If the -rule is omitted, all lint warnings (see list in If the :code:`-rule` is omitted, all lint warnings (see list in
:vlopt:`-Wno-lint`) are enabled/disabled. This will override all later :vlopt:`-Wno-lint`) are enabled/disabled. This will override all later
lint warning enables for the specified region. lint warning enables for the specified region.
If -match is set, the linter warnings are matched against this If :code:`-match` is provided, the linter warnings are matched against
(wildcard) string and are waived in case they match, provided with the the given wildcard (with '\*' or '?'), and are waived in case they
rule and file also match. match, provided the :code:`-rule` and :code:`-file`
also match. The wildcard is compared across the entire multi-line
message; see :vlopt:`--waiver-multiline`.
In previous versions -rule was named -msg. The latter is deprecated, but Before version 4.026, :code:`-rule` was named :code:`-msg`, and
still works with a deprecation info; it may be removed in future :code:`-msg` remained a deprecated alias until Version 5.000.
versions.
.. option:: public [-module "<modulename>"] [-task/-function "<taskname>"] -var "<signame>" .. option:: public [-module "<modulename>"] [-task/-function "<taskname>"] -var "<signame>"

View File

@ -7559,77 +7559,77 @@ colon<fl>: // Generic colon that isn't making a label (e.g.
// VLT Files // VLT Files
vltItem: vltItem:
// // TODO support arbitrary order of arguments
vltOffFront vltOffFront
{ V3Config::addIgnore($1, false, "*", 0, 0); } { V3Config::addIgnore($1, false, "*", 0, 0); }
| vltOffFront yVLT_D_FILE yaSTRING | vltOffFront vltDFile
{ V3Config::addIgnore($1, false, *$3, 0, 0); } { V3Config::addIgnore($1, false, *$2, 0, 0); }
| vltOffFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM | vltOffFront vltDFile yVLT_D_LINES yaINTNUM
{ V3Config::addIgnore($1, false, *$3, $5->toUInt(), $5->toUInt() + 1); } { V3Config::addIgnore($1, false, *$2, $4->toUInt(), $4->toUInt() + 1); }
| vltOffFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM '-' yaINTNUM | vltOffFront vltDFile yVLT_D_LINES yaINTNUM '-' yaINTNUM
{ V3Config::addIgnore($1, false, *$3, $5->toUInt(), $7->toUInt() + 1); } { V3Config::addIgnore($1, false, *$2, $4->toUInt(), $6->toUInt() + 1); }
| vltOffFront yVLT_D_SCOPE yaSTRING | vltOffFront vltDFile vltDMatch
{ if ($1 != V3ErrorCode::I_TRACING) {
$<fl>1->v3error("Argument -scope only supported for tracing_on/off");
} else {
V3Config::addScopeTraceOn(false, *$3, 0);
}}
| vltOffFront yVLT_D_SCOPE yaSTRING yVLT_D_LEVELS yaINTNUM
{ if ($1 != V3ErrorCode::I_TRACING) {
$<fl>1->v3error("Argument -scope only supported for tracing_on/off_off");
} else {
V3Config::addScopeTraceOn(false, *$3, $5->toUInt());
}}
| vltOffFront yVLT_D_FILE yaSTRING yVLT_D_MATCH yaSTRING
{ if (($1 == V3ErrorCode::I_COVERAGE) || ($1 == V3ErrorCode::I_TRACING)) { { if (($1 == V3ErrorCode::I_COVERAGE) || ($1 == V3ErrorCode::I_TRACING)) {
$<fl>1->v3error("Argument -match only supported for lint_off"); $<fl>1->v3error("Argument -match only supported for lint_off");
} else { } else {
V3Config::addIgnoreMatch($1, *$3, *$5); V3Config::addIgnoreMatch($1, *$2, *$3);
}} }}
| vltOnFront | vltOffFront vltDScope
{ V3Config::addIgnore($1, true, "*", 0, 0); }
| vltOnFront yVLT_D_FILE yaSTRING
{ V3Config::addIgnore($1, true, *$3, 0, 0); }
| vltOnFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM
{ V3Config::addIgnore($1, true, *$3, $5->toUInt(), $5->toUInt() + 1); }
| vltOnFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM '-' yaINTNUM
{ V3Config::addIgnore($1, true, *$3, $5->toUInt(), $7->toUInt() + 1); }
| vltOnFront yVLT_D_SCOPE yaSTRING
{ if ($1 != V3ErrorCode::I_TRACING) { { if ($1 != V3ErrorCode::I_TRACING) {
$<fl>1->v3error("Argument -scope only supported for tracing_on/off"); $<fl>1->v3error("Argument -scope only supported for tracing_on/off");
} else { } else {
V3Config::addScopeTraceOn(true, *$3, 0); V3Config::addScopeTraceOn(false, *$2, 0);
}} }}
| vltOnFront yVLT_D_SCOPE yaSTRING yVLT_D_LEVELS yaINTNUM | vltOffFront vltDScope vltDLevels
{ if ($1 != V3ErrorCode::I_TRACING) { { if ($1 != V3ErrorCode::I_TRACING) {
$<fl>1->v3error("Argument -scope only supported for tracing_on/off_off"); $<fl>1->v3error("Argument -scope only supported for tracing_on/off_off");
} else { } else {
V3Config::addScopeTraceOn(true, *$3, $5->toUInt()); V3Config::addScopeTraceOn(false, *$2, $3->toUInt());
}}
| vltOnFront
{ V3Config::addIgnore($1, true, "*", 0, 0); }
| vltOnFront vltDFile
{ V3Config::addIgnore($1, true, *$2, 0, 0); }
| vltOnFront vltDFile yVLT_D_LINES yaINTNUM
{ V3Config::addIgnore($1, true, *$2, $4->toUInt(), $4->toUInt() + 1); }
| vltOnFront vltDFile yVLT_D_LINES yaINTNUM '-' yaINTNUM
{ V3Config::addIgnore($1, true, *$2, $4->toUInt(), $6->toUInt() + 1); }
| vltOnFront vltDScope
{ if ($1 != V3ErrorCode::I_TRACING) {
$<fl>1->v3error("Argument -scope only supported for tracing_on/off");
} else {
V3Config::addScopeTraceOn(true, *$2, 0);
}}
| vltOnFront vltDScope vltDLevels
{ if ($1 != V3ErrorCode::I_TRACING) {
$<fl>1->v3error("Argument -scope only supported for tracing_on/off_off");
} else {
V3Config::addScopeTraceOn(true, *$2, $3->toUInt());
}} }}
| vltVarAttrFront vltDModuleE vltDFTaskE vltVarAttrVarE attr_event_controlE | vltVarAttrFront vltDModuleE vltDFTaskE vltVarAttrVarE attr_event_controlE
{ V3Config::addVarAttr($<fl>1, *$2, *$3, *$4, $1, $5); } { V3Config::addVarAttr($<fl>1, *$2, *$3, *$4, $1, $5); }
| vltInlineFront vltDModuleE vltDFTaskE | vltInlineFront vltDModuleE vltDFTaskE
{ V3Config::addInline($<fl>1, *$2, *$3, $1); } { V3Config::addInline($<fl>1, *$2, *$3, $1); }
| yVLT_COVERAGE_BLOCK_OFF yVLT_D_FILE yaSTRING | yVLT_COVERAGE_BLOCK_OFF vltDFile
{ V3Config::addCoverageBlockOff(*$3, 0); } { V3Config::addCoverageBlockOff(*$2, 0); }
| yVLT_COVERAGE_BLOCK_OFF yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM | yVLT_COVERAGE_BLOCK_OFF vltDFile yVLT_D_LINES yaINTNUM
{ V3Config::addCoverageBlockOff(*$3, $5->toUInt()); } { V3Config::addCoverageBlockOff(*$2, $4->toUInt()); }
| yVLT_COVERAGE_BLOCK_OFF yVLT_D_MODULE yaSTRING yVLT_D_BLOCK yaSTRING | yVLT_COVERAGE_BLOCK_OFF vltDModule vltDBlock
{ V3Config::addCoverageBlockOff(*$3, *$5); } { V3Config::addCoverageBlockOff(*$2, *$3); }
| yVLT_FULL_CASE yVLT_D_FILE yaSTRING | yVLT_FULL_CASE vltDFile
{ V3Config::addCaseFull(*$3, 0); } { V3Config::addCaseFull(*$2, 0); }
| yVLT_FULL_CASE yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM | yVLT_FULL_CASE vltDFile yVLT_D_LINES yaINTNUM
{ V3Config::addCaseFull(*$3, $5->toUInt()); } { V3Config::addCaseFull(*$2, $4->toUInt()); }
| yVLT_HIER_BLOCK vltDModuleE | yVLT_HIER_BLOCK vltDModuleE
{ V3Config::addModulePragma(*$2, VPragmaType::HIER_BLOCK); } { V3Config::addModulePragma(*$2, VPragmaType::HIER_BLOCK); }
| yVLT_HIER_PARAMS vltDModuleE | yVLT_HIER_PARAMS vltDModuleE
{ V3Config::addModulePragma(*$2, VPragmaType::HIER_PARAMS); } { V3Config::addModulePragma(*$2, VPragmaType::HIER_PARAMS); }
| yVLT_PARALLEL_CASE yVLT_D_FILE yaSTRING | yVLT_PARALLEL_CASE vltDFile
{ V3Config::addCaseParallel(*$3, 0); } { V3Config::addCaseParallel(*$2, 0); }
| yVLT_PARALLEL_CASE yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM | yVLT_PARALLEL_CASE vltDFile yVLT_D_LINES yaINTNUM
{ V3Config::addCaseParallel(*$3, $5->toUInt()); } { V3Config::addCaseParallel(*$2, $4->toUInt()); }
| yVLT_PROFILE_DATA yVLT_D_MODEL yaSTRING yVLT_D_MTASK yaSTRING yVLT_D_COST yaINTNUM | yVLT_PROFILE_DATA vltDModel vltDMtask vltDCost
{ V3Config::addProfileData($<fl>1, *$3, *$5, $7->toUQuad()); } { V3Config::addProfileData($<fl>1, *$2, *$3, $4->toUQuad()); }
; ;
vltOffFront<errcodeen>: vltOffFront<errcodeen>:
@ -7656,9 +7656,45 @@ vltOnFront<errcodeen>:
if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown error code: '" << *$3 << "'"); } } if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown error code: '" << *$3 << "'"); } }
; ;
vltDModuleE<strp>: vltDBlock<strp>: // --block <arg>
yVLT_D_BLOCK str { $$ = $2; }
;
vltDCost<nump>: // --cost <arg>
yVLT_D_COST yaINTNUM { $$ = $2; }
;
vltDFile<strp>: // --file <arg>
yVLT_D_FILE str { $$ = $2; }
;
vltDLevels<nump>: // --levels <arg>
yVLT_D_LEVELS yaINTNUM { $$ = $2; }
;
vltDMatch<strp>: // --match <arg>
yVLT_D_MATCH str { $$ = $2; }
;
vltDModel<strp>: // --model <arg>
yVLT_D_MODEL str { $$ = $2; }
;
vltDMtask<strp>: // --mtask <arg>
yVLT_D_MTASK str { $$ = $2; }
;
vltDModule<strp>: // --module <arg>
yVLT_D_MODULE str { $$ = $2; }
;
vltDModuleE<strp>: // [--module <arg>]
/* empty */ { static string unit = "__024unit"; $$ = &unit; } /* empty */ { static string unit = "__024unit"; $$ = &unit; }
| yVLT_D_MODULE str { $$ = $2; } | vltDModule { $$ = $1; }
;
vltDScope<strp>: // --scope <arg>
yVLT_D_SCOPE str { $$ = $2; }
; ;
vltDFTaskE<strp>: vltDFTaskE<strp>: