diff --git a/Changes b/Changes index 19d88ee3e..13540bc1d 100644 --- a/Changes +++ b/Changes @@ -54,6 +54,7 @@ Verilator 5.037 devel * Fix type operator for interface signals (#6049) (#6050). [Todd Strader] * Fix V3OrderParallel scoring contraction hang (#6052). [Bartłomiej Chmiel, Antmicro Ltd.] * Fix virtual interface array typedef expressions (#6057). +* Fix `--skip-identical` skipping on some errors (#6066). [Todd Strader] Verilator 5.036 2025-04-27 diff --git a/src/V3Error.cpp b/src/V3Error.cpp index 9f1d791c3..3688e9355 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -349,13 +349,14 @@ string V3Error::stripMetaText(const string& text, bool stripContext) VL_PURE { } void V3Error::abortIfWarnings() { + if (!isErrorOrWarn()) return; const bool exwarn = warnFatal() && warnCount(); if (errorCount() && exwarn) { v3fatalMany("Exiting due to " << std::dec << V3Error::s().errorCount() << " error(s), " // << V3Error::s().warnCount() << " warning(s)\n"); } else if (errorCount()) { v3fatalMany("Exiting due to " << std::dec << V3Error::s().errorCount() << " error(s)\n"); - } else if (exwarn) { + } else { v3fatalMany("Exiting due to " << std::dec << V3Error::s().warnCount() << " warning(s)\n"); } } diff --git a/src/V3Error.h b/src/V3Error.h index 633299f80..5a59caba1 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -413,6 +413,9 @@ public: void incWarnings() VL_REQUIRES(m_mutex) { ++m_warnCount; } void incErrors() VL_REQUIRES(m_mutex) { ++m_errCount; } int errorCount() VL_REQUIRES(m_mutex) { return m_errCount; } + bool isErrorOrWarn() VL_REQUIRES(m_mutex) { + return errorCount() || (warnFatal() && warnCount()); + } bool pretendError(int errorCode) VL_REQUIRES(m_mutex) { return m_pretendError[errorCode]; } void pretendError(V3ErrorCode code, bool flag) VL_REQUIRES(m_mutex) { if (code == V3ErrorCode::WIDTH) { @@ -528,6 +531,10 @@ public: const V3RecursiveLockGuard guard{s().m_mutex}; return s().isError(code, supp); } + static bool isErrorOrWarn() VL_MT_SAFE_EXCLUDES(s().m_mutex) { + const V3RecursiveLockGuard guard{s().m_mutex}; + return s().isErrorOrWarn(); + } static void abortIfErrors() { if (errorCount()) abortIfWarnings(); } diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 1add95bdd..315c2c271 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -755,7 +755,8 @@ static void verilate(const string& argString) { + "__idmap.xml"); } - if (v3Global.opt.skipIdentical().isTrue() || v3Global.opt.makeDepend().isTrue()) { + if ((v3Global.opt.skipIdentical().isTrue() || v3Global.opt.makeDepend().isTrue()) + && !V3Error::isErrorOrWarn()) { V3File::writeTimes(v3Global.opt.hierTopDataDir() + "/" + v3Global.opt.prefix() + "__verFiles.dat", argString);