Fix codacity warnings

This commit is contained in:
Wilson Snyder 2020-04-04 20:08:58 -04:00
parent 4dc1f40856
commit bf17bb4648
6 changed files with 13 additions and 14 deletions

View File

@ -335,9 +335,9 @@ AstVar::VlArgTypeRecursed AstVar::vlArgTypeRecurse(bool forFunc, const AstNodeDT
} else if (const AstBasicDType* bdtypep = dtypep->basicp()) {
string otype;
string oarray;
bool strtype = bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::STRING;
bool strtype = bdtypep->keyword() == AstBasicDTypeKwd::STRING;
string bitvec;
if (bdtypep && !bdtypep->isOpaque() && !v3Global.opt.protectIds()) {
if (!bdtypep->isOpaque() && !v3Global.opt.protectIds()) {
// We don't print msb()/lsb() as multidim packed would require recursion,
// and may confuse users as C++ data is stored always with bit 0 used
bitvec += "/*"+cvtToStr(dtypep->width()-1)+":0*/";
@ -345,13 +345,13 @@ AstVar::VlArgTypeRecursed AstVar::vlArgTypeRecurse(bool forFunc, const AstNodeDT
if ((forFunc && isReadOnly())
|| bdtypep->keyword() == AstBasicDTypeKwd::CHARPTR
|| bdtypep->keyword() == AstBasicDTypeKwd::SCOPEPTR) otype += "const ";
if (bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::CHARPTR) {
if (bdtypep->keyword() == AstBasicDTypeKwd::CHARPTR) {
otype += "char*";
} else if (bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::SCOPEPTR) {
} else if (bdtypep->keyword() == AstBasicDTypeKwd::SCOPEPTR) {
otype += "VerilatedScope*";
} else if (bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::DOUBLE) {
} else if (bdtypep->keyword() == AstBasicDTypeKwd::DOUBLE) {
otype += "double";
} else if (bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::FLOAT) {
} else if (bdtypep->keyword() == AstBasicDTypeKwd::FLOAT) {
otype += "float";
} else if (strtype) {
otype += "std::string";

View File

@ -132,6 +132,6 @@ void EmitCInlines::emitInt() {
// EmitC class functions
void V3EmitC::emitcInlines() {
UINFO(2,__FUNCTION__<<": "<<endl);
EmitCInlines syms (v3Global.rootp());
UINFO(2, __FUNCTION__ << ": " << endl);
EmitCInlines(v3Global.rootp());
}

View File

@ -874,6 +874,6 @@ void EmitCSyms::emitDpiImp() {
// EmitC class functions
void V3EmitC::emitcSyms(bool dpiHdrOnly) {
UINFO(2,__FUNCTION__<<": "<<endl);
EmitCSyms syms (v3Global.rootp(), dpiHdrOnly);
UINFO(2, __FUNCTION__ << ": " << endl);
EmitCSyms(v3Global.rootp(), dpiHdrOnly);
}

View File

@ -992,7 +992,7 @@ class LinkDotFindVisitor : public AstNVisitor {
UINFO(4,"DupVar: "<<nodep<<" ;; "<<foundp->nodep()<<endl);
UINFO(4," found cur=se"<<cvtToHex(m_curSymp)
<<" ;; parent=se"<<cvtToHex(foundp->parentp())<<endl);
if (foundp && foundp->parentp() == m_curSymp // Only when on same level
if (foundp->parentp() == m_curSymp // Only when on same level
&& !foundp->imported()) { // and not from package
bool nansiBad = ((findvarp->isDeclTyped() && nodep->isDeclTyped())
|| (findvarp->isIO() && nodep->isIO())); // e.g. !(output && output)

View File

@ -452,6 +452,6 @@ class ProtectVisitor : public AstNVisitor {
// ProtectLib class functions
void V3ProtectLib::protect() {
UINFO(2,__FUNCTION__<<": "<<endl);
ProtectVisitor visitor(v3Global.rootp());
UINFO(2, __FUNCTION__ << ": " << endl);
ProtectVisitor(v3Global.rootp());
}

View File

@ -62,7 +62,6 @@ int main(int argc, char** argv, char** env) {
#endif
{
ap->clk = false;
ap->clk = false;
main_time += 10;
}