Internals: Add some std::'s. No functional change intended.
This commit is contained in:
parent
e0808bcd15
commit
5b4448de23
|
@ -77,7 +77,7 @@ void V3Error::init() {
|
|||
|
||||
string V3Error::lineStr(const char* filename, int lineno) {
|
||||
std::ostringstream out;
|
||||
const char* fnslashp = strrchr(filename, '/');
|
||||
const char* fnslashp = std::strrchr(filename, '/');
|
||||
if (fnslashp) filename = fnslashp + 1;
|
||||
out << filename << ":" << std::dec << lineno << ":";
|
||||
const char* const spaces = " ";
|
||||
|
@ -167,7 +167,7 @@ void V3Error::vlAbortOrExit() {
|
|||
|
||||
void V3Error::vlAbort() {
|
||||
VL_GCOV_FLUSH();
|
||||
abort();
|
||||
std::abort();
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
|
||||
// Return if two numbers within Epsilon of each other
|
||||
inline bool v3EpsilonEqual(double a, double b) {
|
||||
return fabs(a - b) <= (std::numeric_limits<double>::epsilon() * std::max(1.0, std::max(a, b)));
|
||||
return std::fabs(a - b)
|
||||
<= (std::numeric_limits<double>::epsilon() * std::max(1.0, std::max(a, b)));
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -276,7 +276,7 @@ class ParamProcessor final {
|
|||
if (AstVar* varp = VN_CAST(stmtp, Var)) {
|
||||
if (varp->isGParam() || varp->isIfaceRef()) {
|
||||
char ch = varp->name()[0];
|
||||
ch = toupper(ch);
|
||||
ch = std::toupper(ch);
|
||||
if (ch < 'A' || ch > 'Z') ch = 'Z';
|
||||
varp->user4(usedLetter[static_cast<int>(ch)] * 256 + ch);
|
||||
usedLetter[static_cast<int>(ch)]++;
|
||||
|
|
|
@ -321,7 +321,7 @@ private:
|
|||
+ " library, "
|
||||
"Verliog (%u) and library (%u) hash values do not "
|
||||
"agree\\n\", protectlib_hash__V, expected_hash__V);\n");
|
||||
txtp->addText(fl, "exit(EXIT_FAILURE);\n");
|
||||
txtp->addText(fl, "std::exit(EXIT_FAILURE);\n");
|
||||
txtp->addText(fl, "}\n");
|
||||
txtp->addText(fl, "}\n\n");
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ private:
|
|||
// Calc data storage in bytes
|
||||
size_t chgWidth = m_outVarps.size(); // Width of one change-it-vector
|
||||
if (chgWidth < 8) chgWidth = 8;
|
||||
double space = (pow(static_cast<double>(2.0), static_cast<double>(m_inWidth))
|
||||
double space = (std::pow(static_cast<double>(2.0), static_cast<double>(m_inWidth))
|
||||
* static_cast<double>(m_outWidth + chgWidth));
|
||||
// Instruction count bytes (ok, it's space also not time :)
|
||||
double bytesPerInst = 4;
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
if (m_dataSize < point) m_dataSize = (point + 64) & ~63ULL; // Keep power of two
|
||||
m_dataSize *= 2;
|
||||
// UINFO(9, "Realloc "<<allocSize()<<" for "<<point<<" "<<cvtToHex(m_datap)<<endl);
|
||||
vluint64_t* newp = static_cast<vluint64_t*>(realloc(m_datap, allocSize()));
|
||||
vluint64_t* newp = static_cast<vluint64_t*>(std::realloc(m_datap, allocSize()));
|
||||
if (VL_UNCOVERABLE(!newp)) {
|
||||
// cppcheck-suppress doubleFree // cppcheck 1.90 bug - realloc doesn't free on fail
|
||||
free(m_datap); // LCOV_EXCL_LINE
|
||||
|
|
|
@ -56,16 +56,16 @@ public:
|
|||
string type() const { return keyExtract(VL_CIK_TYPE); }
|
||||
string thresh() const { return keyExtract(VL_CIK_THRESH); } // string as maybe ""
|
||||
string linescov() const { return keyExtract(VL_CIK_LINESCOV); }
|
||||
int lineno() const { return atoi(keyExtract(VL_CIK_LINENO).c_str()); }
|
||||
int column() const { return atoi(keyExtract(VL_CIK_COLUMN).c_str()); }
|
||||
int lineno() const { return std::atoi(keyExtract(VL_CIK_LINENO).c_str()); }
|
||||
int column() const { return std::atoi(keyExtract(VL_CIK_COLUMN).c_str()); }
|
||||
// METHODS
|
||||
string keyExtract(const char* shortKey) const {
|
||||
// Hot function
|
||||
size_t shortLen = strlen(shortKey);
|
||||
size_t shortLen = std::strlen(shortKey);
|
||||
const string namestr = name();
|
||||
for (const char* cp = namestr.c_str(); *cp; ++cp) {
|
||||
if (*cp == '\001') {
|
||||
if (0 == strncmp(cp + 1, shortKey, shortLen) && cp[shortLen + 1] == '\002') {
|
||||
if (0 == std::strncmp(cp + 1, shortKey, shortLen) && cp[shortLen + 1] == '\002') {
|
||||
cp += shortLen + 2; // Skip \001+short+\002
|
||||
const char* ep = cp;
|
||||
while (*ep && *ep != '\001') ++ep;
|
||||
|
|
|
@ -45,7 +45,7 @@ void VlcTop::readCoverage(const string& filename, bool nonfatal) {
|
|||
if (line[secspace] == '\'' && line[secspace + 1] == ' ') break;
|
||||
}
|
||||
string point = line.substr(3, secspace - 3);
|
||||
vluint64_t hits = atoll(line.c_str() + secspace + 1);
|
||||
vluint64_t hits = std::atoll(line.c_str() + secspace + 1);
|
||||
// UINFO(9," point '"<<point<<"'"<<" "<<hits<<endl);
|
||||
|
||||
vluint64_t pointnum = points().findAddPoint(point, hits);
|
||||
|
@ -203,7 +203,8 @@ void VlcTop::annotateCalc() {
|
|||
if (!filename.empty() && lineno != 0) {
|
||||
VlcSource& source = sources().findNewSource(filename);
|
||||
string threshStr = point.thresh();
|
||||
unsigned thresh = (!threshStr.empty()) ? atoi(threshStr.c_str()) : opt.annotateMin();
|
||||
unsigned thresh
|
||||
= (!threshStr.empty()) ? std::atoi(threshStr.c_str()) : opt.annotateMin();
|
||||
bool ok = (point.count() >= thresh);
|
||||
UINFO(9, "AnnoCalc count " << filename << ":" << lineno << ":" << point.column() << " "
|
||||
<< point.count() << " " << point.linescov() << '\n');
|
||||
|
@ -225,12 +226,12 @@ void VlcTop::annotateCalc() {
|
|||
range = false;
|
||||
} else if (*covp == '-') {
|
||||
range = true;
|
||||
} else if (isdigit(*covp)) {
|
||||
} else if (std::isdigit(*covp)) {
|
||||
const char* digitsp = covp;
|
||||
while (isdigit(*covp)) ++covp;
|
||||
while (std::isdigit(*covp)) ++covp;
|
||||
--covp; // Will inc in for loop
|
||||
if (!range) start = atoi(digitsp);
|
||||
end = atoi(digitsp);
|
||||
if (!range) start = std::atoi(digitsp);
|
||||
end = std::atoi(digitsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -314,7 +315,7 @@ void VlcTop::annotateOutputFiles(const string& dirname) {
|
|||
// Multiple columns on same line; print line just once
|
||||
string indent;
|
||||
for (string::const_iterator pos = line.begin();
|
||||
pos != line.end() && isspace(*pos); ++pos) {
|
||||
pos != line.end() && std::isspace(*pos); ++pos) {
|
||||
indent += *pos;
|
||||
}
|
||||
line = indent + "verilator_coverage: (next point on previous line)\n";
|
||||
|
|
Loading…
Reference in New Issue