Fix cpp-check warnings; support XML format 2
This commit is contained in:
parent
9d5004db1c
commit
70daadf987
|
|
@ -495,7 +495,7 @@ void _vl_vsformat(string& output, const char* formatp, va_list ap) {
|
||||||
case 'u': // Packed 2-state
|
case 'u': // Packed 2-state
|
||||||
output.reserve(output.size() + 4*VL_WORDS_I(lbits));
|
output.reserve(output.size() + 4*VL_WORDS_I(lbits));
|
||||||
for (int i=0; i<VL_WORDS_I(lbits); ++i) {
|
for (int i=0; i<VL_WORDS_I(lbits); ++i) {
|
||||||
output += (char)((lwp[i] >> 0) & 0xff);
|
output += (char)((lwp[i] ) & 0xff);
|
||||||
output += (char)((lwp[i] >> 8) & 0xff);
|
output += (char)((lwp[i] >> 8) & 0xff);
|
||||||
output += (char)((lwp[i] >> 16) & 0xff);
|
output += (char)((lwp[i] >> 16) & 0xff);
|
||||||
output += (char)((lwp[i] >> 24) & 0xff);
|
output += (char)((lwp[i] >> 24) & 0xff);
|
||||||
|
|
@ -504,7 +504,7 @@ void _vl_vsformat(string& output, const char* formatp, va_list ap) {
|
||||||
case 'z': // Packed 4-state
|
case 'z': // Packed 4-state
|
||||||
output.reserve(output.size() + 8*VL_WORDS_I(lbits));
|
output.reserve(output.size() + 8*VL_WORDS_I(lbits));
|
||||||
for (int i=0; i<VL_WORDS_I(lbits); ++i) {
|
for (int i=0; i<VL_WORDS_I(lbits); ++i) {
|
||||||
output += (char)((lwp[i] >> 0) & 0xff);
|
output += (char)((lwp[i] ) & 0xff);
|
||||||
output += (char)((lwp[i] >> 8) & 0xff);
|
output += (char)((lwp[i] >> 8) & 0xff);
|
||||||
output += (char)((lwp[i] >> 16) & 0xff);
|
output += (char)((lwp[i] >> 16) & 0xff);
|
||||||
output += (char)((lwp[i] >> 24) & 0xff);
|
output += (char)((lwp[i] >> 24) & 0xff);
|
||||||
|
|
@ -654,7 +654,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
||||||
// Deal with all read-and-scan somethings
|
// Deal with all read-and-scan somethings
|
||||||
// Note LSBs are preserved if there's an overflow
|
// Note LSBs are preserved if there's an overflow
|
||||||
const int obits = va_arg(ap, int);
|
const int obits = va_arg(ap, int);
|
||||||
WData qowp[2];
|
WData qowp[2] = {0, 0};
|
||||||
WDataOutP owp = qowp;
|
WDataOutP owp = qowp;
|
||||||
if (obits > VL_QUADSIZE) {
|
if (obits > VL_QUADSIZE) {
|
||||||
owp = va_arg(ap,WDataOutP);
|
owp = va_arg(ap,WDataOutP);
|
||||||
|
|
@ -1095,7 +1095,7 @@ void VL_READMEM_N(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
}
|
}
|
||||||
lastc = c;
|
lastc = c;
|
||||||
}
|
}
|
||||||
if (needinc) { addr++; needinc=false; }
|
if (needinc) { addr++; }
|
||||||
|
|
||||||
// Final checks
|
// Final checks
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
@ -1250,7 +1250,7 @@ const char* Verilated::catName(const char* n1, const char* n2) {
|
||||||
static char* strp = NULL;
|
static char* strp = NULL;
|
||||||
static size_t len = 0;
|
static size_t len = 0;
|
||||||
size_t newlen = strlen(n1)+strlen(n2)+2;
|
size_t newlen = strlen(n1)+strlen(n2)+2;
|
||||||
if (newlen > len) {
|
if (!strp || newlen > len) {
|
||||||
if (strp) delete [] strp;
|
if (strp) delete [] strp;
|
||||||
strp = new char[newlen];
|
strp = new char[newlen];
|
||||||
len = newlen;
|
len = newlen;
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ private:
|
||||||
T* m_countp; ///< Count value
|
T* m_countp; ///< Count value
|
||||||
public:
|
public:
|
||||||
// METHODS
|
// METHODS
|
||||||
|
// cppcheck-suppress truncLongCastReturn
|
||||||
virtual vluint64_t count() const { return *m_countp; }
|
virtual vluint64_t count() const { return *m_countp; }
|
||||||
virtual void zero() const { *m_countp = 0; }
|
virtual void zero() const { *m_countp = 0; }
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
|
|
|
||||||
|
|
@ -570,6 +570,7 @@ void VerilatedVcd::declDouble (vluint32_t code, const char* name, int arraynum
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void VerilatedVcd::fullDouble (vluint32_t code, const double newval) {
|
void VerilatedVcd::fullDouble (vluint32_t code, const double newval) {
|
||||||
|
// cppcheck-suppress invalidPointerCast
|
||||||
(*((double*)&m_sigs_oldvalp[code])) = newval;
|
(*((double*)&m_sigs_oldvalp[code])) = newval;
|
||||||
// Buffer can't overflow before sprintf; we sized during declaration
|
// Buffer can't overflow before sprintf; we sized during declaration
|
||||||
sprintf(m_writep, "r%.16g", newval);
|
sprintf(m_writep, "r%.16g", newval);
|
||||||
|
|
@ -578,6 +579,7 @@ void VerilatedVcd::fullDouble (vluint32_t code, const double newval) {
|
||||||
bufferCheck();
|
bufferCheck();
|
||||||
}
|
}
|
||||||
void VerilatedVcd::fullFloat (vluint32_t code, const float newval) {
|
void VerilatedVcd::fullFloat (vluint32_t code, const float newval) {
|
||||||
|
// cppcheck-suppress invalidPointerCast
|
||||||
(*((float*)&m_sigs_oldvalp[code])) = newval;
|
(*((float*)&m_sigs_oldvalp[code])) = newval;
|
||||||
// Buffer can't overflow before sprintf; we sized during declaration
|
// Buffer can't overflow before sprintf; we sized during declaration
|
||||||
sprintf(m_writep, "r%.16g", (double)newval);
|
sprintf(m_writep, "r%.16g", (double)newval);
|
||||||
|
|
|
||||||
|
|
@ -382,11 +382,13 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline void chgDouble (vluint32_t code, const double newval) {
|
inline void chgDouble (vluint32_t code, const double newval) {
|
||||||
|
// cppcheck-suppress invalidPointerCast
|
||||||
if (VL_UNLIKELY((*((double*)&m_sigs_oldvalp[code])) != newval)) {
|
if (VL_UNLIKELY((*((double*)&m_sigs_oldvalp[code])) != newval)) {
|
||||||
fullDouble (code, newval);
|
fullDouble (code, newval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline void chgFloat (vluint32_t code, const float newval) {
|
inline void chgFloat (vluint32_t code, const float newval) {
|
||||||
|
// cppcheck-suppress invalidPointerCast
|
||||||
if (VL_UNLIKELY((*((float*)&m_sigs_oldvalp[code])) != newval)) {
|
if (VL_UNLIKELY((*((float*)&m_sigs_oldvalp[code])) != newval)) {
|
||||||
fullFloat (code, newval);
|
fullFloat (code, newval);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
// This is not necessarily the same as #UL, depending on what the IData typedef is.
|
// This is not necessarily the same as #UL, depending on what the IData typedef is.
|
||||||
#define VL_UL(c) ((IData)(c##UL)) ///< Add appropriate suffix to 32-bit constant
|
#define VL_UL(c) ((IData)(c##UL)) ///< Add appropriate suffix to 32-bit constant
|
||||||
|
|
||||||
#ifdef VL_CPPCHECK
|
#if defined(VL_CPPCHECK) || defined(__clang_analyzer__)
|
||||||
# define VL_DANGLING(v)
|
# define VL_DANGLING(v)
|
||||||
#else
|
#else
|
||||||
# define VL_DANGLING(v) do { (v) = NULL; } while(0) ///< After e.g. delete, set variable to NULL to indicate must not use later
|
# define VL_DANGLING(v) do { (v) = NULL; } while(0) ///< After e.g. delete, set variable to NULL to indicate must not use later
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ private:
|
||||||
// Read sensitivitues
|
// Read sensitivitues
|
||||||
m_itemCombo = false;
|
m_itemCombo = false;
|
||||||
m_itemSequent = false;
|
m_itemSequent = false;
|
||||||
oldsensesp->iterateAndNext(*this);
|
if (oldsensesp) oldsensesp->iterateAndNext(*this);
|
||||||
bool combo = m_itemCombo;
|
bool combo = m_itemCombo;
|
||||||
bool sequent = m_itemSequent;
|
bool sequent = m_itemSequent;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
nodep->v3fatalSrc("Unknown node type");
|
nodep->v3fatalSrc("Unknown node type");
|
||||||
}
|
}
|
||||||
if (stmtsp) bodysp = bodysp->addNext(stmtsp);
|
if (bodysp && stmtsp) bodysp = bodysp->addNext(stmtsp);
|
||||||
AstIf* ifp = new AstIf (nodep->fileline(), propp, bodysp, NULL);
|
AstIf* ifp = new AstIf (nodep->fileline(), propp, bodysp, NULL);
|
||||||
bodysp = ifp;
|
bodysp = ifp;
|
||||||
if (nodep->castVAssert()) ifp->branchPred(AstBranchPred::BP_UNLIKELY);
|
if (nodep->castVAssert()) ifp->branchPred(AstBranchPred::BP_UNLIKELY);
|
||||||
|
|
|
||||||
|
|
@ -902,7 +902,7 @@ bool AstNode::sameTreeIter(AstNode* node1p, AstNode* node2p, bool ignNext, bool
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Static utilities
|
// Static utilities
|
||||||
|
|
||||||
ostream& operator<<(ostream& os, V3Hash rhs) {
|
ostream& operator<<(ostream& os, const V3Hash& rhs) {
|
||||||
return os<<hex<<setw(2)<<setfill('0')<<rhs.depth()
|
return os<<hex<<setw(2)<<setfill('0')<<rhs.depth()
|
||||||
<<"_"<<setw(6)<<setfill('0')<<rhs.hshval();
|
<<"_"<<setw(6)<<setfill('0')<<rhs.hshval();
|
||||||
}
|
}
|
||||||
|
|
@ -1057,6 +1057,8 @@ void AstNode::dumpTreeFile(const string& filename, bool append, bool doDump) {
|
||||||
editCountSetLast();
|
editCountSetLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AstNode::v3errorEndFatal(ostringstream& str) const { v3errorEnd(str); assert(0); }
|
||||||
|
|
||||||
void AstNode::v3errorEnd(ostringstream& str) const {
|
void AstNode::v3errorEnd(ostringstream& str) const {
|
||||||
if (!dynamic_cast<const AstNode*>(this)) {
|
if (!dynamic_cast<const AstNode*>(this)) {
|
||||||
// No known cases cause this, but better than a core dump
|
// No known cases cause this, but better than a core dump
|
||||||
|
|
|
||||||
24
src/V3Ast.h
24
src/V3Ast.h
|
|
@ -61,7 +61,7 @@ public:
|
||||||
inline bool operator== (AstType lhs, AstType rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (AstType lhs, AstType rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
inline bool operator== (AstType lhs, AstType::en rhs) { return (lhs.m_e == rhs); }
|
inline bool operator== (AstType lhs, AstType::en rhs) { return (lhs.m_e == rhs); }
|
||||||
inline bool operator== (AstType::en lhs, AstType rhs) { return (lhs == rhs.m_e); }
|
inline bool operator== (AstType::en lhs, AstType rhs) { return (lhs == rhs.m_e); }
|
||||||
inline ostream& operator<<(ostream& os, AstType rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, const AstType& rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ public:
|
||||||
inline bool operator== (AstNumeric lhs, AstNumeric rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (AstNumeric lhs, AstNumeric rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
inline bool operator== (AstNumeric lhs, AstNumeric::en rhs) { return (lhs.m_e == rhs); }
|
inline bool operator== (AstNumeric lhs, AstNumeric::en rhs) { return (lhs.m_e == rhs); }
|
||||||
inline bool operator== (AstNumeric::en lhs, AstNumeric rhs) { return (lhs == rhs.m_e); }
|
inline bool operator== (AstNumeric::en lhs, AstNumeric rhs) { return (lhs == rhs.m_e); }
|
||||||
inline ostream& operator<<(ostream& os, AstNumeric rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, const AstNumeric& rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
|
@ -464,7 +464,7 @@ public:
|
||||||
inline bool operator== (AstVarType lhs, AstVarType rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (AstVarType lhs, AstVarType rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
inline bool operator== (AstVarType lhs, AstVarType::en rhs) { return (lhs.m_e == rhs); }
|
inline bool operator== (AstVarType lhs, AstVarType::en rhs) { return (lhs.m_e == rhs); }
|
||||||
inline bool operator== (AstVarType::en lhs, AstVarType rhs) { return (lhs == rhs.m_e); }
|
inline bool operator== (AstVarType::en lhs, AstVarType rhs) { return (lhs == rhs.m_e); }
|
||||||
inline ostream& operator<<(ostream& os, AstVarType rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, const AstVarType& rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
|
@ -496,7 +496,7 @@ public:
|
||||||
inline bool operator== (AstBranchPred lhs, AstBranchPred rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (AstBranchPred lhs, AstBranchPred rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
inline bool operator== (AstBranchPred lhs, AstBranchPred::en rhs) { return (lhs.m_e == rhs); }
|
inline bool operator== (AstBranchPred lhs, AstBranchPred::en rhs) { return (lhs.m_e == rhs); }
|
||||||
inline bool operator== (AstBranchPred::en lhs, AstBranchPred rhs) { return (lhs == rhs.m_e); }
|
inline bool operator== (AstBranchPred::en lhs, AstBranchPred rhs) { return (lhs == rhs.m_e); }
|
||||||
inline ostream& operator<<(ostream& os, AstBranchPred rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, const AstBranchPred& rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
|
@ -529,7 +529,7 @@ public:
|
||||||
inline bool operator== (AstVarAttrClocker lhs, AstVarAttrClocker rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (AstVarAttrClocker lhs, AstVarAttrClocker rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
inline bool operator== (AstVarAttrClocker lhs, AstVarAttrClocker::en rhs) { return (lhs.m_e == rhs); }
|
inline bool operator== (AstVarAttrClocker lhs, AstVarAttrClocker::en rhs) { return (lhs.m_e == rhs); }
|
||||||
inline bool operator== (AstVarAttrClocker::en lhs, AstVarAttrClocker rhs) { return (lhs == rhs.m_e); }
|
inline bool operator== (AstVarAttrClocker::en lhs, AstVarAttrClocker rhs) { return (lhs == rhs.m_e); }
|
||||||
inline ostream& operator<<(ostream& os, AstVarAttrClocker rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, const AstVarAttrClocker& rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
|
@ -628,7 +628,7 @@ public:
|
||||||
inline bool operator== (AstParseRefExp lhs, AstParseRefExp rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (AstParseRefExp lhs, AstParseRefExp rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
inline bool operator== (AstParseRefExp lhs, AstParseRefExp::en rhs) { return (lhs.m_e == rhs); }
|
inline bool operator== (AstParseRefExp lhs, AstParseRefExp::en rhs) { return (lhs.m_e == rhs); }
|
||||||
inline bool operator== (AstParseRefExp::en lhs, AstParseRefExp rhs) { return (lhs == rhs.m_e); }
|
inline bool operator== (AstParseRefExp::en lhs, AstParseRefExp rhs) { return (lhs == rhs.m_e); }
|
||||||
inline ostream& operator<<(ostream& os, AstParseRefExp rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, const AstParseRefExp& rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// VNumRange - Structure containing numberic range information
|
// VNumRange - Structure containing numberic range information
|
||||||
|
|
@ -680,7 +680,7 @@ struct VNumRange {
|
||||||
{ return (!m_ranged || (m_lo==0 && m_hi>=1 && !m_littleEndian)); }
|
{ return (!m_ranged || (m_lo==0 && m_hi>=1 && !m_littleEndian)); }
|
||||||
void dump(ostream& str) const { if (ranged()) str<<"["<<left()<<":"<<right()<<"]"; else str<<"[norg]"; }
|
void dump(ostream& str) const { if (ranged()) str<<"["<<left()<<":"<<right()<<"]"; else str<<"[norg]"; }
|
||||||
};
|
};
|
||||||
inline ostream& operator<<(ostream& os, VNumRange rhs) { rhs.dump(os); return os; }
|
inline ostream& operator<<(ostream& os, const VNumRange& rhs) { rhs.dump(os); return os; }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
|
@ -709,7 +709,7 @@ struct VBasicTypeKey {
|
||||||
if (!(m_nrange == rhs.m_nrange)) return false; // lhs > rhs
|
if (!(m_nrange == rhs.m_nrange)) return false; // lhs > rhs
|
||||||
return false; }
|
return false; }
|
||||||
VBasicTypeKey(int width, int widthMin, AstNumeric numeric, AstBasicDTypeKwd kwd,
|
VBasicTypeKey(int width, int widthMin, AstNumeric numeric, AstBasicDTypeKwd kwd,
|
||||||
VNumRange nrange)
|
const VNumRange& nrange)
|
||||||
: m_width(width), m_widthMin(widthMin), m_numeric(numeric),
|
: m_width(width), m_widthMin(widthMin), m_numeric(numeric),
|
||||||
m_keyword(kwd), m_nrange(nrange) {}
|
m_keyword(kwd), m_nrange(nrange) {}
|
||||||
~VBasicTypeKey() {}
|
~VBasicTypeKey() {}
|
||||||
|
|
@ -733,8 +733,9 @@ class VNUser {
|
||||||
} m_u;
|
} m_u;
|
||||||
public:
|
public:
|
||||||
VNUser() {}
|
VNUser() {}
|
||||||
|
// non-explicit:
|
||||||
VNUser(int i) { m_u.up = 0; m_u.ui = i; }
|
VNUser(int i) { m_u.up = 0; m_u.ui = i; }
|
||||||
VNUser(void* p) { m_u.up = p; }
|
explicit VNUser(void* p) { m_u.up = p; }
|
||||||
~VNUser() {}
|
~VNUser() {}
|
||||||
// Casters
|
// Casters
|
||||||
WidthVP* c() { return ((WidthVP*)m_u.up); }
|
WidthVP* c() { return ((WidthVP*)m_u.up); }
|
||||||
|
|
@ -891,7 +892,7 @@ public:
|
||||||
AstNode* oldp() const { return m_oldp; }
|
AstNode* oldp() const { return m_oldp; }
|
||||||
void dump(ostream& str=cout) const;
|
void dump(ostream& str=cout) const;
|
||||||
};
|
};
|
||||||
inline ostream& operator<<(ostream& os, AstNRelinker& rhs) { rhs.dump(os); return os;}
|
inline ostream& operator<<(ostream& os, const AstNRelinker& rhs) { rhs.dump(os); return os;}
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// V3Hash -- Node hashing for V3Combine
|
// V3Hash -- Node hashing for V3Combine
|
||||||
|
|
@ -941,7 +942,7 @@ public:
|
||||||
V3Hash(V3Hash h1, V3Hash h2, V3Hash h3, V3Hash h4) {
|
V3Hash(V3Hash h1, V3Hash h2, V3Hash h3, V3Hash h4) {
|
||||||
setBoth(1,((h1.hshval()*31+h2.hshval())*31+h3.hshval())*31+h4.hshval()); }
|
setBoth(1,((h1.hshval()*31+h2.hshval())*31+h3.hshval())*31+h4.hshval()); }
|
||||||
};
|
};
|
||||||
ostream& operator<<(ostream& os, V3Hash rhs);
|
ostream& operator<<(ostream& os, const V3Hash& rhs);
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// AstNode -- Base type of all Ast types
|
// AstNode -- Base type of all Ast types
|
||||||
|
|
@ -1231,6 +1232,7 @@ public:
|
||||||
|
|
||||||
// METHODS - dump and error
|
// METHODS - dump and error
|
||||||
void v3errorEnd(ostringstream& str) const;
|
void v3errorEnd(ostringstream& str) const;
|
||||||
|
void v3errorEndFatal(ostringstream& str) const VL_ATTR_NORETURN;
|
||||||
string warnMore() const;
|
string warnMore() const;
|
||||||
virtual void dump(ostream& str=cout);
|
virtual void dump(ostream& str=cout);
|
||||||
void dumpGdb(); // For GDB only
|
void dumpGdb(); // For GDB only
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ public:
|
||||||
m_littleEndian = false;
|
m_littleEndian = false;
|
||||||
setOp2p(new AstConst(fl,msb)); setOp3p(new AstConst(fl,lsb));
|
setOp2p(new AstConst(fl,msb)); setOp3p(new AstConst(fl,lsb));
|
||||||
}
|
}
|
||||||
AstRange(FileLine* fl, VNumRange range)
|
AstRange(FileLine* fl, const VNumRange& range)
|
||||||
:AstNode(fl) {
|
:AstNode(fl) {
|
||||||
m_littleEndian = range.littleEndian();
|
m_littleEndian = range.littleEndian();
|
||||||
setOp2p(new AstConst(fl,range.hi())); setOp3p(new AstConst(fl,range.lo()));
|
setOp2p(new AstConst(fl,range.hi())); setOp3p(new AstConst(fl,range.lo()));
|
||||||
|
|
@ -743,7 +743,7 @@ class AstParseTypeDType : public AstNodeDType {
|
||||||
// During parsing, this indicates the type of a parameter is a "parameter type"
|
// During parsing, this indicates the type of a parameter is a "parameter type"
|
||||||
// e.g. the data type is a container of any data type
|
// e.g. the data type is a container of any data type
|
||||||
public:
|
public:
|
||||||
AstParseTypeDType(FileLine* fl)
|
explicit AstParseTypeDType(FileLine* fl)
|
||||||
: AstNodeDType(fl) {}
|
: AstNodeDType(fl) {}
|
||||||
ASTNODE_NODE_FUNCS(ParseTypeDType)
|
ASTNODE_NODE_FUNCS(ParseTypeDType)
|
||||||
AstNodeDType* dtypep() const { return NULL; }
|
AstNodeDType* dtypep() const { return NULL; }
|
||||||
|
|
@ -1655,7 +1655,7 @@ private:
|
||||||
string m_name; // Cell name
|
string m_name; // Cell name
|
||||||
public:
|
public:
|
||||||
AstCellRef(FileLine* fl,
|
AstCellRef(FileLine* fl,
|
||||||
string name, AstNode* cellp, AstNode* exprp)
|
const string& name, AstNode* cellp, AstNode* exprp)
|
||||||
: AstNode(fl)
|
: AstNode(fl)
|
||||||
, m_name(name) {
|
, m_name(name) {
|
||||||
addNOp1p(cellp); addNOp2p(exprp); }
|
addNOp1p(cellp); addNOp2p(exprp); }
|
||||||
|
|
@ -1672,7 +1672,7 @@ private:
|
||||||
string m_name; // Array name
|
string m_name; // Array name
|
||||||
public:
|
public:
|
||||||
AstCellArrayRef(FileLine* fl,
|
AstCellArrayRef(FileLine* fl,
|
||||||
string name, AstNode* selectExprp)
|
const string& name, AstNode* selectExprp)
|
||||||
: AstNode(fl)
|
: AstNode(fl)
|
||||||
, m_name(name) {
|
, m_name(name) {
|
||||||
addNOp1p(selectExprp); }
|
addNOp1p(selectExprp); }
|
||||||
|
|
@ -1688,7 +1688,7 @@ private:
|
||||||
string m_name; // Var name
|
string m_name; // Var name
|
||||||
public:
|
public:
|
||||||
AstUnlinkedRef(FileLine* fl,
|
AstUnlinkedRef(FileLine* fl,
|
||||||
AstNode* refp, string name, AstNode* crp)
|
AstNode* refp, const string& name, AstNode* crp)
|
||||||
: AstNode(fl)
|
: AstNode(fl)
|
||||||
, m_name(name) {
|
, m_name(name) {
|
||||||
addNOp1p(refp); addNOp2p(crp); }
|
addNOp1p(refp); addNOp2p(crp); }
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ public:
|
||||||
m_funcp = m_tlFuncp;
|
m_funcp = m_tlFuncp;
|
||||||
m_modp->addStmtp(m_tlFuncp);
|
m_modp->addStmtp(m_tlFuncp);
|
||||||
}
|
}
|
||||||
|
~V3CCtorsVisitor() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
|
||||||
|
|
@ -423,7 +423,7 @@ private:
|
||||||
// Handle any assertions
|
// Handle any assertions
|
||||||
replaceCaseParallel(nodep, false);
|
replaceCaseParallel(nodep, false);
|
||||||
// Replace the CASE... with IF...
|
// Replace the CASE... with IF...
|
||||||
if (debug()>=9) grouprootp->dumpTree(cout," _new: ");
|
if (debug()>=9 && grouprootp) grouprootp->dumpTree(cout," _new: ");
|
||||||
if (grouprootp) nodep->replaceWith(grouprootp);
|
if (grouprootp) nodep->replaceWith(grouprootp);
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
|
|
|
||||||
|
|
@ -611,7 +611,8 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
// Edges from IFs represent a real IF branch in the equation tree
|
// Edges from IFs represent a real IF branch in the equation tree
|
||||||
//UINFO(9," ifver "<<(void*)(edgep)<<" cc"<<edgep->dotColor()<<endl);
|
//UINFO(9," ifver "<<(void*)(edgep)<<" cc"<<edgep->dotColor()<<endl);
|
||||||
eqnp = cVxp->nodep()->condp()->cloneTree(true);
|
eqnp = cVxp->nodep()->condp()->cloneTree(true);
|
||||||
if (eqnp && cedgep->ifelseFalse()) {
|
if (!eqnp) cVxp->nodep()->v3fatalSrc("null condition");
|
||||||
|
if (cedgep->ifelseFalse()) {
|
||||||
eqnp = new AstNot(eqnp->fileline(),eqnp);
|
eqnp = new AstNot(eqnp->fileline(),eqnp);
|
||||||
}
|
}
|
||||||
// We need to AND this term onto whatever was found below it
|
// We need to AND this term onto whatever was found below it
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ class V3ConfigIgnores {
|
||||||
public:
|
public:
|
||||||
inline static V3ConfigIgnores& singleton() { return s_singleton; }
|
inline static V3ConfigIgnores& singleton() { return s_singleton; }
|
||||||
|
|
||||||
void addIgnore(V3ErrorCode code, string wildname, int lineno, bool on) {
|
void addIgnore(V3ErrorCode code, const string& wildname, int lineno, bool on) {
|
||||||
// Insert
|
// Insert
|
||||||
IgnLines* linesp = findWilds(wildname);
|
IgnLines* linesp = findWilds(wildname);
|
||||||
UINFO(9,"config addIgnore "<<wildname<<":"<<lineno<<", "<<code<<", "<<on<<endl);
|
UINFO(9,"config addIgnore "<<wildname<<":"<<lineno<<", "<<code<<", "<<on<<endl);
|
||||||
|
|
|
||||||
|
|
@ -1374,6 +1374,7 @@ private:
|
||||||
AstNode* fromp = repp->lhsp()->unlinkFrBack();
|
AstNode* fromp = repp->lhsp()->unlinkFrBack();
|
||||||
AstConst* lsbp = nodep->lsbp()->castConst();
|
AstConst* lsbp = nodep->lsbp()->castConst();
|
||||||
AstNode* widthp = nodep->widthp()->unlinkFrBack();
|
AstNode* widthp = nodep->widthp()->unlinkFrBack();
|
||||||
|
if (!fromp->width()) nodep->v3fatalSrc("Not widthed");
|
||||||
AstSel* newp = new AstSel(nodep->fileline(),
|
AstSel* newp = new AstSel(nodep->fileline(),
|
||||||
fromp,
|
fromp,
|
||||||
new AstConst(lsbp->fileline(), lsbp->toUInt() % fromp->width()),
|
new AstConst(lsbp->fileline(), lsbp->toUInt() % fromp->width()),
|
||||||
|
|
|
||||||
|
|
@ -138,8 +138,9 @@ private:
|
||||||
for (AstNode* stmtp = newfuncp->argsp(); stmtp; stmtp=stmtp->nextp()) {
|
for (AstNode* stmtp = newfuncp->argsp(); stmtp; stmtp=stmtp->nextp()) {
|
||||||
if (AstVar* portp = stmtp->castVar()) {
|
if (AstVar* portp = stmtp->castVar()) {
|
||||||
if (portp->isIO() && !portp->isFuncReturn()) {
|
if (portp->isIO() && !portp->isFuncReturn()) {
|
||||||
argsp = argsp->addNextNull(new AstVarRef(portp->fileline(), portp,
|
AstNode* newp = new AstVarRef(portp->fileline(), portp, portp->isOutput());
|
||||||
portp->isOutput()));
|
if (argsp) argsp = argsp->addNextNull(newp);
|
||||||
|
else argsp = newp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public:
|
||||||
const string& vformat, AstNode* exprsp, bool isScan);
|
const string& vformat, AstNode* exprsp, bool isScan);
|
||||||
void displayEmit(AstNode* nodep, bool isScan);
|
void displayEmit(AstNode* nodep, bool isScan);
|
||||||
void displayArg(AstNode* dispp, AstNode** elistp, bool isScan,
|
void displayArg(AstNode* dispp, AstNode** elistp, bool isScan,
|
||||||
string vfmt, char fmtLetter);
|
const string& vfmt, char fmtLetter);
|
||||||
|
|
||||||
void emitVarDecl(AstVar* nodep, const string& prefixIfImp);
|
void emitVarDecl(AstVar* nodep, const string& prefixIfImp);
|
||||||
typedef enum {EVL_IO, EVL_SIG, EVL_TEMP, EVL_PAR, EVL_ALL} EisWhich;
|
typedef enum {EVL_IO, EVL_SIG, EVL_TEMP, EVL_PAR, EVL_ALL} EisWhich;
|
||||||
|
|
@ -1237,7 +1237,6 @@ void EmitCStmts::displayEmit(AstNode* nodep, bool isScan) {
|
||||||
if (dispp) {}
|
if (dispp) {}
|
||||||
puts("VL_SFORMATF_NX(");
|
puts("VL_SFORMATF_NX(");
|
||||||
} else {
|
} else {
|
||||||
isStmt = true;
|
|
||||||
nodep->v3fatalSrc("Unknown displayEmit node type");
|
nodep->v3fatalSrc("Unknown displayEmit node type");
|
||||||
}
|
}
|
||||||
ofp()->putsQuoted(emitDispState.m_format);
|
ofp()->putsQuoted(emitDispState.m_format);
|
||||||
|
|
@ -1269,7 +1268,7 @@ void EmitCStmts::displayEmit(AstNode* nodep, bool isScan) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitCStmts::displayArg(AstNode* dispp, AstNode** elistp, bool isScan,
|
void EmitCStmts::displayArg(AstNode* dispp, AstNode** elistp, bool isScan,
|
||||||
string vfmt, char fmtLetter) {
|
const string& vfmt, char fmtLetter) {
|
||||||
// Print display argument, edits elistp
|
// Print display argument, edits elistp
|
||||||
AstNode* argp = *elistp;
|
AstNode* argp = *elistp;
|
||||||
if (!argp) {
|
if (!argp) {
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public:
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (AstCFile* nodep = v3Global.rootp()->filesp(); nodep; nodep=nodep->nextp()->castCFile()) {
|
for (AstCFile* nodep = v3Global.rootp()->filesp(); nodep; nodep=nodep->nextp()->castCFile()) {
|
||||||
if (nodep->source() && nodep->slow()==slow && nodep->support()==support) {
|
if (nodep->source() && nodep->slow()==(slow!=0) && nodep->support()==(support!=0)) {
|
||||||
putMakeClassEntry(of, nodep->name());
|
putMakeClassEntry(of, nodep->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
|
@ -253,18 +254,21 @@ class V3Error {
|
||||||
// Global versions, so that if the class doesn't define a operator, we get the functions anyways.
|
// Global versions, so that if the class doesn't define a operator, we get the functions anyways.
|
||||||
inline int debug() { return V3Error::debugDefault(); }
|
inline int debug() { return V3Error::debugDefault(); }
|
||||||
inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); }
|
inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); }
|
||||||
|
inline void v3errorEndFatal(ostringstream& sstr) VL_ATTR_NORETURN;
|
||||||
|
inline void v3errorEndFatal(ostringstream& sstr) { V3Error::v3errorEnd(sstr); assert(0); }
|
||||||
|
|
||||||
// Theses allow errors using << operators: v3error("foo"<<"bar");
|
// Theses allow errors using << operators: v3error("foo"<<"bar");
|
||||||
// Careful, you can't put () around msg, as you would in most macro definitions
|
// Careful, you can't put () around msg, as you would in most macro definitions
|
||||||
// Note the commas are the comma operator, not separating arguments. These are needed to insure
|
// Note the commas are the comma operator, not separating arguments. These are needed to insure
|
||||||
// evaluation order as otherwise we couldn't insure v3errorPrep is called first.
|
// evaluation order as otherwise we couldn't insure v3errorPrep is called first.
|
||||||
#define v3warnCode(code,msg) v3errorEnd((V3Error::v3errorPrep(code), (V3Error::v3errorStr()<<msg), V3Error::v3errorStr()));
|
#define v3warnCode(code,msg) v3errorEnd((V3Error::v3errorPrep(code), (V3Error::v3errorStr()<<msg), V3Error::v3errorStr()));
|
||||||
#define v3warn(code,msg) v3warnCode(V3ErrorCode::code,msg)
|
#define v3warnCodeFatal(code,msg) v3errorEndFatal((V3Error::v3errorPrep(code), (V3Error::v3errorStr()<<msg), V3Error::v3errorStr()));
|
||||||
#define v3info(msg) v3warn(EC_INFO,msg)
|
#define v3warn(code,msg) v3warnCode(V3ErrorCode::code, msg)
|
||||||
#define v3fatal(msg) v3warn(EC_FATAL,msg)
|
#define v3info(msg) v3warnCode(V3ErrorCode::EC_INFO, msg)
|
||||||
#define v3error(msg) v3warn(EC_ERROR,msg)
|
#define v3error(msg) v3warnCode(V3ErrorCode::EC_ERROR, msg)
|
||||||
|
#define v3fatal(msg) v3warnCodeFatal(V3ErrorCode::EC_FATAL, msg)
|
||||||
// Use this instead of fatal() to mention the source code line.
|
// Use this instead of fatal() to mention the source code line.
|
||||||
#define v3fatalSrc(msg) v3warn(EC_FATALSRC,__FILE__<<":"<<dec<<__LINE__<<": "<<msg)
|
#define v3fatalSrc(msg) v3warnCodeFatal(V3ErrorCode::EC_FATALSRC, __FILE__<<":"<<dec<<__LINE__<<": "<<msg)
|
||||||
|
|
||||||
#define UINFO(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<"- "<<V3Error::lineStr(__FILE__,__LINE__)<<stmsg; }}
|
#define UINFO(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<"- "<<V3Error::lineStr(__FILE__,__LINE__)<<stmsg; }}
|
||||||
#define UINFONL(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<stmsg; } }
|
#define UINFONL(level,stmsg) {if(VL_UNLIKELY(debug()>=(level))) { cout<<stmsg; } }
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@ public:
|
||||||
|
|
||||||
// OPERATORS
|
// OPERATORS
|
||||||
void v3errorEnd(ostringstream& str);
|
void v3errorEnd(ostringstream& str);
|
||||||
|
void v3errorEndFatal(ostringstream& str) VL_ATTR_NORETURN;
|
||||||
string warnMore() const;
|
string warnMore() const;
|
||||||
inline bool operator==(FileLine rhs) const {
|
inline bool operator==(FileLine rhs) const {
|
||||||
return (m_lineno==rhs.m_lineno && m_filenameno==rhs.m_filenameno && m_warnOn==rhs.m_warnOn);
|
return (m_lineno==rhs.m_lineno && m_filenameno==rhs.m_filenameno && m_warnOn==rhs.m_warnOn);
|
||||||
|
|
@ -168,4 +169,6 @@ public:
|
||||||
};
|
};
|
||||||
ostream& operator<<(ostream& os, FileLine* fileline);
|
ostream& operator<<(ostream& os, FileLine* fileline);
|
||||||
|
|
||||||
|
inline void FileLine::v3errorEndFatal(ostringstream& str) { v3errorEnd(str); assert(0); }
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -1409,7 +1409,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GateClkDecompGraphVisitor(V3Graph* graphp) {
|
explicit GateClkDecompGraphVisitor(V3Graph* graphp) {
|
||||||
m_graphp = graphp;
|
m_graphp = graphp;
|
||||||
m_seen_clk_vectors = 0;
|
m_seen_clk_vectors = 0;
|
||||||
m_clk_vsp = NULL;
|
m_clk_vsp = NULL;
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ public:
|
||||||
static DfaInput EPSILON() { return VNUser::fromInt(0); }
|
static DfaInput EPSILON() { return VNUser::fromInt(0); }
|
||||||
static DfaInput NA() { return VNUser::fromInt(1); } // as in not-applicable
|
static DfaInput NA() { return VNUser::fromInt(1); } // as in not-applicable
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
DfaEdge(DfaGraph* graphp, DfaVertex* fromp, DfaVertex* top, DfaInput input)
|
DfaEdge(DfaGraph* graphp, DfaVertex* fromp, DfaVertex* top, const DfaInput& input)
|
||||||
: V3GraphEdge(graphp, fromp, top, 1)
|
: V3GraphEdge(graphp, fromp, top, 1)
|
||||||
, m_input(input), m_complement(false) {}
|
, m_input(input), m_complement(false) {}
|
||||||
DfaEdge(DfaGraph* graphp, DfaVertex* fromp, DfaVertex* top, const DfaEdge* copyfrom)
|
DfaEdge(DfaGraph* graphp, DfaVertex* fromp, DfaVertex* top, const DfaEdge* copyfrom)
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public:
|
||||||
class V3GraphTestVertex : public V3GraphVertex {
|
class V3GraphTestVertex : public V3GraphVertex {
|
||||||
string m_name;
|
string m_name;
|
||||||
public:
|
public:
|
||||||
V3GraphTestVertex(V3Graph* graphp, string name) : V3GraphVertex(graphp), m_name(name) {}
|
V3GraphTestVertex(V3Graph* graphp, const string& name) : V3GraphVertex(graphp), m_name(name) {}
|
||||||
virtual ~V3GraphTestVertex() {}
|
virtual ~V3GraphTestVertex() {}
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual string name() const { return m_name; }
|
virtual string name() const { return m_name; }
|
||||||
|
|
@ -80,7 +80,7 @@ public:
|
||||||
|
|
||||||
class V3GraphTestVarVertex : public V3GraphTestVertex {
|
class V3GraphTestVarVertex : public V3GraphTestVertex {
|
||||||
public:
|
public:
|
||||||
V3GraphTestVarVertex(V3Graph* graphp, string name) : V3GraphTestVertex(graphp, name) {}
|
V3GraphTestVarVertex(V3Graph* graphp, const string& name) : V3GraphTestVertex(graphp, name) {}
|
||||||
virtual ~V3GraphTestVarVertex() {}
|
virtual ~V3GraphTestVarVertex() {}
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual string dotColor() const { return "blue"; }
|
virtual string dotColor() const { return "blue"; }
|
||||||
|
|
@ -270,7 +270,7 @@ public:
|
||||||
class DfaTestVertex : public DfaVertex {
|
class DfaTestVertex : public DfaVertex {
|
||||||
string m_name;
|
string m_name;
|
||||||
public:
|
public:
|
||||||
DfaTestVertex(DfaGraph* graphp, string name) : DfaVertex(graphp), m_name(name) {}
|
DfaTestVertex(DfaGraph* graphp, const string& name) : DfaVertex(graphp), m_name(name) {}
|
||||||
virtual ~DfaTestVertex() {}
|
virtual ~DfaTestVertex() {}
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual string name() const { return m_name; }
|
virtual string name() const { return m_name; }
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,9 @@ private:
|
||||||
AstNode* valuep = NULL;
|
AstNode* valuep = NULL;
|
||||||
if (nodep->valuep()) valuep = new AstAdd(nodep->fileline(), nodep->valuep()->cloneTree(true),
|
if (nodep->valuep()) valuep = new AstAdd(nodep->fileline(), nodep->valuep()->cloneTree(true),
|
||||||
new AstConst(nodep->fileline(), AstConst::Unsized32(), offset_from_init));
|
new AstConst(nodep->fileline(), AstConst::Unsized32(), offset_from_init));
|
||||||
addp = addp->addNextNull(new AstEnumItem(nodep->fileline(), name, NULL, valuep));
|
AstNode* newp = new AstEnumItem(nodep->fileline(), name, NULL, valuep);
|
||||||
|
if (addp) addp = addp->addNextNull(newp);
|
||||||
|
else addp = newp;
|
||||||
}
|
}
|
||||||
nodep->replaceWith(addp);
|
nodep->replaceWith(addp);
|
||||||
nodep->deleteTree();
|
nodep->deleteTree();
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ V3Number::V3Number (FileLine* fileline, const char* sourcep) {
|
||||||
if (*cp != '_') *wp++ = *cp;
|
if (*cp != '_') *wp++ = *cp;
|
||||||
}
|
}
|
||||||
*wp++ = '\0';
|
*wp++ = '\0';
|
||||||
while (*cp && *cp == '_') cp++;
|
while (*cp == '_') cp++;
|
||||||
if (*cp && tolower(*cp)=='s') {
|
if (*cp && tolower(*cp)=='s') {
|
||||||
cp++; isSigned(true);
|
cp++; isSigned(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,6 @@ public:
|
||||||
V3Number& opLtN (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opLtN (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opLteN (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opLteN (const V3Number& lhs, const V3Number& rhs);
|
||||||
};
|
};
|
||||||
inline ostream& operator<<(ostream& os, V3Number rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, const V3Number& rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "V3Number.h"
|
#include "V3Number.h"
|
||||||
|
|
||||||
void test(string lhss, string op, string rhss, string exps) {
|
void test(const string& lhss, const string& op, const string& rhss, const string& exps) {
|
||||||
char* l1 = strdup(lhss.c_str());
|
char* l1 = strdup(lhss.c_str());
|
||||||
char* r1 = strdup(rhss.c_str());
|
char* r1 = strdup(rhss.c_str());
|
||||||
char* e1 = strdup(exps.c_str());
|
char* e1 = strdup(exps.c_str());
|
||||||
|
|
|
||||||
|
|
@ -559,8 +559,9 @@ string V3Options::version() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3Options::throwSigsegv() {
|
void V3Options::throwSigsegv() {
|
||||||
// cppcheck-suppress nullPointer
|
#if !(defined(VL_CPPCHECK) || defined(__clang_analyzer__))
|
||||||
char* zp=NULL; *zp=0; // Intentional core dump, ignore warnings here
|
char* zp=NULL; *zp=0; // Intentional core dump, ignore warnings here
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,8 @@ public:
|
||||||
virtual string removeDefines(const string& text)=0; // Remove defines in a text string
|
virtual string removeDefines(const string& text)=0; // Remove defines in a text string
|
||||||
|
|
||||||
// UTILITIES
|
// UTILITIES
|
||||||
void error(string msg) { fileline()->v3error(msg); } ///< Report a error
|
void error(const string& msg) { fileline()->v3error(msg); } ///< Report a error
|
||||||
void fatal(string msg) { fileline()->v3fatalSrc(msg); } ///< Report a fatal error
|
void fatal(const string& msg) { fileline()->v3fatalSrc(msg); } ///< Report a fatal error
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
|
|
|
||||||
|
|
@ -411,7 +411,8 @@ private:
|
||||||
UINFO(6, " Color="<<color<<" New order: "<<nextp<<endl);
|
UINFO(6, " Color="<<color<<" New order: "<<nextp<<endl);
|
||||||
if (nextp == nodep && !splitAlwaysp) nodep->unlinkFrBack(&replaceHandle);
|
if (nextp == nodep && !splitAlwaysp) nodep->unlinkFrBack(&replaceHandle);
|
||||||
else nextp->unlinkFrBack();
|
else nextp->unlinkFrBack();
|
||||||
newListp = newListp->addNext(nextp);
|
if (newListp) newListp = newListp->addNext(nextp);
|
||||||
|
else newListp = nextp;
|
||||||
}
|
}
|
||||||
if (splitAlwaysp) {
|
if (splitAlwaysp) {
|
||||||
++m_statSplits;
|
++m_statSplits;
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ private:
|
||||||
return newvscp;
|
return newvscp;
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNode* createInlinedFTask(AstNodeFTaskRef* refp, string namePrefix, AstVarScope* outvscp) {
|
AstNode* createInlinedFTask(AstNodeFTaskRef* refp, const string& namePrefix, AstVarScope* outvscp) {
|
||||||
// outvscp is the variable for functions only, if NULL, it's a task
|
// outvscp is the variable for functions only, if NULL, it's a task
|
||||||
if (!refp->taskp()) refp->v3fatalSrc("Unlinked?");
|
if (!refp->taskp()) refp->v3fatalSrc("Unlinked?");
|
||||||
AstNode* newbodysp = refp->taskp()->stmtsp()->cloneTree(true); // Maybe NULL
|
AstNode* newbodysp = refp->taskp()->stmtsp()->cloneTree(true); // Maybe NULL
|
||||||
|
|
@ -463,7 +463,7 @@ private:
|
||||||
return beginp;
|
return beginp;
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNode* createNonInlinedFTask(AstNodeFTaskRef* refp, string namePrefix, AstVarScope* outvscp) {
|
AstNode* createNonInlinedFTask(AstNodeFTaskRef* refp, const string& namePrefix, AstVarScope* outvscp) {
|
||||||
// outvscp is the variable for functions only, if NULL, it's a task
|
// outvscp is the variable for functions only, if NULL, it's a task
|
||||||
if (!refp->taskp()) refp->v3fatalSrc("Unlinked?");
|
if (!refp->taskp()) refp->v3fatalSrc("Unlinked?");
|
||||||
AstCFunc* cfuncp = m_statep->ftaskCFuncp(refp->taskp());
|
AstCFunc* cfuncp = m_statep->ftaskCFuncp(refp->taskp());
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ private:
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNode* newSubLsbOf(AstNode* underp, VNumRange fromRange) {
|
AstNode* newSubLsbOf(AstNode* underp, const VNumRange& fromRange) {
|
||||||
// Account for a variable's LSB in bit selections
|
// Account for a variable's LSB in bit selections
|
||||||
// Will likely become SUB(underp, lsb_of_signal)
|
// Will likely become SUB(underp, lsb_of_signal)
|
||||||
// Don't report WIDTH warnings etc here, as may be inside a generate branch that will be deleted
|
// Don't report WIDTH warnings etc here, as may be inside a generate branch that will be deleted
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,19 @@ sub process {
|
||||||
$fh or die "%Error: '$cmd' failed: $!\n";
|
$fh or die "%Error: '$cmd' failed: $!\n";
|
||||||
my %uniq;
|
my %uniq;
|
||||||
my %errs;
|
my %errs;
|
||||||
|
my $last_error = "";
|
||||||
while (defined(my $line = $fh->getline())) {
|
while (defined(my $line = $fh->getline())) {
|
||||||
$line =~ s/^\s+//;
|
$line =~ s/^\s+//;
|
||||||
$line =~ s/Checking usage of global functions\.+//; # Sometimes tacked at end-of-line
|
$line =~ s/Checking usage of global functions\.+//; # Sometimes tacked at end-of-line
|
||||||
# General gunk
|
# General gunk
|
||||||
next if $uniq{$line}++;
|
next if $uniq{$line}++;
|
||||||
next if $line =~ m!^<\?xml version!;
|
next if $line =~ m!^<\?xml version!;
|
||||||
next if $line =~ m!^<results>!;
|
next if $line =~ m!^<cppcheck!;
|
||||||
|
next if $line =~ m!^<results!;
|
||||||
next if $line =~ m!^</results>!;
|
next if $line =~ m!^</results>!;
|
||||||
|
next if $line =~ m!^<errors!;
|
||||||
|
next if $line =~ m!^</error>!;
|
||||||
|
next if $line =~ m!^</errors>!;
|
||||||
next if $line =~ m!^<error.*id="unmatchedSuppression"!; # --suppress=unmatchedSuppression doesn't work
|
next if $line =~ m!^<error.*id="unmatchedSuppression"!; # --suppress=unmatchedSuppression doesn't work
|
||||||
next if $line =~ m!Cppcheck cannot find all the include files!; # An earlier id line is more specific
|
next if $line =~ m!Cppcheck cannot find all the include files!; # An earlier id line is more specific
|
||||||
next if $line =~ m!^Checking !;
|
next if $line =~ m!^Checking !;
|
||||||
|
|
@ -80,10 +85,32 @@ sub process {
|
||||||
print $line;
|
print $line;
|
||||||
} else {
|
} else {
|
||||||
my $suppress;
|
my $suppress;
|
||||||
|
# --xml-format=1
|
||||||
if ($line =~ /file="([^"]+)"\s+line="(\d+)"\s+id="([^"]+)"/) {
|
if ($line =~ /file="([^"]+)"\s+line="(\d+)"\s+id="([^"]+)"/) {
|
||||||
my $file = $1; my $linenum = $2; my $id = $3;
|
my $file = $1; my $linenum = $2; my $id = $3;
|
||||||
$suppress = 1 if _suppress($file,$linenum,$id);
|
$suppress = 1 if _suppress($file,$linenum,$id);
|
||||||
}
|
}
|
||||||
|
# --xml-format=2
|
||||||
|
if ($line =~ /<error id.*/) {
|
||||||
|
$last_error = $line;
|
||||||
|
chomp $last_error;
|
||||||
|
$suppress = 1;
|
||||||
|
}
|
||||||
|
elsif ($line =~ /<location.* file="([^"]+)"\s+line="(\d+)"/) {
|
||||||
|
my $file = $1; my $linenum = $2; my $id;
|
||||||
|
if ($last_error =~ / id="([^"]+)"/) {
|
||||||
|
$id = $1;
|
||||||
|
} else {
|
||||||
|
$id = "?";
|
||||||
|
}
|
||||||
|
$suppress = 1 if _suppress($file,$linenum,$id);
|
||||||
|
$suppress = 1 if $file eq "*";
|
||||||
|
if (!$suppress) {
|
||||||
|
chomp $line;
|
||||||
|
print "$file:$linenum: ".$last_error."\n";
|
||||||
|
$suppress = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!$suppress) {
|
if (!$suppress) {
|
||||||
my $eline = "%Error: cppcheck: $line";
|
my $eline = "%Error: cppcheck: $line";
|
||||||
print $eline;
|
print $eline;
|
||||||
|
|
@ -122,7 +149,7 @@ sub _suppress {
|
||||||
my $supids = $1;
|
my $supids = $1;
|
||||||
foreach my $supid (split /\s+/, $supids) {
|
foreach my $supid (split /\s+/, $supids) {
|
||||||
if ($supid eq $id
|
if ($supid eq $id
|
||||||
|| $supid eq $SuppressMap{$id}) {
|
|| $supid eq ($SuppressMap{$id}||'')) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue