Fix some cppcheck warnings. No functional change intended.
This commit is contained in:
parent
5e69faff46
commit
98b89d0f2c
|
|
@ -2980,7 +2980,6 @@ void vl_get_value_array_vectors(unsigned index, const unsigned num, const unsign
|
|||
"type T is not unsigned"); // ensure logical right shift
|
||||
const unsigned element_size_bytes = VL_BYTES_I(packedSize);
|
||||
const unsigned element_size_words = VL_WORDS_I(packedSize);
|
||||
const unsigned element_size_repr = (element_size_bytes + sizeof(T) - 1) / sizeof(T);
|
||||
if (sizeof(T) == sizeof(QData)) {
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
dst[i * 2].aval = static_cast<QData>(src[index]);
|
||||
|
|
@ -3102,7 +3101,7 @@ void vl_put_value_array_rawvals(unsigned index, const unsigned num, const unsign
|
|||
}
|
||||
}
|
||||
|
||||
void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, PLI_INT32* index_p,
|
||||
void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const PLI_INT32* index_p,
|
||||
PLI_UINT32 num) {
|
||||
const VerilatedVpioVar* const vop = VerilatedVpioVar::castp(object);
|
||||
if (!vl_check_array_format(vop->varp(), arrayvalue_p, vop->fullname())) return;
|
||||
|
|
@ -3328,7 +3327,7 @@ void vpi_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, PLI_IN
|
|||
vl_get_value_array(object, arrayvalue_p, index_p, num);
|
||||
}
|
||||
|
||||
void vl_put_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, PLI_INT32* index_p,
|
||||
void vl_put_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const PLI_INT32* index_p,
|
||||
PLI_UINT32 num) {
|
||||
const VerilatedVpioVar* const vop = VerilatedVpioVar::castp(object);
|
||||
if (!vl_check_array_format(vop->varp(), arrayvalue_p, vop->fullname())) return;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ private:
|
|||
v3Global.opt.addCFlags("-DVL_TIME_CONTEXT"); // On MSVC++ anyways
|
||||
|
||||
// Optional main top name argument, with empty string replacement
|
||||
string topArg;
|
||||
string topName = v3Global.opt.mainTopName();
|
||||
if (topName == "-") topName = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ private:
|
|||
const int m_dbgId; // Work list ID for debugging.
|
||||
|
||||
WorkList() = delete;
|
||||
WorkList(int id)
|
||||
explicit WorkList(int id)
|
||||
: m_dbgId{id} {}
|
||||
};
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ private:
|
|||
public:
|
||||
static std::vector<FileOrConcatenatedFilesList>
|
||||
singleConcatenatedFilesList(std::vector<FilenameWithScore> inputFiles, uint64_t totalScore,
|
||||
std::string groupFilePrefix) {
|
||||
const std::string& groupFilePrefix) {
|
||||
EmitGroup group{std::move(inputFiles), totalScore, groupFilePrefix};
|
||||
group.process();
|
||||
return group.m_outputFiles;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ class V3EmitMkJsonEmitter final {
|
|||
|
||||
// METHODS
|
||||
public:
|
||||
Printer(const std::unique_ptr<std::ofstream>& of, const std::string& indent = " ")
|
||||
explicit Printer(const std::unique_ptr<std::ofstream>& of,
|
||||
const std::string& indent = " ")
|
||||
: m_of(of)
|
||||
, m_indent(indent) {
|
||||
begin();
|
||||
|
|
@ -144,7 +145,6 @@ class V3EmitMkJsonEmitter final {
|
|||
const std::unique_ptr<std::ofstream> of{
|
||||
V3File::new_ofstream(makeDir + "/" + v3Global.opt.prefix() + ".json")};
|
||||
|
||||
const string name = v3Global.opt.prefix();
|
||||
const std::string trace
|
||||
= v3Global.opt.trace() ? (v3Global.opt.traceFormat().vcd() ? "vcd" : "fst") : "off";
|
||||
|
||||
|
|
@ -257,11 +257,11 @@ class V3EmitMkJsonEmitter final {
|
|||
const V3HierBlock* hblockp = *it;
|
||||
const V3HierBlock::HierBlockSet& children = hblockp->children();
|
||||
|
||||
std::vector<std::string> deps;
|
||||
std::vector<std::string> childDeps;
|
||||
std::vector<std::string> sources;
|
||||
|
||||
for (const auto& childr : children) {
|
||||
deps.emplace_back((childr)->hierPrefix());
|
||||
childDeps.emplace_back((childr)->hierPrefix());
|
||||
sources.emplace_back(makeDir + "/" + childr->hierWrapperFilename(true));
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ class V3EmitMkJsonEmitter final {
|
|||
cursor += cursor.begin()
|
||||
.put("prefix", hblockp->hierPrefix())
|
||||
.put("top", hblockp->modp()->name())
|
||||
.putList("deps", deps)
|
||||
.putList("deps", childDeps)
|
||||
.put("directory", makeDir + "/" + hblockp->hierPrefix())
|
||||
.putList("sources", sources)
|
||||
.putList("cflags", cflags)
|
||||
|
|
|
|||
|
|
@ -325,9 +325,9 @@ void V3FuncOpt::funcOptAll(AstNetlist* nodep) {
|
|||
V3ThreadScope threadScope;
|
||||
for (AstNodeModule *modp = nodep->modulesp(), *nextModp; modp; modp = nextModp) {
|
||||
nextModp = VN_AS(modp->nextp(), NodeModule);
|
||||
for (AstNode *nodep = modp->stmtsp(), *nextNodep; nodep; nodep = nextNodep) {
|
||||
nextNodep = nodep->nextp();
|
||||
if (AstCFunc* const cfuncp = VN_CAST(nodep, CFunc)) {
|
||||
for (AstNode *stmtp = modp->stmtsp(), *nextStmtp; stmtp; stmtp = nextStmtp) {
|
||||
nextStmtp = stmtp->nextp();
|
||||
if (AstCFunc* const cfuncp = VN_CAST(stmtp, CFunc)) {
|
||||
threadScope.enqueue([cfuncp]() { FuncOptVisitor::apply(cfuncp); });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4283,8 +4283,8 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
|||
} else if (m_insideClassExtParam) {
|
||||
return;
|
||||
} else {
|
||||
if (foundp) UINFO(1, "Found sym node: " << foundp->nodep() << endl);
|
||||
if (foundp) {
|
||||
UINFO(1, "Found sym node: " << foundp->nodep() << endl);
|
||||
nodep->v3error("Expecting a data type: " << nodep->prettyNameQ());
|
||||
} else {
|
||||
nodep->v3error("Can't find typedef/interface: " << nodep->prettyNameQ());
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ class LinkParseVisitor final : public VNVisitor {
|
|||
if (nodep->genforp()) {
|
||||
++m_genblkNum;
|
||||
if (nodep->name() == "") assignGenBlkNum = m_genblkNum;
|
||||
} else if (nodep->generate() && nodep->name() == "" && assignGenBlkNum == -1
|
||||
} else if (nodep->generate() && nodep->name() == ""
|
||||
&& (VN_IS(backp, CaseItem) || VN_IS(backp, GenIf)) && !nestedIf) {
|
||||
assignGenBlkNum = m_genblkAbove;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ void V3ParseImp::tokenPipelineSym() {
|
|||
} else { // Not found
|
||||
yylval.scp = nullptr;
|
||||
if (token == yaID__CC) {
|
||||
if (!m_afterColonColon & !v3Global.opt.bboxUnsup()) {
|
||||
if (!m_afterColonColon && !v3Global.opt.bboxUnsup()) {
|
||||
// IEEE does require this, but we may relax this as UVM breaks it, so allow
|
||||
// bbox for today
|
||||
// We'll get a parser error eventually but might not be obvious
|
||||
|
|
|
|||
|
|
@ -1952,9 +1952,8 @@ string V3Task::assignInternalToDpi(AstVar* portp, bool isPtr, const string& frSu
|
|||
const string idx = portp->name() + "__Vidx";
|
||||
stmt = "for (size_t " + idx + " = 0; " + idx + " < " + cvtToStr(unpackSize) + "; ++" + idx
|
||||
+ ") ";
|
||||
stmt += (isBit ? "VL_SET_SVBV_" : "VL_SET_SVLV_")
|
||||
+ string{portp->dtypep()->skipRefp()->charIQWN()} + "(" + cvtToStr(portp->width())
|
||||
+ ", ";
|
||||
stmt += (isBit ? "VL_SET_SVBV_"s : "VL_SET_SVLV_"s)
|
||||
+ portp->dtypep()->skipRefp()->charIQWN() + "(" + cvtToStr(portp->width()) + ", ";
|
||||
stmt += toName + " + " + cvtToStr(portp->dtypep()->skipRefp()->widthWords()) + " * " + idx
|
||||
+ ", ";
|
||||
if (unpackDim > 0) { // Access multi-dimensional array as a 1D array
|
||||
|
|
|
|||
Loading…
Reference in New Issue