systemc: Warn if sc_stop is called more than once.
authorGabe Black <gabeblack@google.com>
Sat, 15 Sep 2018 04:56:14 +0000 (21:56 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 9 Oct 2018 21:51:58 +0000 (21:51 +0000)
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>

src/systemc/core/sc_main.cc

index 5e1cd4fe6402e3c61a12e57d70f0e8782651a9c2..735fb0c1bbc24add5d6885b8f202e9710e00d0ca 100644 (file)
@@ -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;