From: Gabe Black Date: Sat, 15 Sep 2018 04:56:14 +0000 (-0700) Subject: systemc: Warn if sc_stop is called more than once. X-Git-Tag: v19.0.0.0~1607 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb85067eee3fd7184b692f71af1016e52d44bb67;p=gem5.git systemc: Warn if sc_stop is called more than once. Change-Id: Ief88b9af0119ba4b007f79905db2522b5f95b820 Reviewed-on: https://gem5-review.googlesource.com/c/12811 Reviewed-by: Gabe Black Maintainer: Gabe Black --- diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 5e1cd4fe6..735fb0c1b 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -226,6 +226,16 @@ sc_get_stop_mode() void sc_stop() { + static bool stop_called = false; + if (stop_called) { + static bool stop_warned = false; + if (!stop_warned) + SC_REPORT_WARNING("(W545) sc_stop has already been called", ""); + stop_warned = true; + return; + } + stop_called = true; + if (::sc_gem5::Kernel::status() == SC_STOPPED) return;