Fix missing VL_REQUIRES in definition (#3804)

This commit is contained in:
Kamil Rakoczy 2022-12-14 21:12:54 -05:00 committed by Wilson Snyder
parent fcd1306ef3
commit 925fb921a2
2 changed files with 23 additions and 6 deletions

View File

@ -2454,14 +2454,17 @@ void VerilatedContext::threads(unsigned n) {
} }
void VerilatedContext::commandArgs(int argc, const char** argv) VL_MT_SAFE_EXCLUDES(m_argMutex) { void VerilatedContext::commandArgs(int argc, const char** argv) VL_MT_SAFE_EXCLUDES(m_argMutex) {
const VerilatedLockGuard lock{m_argMutex}; // Not locking m_argMutex here, it is done in impp()->commandArgsAddGuts
m_args.m_argVec.clear(); // Empty first, then add // m_argMutex here is the same as in impp()->commandArgsAddGuts;
impp()->commandArgsAddGuts(argc, argv); // due to clang limitations, it doesn't properly check it
impp()->commandArgsGuts(argc, argv);
} }
void VerilatedContext::commandArgsAdd(int argc, const char** argv) void VerilatedContext::commandArgsAdd(int argc, const char** argv)
VL_MT_SAFE_EXCLUDES(m_argMutex) { VL_MT_SAFE_EXCLUDES(m_argMutex) {
const VerilatedLockGuard lock{m_argMutex}; // Not locking m_argMutex here, it is done in impp()->commandArgsAddGuts
impp()->commandArgsAddGuts(argc, argv); // m_argMutex here is the same as in impp()->commandArgsAddGuts;
// due to clang limitations, it doesn't properly check it
impp()->commandArgsAddGutsLock(argc, argv);
} }
const char* VerilatedContext::commandArgsPlusMatch(const char* prefixp) const char* VerilatedContext::commandArgsPlusMatch(const char* prefixp)
VL_MT_SAFE_EXCLUDES(m_argMutex) { VL_MT_SAFE_EXCLUDES(m_argMutex) {
@ -2510,6 +2513,18 @@ VerilatedContext::enableExecutionProfiler(VerilatedVirtualBase* (*construct)(Ver
//====================================================================== //======================================================================
// VerilatedContextImp:: Methods - command line // VerilatedContextImp:: Methods - command line
void VerilatedContextImp::commandArgsGuts(int argc, const char** argv)
VL_MT_SAFE_EXCLUDES(m_argMutex) {
const VerilatedLockGuard lock{m_argMutex};
m_args.m_argVec.clear(); // Empty first, then add
commandArgsAddGuts(argc, argv);
}
void VerilatedContextImp::commandArgsAddGutsLock(int argc, const char** argv)
VL_MT_SAFE_EXCLUDES(m_argMutex) {
const VerilatedLockGuard lock{m_argMutex};
commandArgsAddGuts(argc, argv);
}
void VerilatedContextImp::commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(m_argMutex) { void VerilatedContextImp::commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(m_argMutex) {
if (!m_args.m_argVecLoaded) m_args.m_argVec.clear(); if (!m_args.m_argVecLoaded) m_args.m_argVec.clear();

View File

@ -387,7 +387,9 @@ private:
protected: protected:
// METHODS - protected // METHODS - protected
void commandArgsAddGuts(int argc, const char** argv); void commandArgsGuts(int argc, const char** argv) VL_MT_SAFE_EXCLUDES(m_argMutex);
void commandArgsAddGutsLock(int argc, const char** argv) VL_MT_SAFE_EXCLUDES(m_argMutex);
void commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(m_argMutex);
void commandArgVl(const std::string& arg); void commandArgVl(const std::string& arg);
bool commandArgVlString(const std::string& arg, const std::string& prefix, bool commandArgVlString(const std::string& arg, const std::string& prefix,
std::string& valuer); std::string& valuer);