mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 10:48:27 +02:00
Change metacomment extra underscore error to warning (#6968)
Used to throw a hard v3error on stray underscores in metacomments. Issue a BADVLTPRAGMA that can be turned off instead.
This commit is contained in:
+9
-7
@@ -481,17 +481,21 @@ void V3PreProcImp::comment(const string& text) {
|
||||
if ((cp[0] == 'v' || cp[0] == 'V') && VString::startsWith(cp + 1, "erilator")) {
|
||||
cp += std::strlen("verilator");
|
||||
if (*cp == '_') {
|
||||
fileline()->v3error("Extra underscore in meta-comment;"
|
||||
" use /*verilator {...}*/ not /*verilator_{...}*/");
|
||||
V3Control::applyIgnores(fileline());
|
||||
fileline()->v3warn(BADVLTPRAGMA, "Extra underscore in meta-comment, ignoring comment;"
|
||||
" use /*verilator {...}*/ not /*verilator_{...}*/");
|
||||
return;
|
||||
}
|
||||
vlcomment = true;
|
||||
} else if (VString::startsWith(cp, "synopsys")) {
|
||||
cp += std::strlen("synopsys");
|
||||
synth = true;
|
||||
if (*cp == '_') {
|
||||
fileline()->v3error("Extra underscore in meta-comment;"
|
||||
" use /*synopsys {...}*/ not /*synopsys_{...}*/");
|
||||
V3Control::applyIgnores(fileline());
|
||||
fileline()->v3warn(BADVLTPRAGMA, "Extra underscore in meta-comment, ignoring comment;"
|
||||
" use /*synopsys {...}*/ not /*synopsys_{...}*/");
|
||||
return;
|
||||
}
|
||||
synth = true;
|
||||
} else if (VString::startsWith(cp, "cadence")) {
|
||||
cp += std::strlen("cadence");
|
||||
synth = true;
|
||||
@@ -505,8 +509,6 @@ void V3PreProcImp::comment(const string& text) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!vlcomment && !synth) return; // Short-circuit
|
||||
|
||||
while (std::isspace(*cp)) ++cp;
|
||||
string cmd = commentCleanup(string{cp});
|
||||
// cmd now is comment without extra spaces and "verilator" prefix
|
||||
|
||||
Reference in New Issue
Block a user