Merge from master

This commit is contained in:
Wilson Snyder 2018-06-12 21:25:26 -04:00
commit 5988bba9fb
5 changed files with 17 additions and 7 deletions

View File

@ -17,7 +17,10 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix Verilation performance issues, bug1316. [John Coiner] **** Fix Verilation performance issues, bug1316. [John Coiner]
* Verilator 3.923 devel * Verilator 3.925 devel
* Verilator 3.924 2018-06-12
*** Renamed --profile-cfuncs to --prof-cfuncs. *** Renamed --profile-cfuncs to --prof-cfuncs.

View File

@ -122,10 +122,16 @@ std::string _vl_string_vprintf(const char* formatp, va_list ap) VL_MT_SAFE {
va_list aq; va_list aq;
va_copy(aq, ap); va_copy(aq, ap);
int len = VL_VSNPRINTF(NULL, 0, formatp, aq); int len = VL_VSNPRINTF(NULL, 0, formatp, aq);
if (VL_UNLIKELY(len < 1)) return ""; va_end(aq);
if (VL_UNLIKELY(len < 1)) {
va_end(ap);
return "";
}
char* bufp = new char[len+1]; char* bufp = new char[len+1];
VL_VSNPRINTF(bufp, len+1, formatp, ap); VL_VSNPRINTF(bufp, len+1, formatp, ap);
va_end(ap);
std::string out = std::string(bufp, len); std::string out = std::string(bufp, len);
delete[] bufp; delete[] bufp;
return out; return out;
@ -163,7 +169,7 @@ void VL_DBG_MSGF(const char* formatp, ...) VL_MT_SAFE {
// Using VL_PRINTF not VL_PRINTF_MT so that we can call VL_DBG_MSGF // Using VL_PRINTF not VL_PRINTF_MT so that we can call VL_DBG_MSGF
// from within the guts of the thread execution machinery (and it goes // from within the guts of the thread execution machinery (and it goes
// to the screen and not into the queues we're debugging) // to the screen and not into the queues we're debugging)
VL_PRINTF("-V{t%d,%" VL_PRI64 "d}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str()); VL_PRINTF("-V{t%d,%" VL_PRI64 "u}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str());
} }
#ifdef VL_THREADED #ifdef VL_THREADED

View File

@ -473,11 +473,12 @@ public:
m_errorInfo.level = level; m_errorInfo.level = level;
return this; return this;
} }
void setMessage(std::string file, PLI_INT32 line, const std::string& message, ...) { void setMessage(std::string file, PLI_INT32 line, const char* message, ...) {
// message cannot be a const string& as va_start cannot use a reference
static VL_THREAD_LOCAL std::string filehold; static VL_THREAD_LOCAL std::string filehold;
va_list args; va_list args;
va_start(args, message); va_start(args, message);
VL_VSNPRINTF(m_buff, sizeof(m_buff), message.c_str(), args); VL_VSNPRINTF(m_buff, sizeof(m_buff), message, args);
va_end(args); va_end(args);
m_errorInfo.state = vpiPLI; m_errorInfo.state = vpiPLI;
filehold = file; filehold = file;

View File

@ -2105,7 +2105,7 @@ public:
class AstNodeRange : public AstNode { class AstNodeRange : public AstNode {
// A range, sized or unsized // A range, sized or unsized
public: public:
AstNodeRange(FileLine* fl) : AstNode (fl) { } explicit AstNodeRange(FileLine* fl) : AstNode (fl) { }
ASTNODE_BASE_FUNCS(NodeRange) ASTNODE_BASE_FUNCS(NodeRange)
}; };

View File

@ -151,7 +151,7 @@ public:
class AstUnsizedRange : public AstNodeRange { class AstUnsizedRange : public AstNodeRange {
// Unsized range specification, for open arrays // Unsized range specification, for open arrays
public: public:
AstUnsizedRange(FileLine* fl) : AstNodeRange(fl) { } explicit AstUnsizedRange(FileLine* fl) : AstNodeRange(fl) { }
ASTNODE_NODE_FUNCS(UnsizedRange) ASTNODE_NODE_FUNCS(UnsizedRange)
virtual string emitC() { V3ERROR_NA; return ""; } virtual string emitC() { V3ERROR_NA; return ""; }
virtual string emitVerilog() { return "[]"; } virtual string emitVerilog() { return "[]"; }