Don't automatically add the "warning: " prefix in VLwarn().

One variant did, the other variant didn't. As well as being a trap for
the unwary, this gets in the way of using yywarn/VLwarn for non-fatal
"sorry" messages.
This commit is contained in:
Martin Whitaker 2022-12-22 10:34:56 +00:00
parent bb867480fc
commit 82aedbc36c
4 changed files with 12 additions and 11 deletions

View File

@ -899,7 +899,7 @@ TU [munpf]
}
`[a-zA-Z_]+ {
yywarn(yylloc, "macro replacement not supported. "
yywarn(yylloc, "warning: macro replacement not supported. "
"Use an external preprocessor.");
}
@ -941,7 +941,8 @@ static unsigned truncate_to_integer_width(verinum::V*bits, unsigned size)
for (unsigned idx = integer_width; idx < size; idx += 1) {
if (bits[idx] != pad) {
yywarn(yylloc, "Unsized numeric constant truncated to integer width.");
yywarn(yylloc, "warning: Unsized numeric constant truncated "
"to integer width.");
break;
}
}
@ -985,7 +986,7 @@ verinum*make_unsized_binary(const char*txt)
}
if ((based_size > 0) && (size > based_size)) yywarn(yylloc,
"extra digits given for sized binary constant.");
"warning: extra digits given for sized binary constant.");
verinum::V*bits = new verinum::V[size];
@ -1050,7 +1051,7 @@ verinum*make_unsized_octal(const char*txt)
int rem = based_size % 3;
if (rem != 0) based_size += 3 - rem;
if (size > based_size) yywarn(yylloc,
"extra digits given for sized octal constant.");
"warning: extra digits given for sized octal constant.");
}
verinum::V*bits = new verinum::V[size];
@ -1119,7 +1120,7 @@ verinum*make_unsized_hex(const char*txt)
int rem = based_size % 4;
if (rem != 0) based_size += 4 - rem;
if (size > based_size) yywarn(yylloc,
"extra digits given for sized hex constant.");
"warning: extra digits given for sized hex constant.");
}
verinum::V*bits = new verinum::V[size];

View File

@ -6068,7 +6068,7 @@ specify_path_identifiers
}
| IDENTIFIER '[' expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Bit selects are not currently supported "
yywarn(@4, "warning: Bit selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}
@ -6079,7 +6079,7 @@ specify_path_identifiers
}
| IDENTIFIER '[' expr_primary polarity_operator expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Part selects are not currently supported "
yywarn(@4, "warning: Part selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}
@ -6096,7 +6096,7 @@ specify_path_identifiers
}
| specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Bit selects are not currently supported "
yywarn(@4, "warning: Bit selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}
@ -6107,7 +6107,7 @@ specify_path_identifiers
}
| specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Part selects are not currently supported "
yywarn(@4, "warning: Part selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}

View File

@ -70,7 +70,7 @@ void VLerror(const YYLTYPE&loc, const char*msg, ...)
void VLwarn(const YYLTYPE&loc, const char*msg)
{
warn_count += 1;
cerr << loc << ": warning: " << msg << endl;
cerr << loc << ": " << msg << endl;
}
int VLwrap()

View File

@ -2048,7 +2048,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
// Put the primitive into the primitives table
if (pform_primitives[name]) {
VLwarn("UDP primitive already exists.");
VLwarn("warning: UDP primitive already exists.");
} else {
PUdp*udp = new PUdp(name, parms->size());