Internals: Use C++14 quoted literal std::string

This commit is contained in:
Wilson Snyder 2024-01-28 20:24:28 -05:00
parent eecdf4b0f3
commit 22687a6901
38 changed files with 92 additions and 107 deletions

View File

@ -943,7 +943,7 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
if (VL_SIGN_E(lbits, lwp[VL_WORDS_I(lbits) - 1])) { if (VL_SIGN_E(lbits, lwp[VL_WORDS_I(lbits) - 1])) {
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> neg; VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> neg;
VL_NEGATE_W(VL_WORDS_I(lbits), neg, lwp); VL_NEGATE_W(VL_WORDS_I(lbits), neg, lwp);
append = std::string{"-"} + VL_DECIMAL_NW(lbits, neg); append = "-"s + VL_DECIMAL_NW(lbits, neg);
} else { } else {
append = VL_DECIMAL_NW(lbits, lwp); append = VL_DECIMAL_NW(lbits, lwp);
} }
@ -1085,7 +1085,7 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
} }
break; break;
default: { // LCOV_EXCL_START default: { // LCOV_EXCL_START
const std::string msg = std::string{"Unknown _vl_vsformat code: "} + pos[0]; const std::string msg = "Unknown _vl_vsformat code: "s + pos[0];
VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str());
break; break;
} // LCOV_EXCL_STOP } // LCOV_EXCL_STOP
@ -1367,7 +1367,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
break; break;
} }
default: { // LCOV_EXCL_START default: { // LCOV_EXCL_START
const std::string msg = std::string{"Unknown _vl_vsscanf code: "} + pos[0]; const std::string msg = "Unknown _vl_vsscanf code: "s + pos[0];
VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str());
break; break;
} // LCOV_EXCL_STOP } // LCOV_EXCL_STOP
@ -1727,7 +1727,7 @@ std::string VL_STACKTRACE_N() VL_MT_SAFE {
if (!strings) return "Unable to backtrace\n"; if (!strings) return "Unable to backtrace\n";
std::string result = "Backtrace:\n"; std::string result = "Backtrace:\n";
for (int j = 0; j < nptrs; j++) result += std::string{strings[j]} + std::string{"\n"}; for (int j = 0; j < nptrs; j++) result += std::string{strings[j]} + "\n"s;
free(strings); free(strings);
return result; return result;
} }
@ -2990,7 +2990,7 @@ void Verilated::nullPointerError(const char* filename, int linenum) VL_MT_SAFE {
void Verilated::overWidthError(const char* signame) VL_MT_SAFE { void Verilated::overWidthError(const char* signame) VL_MT_SAFE {
// Slowpath - Called only when signal sets too high of a bit // Slowpath - Called only when signal sets too high of a bit
const std::string msg = (std::string{"Testbench C set input '"} + signame const std::string msg = ("Testbench C set input '"s + signame
+ "' to value that overflows what the signal's width can fit"); + "' to value that overflows what the signal's width can fit");
VL_FATAL_MT("unknown", 0, "", msg.c_str()); VL_FATAL_MT("unknown", 0, "", msg.c_str());
VL_UNREACHABLE; VL_UNREACHABLE;
@ -3212,8 +3212,7 @@ void VerilatedScope::varInsert(int finalize, const char* namep, void* datap, boo
} else { } else {
// We could have a linked list of ranges, but really this whole thing needs // We could have a linked list of ranges, but really this whole thing needs
// to be generalized to support structs and unions, etc. // to be generalized to support structs and unions, etc.
const std::string msg const std::string msg = "Unsupported multi-dimensional public varInsert: "s + namep;
= std::string{"Unsupported multi-dimensional public varInsert: "} + namep;
VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str());
} }
} }
@ -3233,10 +3232,9 @@ VerilatedVar* VerilatedScope::varFind(const char* namep) const VL_MT_SAFE_POSTIN
void* VerilatedScope::exportFindNullError(int funcnum) VL_MT_SAFE { void* VerilatedScope::exportFindNullError(int funcnum) VL_MT_SAFE {
// Slowpath - Called only when find has failed // Slowpath - Called only when find has failed
const std::string msg const std::string msg = ("Testbench C called '"s + VerilatedImp::exportName(funcnum)
= (std::string{"Testbench C called '"} + VerilatedImp::exportName(funcnum) + "' but scope wasn't set, perhaps due to dpi import call without "
+ "' but scope wasn't set, perhaps due to dpi import call without " + "'context', or missing svSetScope. See IEEE 1800-2017 35.5.3.");
+ "'context', or missing svSetScope. See IEEE 1800-2017 35.5.3.");
VL_FATAL_MT("unknown", 0, "", msg.c_str()); VL_FATAL_MT("unknown", 0, "", msg.c_str());
return nullptr; return nullptr;
} }
@ -3244,7 +3242,7 @@ void* VerilatedScope::exportFindNullError(int funcnum) VL_MT_SAFE {
void* VerilatedScope::exportFindError(int funcnum) const VL_MT_SAFE { void* VerilatedScope::exportFindError(int funcnum) const VL_MT_SAFE {
// Slowpath - Called only when find has failed // Slowpath - Called only when find has failed
const std::string msg const std::string msg
= (std::string{"Testbench C called '"} + VerilatedImp::exportName(funcnum) = ("Testbench C called '"s + VerilatedImp::exportName(funcnum)
+ "' but this DPI export function exists only in other scopes, not scope '" + name() + "' but this DPI export function exists only in other scopes, not scope '" + name()
+ "'"); + "'");
VL_FATAL_MT("unknown", 0, "", msg.c_str()); VL_FATAL_MT("unknown", 0, "", msg.c_str());

View File

@ -168,11 +168,11 @@ private:
const std::string& value) VL_PURE { const std::string& value) VL_PURE {
std::string name; std::string name;
if (key.length() == 1 && std::isalpha(key[0])) { if (key.length() == 1 && std::isalpha(key[0])) {
name += std::string{"\001"} + key; name += "\001"s + key;
} else { } else {
name += std::string{"\001"} + dequote(key); name += "\001"s + dequote(key);
} }
name += std::string{"\002"} + dequote(value); name += "\002"s + dequote(value);
return name; return name;
} }
static std::string combineHier(const std::string& old, const std::string& add) VL_PURE { static std::string combineHier(const std::string& old, const std::string& add) VL_PURE {
@ -364,7 +364,7 @@ public:
std::ofstream os{filename}; std::ofstream os{filename};
if (os.fail()) { if (os.fail()) {
const std::string msg = std::string{"%Error: Can't write '"} + filename + "'"; const std::string msg = "%Error: Can't write '"s + filename + "'";
VL_FATAL_MT("", 0, "", msg.c_str()); VL_FATAL_MT("", 0, "", msg.c_str());
return; return;
} }

View File

@ -552,7 +552,7 @@ public:
const VerilatedLockGuard lock{s().m_exportMutex}; const VerilatedLockGuard lock{s().m_exportMutex};
const auto& it = s().m_exportMap.find(namep); const auto& it = s().m_exportMap.find(namep);
if (VL_LIKELY(it != s().m_exportMap.end())) return it->second; if (VL_LIKELY(it != s().m_exportMap.end())) return it->second;
const std::string msg = (std::string{"%Error: Testbench C called "} + namep const std::string msg = ("%Error: Testbench C called "s + namep
+ " but no such DPI export function name exists in ANY model"); + " but no such DPI export function name exists in ANY model");
VL_FATAL_MT("unknown", 0, "", msg.c_str()); VL_FATAL_MT("unknown", 0, "", msg.c_str());
return -1; return -1;

View File

@ -114,8 +114,7 @@ void VerilatedDeserialize::trailer() VL_MT_UNSAFE_ONE {
if (VL_UNLIKELY(os.readDiffers(VLTSAVE_TRAILER_STR, std::strlen(VLTSAVE_TRAILER_STR)))) { if (VL_UNLIKELY(os.readDiffers(VLTSAVE_TRAILER_STR, std::strlen(VLTSAVE_TRAILER_STR)))) {
const std::string fn = filename(); const std::string fn = filename();
const std::string msg const std::string msg
= std::string{"Can't deserialize; file has wrong end-of-file signature: "} = "Can't deserialize; file has wrong end-of-file signature: "s + filename();
+ filename();
VL_FATAL_MT(fn.c_str(), 0, "", msg.c_str()); VL_FATAL_MT(fn.c_str(), 0, "", msg.c_str());
// Die before we close() as close would infinite loop // Die before we close() as close would infinite loop
} }

View File

@ -263,7 +263,7 @@ public:
inline std::string VL_TO_STRING(const VlEventBase& e); inline std::string VL_TO_STRING(const VlEventBase& e);
inline std::string VL_TO_STRING(const VlEvent& e) { inline std::string VL_TO_STRING(const VlEvent& e) {
return std::string{"triggered="} + (e.isTriggered() ? "true" : "false"); return "triggered="s + (e.isTriggered() ? "true" : "false");
} }
inline std::string VL_TO_STRING(const VlAssignableEvent& e) { inline std::string VL_TO_STRING(const VlAssignableEvent& e) {
@ -274,7 +274,7 @@ inline std::string VL_TO_STRING(const VlEventBase& e) {
if (const VlAssignableEvent& assignable = dynamic_cast<const VlAssignableEvent&>(e)) { if (const VlAssignableEvent& assignable = dynamic_cast<const VlAssignableEvent&>(e)) {
return VL_TO_STRING(assignable); return VL_TO_STRING(assignable);
} }
return std::string{"triggered="} + (e.isTriggered() ? "true" : "false"); return "triggered="s + (e.isTriggered() ? "true" : "false");
} }
//=================================================================== //===================================================================

View File

@ -282,8 +282,7 @@ void VerilatedVcd::bufferFlush() VL_MT_UNSAFE_ONE {
if (VL_UNCOVERABLE(errno != EAGAIN && errno != EINTR)) { if (VL_UNCOVERABLE(errno != EAGAIN && errno != EINTR)) {
// LCOV_EXCL_START // LCOV_EXCL_START
// write failed, presume error (perhaps out of disk space) // write failed, presume error (perhaps out of disk space)
const std::string msg const std::string msg = "VerilatedVcd::bufferFlush: "s + std::strerror(errno);
= std::string{"VerilatedVcd::bufferFlush: "} + std::strerror(errno);
VL_FATAL_MT("", 0, "", msg.c_str()); VL_FATAL_MT("", 0, "", msg.c_str());
closeErr(); closeErr();
break; break;

View File

@ -1402,8 +1402,7 @@ const char* VerilatedVpiError::strFromVpiConstType(PLI_INT32 constType) VL_PURE
#define SELF_CHECK_RESULT_CSTR(got, exp) \ #define SELF_CHECK_RESULT_CSTR(got, exp) \
if (0 != std::strcmp((got), (exp))) { \ if (0 != std::strcmp((got), (exp))) { \
const std::string msg \ const std::string msg = "%Error: GOT = '"s + (got) + "'" + " EXP = '" + (exp) + "'"; \
= std::string{"%Error: "} + "GOT = '" + (got) + "'" + " EXP = '" + (exp) + "'"; \
VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); \ VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); \
} }

View File

@ -1972,7 +1972,7 @@ public:
static string prettyName(const string& namein) VL_PURE; // Name for printing out to the user static string prettyName(const string& namein) VL_PURE; // Name for printing out to the user
static string vpiName(const string& namein); // Name for vpi access static string vpiName(const string& namein); // Name for vpi access
static string prettyNameQ(const string& namein) { // Quoted pretty name (for errors) static string prettyNameQ(const string& namein) { // Quoted pretty name (for errors)
return std::string{"'"} + prettyName(namein) + "'"; return "'"s + prettyName(namein) + "'";
} }
// Encode user name into internal C representation // Encode user name into internal C representation
static string encodeName(const string& namein); static string encodeName(const string& namein);

View File

@ -98,7 +98,7 @@ static void makeToString(AstClass* nodep) {
funcp->isStatic(false); funcp->isStatic(false);
funcp->protect(false); funcp->protect(false);
AstCExpr* const exprp AstCExpr* const exprp
= new AstCExpr{nodep->fileline(), R"(std::string{"'{"} + to_string_middle() + "}")", 0}; = new AstCExpr{nodep->fileline(), R"("'{"s + to_string_middle() + "}")", 0};
exprp->dtypeSetString(); exprp->dtypeSetString();
funcp->addStmtsp(new AstCReturn{nodep->fileline(), exprp}); funcp->addStmtsp(new AstCReturn{nodep->fileline(), exprp});
nodep->addStmtsp(funcp); nodep->addStmtsp(funcp);

View File

@ -273,7 +273,7 @@ class CoverageVisitor final : public VNVisitor {
// We'll do this, and make the if(...) coverinc later. // We'll do this, and make the if(...) coverinc later.
// Add signal to hold the old value // Add signal to hold the old value
const string newvarname = std::string{"__Vtogcov__"} + nodep->shortName(); const string newvarname = "__Vtogcov__"s + nodep->shortName();
FileLine* const fl_nowarn = new FileLine{nodep->fileline()}; FileLine* const fl_nowarn = new FileLine{nodep->fileline()};
fl_nowarn->modifyWarnOff(V3ErrorCode::UNUSEDSIGNAL, true); fl_nowarn->modifyWarnOff(V3ErrorCode::UNUSEDSIGNAL, true);
AstVar* const chgVarp AstVar* const chgVarp
@ -284,7 +284,7 @@ class CoverageVisitor final : public VNVisitor {
// This is necessarily an O(n^2) expansion, which is why // This is necessarily an O(n^2) expansion, which is why
// we limit coverage to signals with < 256 bits. // we limit coverage to signals with < 256 bits.
ToggleEnt newvec{std::string{""}, new AstVarRef{fl_nowarn, nodep, VAccess::READ}, ToggleEnt newvec{""s, new AstVarRef{fl_nowarn, nodep, VAccess::READ},
new AstVarRef{fl_nowarn, chgVarp, VAccess::WRITE}}; new AstVarRef{fl_nowarn, chgVarp, VAccess::WRITE}};
toggleVarRecurse(nodep->dtypeSkipRefp(), 0, newvec, nodep, chgVarp); toggleVarRecurse(nodep->dtypeSkipRefp(), 0, newvec, nodep, chgVarp);
newvec.cleanup(); newvec.cleanup();
@ -308,8 +308,7 @@ class CoverageVisitor final : public VNVisitor {
for (int index_docs = bdtypep->lo(); index_docs < bdtypep->hi() + 1; for (int index_docs = bdtypep->lo(); index_docs < bdtypep->hi() + 1;
++index_docs) { ++index_docs) {
const int index_code = index_docs - bdtypep->lo(); const int index_code = index_docs - bdtypep->lo();
ToggleEnt newent{above.m_comment + std::string{"["} + cvtToStr(index_docs) ToggleEnt newent{above.m_comment + "["s + cvtToStr(index_docs) + "]",
+ "]",
new AstSel{varp->fileline(), above.m_varRefp->cloneTree(true), new AstSel{varp->fileline(), above.m_varRefp->cloneTree(true),
index_code, 1}, index_code, 1},
new AstSel{varp->fileline(), above.m_chgRefp->cloneTree(true), new AstSel{varp->fileline(), above.m_chgRefp->cloneTree(true),
@ -323,7 +322,7 @@ class CoverageVisitor final : public VNVisitor {
} else if (const AstUnpackArrayDType* const adtypep = VN_CAST(dtypep, UnpackArrayDType)) { } else if (const AstUnpackArrayDType* const adtypep = VN_CAST(dtypep, UnpackArrayDType)) {
for (int index_docs = adtypep->lo(); index_docs <= adtypep->hi(); ++index_docs) { for (int index_docs = adtypep->lo(); index_docs <= adtypep->hi(); ++index_docs) {
const int index_code = index_docs - adtypep->lo(); const int index_code = index_docs - adtypep->lo();
ToggleEnt newent{above.m_comment + std::string{"["} + cvtToStr(index_docs) + "]", ToggleEnt newent{above.m_comment + "["s + cvtToStr(index_docs) + "]",
new AstArraySel{varp->fileline(), new AstArraySel{varp->fileline(),
above.m_varRefp->cloneTree(true), index_code}, above.m_varRefp->cloneTree(true), index_code},
new AstArraySel{varp->fileline(), new AstArraySel{varp->fileline(),
@ -336,7 +335,7 @@ class CoverageVisitor final : public VNVisitor {
for (int index_docs = adtypep->lo(); index_docs <= adtypep->hi(); ++index_docs) { for (int index_docs = adtypep->lo(); index_docs <= adtypep->hi(); ++index_docs) {
const AstNodeDType* const subtypep = adtypep->subDTypep()->skipRefp(); const AstNodeDType* const subtypep = adtypep->subDTypep()->skipRefp();
const int index_code = index_docs - adtypep->lo(); const int index_code = index_docs - adtypep->lo();
ToggleEnt newent{above.m_comment + std::string{"["} + cvtToStr(index_docs) + "]", ToggleEnt newent{above.m_comment + "["s + cvtToStr(index_docs) + "]",
new AstSel{varp->fileline(), above.m_varRefp->cloneTree(true), new AstSel{varp->fileline(), above.m_varRefp->cloneTree(true),
index_code * subtypep->width(), subtypep->width()}, index_code * subtypep->width(), subtypep->width()},
new AstSel{varp->fileline(), above.m_chgRefp->cloneTree(true), new AstSel{varp->fileline(), above.m_chgRefp->cloneTree(true),
@ -351,7 +350,7 @@ class CoverageVisitor final : public VNVisitor {
itemp = VN_AS(itemp->nextp(), MemberDType)) { itemp = VN_AS(itemp->nextp(), MemberDType)) {
AstNodeDType* const subtypep = itemp->subDTypep()->skipRefp(); AstNodeDType* const subtypep = itemp->subDTypep()->skipRefp();
const int index_code = itemp->lsb(); const int index_code = itemp->lsb();
ToggleEnt newent{above.m_comment + std::string{"."} + itemp->name(), ToggleEnt newent{above.m_comment + "."s + itemp->name(),
new AstSel{varp->fileline(), above.m_varRefp->cloneTree(true), new AstSel{varp->fileline(), above.m_varRefp->cloneTree(true),
index_code, subtypep->width()}, index_code, subtypep->width()},
new AstSel{varp->fileline(), above.m_chgRefp->cloneTree(true), new AstSel{varp->fileline(), above.m_chgRefp->cloneTree(true),
@ -369,8 +368,7 @@ class CoverageVisitor final : public VNVisitor {
varp->fileline(), above.m_varRefp->cloneTree(true), itemp->name()}; varp->fileline(), above.m_varRefp->cloneTree(true), itemp->name()};
varRefp->dtypep(subtypep); varRefp->dtypep(subtypep);
chgRefp->dtypep(subtypep); chgRefp->dtypep(subtypep);
ToggleEnt newent{above.m_comment + std::string{"."} + itemp->name(), varRefp, ToggleEnt newent{above.m_comment + "."s + itemp->name(), varRefp, chgRefp};
chgRefp};
toggleVarRecurse(subtypep, depth + 1, newent, varp, chgVarp); toggleVarRecurse(subtypep, depth + 1, newent, varp, chgVarp);
newent.cleanup(); newent.cleanup();
} }
@ -379,7 +377,7 @@ class CoverageVisitor final : public VNVisitor {
// Arbitrarily handle only the first member of the union // Arbitrarily handle only the first member of the union
if (const AstMemberDType* const itemp = adtypep->membersp()) { if (const AstMemberDType* const itemp = adtypep->membersp()) {
AstNodeDType* const subtypep = itemp->subDTypep()->skipRefp(); AstNodeDType* const subtypep = itemp->subDTypep()->skipRefp();
ToggleEnt newent{above.m_comment + std::string{"."} + itemp->name(), ToggleEnt newent{above.m_comment + "."s + itemp->name(),
above.m_varRefp->cloneTree(true), above.m_varRefp->cloneTree(true),
above.m_chgRefp->cloneTree(true)}; above.m_chgRefp->cloneTree(true)};
toggleVarRecurse(subtypep, depth + 1, newent, varp, chgVarp); toggleVarRecurse(subtypep, depth + 1, newent, varp, chgVarp);

View File

@ -309,7 +309,7 @@ class EmitCModel final : public EmitCFunc {
const int vecnum = vects++; const int vecnum = vects++;
UASSERT_OBJ(arrayp->hi() >= arrayp->lo(), varp, UASSERT_OBJ(arrayp->hi() >= arrayp->lo(), varp,
"Should have swapped msb & lsb earlier."); "Should have swapped msb & lsb earlier.");
const string ivar = std::string{"__Vi"} + cvtToStr(vecnum); const string ivar = "__Vi"s + cvtToStr(vecnum);
putns(varp, "for (int __Vi" + cvtToStr(vecnum) + " = " putns(varp, "for (int __Vi" + cvtToStr(vecnum) + " = "
+ cvtToStr(arrayp->lo())); + cvtToStr(arrayp->lo()));
puts("; " + ivar + " <= " + cvtToStr(arrayp->hi())); puts("; " + ivar + " <= " + cvtToStr(arrayp->hi()));

View File

@ -205,7 +205,7 @@ class EmitVBaseVisitorConst VL_NOT_FINAL : public EmitCBaseVisitorConst {
putqs(nodep, "end\n"); putqs(nodep, "end\n");
} }
void visit(AstComment* nodep) override { void visit(AstComment* nodep) override {
puts(std::string{"// "} + nodep->name() + "\n"); puts("// "s + nodep->name() + "\n");
iterateChildrenConst(nodep); iterateChildrenConst(nodep);
} }
void visit(AstContinue*) override { void visit(AstContinue*) override {
@ -747,7 +747,7 @@ class EmitVBaseVisitorConst VL_NOT_FINAL : public EmitCBaseVisitorConst {
void visit(AstCell*) override {} // Handled outside the Visit class void visit(AstCell*) override {} // Handled outside the Visit class
// Default // Default
void visit(AstNode* nodep) override { void visit(AstNode* nodep) override {
puts(std::string{"\n???? // "} + nodep->prettyTypeName() + "\n"); puts("\n???? // "s + nodep->prettyTypeName() + "\n");
iterateChildrenConst(nodep); iterateChildrenConst(nodep);
// Not v3fatalSrc so we keep processing // Not v3fatalSrc so we keep processing
if (!m_suppressUnknown) { if (!m_suppressUnknown) {

View File

@ -111,7 +111,7 @@ string V3ErrorGuarded::warnMore() VL_REQUIRES(m_mutex) { return string(msgPrefix
void V3ErrorGuarded::suppressThisWarning() VL_REQUIRES(m_mutex) { void V3ErrorGuarded::suppressThisWarning() VL_REQUIRES(m_mutex) {
#ifndef V3ERROR_NO_GLOBAL_ #ifndef V3ERROR_NO_GLOBAL_
V3Stats::addStatSum(std::string{"Warnings, Suppressed "} + errorCode().ascii(), 1); V3Stats::addStatSum("Warnings, Suppressed "s + errorCode().ascii(), 1);
#endif #endif
errorSuppressed(true); errorSuppressed(true);
} }

View File

@ -877,26 +877,26 @@ string V3OutFormatter::quoteNameControls(const string& namein,
// Encode chars into XML string // Encode chars into XML string
for (const char c : namein) { for (const char c : namein) {
if (c == '"') { if (c == '"') {
out += std::string{"&quot;"}; out += "&quot;"s;
} else if (c == '\'') { } else if (c == '\'') {
out += std::string{"&apos;"}; out += "&apos;"s;
} else if (c == '<') { } else if (c == '<') {
out += std::string{"&lt;"}; out += "&lt;"s;
} else if (c == '>') { } else if (c == '>') {
out += std::string{"&gt;"}; out += "&gt;"s;
} else if (c == '&') { } else if (c == '&') {
out += std::string{"&amp;"}; out += "&amp;"s;
} else if (std::isprint(c)) { } else if (std::isprint(c)) {
out += c; out += c;
} else { } else {
out += std::string{"&#"} + cvtToStr((unsigned int)(c & 0xff)) + ";"; out += "&#"s + cvtToStr((unsigned int)(c & 0xff)) + ";";
} }
} }
} else { } else {
// Encode control chars into C style escapes // Encode control chars into C style escapes
for (const char c : namein) { for (const char c : namein) {
if (c == '\\' || c == '"') { if (c == '\\' || c == '"') {
out += std::string{"\\"} + c; out += "\\"s + c;
} else if (c == '\n') { } else if (c == '\n') {
out += "\\n"; out += "\\n";
} else if (c == '\r') { } else if (c == '\r') {
@ -907,8 +907,8 @@ string V3OutFormatter::quoteNameControls(const string& namein,
out += c; out += c;
} else { } else {
// This will also cover \a etc // This will also cover \a etc
const string octal = std::string{"\\"} + cvtToStr((c >> 6) & 3) const string octal
+ cvtToStr((c >> 3) & 7) + cvtToStr(c & 7); = "\\"s + cvtToStr((c >> 6) & 3) + cvtToStr((c >> 3) & 7) + cvtToStr(c & 7);
out += octal; out += octal;
} }
} }
@ -955,8 +955,7 @@ void V3OutFile::putsForceIncs() {
void V3OutCFile::putsGuard() { void V3OutCFile::putsGuard() {
UASSERT(!m_guard, "Already called putsGuard in emit file"); UASSERT(!m_guard, "Already called putsGuard in emit file");
m_guard = true; m_guard = true;
string var string var = VString::upcase("VERILATED_"s + V3Os::filenameNonDir(filename()) + "_");
= VString::upcase(std::string{"VERILATED_"} + V3Os::filenameNonDir(filename()) + "_");
for (char& c : var) { for (char& c : var) {
if (!std::isalnum(c)) c = '_'; if (!std::isalnum(c)) c = '_';
} }

View File

@ -203,7 +203,7 @@ string FileLine::xmlDetailedLocation() const {
} }
string FileLine::lineDirectiveStrg(int enterExit) const { string FileLine::lineDirectiveStrg(int enterExit) const {
return std::string{"`line "} + cvtToStr(lastLineno()) + " \"" return "`line "s + cvtToStr(lastLineno()) + " \""
+ V3OutFormatter::quoteNameControls(filename()) + "\" " + cvtToStr(enterExit) + "\n"; + V3OutFormatter::quoteNameControls(filename()) + "\" " + cvtToStr(enterExit) + "\n";
} }

View File

@ -253,7 +253,7 @@ class HierBlockUsageCollectVisitor final : public VNVisitorConst {
// Don't visit twice // Don't visit twice
if (nodep->user1SetOnce()) return; if (nodep->user1SetOnce()) return;
UINFO(5, "Checking " << nodep->prettyNameQ() << " from " UINFO(5, "Checking " << nodep->prettyNameQ() << " from "
<< (m_hierBlockp ? m_hierBlockp->prettyNameQ() : std::string{"null"}) << (m_hierBlockp ? m_hierBlockp->prettyNameQ() : "null"s)
<< std::endl); << std::endl);
VL_RESTORER(m_modp); VL_RESTORER(m_modp);
AstModule* const prevHierBlockp = m_hierBlockp; AstModule* const prevHierBlockp = m_hierBlockp;

View File

@ -421,13 +421,11 @@ class InlineRelinkVisitor final : public VNVisitor {
// To keep correct visual order, must add before other Text's // To keep correct visual order, must add before other Text's
AstText* afterp = nodep->scopeAttrp(); AstText* afterp = nodep->scopeAttrp();
if (afterp) afterp->unlinkFrBackWithNext(); if (afterp) afterp->unlinkFrBackWithNext();
nodep->addScopeAttrp( nodep->addScopeAttrp(new AstText{nodep->fileline(), "__DOT__"s + m_cellp->name()});
new AstText{nodep->fileline(), std::string{"__DOT__"} + m_cellp->name()});
if (afterp) nodep->addScopeAttrp(afterp); if (afterp) nodep->addScopeAttrp(afterp);
afterp = nodep->scopeEntrp(); afterp = nodep->scopeEntrp();
if (afterp) afterp->unlinkFrBackWithNext(); if (afterp) afterp->unlinkFrBackWithNext();
nodep->addScopeEntrp( nodep->addScopeEntrp(new AstText{nodep->fileline(), "__DOT__"s + m_cellp->name()});
new AstText{nodep->fileline(), std::string{"__DOT__"} + m_cellp->name()});
if (afterp) nodep->addScopeEntrp(afterp); if (afterp) nodep->addScopeEntrp(afterp);
iterateChildren(nodep); iterateChildren(nodep);
} }

View File

@ -45,7 +45,7 @@ class NameVisitor final : public VNVisitorConst {
void rename(AstNode* nodep, bool addPvt) { void rename(AstNode* nodep, bool addPvt) {
if (!nodep->user1()) { // Not already done if (!nodep->user1()) { // Not already done
if (addPvt) { if (addPvt) {
const string newname = std::string{"__PVT__"} + nodep->name(); const string newname = "__PVT__"s + nodep->name();
nodep->name(newname); nodep->name(newname);
nodep->editCountInc(); nodep->editCountInc();
} else if (VN_IS(nodep, CFunc) && VN_AS(nodep, CFunc)->isConstructor()) { } else if (VN_IS(nodep, CFunc) && VN_AS(nodep, CFunc)->isConstructor()) {
@ -54,7 +54,7 @@ class NameVisitor final : public VNVisitorConst {
if (rsvd != "") { if (rsvd != "") {
nodep->v3warn(SYMRSVDWORD, nodep->v3warn(SYMRSVDWORD,
"Symbol matches " + rsvd + ": " << nodep->prettyNameQ()); "Symbol matches " + rsvd + ": " << nodep->prettyNameQ());
const string newname = std::string{"__SYM__"} + nodep->name(); const string newname = "__SYM__"s + nodep->name();
nodep->name(newname); nodep->name(newname);
nodep->editCountInc(); nodep->editCountInc();
} }

View File

@ -851,7 +851,7 @@ string V3Number::toDecimalS() const VL_MT_STABLE {
if (isNegative()) { if (isNegative()) {
V3Number lhsNoSign = *this; V3Number lhsNoSign = *this;
lhsNoSign.opNegate(*this); lhsNoSign.opNegate(*this);
return std::string{"-"} + lhsNoSign.toDecimalU(); return "-"s + lhsNoSign.toDecimalU();
} else { } else {
return toDecimalU(); return toDecimalU();
} }

View File

@ -145,9 +145,7 @@ V3OptionParser::ActionIfs* V3OptionParser::find(const char* optp) {
if (act.second->isOnOffAllowed()) { // Find starts with "-no" if (act.second->isOnOffAllowed()) { // Find starts with "-no"
if (const char* const nop if (const char* const nop
= VString::startsWith(optp, "-no") ? (optp + std::strlen("-no")) : nullptr) { = VString::startsWith(optp, "-no") ? (optp + std::strlen("-no")) : nullptr) {
if (act.first == nop || act.first == (std::string{"-"} + nop)) { if (act.first == nop || act.first == ("-"s + nop)) { return act.second.get(); }
return act.second.get();
}
} }
} else if (act.second->isPartialMatchAllowed()) { } else if (act.second->isPartialMatchAllowed()) {
if (VString::startsWith(optp, act.first)) return act.second.get(); if (VString::startsWith(optp, act.first)) return act.second.get();

View File

@ -1584,7 +1584,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
}); });
DECL_OPTION("-Wno-", CbPartialMatch, [fl, &parser](const char* optp) VL_MT_DISABLED { DECL_OPTION("-Wno-", CbPartialMatch, [fl, &parser](const char* optp) VL_MT_DISABLED {
if (!FileLine::globalWarnOff(optp, true)) { if (!FileLine::globalWarnOff(optp, true)) {
const string fullopt = std::string{"-Wno-"} + optp; const string fullopt = "-Wno-"s + optp;
fl->v3fatal("Unknown warning specified: " << fullopt fl->v3fatal("Unknown warning specified: " << fullopt
<< parser.getSuggestion(fullopt.c_str())); << parser.getSuggestion(fullopt.c_str()));
} }
@ -1606,7 +1606,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
const V3ErrorCode code{optp}; const V3ErrorCode code{optp};
if (code == V3ErrorCode::EC_ERROR) { if (code == V3ErrorCode::EC_ERROR) {
if (!isFuture(optp)) { if (!isFuture(optp)) {
const string fullopt = std::string{"-Wwarn-"} + optp; const string fullopt = "-Wwarn-"s + optp;
fl->v3fatal("Unknown warning specified: " fl->v3fatal("Unknown warning specified: "
<< fullopt << parser.getSuggestion(fullopt.c_str())); << fullopt << parser.getSuggestion(fullopt.c_str()));
} }

View File

@ -367,7 +367,7 @@ class ParamProcessor final {
const auto pair = m_valueMap.emplace(hash, 0); const auto pair = m_valueMap.emplace(hash, 0);
if (pair.second) pair.first->second = m_nextValue++; if (pair.second) pair.first->second = m_nextValue++;
num = pair.first->second; num = pair.first->second;
return std::string{"z"} + cvtToStr(num); return "z"s + cvtToStr(num);
} }
string moduleCalcName(const AstNodeModule* srcModp, const string& longname) { string moduleCalcName(const AstNodeModule* srcModp, const string& longname) {
string newname = longname; string newname = longname;

View File

@ -91,7 +91,7 @@ public:
void reinsert(AstNode* nodep, VSymEnt* parentp, string name) { void reinsert(AstNode* nodep, VSymEnt* parentp, string name) {
if (!parentp) parentp = symCurrentp(); if (!parentp) parentp = symCurrentp();
if (name == "") { // New name with space in name so can't collide with users if (name == "") { // New name with space in name so can't collide with users
name = std::string{" anon"} + nodep->type().ascii() + cvtToStr(++s_anonNum); name = " anon"s + nodep->type().ascii() + cvtToStr(++s_anonNum);
} }
parentp->reinsert(name, findNewTable(nodep)); parentp->reinsert(name, findNewTable(nodep));
} }

View File

@ -84,9 +84,9 @@ public:
uint64_t profilerId() const { return m_profilerId; } uint64_t profilerId() const { return m_profilerId; }
string cFuncName() const { string cFuncName() const {
// If this MTask maps to a C function, this should be the name // If this MTask maps to a C function, this should be the name
return std::string{"__Vmtask"} + "__" + cvtToStr(m_id); return "__Vmtask"s + "__" + cvtToStr(m_id);
} }
string name() const override VL_MT_STABLE { return std::string{"mt"} + cvtToStr(id()); } string name() const override VL_MT_STABLE { return "mt"s + cvtToStr(id()); }
string hashName() const { return m_hashName; } string hashName() const { return m_hashName; }
void hashName(const string& name) { m_hashName = name; } void hashName(const string& name) { m_hashName = name; }
void dump(std::ostream& str) const { void dump(std::ostream& str) const {

View File

@ -329,7 +329,7 @@ FileLine* V3PreProcImp::defFileline(const string& name) {
void V3PreProcImp::define(FileLine* fl, const string& name, const string& value, void V3PreProcImp::define(FileLine* fl, const string& name, const string& value,
const string& params, bool cmdline) { const string& params, bool cmdline) {
UINFO(4, "DEFINE '" << name << "' as '" << value << "' params '" << params << "'" << endl); UINFO(4, "DEFINE '" << name << "' as '" << value << "' params '" << params << "'" << endl);
if (!V3LanguageWords::isKeyword(std::string{"`"} + name).empty()) { if (!V3LanguageWords::isKeyword("`"s + name).empty()) {
fl->v3error("Attempting to define built-in directive: '`" << name fl->v3error("Attempting to define built-in directive: '`" << name
<< "' (IEEE 1800-2017 22.5.1)"); << "' (IEEE 1800-2017 22.5.1)");
} else { } else {
@ -887,7 +887,7 @@ void V3PreProcImp::dumpDefines(std::ostream& os) {
void V3PreProcImp::candidateDefines(VSpellCheck* spellerp) { void V3PreProcImp::candidateDefines(VSpellCheck* spellerp) {
for (DefinesMap::const_iterator it = m_defines.begin(); it != m_defines.end(); ++it) { for (DefinesMap::const_iterator it = m_defines.begin(); it != m_defines.end(); ++it) {
spellerp->pushCandidate(std::string{"`"} + it->first); spellerp->pushCandidate("`"s + it->first);
} }
} }
@ -1107,7 +1107,7 @@ int V3PreProcImp::getStateToken() {
// IE, `ifdef `MACRO(x): Substitute and come back here when state pops. // IE, `ifdef `MACRO(x): Substitute and come back here when state pops.
break; break;
} else { } else {
error(std::string{"Expecting define name. Found: "} + tokenName(tok) + "\n"); error("Expecting define name. Found: "s + tokenName(tok) + "\n");
goto next_tok; goto next_tok;
} }
} }
@ -1128,8 +1128,7 @@ int V3PreProcImp::getStateToken() {
goto next_tok; goto next_tok;
} }
} else { } else {
error(std::string{"Expecting define formal arguments. Found: "} + tokenName(tok) error("Expecting define formal arguments. Found: "s + tokenName(tok) + "\n");
+ "\n");
goto next_tok; goto next_tok;
} }
} }
@ -1165,8 +1164,7 @@ int V3PreProcImp::getStateToken() {
define(fileline(), m_lastSym, value, formals, false); define(fileline(), m_lastSym, value, formals, false);
} }
} else { } else {
const string msg const string msg = "Bad define text, unexpected "s + tokenName(tok) + "\n";
= std::string{"Bad define text, unexpected "} + tokenName(tok) + "\n";
v3fatalSrc(msg); v3fatalSrc(msg);
} }
statePop(); statePop();
@ -1182,8 +1180,8 @@ int V3PreProcImp::getStateToken() {
} else { } else {
UASSERT(!m_defRefs.empty(), "Shouldn't be in DEFPAREN w/o active defref"); UASSERT(!m_defRefs.empty(), "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("Expecting ( to begin argument list for define reference `"s + refp->name()
+ refp->name() + "\n"); + "\n");
statePop(); statePop();
goto next_tok; goto next_tok;
} }
@ -1282,7 +1280,7 @@ int V3PreProcImp::getStateToken() {
break; break;
} else { } else {
statePop(); statePop();
error(std::string{"Expecting include filename. Found: "} + tokenName(tok) + "\n"); error("Expecting include filename. Found: "s + tokenName(tok) + "\n");
goto next_tok; goto next_tok;
} }
} }
@ -1295,7 +1293,7 @@ int V3PreProcImp::getStateToken() {
statePop(); statePop();
goto next_tok; goto next_tok;
} else { } else {
error(std::string{"Expecting `error string. Found: "} + tokenName(tok) + "\n"); error("Expecting `error string. Found: "s + tokenName(tok) + "\n");
statePop(); statePop();
goto next_tok; goto next_tok;
} }
@ -1338,7 +1336,7 @@ int V3PreProcImp::getStateToken() {
// multiline "..." without \ escapes. // multiline "..." without \ escapes.
// The spec is silent about this either way; simulators vary // The spec is silent about this either way; simulators vary
std::replace(out.begin(), out.end(), '\n', ' '); std::replace(out.begin(), out.end(), '\n', ' ');
unputString(std::string{"\""} + out + "\""); unputString("\""s + out + "\"");
statePop(); statePop();
goto next_tok; goto next_tok;
} else if (tok == VP_EOF) { } else if (tok == VP_EOF) {
@ -1422,7 +1420,7 @@ int V3PreProcImp::getStateToken() {
} else { } else {
// We want final text of `name, but that would cause // We want final text of `name, but that would cause
// recursion, so use a special character to get it through // recursion, so use a special character to get it through
unputDefrefString(std::string{"`\032"} + name); unputDefrefString("`\032"s + name);
goto next_tok; goto next_tok;
} }
} else { } else {
@ -1510,7 +1508,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
v3fatalSrc(std::string{"Internal error: Unexpected token "} + tokenName(tok) + "\n"); v3fatalSrc("Internal error: Unexpected token "s + tokenName(tok) + "\n");
break; // LCOV_EXCL_LINE break; // LCOV_EXCL_LINE
} }
return tok; return tok;

View File

@ -102,8 +102,8 @@ protected:
// intervening +<lang>ext+ options since it was first encountered. // intervening +<lang>ext+ options since it was first encountered.
FileLine* const modfileline = new FileLine{modfilename}; FileLine* const modfileline = new FileLine{modfilename};
modfileline->language(v3Global.opt.fileLanguage(modfilename)); modfileline->language(v3Global.opt.fileLanguage(modfilename));
V3Parse::ppPushText(parsep, (std::string{"`begin_keywords \""} V3Parse::ppPushText(
+ modfileline->language().ascii() + "\"\n")); parsep, ("`begin_keywords \""s + modfileline->language().ascii() + "\"\n"));
// FileLine tracks and frees modfileline // FileLine tracks and frees modfileline
} }

View File

@ -149,18 +149,16 @@ class ProtectVisitor final : public VNVisitor {
// Timescale // Timescale
if (v3Global.opt.hierChild() && v3Global.rootp()->timescaleSpecified()) { if (v3Global.opt.hierChild() && v3Global.rootp()->timescaleSpecified()) {
// Emit timescale for hierarchical Verilation if input HDL specifies timespec // Emit timescale for hierarchical Verilation if input HDL specifies timespec
txtp->addText(fl, std::string{"timeunit "} + modp->timeunit().ascii() + ";\n"); txtp->addText(fl, "timeunit "s + modp->timeunit().ascii() + ";\n");
txtp->addText(fl, std::string{"timeprecision "} txtp->addText(fl,
+ +v3Global.rootp()->timeprecision().ascii() + ";\n"); "timeprecision "s + +v3Global.rootp()->timeprecision().ascii() + ";\n");
} else { } else {
addComment(txtp, fl, addComment(txtp, fl,
"Precision of submodule" "Precision of submodule"
" (commented out to avoid requiring timescale on all modules)"); " (commented out to avoid requiring timescale on all modules)");
addComment(txtp, fl, "timeunit "s + v3Global.rootp()->timeunit().ascii() + ";");
addComment(txtp, fl, addComment(txtp, fl,
std::string{"timeunit "} + v3Global.rootp()->timeunit().ascii() + ";"); "timeprecision "s + v3Global.rootp()->timeprecision().ascii() + ";\n");
addComment(txtp, fl,
std::string{"timeprecision "} + v3Global.rootp()->timeprecision().ascii()
+ ";\n");
} }
// DPI declarations // DPI declarations

View File

@ -303,7 +303,7 @@ class ScopeVisitor final : public VNVisitor {
} }
void visit(AstScopeName* nodep) override { void visit(AstScopeName* nodep) override {
// If there's a %m in the display text, we add a special node that will contain the name() // If there's a %m in the display text, we add a special node that will contain the name()
const string prefix = std::string{"__DOT__"} + m_scopep->name(); const string prefix = "__DOT__"s + m_scopep->name();
// TOP and above will be the user's name(). // TOP and above will be the user's name().
// Note 'TOP.' is stripped by scopePrettyName // Note 'TOP.' is stripped by scopePrettyName
// To keep correct visual order, must add before other Text's // To keep correct visual order, must add before other Text's

View File

@ -366,7 +366,7 @@ private:
// Call for node types we know we can't handle // Call for node types we know we can't handle
checkNodeInfo(nodep); checkNodeInfo(nodep);
if (optimizable()) { if (optimizable()) {
clearOptimizable(nodep, std::string{"Known unhandled node type "} + nodep->typeName()); clearOptimizable(nodep, "Known unhandled node type "s + nodep->typeName());
} }
} }
void badNodeType(AstNode* nodep) { void badNodeType(AstNode* nodep) {
@ -1130,7 +1130,7 @@ private:
nodep, "Argument for $display like statement is not constant"); nodep, "Argument for $display like statement is not constant");
break; break;
} }
const string pformat = std::string{"%"} + width + pos[0]; const string pformat = "%"s + width + pos[0];
result += constp->num().displayed(nodep, pformat); result += constp->num().displayed(nodep, pformat);
} else { } else {
switch (std::tolower(pos[0])) { switch (std::tolower(pos[0])) {

View File

@ -156,7 +156,7 @@ public:
// Branch predictions // Branch predictions
for (int t = 0; t < VBranchPred::_ENUM_END; ++t) { for (int t = 0; t < VBranchPred::_ENUM_END; ++t) {
if (const uint64_t c = m_counters.m_statPred[t]) { if (const uint64_t c = m_counters.m_statPred[t]) {
addStat(std::string{"Branch prediction, "} + VBranchPred{t}.ascii(), c); addStat("Branch prediction, "s + VBranchPred{t}.ascii(), c);
} }
} }
} }

View File

@ -250,7 +250,7 @@ public:
if (candidate.empty()) { if (candidate.empty()) {
return ""; return "";
} else { } else {
return std::string{"... Suggested alternative: '"} + candidate + "'"; return "... Suggested alternative: '"s + candidate + "'";
} }
} }
static void selfTest(); static void selfTest();

View File

@ -714,8 +714,8 @@ class TraceVisitor final : public VNVisitor {
m_regFuncp->addStmtsp(new AstText{fl, ", vlSelf);\n", true}); m_regFuncp->addStmtsp(new AstText{fl, ", vlSelf);\n", true});
// Clear global activity flag // Clear global activity flag
cleanupFuncp->addStmtsp(new AstCStmt{m_topScopep->fileline(), cleanupFuncp->addStmtsp(
std::string{"vlSymsp->__Vm_activity = false;\n"}}); new AstCStmt{m_topScopep->fileline(), "vlSymsp->__Vm_activity = false;\n"s});
// Clear fine grained activity flags // Clear fine grained activity flags
for (uint32_t i = 0; i < m_activityNumber; ++i) { for (uint32_t i = 0; i < m_activityNumber; ++i) {

View File

@ -240,7 +240,7 @@ class TraceDeclVisitor final : public VNVisitor {
void addIgnore(const char* why) { void addIgnore(const char* why) {
++m_statIgnSigs; ++m_statIgnSigs;
std::string cmt = std::string{"Tracing: "} + m_traName + " // Ignored: " + why; std::string cmt = "Tracing: "s + m_traName + " // Ignored: " + why;
if (debug() > 3 && m_traVscp) std::cout << "- " << m_traVscp->fileline() << cmt << endl; if (debug() > 3 && m_traVscp) std::cout << "- " << m_traVscp->fileline() << cmt << endl;
} }

View File

@ -59,7 +59,7 @@ class UnrollVisitor final : public VNVisitor {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Can't unroll generate for; " << reason); nodep->v3warn(E_UNSUPPORTED, "Unsupported: Can't unroll generate for; " << reason);
UINFO(3, " Can't Unroll: " << reason << " :" << nodep << endl); UINFO(3, " Can't Unroll: " << reason << " :" << nodep << endl);
// if (debug() >= 9) nodep->dumpTree("- cant: "); // if (debug() >= 9) nodep->dumpTree("- cant: ");
V3Stats::addStatSum(std::string{"Unrolling gave up, "} + reason, 1); V3Stats::addStatSum("Unrolling gave up, "s + reason, 1);
return false; return false;
} }

View File

@ -67,6 +67,7 @@
using string = std::string; using string = std::string;
using std::cout; using std::cout;
using std::endl; using std::endl;
using namespace std::literals; // "<std::string literal>"s; see SF.7 core guideline
//********************************************************************** //**********************************************************************
//**** OS and compiler specifics //**** OS and compiler specifics

View File

@ -384,7 +384,7 @@ int V3ParseGrammar::s_modTypeImpNum = 0;
static void ERRSVKWD(FileLine* fileline, const string& tokname) { static void ERRSVKWD(FileLine* fileline, const string& tokname) {
static int toldonce = 0; static int toldonce = 0;
fileline->v3error( fileline->v3error(
std::string{"Unexpected '"} + tokname + "': '" + tokname "Unexpected '"s + tokname + "': '" + tokname
+ "' is a SystemVerilog keyword misused as an identifier." + "' is a SystemVerilog keyword misused as an identifier."
+ (!toldonce++ ? "\n" + fileline->warnMore() + (!toldonce++ ? "\n" + fileline->warnMore()
+ "... Suggest modify the Verilog-2001 code to avoid SV keywords," + "... Suggest modify the Verilog-2001 code to avoid SV keywords,"

View File

@ -51,7 +51,7 @@ void mon_class_name(const char* namep) {
#endif #endif
// Check the C's calling name of "" doesn't lead to extra dots in the name() // Check the C's calling name of "" doesn't lead to extra dots in the name()
if (namep && namep[0] == '.') if (namep && namep[0] == '.')
vl_fatal(__FILE__, __LINE__, "", (std::string{"Unexp class name "} + namep).c_str()); vl_fatal(__FILE__, __LINE__, "", ("Unexp class name "s + namep).c_str());
} }
extern "C" void mon_scope_name(const char* namep); extern "C" void mon_scope_name(const char* namep);
@ -61,9 +61,9 @@ void mon_scope_name(const char* namep) {
VL_PRINTF("- mon_scope_name('%s', \"%s\");\n", modp, namep); VL_PRINTF("- mon_scope_name('%s', \"%s\");\n", modp, namep);
#endif #endif
if (std::strcmp(namep, "t.sub")) if (std::strcmp(namep, "t.sub"))
vl_fatal(__FILE__, __LINE__, "", (std::string{"Unexp scope name "} + namep).c_str()); vl_fatal(__FILE__, __LINE__, "", ("Unexp scope name "s + namep).c_str());
if (std::strcmp(modp, "t.sub")) if (std::strcmp(modp, "t.sub"))
vl_fatal(__FILE__, __LINE__, "", (std::string{"Unexp dpiscope name "} + modp).c_str()); vl_fatal(__FILE__, __LINE__, "", ("Unexp dpiscope name "s + modp).c_str());
} }
extern "C" void mon_register_b(const char* namep, int isOut); extern "C" void mon_register_b(const char* namep, int isOut);

View File

@ -138,7 +138,7 @@ int main(int argc, char** argv) {
void* lib = dlopen(filenamep, RTLD_LAZY); void* lib = dlopen(filenamep, RTLD_LAZY);
void* bootstrap = dlsym(lib, "vpi_compat_bootstrap"); void* bootstrap = dlsym(lib, "vpi_compat_bootstrap");
if (!bootstrap) { if (!bootstrap) {
const std::string msg = std::string{"%Error: Could not dlopen "} + filenamep; const std::string msg = "%Error: Could not dlopen "s + filenamep;
vl_fatal(__FILE__, __LINE__, "main", msg.c_str()); vl_fatal(__FILE__, __LINE__, "main", msg.c_str());
} }
((void (*)(void))bootstrap)(); ((void (*)(void))bootstrap)();