From ea3acc2d3ad4f024deb8fcee8baee9554adf0e3c Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 11 Apr 2020 20:22:57 -0400 Subject: [PATCH] Fix --skip-identical broke recent commit. --- src/V3EmitCSyms.cpp | 1 + src/Verilator.cpp | 17 +++++++++++------ test_regress/t/t_flag_skipidentical.pl | 5 ++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index 3a4534e7d..eb427a728 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -785,6 +785,7 @@ void EmitCSyms::emitSymImp() { m_ofpBase->puts("}\n"); closeSplit(); + VL_DO_CLEAR(delete m_ofp, m_ofp = NULL); } //###################################################################### diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 72d32d051..5cfbc3115 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -557,11 +557,16 @@ int main(int argc, char** argv, char** env) { // Can we skip doing everything if times are ok? V3File::addSrcDepend(v3Global.opt.bin()); if (v3Global.opt.skipIdentical().isTrue() - && V3File::checkTimes(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix() - +"__verFiles.dat", argString)) { + && V3File::checkTimes(v3Global.opt.makeDir() + "/" + v3Global.opt.prefix() + + "__verFiles.dat", argString)) { UINFO(1,"--skip-identical: No change to any source files, exiting\n"); exit(0); } + // Undocumented debugging - cannot be a switch as then command line + // would mismatch forcing non-identicalness when we set it + if (!V3Os::getenvStr("VERILATOR_DEBUG_SKIP_IDENTICAL", "").empty()) { + v3fatalSrc("VERILATOR_DEBUG_SKIP_IDENTICAL w/ --skip-identical: Changes found\n"); + } //--FRONTEND------------------ @@ -597,13 +602,13 @@ int main(int argc, char** argv, char** env) { if (v3Global.opt.makeDepend().isTrue()) { V3File::writeDepend(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__ver.d"); } - if (v3Global.opt.skipIdentical().isTrue() || v3Global.opt.makeDepend().isTrue()) { - V3File::writeTimes(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix() - +"__verFiles.dat", argString); - } if (v3Global.opt.protectIds()) { VIdProtect::writeMapFile(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__idmap.xml"); } + if (v3Global.opt.skipIdentical().isTrue() || v3Global.opt.makeDepend().isTrue()) { + V3File::writeTimes(v3Global.opt.makeDir() + "/" + v3Global.opt.prefix() + "__verFiles.dat", + argString); + } // Final writing shouldn't throw warnings, but... V3Error::abortIfWarnings(); diff --git a/test_regress/t/t_flag_skipidentical.pl b/test_regress/t/t_flag_skipidentical.pl index 93d5d8b3d..9ac3f346f 100755 --- a/test_regress/t/t_flag_skipidentical.pl +++ b/test_regress/t/t_flag_skipidentical.pl @@ -13,13 +13,16 @@ scenarios(vlt => 1); { compile(); + print "NOTE: use --debugi, as --debug in driver turns off skip-identical\n"; + my $outfile = "$Self->{obj_dir}/V".$Self->{name}.".cpp"; my @oldstats = stat($outfile); print "Old mtime=",$oldstats[9],"\n"; $oldstats[9] or error("No output file found: $outfile\n"); - sleep(1); # Or else it might take < 1 second to compile and see no diff. + sleep(2); # Or else it might take < 1 second to compile and see no diff. + $ENV{VERILATOR_DEBUG_SKIP_IDENTICAL} = 1; compile(); my @newstats = stat($outfile);