From b9101c3d6a8acc13b72611b2fb2434b36ac7a7e0 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 2 May 2012 21:04:50 -0400 Subject: [PATCH] Better message for display-like format warnings, bug500. --- src/V3EmitC.cpp | 10 +++++----- src/V3LinkResolve.cpp | 6 +++--- src/V3Number.cpp | 8 ++++---- test_regress/t/t_display_bad.pl | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 9eabad98e..4f563d4dd 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1192,11 +1192,11 @@ void EmitCStmts::displayArg(AstNode* dispp, AstNode** elistp, bool isScan, AstNode* argp = *elistp; if (!argp) { // expectDisplay() checks this first, so internal error if found here - dispp->v3error("Internal: Missing arguments for $display format"); + dispp->v3error("Internal: Missing arguments for $display-like format"); return; } if (argp->widthMin() > VL_VALUE_STRING_MAX_WIDTH) { - dispp->v3error("Exceeded limit of "+cvtToStr(VL_VALUE_STRING_MAX_WIDTH)+" bits for any display arguments"); + dispp->v3error("Exceeded limit of "+cvtToStr(VL_VALUE_STRING_MAX_WIDTH)+" bits for any $display-like arguments"); } if (argp && argp->isWide() && (fmtLetter=='d'||fmtLetter=='u')) { @@ -1287,17 +1287,17 @@ void EmitCStmts::displayNode(AstNode* nodep, AstScopeName* scopenamep, case 'z': case 'l': case 'v': - nodep->v3error("Unsupported: $display format code: %"<v3error("Unsupported: $display-like format code: %"<v3error("Unknown $display format code: %"<v3error("Unknown $display-like format code: %"<v3error("Internal: Extra arguments for $display format"); + elistp->v3error("Internal: Extra arguments for $display-like format"); } displayEmit(nodep, isScan); } diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index 879951dc3..239069550 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -260,10 +260,10 @@ private: break; default: // Most operators, just move to next argument if (!V3Number::displayedFmtLegal(ch)) { - nodep->v3error("Unknown $display format code: %"<v3error("Unknown $display-like format code: %"<v3error("Missing arguments for $display format"); + nodep->v3error("Missing arguments for $display-like format"); } else { argp = argp->nextp(); } @@ -273,7 +273,7 @@ private: } } if (argp) { - argp->v3error("Extra arguments for $display format"); + argp->v3error("Extra arguments for $display-like format"); } } diff --git a/src/V3Number.cpp b/src/V3Number.cpp index fba516467..d23f7f366 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -401,7 +401,7 @@ bool V3Number::displayedFmtLegal(char format) { string V3Number::displayed(const string& vformat) const { string::const_iterator pos = vformat.begin(); - UASSERT(pos != vformat.end() && pos[0]=='%', "display with non format argument "<<*this); + UASSERT(pos != vformat.end() && pos[0]=='%', "$display-like function with non format argument "<<*this); ++pos; string fmtsize; for (; pos != vformat.end() && (isdigit(pos[0]) || pos[0]=='.'); ++pos) { @@ -444,7 +444,7 @@ string V3Number::displayed(const string& vformat) const { return str; } case 'c': { - if (this->width()>8) m_fileline->v3error("$display of char format of > 8 bit value"); + if (this->width()>8) m_fileline->v3error("$display-like format of char of > 8 bit value"); int v = bitsValue(0, 8); str += (char)(v); return str; @@ -477,7 +477,7 @@ string V3Number::displayed(const string& vformat) const { fmtsize = cvtToStr(int(dchars)); } if (width() > 64) { - m_fileline->v3error("Unsupported: $display of dec format of > 64 bit results (use hex format instead)"); + m_fileline->v3error("Unsupported: $display-like format of decimal of > 64 bit results (use hex format instead)"); return "ERR"; } if (issigned) { @@ -501,7 +501,7 @@ string V3Number::displayed(const string& vformat) const { return tmp; } default: - m_fileline->v3fatalSrc("Unknown $display format code for number: %"<v3fatalSrc("Unknown $display-like format code for number: %"< ["--lint-only"], fails=>1, expect=> -'%Error: t/t_display_bad.v:\d+: Missing arguments for \$display format -%Error: t/t_display_bad.v:\d+: Extra arguments for \$display format -%Error: t/t_display_bad.v:\d+: Unknown \$display format code: %q +'%Error: t/t_display_bad.v:\d+: Missing arguments for \$display-like format +%Error: t/t_display_bad.v:\d+: Extra arguments for \$display-like format +%Error: t/t_display_bad.v:\d+: Unknown \$display-like format code: %q %Error: Exiting due to.*', );