Internals: Prefer '(void)' to avoid unused var. No functional change.

This commit is contained in:
Wilson Snyder 2024-03-27 18:07:14 -04:00
parent 0ff77fc352
commit ea8f86dd30
8 changed files with 22 additions and 20 deletions

View File

@ -17,7 +17,8 @@
#endif
int main(int argc, char** argv) {
if (false && argc && argv) {}
(void)argc;
(void)argv;
// Construct context to hold simulation time, etc
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};

View File

@ -886,7 +886,7 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
case '^': { // Realtime
const int lbits = va_arg(ap, int);
const double d = va_arg(ap, double);
if (lbits) {} // UNUSED - always 64
(void)lbits; // UNUSED - always 64
if (fmt == '^') { // Realtime
if (!widthSet) width = Verilated::threadContextp()->impp()->timeFormatWidth();
const int timeunit = va_arg(ap, int);
@ -3101,7 +3101,7 @@ void Verilated::stackCheck(QData needSize) VL_MT_UNSAFE {
haveSize / 1024, (needSize * 2) / 1024);
}
#else
if (false && needSize) {} // Unused argument
(void)needSize; // Unused argument
#endif
}

View File

@ -428,7 +428,7 @@ V3Number& V3Number::setLongS(int32_t value) {
int32_t s;
} u;
u.s = value;
if (u.s) {}
(void)u.s;
m_data.num()[0].m_value = u.u;
opCleanThis();
return *this;
@ -441,7 +441,7 @@ V3Number& V3Number::setDouble(double value) {
uint32_t u[2];
} u;
u.d = value;
if (u.d != 0.0) {}
(void)u.d;
for (int i = 2; i < words(); i++) m_data.num()[i] = {0, 0};
m_data.num()[0].m_value = u.u[0];
m_data.num()[1].m_value = u.u[1];
@ -2374,7 +2374,7 @@ V3Number& V3Number::opRToIRoundS(const V3Number& lhs) {
uint64_t q;
} u;
u.d = v;
if (u.d == 0.0) {}
(void)u.d;
const int exp = static_cast<int>((u.q >> 52ULL) & VL_MASK_Q(11)) - 1023;
const int lsb = exp - 52;

View File

@ -1691,7 +1691,7 @@ class TristateVisitor final : public TristateBaseVisitor {
AstVar* const enVarp = getCreateEnVarp(nodep->varp());
nodep->user1p(new AstVarRef{nodep->fileline(), enVarp, VAccess::READ});
}
if (m_alhs) {} // NOP; user1() already passed down from assignment
(void)m_alhs; // NOP; user1() already passed down from assignment
}
}

View File

@ -6265,7 +6265,7 @@ class WidthVisitor final : public VNVisitor {
nodep->dtypeChgSigned(nodep->lhsp()->isSigned());
const AstNodeBiop* const newp = iterate_shift_final(nodep);
VL_DANGLING(nodep);
if (newp) {} // Ununused
(void)newp; // Ununused
}
void iterate_shift_prelim(AstNodeBiop* nodep) {
// Shifts
@ -6617,7 +6617,7 @@ class WidthVisitor final : public VNVisitor {
AstNodeDType* const expDTypep = underp->findUInt32DType();
underp
= iterateCheck(nodep, "file_descriptor", underp, SELF, FINAL, expDTypep, EXTEND_EXP);
if (underp) {} // cppcheck
(void)underp; // cppcheck
}
void iterateCheckSigned32(AstNode* nodep, const char* side, AstNode* underp, Stage stage) {
// Coerce child to signed32 if not already. Child is self-determined
@ -6629,7 +6629,7 @@ class WidthVisitor final : public VNVisitor {
AstNodeDType* const expDTypep = nodep->findSigned32DType();
underp = iterateCheck(nodep, side, underp, SELF, FINAL, expDTypep, EXTEND_EXP);
}
if (underp) {} // cppcheck
(void)underp; // cppcheck
}
void iterateCheckReal(AstNode* nodep, const char* side, AstNode* underp, Stage stage) {
// Coerce child to real if not already. Child is self-determined
@ -6645,7 +6645,7 @@ class WidthVisitor final : public VNVisitor {
AstNodeDType* const expDTypep = nodep->findDoubleDType();
underp = iterateCheck(nodep, side, underp, SELF, FINAL, expDTypep, EXTEND_EXP);
}
if (underp) {} // cppcheck
(void)underp; // cppcheck
}
void iterateCheckString(AstNode* nodep, const char* side, AstNode* underp, Stage stage) {
if (stage & PRELIM) {
@ -6655,7 +6655,7 @@ class WidthVisitor final : public VNVisitor {
AstNodeDType* const expDTypep = nodep->findStringDType();
underp = iterateCheck(nodep, side, underp, SELF, FINAL, expDTypep, EXTEND_EXP);
}
if (underp) {} // cppcheck
(void)underp; // cppcheck
}
void iterateCheckTyped(AstNode* nodep, const char* side, AstNode* underp,
AstNodeDType* expDTypep, Stage stage) {
@ -6665,7 +6665,7 @@ class WidthVisitor final : public VNVisitor {
if (stage & FINAL) {
underp = iterateCheck(nodep, side, underp, SELF, FINAL, expDTypep, EXTEND_EXP);
}
if (underp) {} // cppcheck
(void)underp; // cppcheck
}
void iterateCheckSizedSelf(AstNode* nodep, const char* side, AstNode* underp, Determ determ,
Stage stage) {
@ -6681,7 +6681,7 @@ class WidthVisitor final : public VNVisitor {
underp = VN_IS(underp, NodeExpr) ? checkCvtUS(VN_AS(underp, NodeExpr)) : underp;
AstNodeDType* const expDTypep = underp->dtypep();
underp = iterateCheck(nodep, side, underp, SELF, FINAL, expDTypep, EXTEND_EXP);
if (underp) {} // cppcheck
(void)underp; // cppcheck
}
void iterateCheckAssign(AstNode* nodep, const char* side, AstNode* rhsp, Stage stage,
AstNodeDType* lhsDTypep) {
@ -6727,7 +6727,7 @@ class WidthVisitor final : public VNVisitor {
rhsp = iterateCheck(nodep, side, rhsp, ASSIGN, FINAL, lhsDTypep,
lhsStream ? EXTEND_OFF : EXTEND_LHS);
// if (debug()) nodep->dumpTree("- checkout: ");
if (rhsp) {} // cppcheck
(void)rhsp; // cppcheck
}
void iterateCheckBool(AstNode* nodep, const char* side, AstNode* underp, Stage stage) {

View File

@ -77,7 +77,7 @@ int dpic_line() {
printf("%%Warning: svGetCallerInfo failed\n");
return 0;
}
if (svGetCallerInfo(nullptr, nullptr)) {} // Check doesn't segflt
(void)svGetCallerInfo(nullptr, nullptr); // Check doesn't segflt
return lineno;
}
@ -115,7 +115,7 @@ int dpic_save(int value) {
}
vp.i = value;
if (vp.i) {}
(void)vp.i;
if (svPutUserData(scope, &Dpic_Unique, vp.ptr)) {
printf("%%Warning: svPutUserData failed\n");
return 0;

View File

@ -35,11 +35,12 @@ int dpii_task() {
// Check DPI warnings
svScope scope = svGetScope(); // Will warn
if (scope) {} // Unused
(void)scope; // Unused
const char* filenamep = "";
int lineno = 0;
svGetCallerInfo(&filenamep, &lineno); // Will warn
if (filenamep && lineno) {} // Unused
(void)filenamep; // Unused
(void)lineno; // Unused
dpix_task();
return 0;

View File

@ -127,7 +127,7 @@ static void _dpii_logic_elem_ux(int p, int u, const svOpenArrayHandle i, const s
#endif
int sizeInputOfArray = svSizeOfArray(i);
// svSizeOfArray(i) undeterministic as not in C representation
if (sizeInputOfArray) {}
(void)sizeInputOfArray; // unused
for (int a = svLow(i, 1); a <= svHigh(i, 1); ++a) {
if (dim == 1) {