summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-14 21:56:14 -0700
committerGabe Black <gabeblack@google.com>2018-10-09 21:51:58 +0000
commitcb85067eee3fd7184b692f71af1016e52d44bb67 (patch)
tree8b46df126ecbf57e27fcfe356364454f449f9f1a
parentdaecb2b529e81c54fe4804ea35e74f4840b93511 (diff)
downloadgem5-cb85067eee3fd7184b692f71af1016e52d44bb67.tar.xz
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 <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r--src/systemc/core/sc_main.cc10
1 files changed, 10 insertions, 0 deletions
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;