From 4739956cfe1b6d567100e05a23a27484d1f2dd02 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 5 Oct 2021 21:20:22 -0400 Subject: [PATCH] Internals: Add missing const. No functional change. --- include/verilated_cov.cpp | 2 +- include/verilated_imp.h | 4 ++-- include/verilated_save.cpp | 2 +- include/verilated_trace_imp.cpp | 4 ++-- test_regress/t/t_vpi_zero_time_cb.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/verilated_cov.cpp b/include/verilated_cov.cpp index 9f04c5429..af6080275 100644 --- a/include/verilated_cov.cpp +++ b/include/verilated_cov.cpp @@ -364,7 +364,7 @@ public: std::ofstream os{filename}; if (os.fail()) { - std::string msg = std::string{"%Error: Can't write '"} + filename + "'"; + const std::string msg = std::string{"%Error: Can't write '"} + filename + "'"; VL_FATAL_MT("", 0, "", msg.c_str()); return; } diff --git a/include/verilated_imp.h b/include/verilated_imp.h index 4c30cbafc..f63b158d0 100644 --- a/include/verilated_imp.h +++ b/include/verilated_imp.h @@ -549,8 +549,8 @@ public: // But only for verilated*.cpp const VerilatedLockGuard lock{s().m_exportMutex}; const auto& it = s().m_exportMap.find(namep); if (VL_LIKELY(it != s().m_exportMap.end())) return it->second; - std::string msg = (std::string{"%Error: Testbench C called "} + namep - + " but no such DPI export function name exists in ANY model"); + const std::string msg = (std::string{"%Error: Testbench C called "} + namep + + " but no such DPI export function name exists in ANY model"); VL_FATAL_MT("unknown", 0, "", msg.c_str()); return -1; } diff --git a/include/verilated_save.cpp b/include/verilated_save.cpp index 2fec9808d..eada7a572 100644 --- a/include/verilated_save.cpp +++ b/include/verilated_save.cpp @@ -204,7 +204,7 @@ void VerilatedSave::flush() VL_MT_UNSAFE_ONE { if (VL_UNCOVERABLE(errno != EAGAIN && errno != EINTR)) { // LCOV_EXCL_START // write failed, presume error (perhaps out of disk space) - std::string msg = std::string{__FUNCTION__} + ": " + std::strerror(errno); + const std::string msg = std::string{__FUNCTION__} + ": " + std::strerror(errno); VL_FATAL_MT("", 0, "", msg.c_str()); close(); break; diff --git a/include/verilated_trace_imp.cpp b/include/verilated_trace_imp.cpp index 07e60f7a3..ba8e43110 100644 --- a/include/verilated_trace_imp.cpp +++ b/include/verilated_trace_imp.cpp @@ -481,8 +481,8 @@ void VerilatedTrace::addCallbackRecord(std::vector VL_MT_SAFE_EXCLUDES(m_mutex) { const VerilatedLockGuard lock{m_mutex}; if (VL_UNCOVERABLE(timeLastDump() != 0)) { // LCOV_EXCL_START - std::string msg = (std::string{"Internal: "} + __FILE__ + "::" + __FUNCTION__ - + " called with already open file"); + const std::string msg = (std::string{"Internal: "} + __FILE__ + "::" + __FUNCTION__ + + " called with already open file"); VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); } // LCOV_EXCL_STOP cbVec.push_back(cbRec); diff --git a/test_regress/t/t_vpi_zero_time_cb.cpp b/test_regress/t/t_vpi_zero_time_cb.cpp index 865472719..9336d60d3 100644 --- a/test_regress/t/t_vpi_zero_time_cb.cpp +++ b/test_regress/t/t_vpi_zero_time_cb.cpp @@ -136,7 +136,7 @@ int main(int argc, char** argv, char** env) { void* lib = dlopen(filenamep, RTLD_LAZY); void* bootstrap = dlsym(lib, "vpi_compat_bootstrap"); if (!bootstrap) { - std::string msg = std::string("%Error: Could not dlopen ") + filenamep; + const std::string msg = std::string("%Error: Could not dlopen ") + filenamep; vl_fatal(__FILE__, __LINE__, "main", msg.c_str()); } ((void (*)(void))bootstrap)();