From bf17bb4648c195aad2884fffc7519982fa1b1656 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 4 Apr 2020 20:08:58 -0400 Subject: [PATCH] Fix codacity warnings --- src/V3AstNodes.cpp | 12 ++++++------ src/V3EmitCInlines.cpp | 4 ++-- src/V3EmitCSyms.cpp | 4 ++-- src/V3LinkDot.cpp | 2 +- src/V3ProtectLib.cpp | 4 ++-- test_regress/t/t_trace_two_cc.cpp | 1 - 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 64df9f9df..314cae720 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -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"; diff --git a/src/V3EmitCInlines.cpp b/src/V3EmitCInlines.cpp index d3fa0084c..ef36bc395 100644 --- a/src/V3EmitCInlines.cpp +++ b/src/V3EmitCInlines.cpp @@ -132,6 +132,6 @@ void EmitCInlines::emitInt() { // EmitC class functions void V3EmitC::emitcInlines() { - UINFO(2,__FUNCTION__<<": "<nodep()<parentp())<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) diff --git a/src/V3ProtectLib.cpp b/src/V3ProtectLib.cpp index ecb49ff4b..b9be66a9b 100644 --- a/src/V3ProtectLib.cpp +++ b/src/V3ProtectLib.cpp @@ -452,6 +452,6 @@ class ProtectVisitor : public AstNVisitor { // ProtectLib class functions void V3ProtectLib::protect() { - UINFO(2,__FUNCTION__<<": "<clk = false; ap->clk = false; main_time += 10; }