diff --git a/Changes b/Changes index 2c0f22857..c290e1477 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** The internal test_verilated test directory is moved to be part of test_regress. +**** Fix Ubuntu 17.10 issues, bug1223 partial. [John Coiner] + * Verilator 3.912 2017-09-23 diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 35d84bf96..389e148c4 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1904,7 +1904,8 @@ void EmitCImp::emitInt(AstNodeModule* modp) { bool did = false; for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) { if (AstCell* cellp=nodep->castCell()) { - if (!did++) { + if (!did) { + did = true; putsDecoration("// CELLS\n"); if (modp->isTop()) puts("// Public to allow access to /*verilator_public*/ items;\n"); if (modp->isTop()) puts("// otherwise the application code can consider these internals.\n"); diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index a1ba82ea0..2261ce6ed 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -329,7 +329,10 @@ void EmitCSyms::emitSymHdr() { { // Scope names bool did = false; for (ScopeNames::iterator it = m_scopeNames.begin(); it != m_scopeNames.end(); ++it) { - if (!did++) puts("\n// SCOPE NAMES\n"); + if (!did) { + did = true; + puts("\n// SCOPE NAMES\n"); + } puts("VerilatedScope __Vscope_"+it->second.m_symName+";\n"); } } @@ -432,7 +435,10 @@ void EmitCSyms::emitSymImp() { { // Setup scope names bool did = false; for (ScopeNames::iterator it = m_scopeNames.begin(); it != m_scopeNames.end(); ++it) { - if (!did++) puts("// Setup scope names\n"); + if (!did) { + did = true; + puts("// Setup scope names\n"); + } puts("__Vscope_"+it->second.m_symName+".configure(this,name(),"); putsQuoted(it->second.m_prettyName); puts(");\n"); diff --git a/test_regress/driver.pl b/test_regress/driver.pl index e8d1a52b2..099b6d939 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -1002,13 +1002,14 @@ sub _run { if ($param{expect}) { # Compare my $quoted = quotemeta ($param{expect}); - my $bad = ($wholefile ne $param{expect} - && $wholefile !~ /$param{expect}/ms - && $wholefile !~ /$quoted/ms); - if ($bad) { + my $ok = ($wholefile eq $param{expect} + || _try_regex($wholefile, $param{expect}) == 1 + || $wholefile =~ /$quoted/ms); + if (!$ok) { #print "**BAD $self->{name} $param{logfile} MT $moretry $try\n"; next if $moretry; $self->error("Mismatch in output from $param{cmd}[0]\n"); + $self->error("Might be error in regexp format\n") if $ok<1; print "GOT:\n"; print $wholefile; print "ENDGOT\n"; @@ -1025,6 +1026,24 @@ sub _run { ####################################################################### # Little utilities +sub _try_regex { + # Try to eval a regexp + # Returns: + # 1 if $text ~= /$regex/ms + # 0 if no match + # -1 if $regex is invalid, doesn't compile + my ($text, $regex) = @_; + my $result; + { + local $@; + eval { + $result = ($text =~ /$regex/ms); + }; + $result = -1 if $@; + } + return $result; +} + sub _make_main { my $self = shift; diff --git a/test_regress/t/t_enum_public.cpp b/test_regress/t/t_enum_public.cpp index 8beeb64b5..62e024f35 100644 --- a/test_regress/t/t_enum_public.cpp +++ b/test_regress/t/t_enum_public.cpp @@ -17,8 +17,8 @@ int main (int argc, char *argv[]) { Verilated::debug(0); // Make sure public tag worked - if (Vt_enum_public_p3::ZERO || Vt_enum_public_p3::ONE) {} - if (Vt_enum_public_p62::ZERO || Vt_enum_public_p62::ALLONE) {} + if (Vt_enum_public_p3::ZERO == Vt_enum_public_p3::ONE) {} + if (Vt_enum_public_p62::ZERO == Vt_enum_public_p62::ALLONE) {} for (int i = 0; i < 10; i++) { topp->eval(); diff --git a/test_regress/t/t_param_public.cpp b/test_regress/t/t_param_public.cpp index 59c33382f..bdceb7470 100644 --- a/test_regress/t/t_param_public.cpp +++ b/test_regress/t/t_param_public.cpp @@ -16,7 +16,7 @@ int main (int argc, char *argv[]) { Verilated::debug(0); // Make sure public tag worked - if (Vt_param_public_p::INPACK) {} + if (Vt_param_public_p::INPACK == Vt_param_public_p::INPACK) {} for (int i = 0; i < 10; i++) { topp->eval();