forked from github/verilator
Fix some MSVC warnings.
This commit is contained in:
parent
71d29a235f
commit
d64971ba35
@ -1383,7 +1383,7 @@ static IData getLine(std::string& str, IData fpi, size_t maxLen) VL_MT_SAFE {
|
||||
str.push_back(c);
|
||||
if (c == '\n') break;
|
||||
}
|
||||
return str.size();
|
||||
return static_cast<IData>(str.size());
|
||||
}
|
||||
|
||||
IData VL_FGETS_IXI(int obits, void* destp, IData fpi) VL_MT_SAFE {
|
||||
@ -1633,12 +1633,12 @@ std::string VL_STACKTRACE_N() VL_MT_SAFE {
|
||||
static VerilatedMutex s_stackTraceMutex;
|
||||
const VerilatedLockGuard lock{s_stackTraceMutex};
|
||||
|
||||
constexpr int BT_BUF_SIZE = 100;
|
||||
void* buffer[BT_BUF_SIZE];
|
||||
int nptrs = 0;
|
||||
char** strings = nullptr;
|
||||
|
||||
#ifdef _VL_HAVE_STACKTRACE
|
||||
constexpr int BT_BUF_SIZE = 100;
|
||||
void* buffer[BT_BUF_SIZE];
|
||||
nptrs = backtrace(buffer, BT_BUF_SIZE);
|
||||
strings = backtrace_symbols(buffer, nptrs);
|
||||
#endif
|
||||
@ -2569,7 +2569,7 @@ std::pair<int, char**> VerilatedContextImp::argc_argv() VL_MT_SAFE_EXCLUDES(m_ar
|
||||
static char** s_argvp = nullptr;
|
||||
if (VL_UNLIKELY(!s_loaded)) {
|
||||
s_loaded = true;
|
||||
s_argc = m_args.m_argVec.size();
|
||||
s_argc = static_cast<int>(m_args.m_argVec.size());
|
||||
s_argvp = new char*[s_argc + 1];
|
||||
int in = 0;
|
||||
for (const auto& i : m_args.m_argVec) {
|
||||
|
@ -2208,7 +2208,7 @@ inline std::string VL_REPLICATEN_NNI(const std::string& lhs, IData rep) VL_PURE
|
||||
return VL_REPLICATEN_NNQ(lhs, rep);
|
||||
}
|
||||
|
||||
inline IData VL_LEN_IN(const std::string& ld) { return ld.length(); }
|
||||
inline IData VL_LEN_IN(const std::string& ld) { return static_cast<IData>(ld.length()); }
|
||||
extern std::string VL_TOLOWER_NN(const std::string& ld) VL_PURE;
|
||||
extern std::string VL_TOUPPER_NN(const std::string& ld) VL_PURE;
|
||||
|
||||
|
@ -527,7 +527,7 @@ void VerilatedVcd::declare(uint32_t code, const char* name, const char* wirep, b
|
||||
std::strlen(buf)); // Code (overwrite separator if isBit)
|
||||
entryp[length + !isBit] = '\n'; // Replace '\0' with line termination '\n'
|
||||
// Set length of suffix (used to increment write pointer)
|
||||
entryp[VL_TRACE_SUFFIX_ENTRY_SIZE - 1] = !isBit + length + 1;
|
||||
entryp[VL_TRACE_SUFFIX_ENTRY_SIZE - 1] = static_cast<char>(length + !isBit + 1);
|
||||
decl += " ";
|
||||
decl += basename;
|
||||
if (array) {
|
||||
|
@ -431,11 +431,12 @@ inline void v3errorEndFatal(std::ostringstream& sstr) {
|
||||
return value
|
||||
|
||||
// Helper macros for VL_DEFINE_DEBUG_FUNCTIONS
|
||||
#define VL_DEFINE_DEBUG(name) \
|
||||
VL_ATTR_UNUSED static int debug##name() { \
|
||||
// Takes an optional "name" (as __VA_ARGS__)
|
||||
#define VL_DEFINE_DEBUG(...) \
|
||||
VL_ATTR_UNUSED static int debug##__VA_ARGS__() { \
|
||||
static int level = -1; \
|
||||
if (VL_UNLIKELY(level < 0)) { \
|
||||
std::string tag{VL_STRINGIFY(name)}; \
|
||||
std::string tag{VL_STRINGIFY(__VA_ARGS__)}; \
|
||||
tag[0] = std::tolower(tag[0]); \
|
||||
const unsigned debugTag = v3Global.opt.debugLevel(tag); \
|
||||
const unsigned debugSrc = v3Global.opt.debugSrcLevel(__FILE__); \
|
||||
@ -447,11 +448,12 @@ inline void v3errorEndFatal(std::ostringstream& sstr) {
|
||||
} \
|
||||
static_assert(true, "")
|
||||
|
||||
#define VL_DEFINE_DUMP(name) \
|
||||
VL_ATTR_UNUSED static int dump##name() { \
|
||||
// Takes an optional "name" (as __VA_ARGS__)
|
||||
#define VL_DEFINE_DUMP(...) \
|
||||
VL_ATTR_UNUSED static int dump##__VA_ARGS__() { \
|
||||
static int level = -1; \
|
||||
if (VL_UNLIKELY(level < 0)) { \
|
||||
std::string tag{VL_STRINGIFY(name)}; \
|
||||
std::string tag{VL_STRINGIFY(__VA_ARGS__)}; \
|
||||
tag[0] = std::tolower(tag[0]); \
|
||||
const unsigned dumpTag = v3Global.opt.dumpLevel(tag); \
|
||||
const unsigned dumpSrc = v3Global.opt.dumpSrcLevel(__FILE__); \
|
||||
|
Loading…
Reference in New Issue
Block a user