From 2b72218dd82d922d08b9c890539b3a52e51bbf7c Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 13 Feb 2021 17:06:53 -0500 Subject: [PATCH] Fix examples not flushing vcd (#2787). --- Changes | 2 ++ examples/make_hello_c/sim_main.cpp | 2 +- examples/make_protect_lib/sim_main.cpp | 3 ++- examples/make_tracing_c/sim_main.cpp | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 33999c758..3bb344cc4 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix $fread extra semicolon inside statements. [Leendert van Doorn] +**** Fix examples not flushing vcd (#2787). [Richard E George] + * Verilator 4.108 2021-01-10 diff --git a/examples/make_hello_c/sim_main.cpp b/examples/make_hello_c/sim_main.cpp index e95be4fa6..b2c76c84a 100644 --- a/examples/make_hello_c/sim_main.cpp +++ b/examples/make_hello_c/sim_main.cpp @@ -38,5 +38,5 @@ int main(int argc, char** argv, char** env) { delete top; // Return good completion status - exit(0); + return 0; } diff --git a/examples/make_protect_lib/sim_main.cpp b/examples/make_protect_lib/sim_main.cpp index c7762ba54..4d15ea360 100644 --- a/examples/make_protect_lib/sim_main.cpp +++ b/examples/make_protect_lib/sim_main.cpp @@ -71,5 +71,6 @@ int main(int argc, char** argv, char** env) { top = nullptr; // Return good completion status - exit(0); + // Don't use exit() or destructor won't get called + return 0; } diff --git a/examples/make_tracing_c/sim_main.cpp b/examples/make_tracing_c/sim_main.cpp index bcd853162..08fa60098 100644 --- a/examples/make_tracing_c/sim_main.cpp +++ b/examples/make_tracing_c/sim_main.cpp @@ -102,5 +102,6 @@ int main(int argc, char** argv, char** env) { #endif // Return good completion status - exit(0); + // Don't use exit() or destructor won't get called + return 0; }