Internals: Remove legacy define. No functional change.

This commit is contained in:
Wilson Snyder 2023-09-13 08:46:51 -04:00
parent 8bd6d7c5b1
commit 823e0723fb
2 changed files with 12 additions and 15 deletions

View File

@ -212,7 +212,7 @@ private:
void parsingOn() { void parsingOn() {
m_off--; m_off--;
if (m_off < 0) fatalSrc("Underflow of parsing cmds"); if (m_off < 0) v3fatalSrc("Underflow of parsing cmds");
// addLineComment no longer needed; getFinalToken will correct. // addLineComment no longer needed; getFinalToken will correct.
} }
void parsingOff() { m_off++; } void parsingOff() { m_off++; }
@ -541,7 +541,7 @@ void V3PreProcImp::unputString(const string& strg) {
// so instead we scan from a temporary buffer, then on EOF return. // so instead we scan from a temporary buffer, then on EOF return.
// This is also faster than the old scheme, amazingly. // This is also faster than the old scheme, amazingly.
if (VL_UNCOVERABLE(m_lexp->m_bufferState != m_lexp->currentBuffer())) { if (VL_UNCOVERABLE(m_lexp->m_bufferState != m_lexp->currentBuffer())) {
fatalSrc("bufferStack missing current buffer; will return incorrectly"); v3fatalSrc("bufferStack missing current buffer; will return incorrectly");
// Hard to debug lost text as won't know till much later // Hard to debug lost text as won't know till much later
} }
m_lexp->scanBytes(strg); m_lexp->scanBytes(strg);
@ -1091,7 +1091,7 @@ int V3PreProcImp::getStateToken() {
m_lexp->pushStateDefForm(); m_lexp->pushStateDefForm();
goto next_tok; goto next_tok;
} else { // LCOV_EXCL_LINE } else { // LCOV_EXCL_LINE
fatalSrc("Bad case\n"); v3fatalSrc("Bad case\n");
} }
goto next_tok; goto next_tok;
} else if (tok == VP_TEXT) { } else if (tok == VP_TEXT) {
@ -1165,7 +1165,7 @@ int V3PreProcImp::getStateToken() {
} else { } else {
const string msg const string msg
= std::string{"Bad define text, unexpected "} + tokenName(tok) + "\n"; = std::string{"Bad define text, unexpected "} + tokenName(tok) + "\n";
fatalSrc(msg); v3fatalSrc(msg);
} }
statePop(); statePop();
// DEFVALUE is terminated by a return, but lex can't return both tokens. // DEFVALUE is terminated by a return, but lex can't return both tokens.
@ -1179,7 +1179,7 @@ int V3PreProcImp::getStateToken() {
goto next_tok; goto next_tok;
} else { } else {
if (VL_UNCOVERABLE(m_defRefs.empty())) { if (VL_UNCOVERABLE(m_defRefs.empty())) {
fatalSrc("Shouldn't be in DEFPAREN w/o active defref"); v3fatalSrc("Shouldn't be in DEFPAREN w/o active defref");
} }
const VDefineRef* const refp = &(m_defRefs.top()); const VDefineRef* const refp = &(m_defRefs.top());
error(std::string{"Expecting ( to begin argument list for define reference `"} error(std::string{"Expecting ( to begin argument list for define reference `"}
@ -1190,7 +1190,7 @@ int V3PreProcImp::getStateToken() {
} }
case ps_DEFARG: { case ps_DEFARG: {
if (VL_UNCOVERABLE(m_defRefs.empty())) { if (VL_UNCOVERABLE(m_defRefs.empty())) {
fatalSrc("Shouldn't be in DEFARG w/o active defref"); v3fatalSrc("Shouldn't be in DEFARG w/o active defref");
} }
VDefineRef* refp = &(m_defRefs.top()); VDefineRef* refp = &(m_defRefs.top());
refp->nextarg(refp->nextarg() + m_lexp->m_defValue); refp->nextarg(refp->nextarg() + m_lexp->m_defValue);
@ -1217,7 +1217,7 @@ int V3PreProcImp::getStateToken() {
if (state() if (state()
== ps_JOIN) { // Handle {left}```FOO(ARG) where `FOO(ARG) might be empty == ps_JOIN) { // Handle {left}```FOO(ARG) where `FOO(ARG) might be empty
if (VL_UNCOVERABLE(m_joinStack.empty())) { if (VL_UNCOVERABLE(m_joinStack.empty())) {
fatalSrc("`` join stack empty, but in a ``"); v3fatalSrc("`` join stack empty, but in a ``");
} }
const string lhs = m_joinStack.top(); const string lhs = m_joinStack.top();
m_joinStack.pop(); m_joinStack.pop();
@ -1307,7 +1307,7 @@ int V3PreProcImp::getStateToken() {
case ps_JOIN: { case ps_JOIN: {
if (tok == VP_SYMBOL || tok == VP_TEXT) { if (tok == VP_SYMBOL || tok == VP_TEXT) {
if (VL_UNCOVERABLE(m_joinStack.empty())) { if (VL_UNCOVERABLE(m_joinStack.empty())) {
fatalSrc("`` join stack empty, but in a ``"); v3fatalSrc("`` join stack empty, but in a ``");
} }
const string lhs = m_joinStack.top(); const string lhs = m_joinStack.top();
m_joinStack.pop(); m_joinStack.pop();
@ -1363,7 +1363,7 @@ int V3PreProcImp::getStateToken() {
goto next_tok; goto next_tok;
} }
} }
default: fatalSrc("Bad case\n"); default: v3fatalSrc("Bad case\n");
} }
// Default is to do top level expansion of some tokens // Default is to do top level expansion of some tokens
switch (tok) { switch (tok) {
@ -1445,7 +1445,7 @@ int V3PreProcImp::getStateToken() {
// Just output the substitution // Just output the substitution
if (state() == ps_JOIN) { // Handle {left}```FOO where `FOO might be empty if (state() == ps_JOIN) { // Handle {left}```FOO where `FOO might be empty
if (VL_UNCOVERABLE(m_joinStack.empty())) { if (VL_UNCOVERABLE(m_joinStack.empty())) {
fatalSrc("`` join stack empty, but in a ``"); v3fatalSrc("`` join stack empty, but in a ``");
} }
const string lhs = m_joinStack.top(); const string lhs = m_joinStack.top();
m_joinStack.pop(); m_joinStack.pop();
@ -1481,7 +1481,7 @@ int V3PreProcImp::getStateToken() {
goto next_tok; goto next_tok;
} }
} }
fatalSrc("Bad case\n"); // FALLTHRU v3fatalSrc("Bad case\n"); // FALLTHRU
goto next_tok; // above fatal means unreachable, but fixes static analysis warning goto next_tok; // above fatal means unreachable, but fixes static analysis warning
} }
case VP_ERROR: { case VP_ERROR: {
@ -1518,7 +1518,7 @@ int V3PreProcImp::getStateToken() {
case VP_DEFFORM: // Handled by state=ps_DEFFORM; case VP_DEFFORM: // Handled by state=ps_DEFFORM;
case VP_DEFVALUE: // Handled by state=ps_DEFVALUE; case VP_DEFVALUE: // Handled by state=ps_DEFVALUE;
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
fatalSrc(std::string{"Internal error: Unexpected token "} + tokenName(tok) + "\n"); v3fatalSrc(std::string{"Internal error: Unexpected token "} + tokenName(tok) + "\n");
break; // LCOV_EXCL_LINE break; // LCOV_EXCL_LINE
} }
return tok; return tok;

View File

@ -28,9 +28,6 @@
#include <list> #include <list>
#include <map> #include <map>
// Compatibility with Verilog-Perl's preprocessor
#define fatalSrc(msg) v3fatalSrc(msg)
class VInFilter; class VInFilter;
class VSpellCheck; class VSpellCheck;