Internals: Fix some shadow and other warnings. No functional change

This commit is contained in:
Wilson Snyder 2017-09-14 22:26:30 -04:00
parent 74420550e6
commit 960b2ed023
13 changed files with 48 additions and 47 deletions

View File

@ -706,10 +706,10 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
_vl_vsss_skipspace(fp,floc,fromp,fstr);
_vl_vsss_read(fp,floc,fromp,fstr, tmp, NULL);
if (!tmp[0]) goto done;
int pos = ((int)strlen(tmp))-1;
int lpos = ((int)strlen(tmp))-1;
int lsb = 0;
for (int i=0; i<obits && pos>=0; --pos) {
_vl_vsss_setbit(owp,obits,lsb, 8, tmp[pos]); lsb+=8;
for (int i=0; i<obits && lpos>=0; --lpos) {
_vl_vsss_setbit(owp,obits,lsb, 8, tmp[lpos]); lsb+=8;
}
break;
}
@ -1186,9 +1186,9 @@ IData VL_VALUEPLUSARGS_INW(int rbits, const string& ld, WDataOutP rwp) {
VL_ZERO_RESET_W(rbits, rwp);
switch (tolower(fmt)) {
case 'd':
vlsint64_t ld;
sscanf(dp,"%30" VL_PRI64 "d",&ld);
VL_SET_WQ(rwp,ld);
vlsint64_t lld;
sscanf(dp,"%30" VL_PRI64 "d",&lld);
VL_SET_WQ(rwp,lld);
break;
case 'b':
_vl_vsss_based(rwp,rbits, 1, dp, 0, (int)strlen(dp));

View File

@ -1726,7 +1726,7 @@ static inline WDataOutP VL_SHIFTRS_WWW(int obits,int lbits,int rbits,WDataOutP o
if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more
int lmsw = VL_WORDS_I(obits)-1;
IData sign = VL_SIGNONES_I(lbits,lwp[lmsw]);
for (int i=0; i <= lmsw; ++i) owp[i] = sign;
for (int j=0; j <= lmsw; ++j) owp[j] = sign;
owp[lmsw] &= VL_MASK_I(lbits);
return owp;
}

View File

@ -338,8 +338,8 @@ private:
if (vscp->user1() == 0) {
UINFO(4," Dead "<<vscp<<endl);
pair <AssignMap::iterator,AssignMap::iterator> eqrange = m_assignMap.equal_range(vscp);
for (AssignMap::iterator it = eqrange.first; it != eqrange.second; ++it) {
AstNodeAssign* assp = it->second;
for (AssignMap::iterator itr = eqrange.first; itr != eqrange.second; ++itr) {
AstNodeAssign* assp = itr->second;
UINFO(4," Dead assign "<<assp<<endl);
assp->dtypep()->user1Inc(-1);
assp->unlinkFrBack()->deleteTree(); VL_DANGLING(assp);

View File

@ -112,8 +112,8 @@ class EmitCSyms : EmitCBaseVisitor {
// We didn'e have all m_scopes loaded when we encountered variables, so expand them now
// It would be less code if each module inserted its own variables.
// Someday. For now public isn't common.
for (vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
AstScope* scopep = it->first; AstNodeModule* smodp = it->second;
for (vector<ScopeModPair>::iterator itsc = m_scopes.begin(); itsc != m_scopes.end(); ++itsc) {
AstScope* scopep = itsc->first; AstNodeModule* smodp = itsc->second;
for (vector<ModVarPair>::iterator it = m_modVars.begin(); it != m_modVars.end(); ++it) {
AstNodeModule* modp = it->first;
AstVar* varp = it->second;
@ -124,10 +124,10 @@ class EmitCSyms : EmitCBaseVisitor {
string scpName;
string varBase;
if (whole.substr(0,10) == "__DOT__TOP") whole.replace(0,10,"");
string::size_type pos = whole.rfind("__DOT__");
if (pos != string::npos) {
scpName = whole.substr(0,pos);
varBase = whole.substr(pos+strlen("__DOT__"));
string::size_type dpos = whole.rfind("__DOT__");
if (dpos != string::npos) {
scpName = whole.substr(0,dpos);
varBase = whole.substr(dpos+strlen("__DOT__"));
} else {
varBase = whole;
}

View File

@ -608,21 +608,22 @@ bool V3OutFormatter::tokenEnd(const char* cp) {
int V3OutFormatter::endLevels (const char *strg) {
int levels=m_indentLevel;
const char* cp=strg;
while (isspace(*cp)) cp++;
switch (*cp) {
case '\n': // Newlines.. No need for whitespace before it
return (0);
case '#': // Preproc directive
return (0);
}
{
// label/public/private: Deindent by 2 spaces
const char* mp=cp;
for (; isalnum(*mp); mp++) ;
if (mp[0]==':' && mp[1]!=':') return (levels-m_blockIndent/2);
const char* cp=strg;
while (isspace(*cp)) cp++;
switch (*cp) {
case '\n': // Newlines.. No need for whitespace before it
return (0);
case '#': // Preproc directive
return (0);
}
{
// label/public/private: Deindent by 2 spaces
const char* mp=cp;
for (; isalnum(*mp); mp++) ;
if (mp[0]==':' && mp[1]!=':') return (levels-m_blockIndent/2);
}
}
// We want "} else {" to be one level to the left of normal
for (const char* cp=strg; *cp; cp++) {
switch (*cp) {

View File

@ -257,11 +257,11 @@ private:
// Find epsilon closure of this nfa node, and destinations to work list
for (V3GraphEdge* nfaEdgep = nfaStatep->outBeginp(); nfaEdgep; nfaEdgep=nfaEdgep->outNextp()) {
DfaEdge* cNfaEdgep = static_cast<DfaEdge*>(nfaEdgep);
DfaVertex* nfaStatep = static_cast<DfaVertex*>(nfaEdgep->top());
DfaVertex* ecNfaStatep = static_cast<DfaVertex*>(nfaEdgep->top());
//UINFO(9," Consider "<<nfaEdgep->top()<<" EP "<<cNfaEdgep->epsilon()<<endl);
if (cNfaEdgep->epsilon()
&& unseenNfaThisStep(nfaStatep)) { // Not processed?
workps.push_back(nfaStatep);
&& unseenNfaThisStep(ecNfaStatep)) { // Not processed?
workps.push_back(ecNfaStatep);
}
}
}

View File

@ -251,7 +251,7 @@ public:
// Outbound are cutable, as we may need to evaluate multiple times
{
V3GraphTestVertex* n = new V3GraphTestVertex(gp,"c=a|b|i");
n = new V3GraphTestVertex(gp,"c=a|b|i");
new V3GraphEdge(gp, n, c, 1, true);
new V3GraphEdge(gp, a, n, 1, false);
new V3GraphEdge(gp, b, n, 1, false);

View File

@ -568,24 +568,24 @@ string V3PreProcImp::defineSubst(V3DefineRef* refp) {
//UINFO(4," Parse Paren="<<paren<<" Arg="<<numArgs<<" token='"<<token<<"' Parse="<<cp<<endl);
if (!quote && paren==1) {
if (*cp==')' || *cp==',') {
string value;
if (haveDefault) { value=token; } else { argName=token; }
string valueDef;
if (haveDefault) { valueDef=token; } else { argName=token; }
argName = trimWhitespace(argName,true);
UINFO(4," Got Arg="<<numArgs<<" argName='"<<argName<<"' default='"<<value<<"'"<<endl);
UINFO(4," Got Arg="<<numArgs<<" argName='"<<argName<<"' default='"<<valueDef<<"'"<<endl);
// Parse it
if (argName!="") {
if (refp->args().size() > numArgs) {
// A call `def( a ) must be equivelent to `def(a ), so trimWhitespace
// At one point we didn't trim trailing whitespace, but this confuses `"
string arg = trimWhitespace(refp->args()[numArgs], true);
if (arg != "") value = arg;
if (arg != "") valueDef = arg;
} else if (!haveDefault) {
error("Define missing argument '"+argName+"' for: "+refp->name()+"\n");
return " `"+refp->name()+" ";
}
numArgs++;
}
argValueByName[argName] = value;
argValueByName[argName] = valueDef;
// Prepare for next
argName = "";
token = "";

View File

@ -147,10 +147,12 @@ int main(int argc, char** argv, char** env) {
top.opt.addReadFile("vlt_coverage.pl");
}
const VlStringSet& readFiles = top.opt.readFiles();
for (VlStringSet::iterator it = readFiles.begin(); it != readFiles.end(); ++it) {
string filename = *it;
top.readCoverage(filename);
{
const VlStringSet& readFiles = top.opt.readFiles();
for (VlStringSet::iterator it = readFiles.begin(); it != readFiles.end(); ++it) {
string filename = *it;
top.readCoverage(filename);
}
}
if (debug() >= 9) {

View File

@ -88,7 +88,7 @@ unsigned int main_time = false;
static int _mon_check_props(TestVpiHandle& handle, int size, int direction, int scalar, int type) {
s_vpi_value value = {
vpiIntVal
vpiIntVal, .value = {.integer = 0}
};
// check size of object
int vpisize = vpi_get(vpiSize, handle);

View File

@ -89,7 +89,7 @@ unsigned int main_time = false;
int _mon_check_range(TestVpiHandle& handle, int size, int left, int right) {
TestVpiHandle iter_h, left_h, right_h;
s_vpi_value value = {
vpiIntVal
vpiIntVal, .value = {.integer = 0}
};
// check size of object
int vpisize = vpi_get(vpiSize, handle);
@ -120,7 +120,7 @@ int _mon_check_memory() {
TestVpiHandle mem_h, lcl_h;
vpiHandle iter_h; // icarus does not like auto free of iterator handles
s_vpi_value value = {
vpiIntVal
vpiIntVal, .value = {.integer = 0}
};
vpi_printf((PLI_BYTE8*)"Check memory vpi ...\n");
mem_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted("mem0"), NULL);

View File

@ -395,7 +395,7 @@ int _mon_check_string() {
CHECK_RESULT_NZ(vh1);
s_vpi_value v;
s_vpi_time t = { vpiSimTime, 0, 0};
s_vpi_time t = { vpiSimTime, 0, 0, 0.0};
s_vpi_error_info e;
v.format = vpiStringVal;

View File

@ -17,8 +17,6 @@
#include "Vtop.h" // Top level header, generated from verilog
Vtop *top;
int sc_main(int argc, char* argv[]) {
Verilated::commandArgs(argc, argv);
Verilated::randReset(2);