Add an URL on warnings to point to the manual's description.

This commit is contained in:
Wilson Snyder
2021-04-18 10:17:05 -04:00
parent 56dd58d259
commit 2e9e4ae110
185 changed files with 198 additions and 4 deletions
+11 -3
View File
@@ -39,6 +39,7 @@ bool V3Error::s_errorSuppressed = false;
std::array<bool, V3ErrorCode::_ENUM_MAX> V3Error::s_describedEachWarn;
std::array<bool, V3ErrorCode::_ENUM_MAX> V3Error::s_pretendError;
bool V3Error::s_describedWarnings = false;
bool V3Error::s_describedWeb = false;
V3Error::MessagesSet V3Error::s_messages;
V3Error::ErrorExitCb V3Error::s_errorExitCb = nullptr;
@@ -225,13 +226,20 @@ void V3Error::v3errorEnd(std::ostringstream& sstr, const string& locationStr) {
}
if (!s_errorSuppressed
&& !(s_errorCode == V3ErrorCode::EC_INFO || s_errorCode == V3ErrorCode::USERINFO)) {
const bool anError = isError(s_errorCode, s_errorSuppressed);
if (s_errorCode >= V3ErrorCode::EC_FIRST_NAMED && !s_describedWeb) {
s_describedWeb = true;
std::cerr << warnMore() << "... For " << (anError ? "error" : "warning")
<< " description see https://verilator.org/warn/" << s_errorCode.ascii()
<< "?v=" << PACKAGE_VERSION_NUMBER_STRING << endl;
}
if (!s_describedEachWarn[s_errorCode] && !s_pretendError[s_errorCode]) {
s_describedEachWarn[s_errorCode] = true;
if (s_errorCode >= V3ErrorCode::EC_FIRST_WARN && !s_describedWarnings) {
s_describedWarnings = true;
std::cerr << warnMore() << "... Use \"/* verilator lint_off "
<< s_errorCode.ascii()
<< " */\" and lint_on around source to disable this message." << endl;
s_describedWarnings = true;
}
if (s_errorCode.dangerous()) {
std::cerr << warnMore() << "*** See the manual before disabling this,\n";
@@ -248,7 +256,7 @@ void V3Error::v3errorEnd(std::ostringstream& sstr, const string& locationStr) {
s_tellManual = 2;
}
}
if (isError(s_errorCode, s_errorSuppressed)) {
if (anError) {
incErrors();
} else {
incWarnings();
@@ -276,7 +284,7 @@ void V3Error::v3errorEnd(std::ostringstream& sstr, const string& locationStr) {
}
vlAbortOrExit();
} else if (isError(s_errorCode, s_errorSuppressed)) {
} else if (anError) {
// We don't dump tree on any error because a Visitor may be in middle of
// a tree cleanup and cause a false broken problem.
if (s_errorExitCb) s_errorExitCb();