Cleanup codacity and missing consts.

This commit is contained in:
Wilson Snyder 2020-05-28 21:04:36 -04:00
parent 5ee4595aa8
commit ebda8f866c
4 changed files with 45 additions and 43 deletions

View File

@ -216,7 +216,7 @@ void VL_DBG_MSGF(const char* formatp, ...) VL_MT_SAFE {
// Using VL_PRINTF not VL_PRINTF_MT so that we can call VL_DBG_MSGF
// from within the guts of the thread execution machinery (and it goes
// to the screen and not into the queues we're debugging)
VL_PRINTF("-V{t%d,%" VL_PRI64 "u}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str());
VL_PRINTF("-V{t%u,%" VL_PRI64 "u}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str());
}
#ifdef VL_THREADED
@ -2053,47 +2053,47 @@ static const char* vl_time_str(int scale) {
double vl_time_multiplier(int scale) {
// Return timescale multipler -18 to +18
// For speed, this does not check for illegal values
static double pow10[] = {1.0,
10.0,
100.0,
1000.0,
10000.0,
100000.0,
1000000.0,
10000000.0,
100000000.0,
1000000000.0,
10000000000.0,
100000000000.0,
1000000000000.0,
10000000000000.0,
100000000000000.0,
1000000000000000.0,
10000000000000000.0,
100000000000000000.0,
1000000000000000000.0};
static double neg10[] = {1.0,
0.1,
0.01,
0.001,
0.0001,
0.00001,
0.000001,
0.0000001,
0.00000001,
0.000000001,
0.0000000001,
0.00000000001,
0.000000000001,
0.0000000000001,
0.00000000000001,
0.000000000000001,
0.0000000000000001,
0.00000000000000001,
0.000000000000000001};
if (scale < 0) {
static const double neg10[] = {1.0,
0.1,
0.01,
0.001,
0.0001,
0.00001,
0.000001,
0.0000001,
0.00000001,
0.000000001,
0.0000000001,
0.00000000001,
0.000000000001,
0.0000000000001,
0.00000000000001,
0.000000000000001,
0.0000000000000001,
0.00000000000000001,
0.000000000000000001};
return neg10[-scale];
} else {
static const double pow10[] = {1.0,
10.0,
100.0,
1000.0,
10000.0,
100000.0,
1000000.0,
10000000.0,
100000000.0,
1000000000.0,
10000000000.0,
100000000000.0,
1000000000000.0,
10000000000000.0,
100000000000000.0,
1000000000000000.0,
10000000000000000.0,
100000000000000000.0,
1000000000000000000.0};
return pow10[scale];
}
}
@ -2514,6 +2514,7 @@ VerilatedScope::VerilatedScope() {
m_funcnumMax = 0;
m_symsp = NULL;
m_varsp = NULL;
m_timeunit = 0;
m_type = SCOPE_OTHER;
}

View File

@ -136,7 +136,7 @@ public:
operator en() const { return m_e; }
const char* ascii() const {
// clang-format off
const char* names[] = {
static const char* const names[] = {
// Leading spaces indicate it can't be disabled.
" MIN", " INFO", " FATAL", " FATALEXIT", " FATALSRC", " ERROR",
// Boolean

View File

@ -134,8 +134,9 @@ public:
}
int powerOfTen() { return 2 - static_cast<int>(m_e); }
double multiplier() const {
static double values[] = {100, 10, 1, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7,
1e-8, 1e-9, 1e-10, 1e-11, 1e-12, 1e-13, 1e-14, 1e-15, 0};
static const double values[]
= {100, 10, 1, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7,
1e-8, 1e-9, 1e-10, 1e-11, 1e-12, 1e-13, 1e-14, 1e-15, 0};
return values[m_e];
}
};

View File

@ -141,7 +141,7 @@ public:
ps_STRIFY
};
static const char* procStateName(ProcState s) {
static const char* states[]
static const char* const states[]
= {"ps_TOP", "ps_DEFNAME_UNDEF", "ps_DEFNAME_DEFINE",
"ps_DEFNAME_IFDEF", "ps_DEFNAME_IFNDEF", "ps_DEFNAME_ELSIF",
"ps_DEFFORM", "ps_DEFVALUE", "ps_DEFPAREN",