Fix MSVC++ portability issues (#3812)

This commit is contained in:
Kritik Bhimani 2022-12-13 05:15:32 +05:30 committed by GitHub
parent 424faa883e
commit 7b073fec7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -234,7 +234,7 @@
//=========================================================================
// C++-2011
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(VL_CPPCHECK)
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(VL_CPPCHECK) || (defined(_MSC_VER) && _MSC_VER >= 1900)
#else
# error "Verilator requires a C++11 or newer compiler"
#endif

View File

@ -100,21 +100,29 @@ AstShiftRS* makeNode<AstShiftRS, DfgShiftRS, AstNodeExpr*, AstNodeExpr*>( //
template <>
AstCCast* makeNode<AstCCast, DfgCCast, AstNodeExpr*>(const DfgCCast* vtxp, AstNodeExpr*) {
vtxp->v3fatalSrc("not implemented");
VL_UNREACHABLE;
return nullptr; // LCOV_EXCL_LINE
}
template <>
AstAtoN* makeNode<AstAtoN, DfgAtoN, AstNodeExpr*>(const DfgAtoN* vtxp, AstNodeExpr*) {
vtxp->v3fatalSrc("not implemented");
VL_UNREACHABLE;
return nullptr; // LCOV_EXCL_LINE
}
template <>
AstCompareNN*
makeNode<AstCompareNN, DfgCompareNN, AstNodeExpr*, AstNodeExpr*>(const DfgCompareNN* vtxp,
AstNodeExpr*, AstNodeExpr*) {
vtxp->v3fatalSrc("not implemented");
VL_UNREACHABLE;
return nullptr; // LCOV_EXCL_LINE
}
template <>
AstSliceSel* makeNode<AstSliceSel, DfgSliceSel, AstNodeExpr*, AstNodeExpr*, AstNodeExpr*>(
const DfgSliceSel* vtxp, AstNodeExpr*, AstNodeExpr*, AstNodeExpr*) {
vtxp->v3fatalSrc("not implemented");
VL_UNREACHABLE;
return nullptr; // LCOV_EXCL_LINE
}
// LCOV_EXCL_STOP

View File

@ -80,10 +80,10 @@ string V3Os::getenvStr(const string& envvar, const string& defaultValue) {
#if defined(_MSC_VER)
// Note: MinGW does not offer _dupenv_s
const char* envvalue = nullptr;
_dupenv_s(&envvalue, nullptr, envvar.c_str());
_dupenv_s((char **)&envvalue, nullptr, envvar.c_str());
if (envvalue != nullptr) {
const std::string result{envvalue};
free(envvalue);
free((void *)envvalue);
ret = result;
} else {
ret = defaultValue;

View File

@ -45,7 +45,7 @@ def process():
if status != 0:
unlink_outputs()
sys.exit("bisonpre: %Error: " + Args.yacc + " version " +
Bison_Version + " run failed due to errors\n")
str(Bison_Version) + " run failed due to errors\n")
clean_output(tmp_prefix() + ".output",
output_prefix() + ".output", True, False)