Earl Ou has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/67237?usp=email )

Change subject: systemc: fix -Wno-free-nonheap-object for building scheduler.cc
......................................................................

systemc: fix -Wno-free-nonheap-object for building scheduler.cc

-Wno-free-nonheap-object can happen at compile or link time depending on
the versions. To better disable this false alarm, we move the memory
management part into .cc file, so the check is always done at link time.

This change also removes the global flags so other code is still checked
with the flags.

Change-Id: I8f1e20197b25c90b5f439e2ecc474bd99e4f82ed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67237
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Yu-hsin Wang <yuhsi...@google.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
---
M SConstruct
M src/sim/eventq.cc
M src/sim/eventq.hh
M src/systemc/core/SConscript
4 files changed, 52 insertions(+), 22 deletions(-)

Approvals:
  Yu-hsin Wang: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/SConstruct b/SConstruct
index bd26e45..e08c2984 100755
--- a/SConstruct
+++ b/SConstruct
@@ -447,10 +447,6 @@
             error('gcc version 7 or newer required.\n'
                   'Installed version:', env['CXXVERSION'])

-        with gem5_scons.Configure(env) as conf:
-            # This warning has a false positive in the systemc in g++ 11.1.
-            conf.CheckCxxFlag('-Wno-free-nonheap-object')
-
         # Add the appropriate Link-Time Optimization (LTO) flags if
         # `--with-lto` is set.
         if GetOption('with_lto'):
diff --git a/src/sim/eventq.cc b/src/sim/eventq.cc
index 66d0385..23ca2f6 100644
--- a/src/sim/eventq.cc
+++ b/src/sim/eventq.cc
@@ -109,6 +109,32 @@
 }

 void
+Event::acquire()
+{
+    if (flags.isSet(Event::Managed))
+        acquireImpl();
+}
+
+void
+Event::release()
+{
+    if (flags.isSet(Event::Managed))
+        releaseImpl();
+}
+
+void
+Event::acquireImpl()
+{
+}
+
+void
+Event::releaseImpl()
+{
+    if (!scheduled())
+        delete this;
+}
+
+void
 EventQueue::insert(Event *event)
 {
     // Deal with the head case
diff --git a/src/sim/eventq.hh b/src/sim/eventq.hh
index cd5d285f..62495bf 100644
--- a/src/sim/eventq.hh
+++ b/src/sim/eventq.hh
@@ -381,26 +381,16 @@
     /**
      * Managed event scheduled and being held in the event queue.
      */
-    void acquire()
-    {
-        if (flags.isSet(Event::Managed))
-            acquireImpl();
-    }
+    void acquire();

     /**
      * Managed event removed from the event queue.
      */
-    void release() {
-        if (flags.isSet(Event::Managed))
-            releaseImpl();
-    }
+    void release();

-    virtual void acquireImpl() {}
+    virtual void acquireImpl();

-    virtual void releaseImpl() {
-        if (!scheduled())
-            delete this;
-    }
+    virtual void releaseImpl();

     /** @} */

diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript
index 2b88111..c7c9dbb 100644
--- a/src/systemc/core/SConscript
+++ b/src/systemc/core/SConscript
@@ -40,6 +40,7 @@
     Source('port.cc')
     Source('process.cc')
     Source('sched_event.cc')
+    Source('scheduler.cc')
     Source('sensitivity.cc')
     Source('time.cc')

@@ -75,7 +76,4 @@
# Disable the false positive warning for the event members of the scheduler.
     with gem5_scons.Configure(env) as conf:
         flag = '-Wno-free-nonheap-object'
-        append = {}
-        if conf.CheckCxxFlag(flag, autoadd=False):
-            append['CCFLAGS'] = [flag]
-        Source('scheduler.cc', append=append)
+        conf.CheckLinkFlag(flag)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/67237?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8f1e20197b25c90b5f439e2ecc474bd99e4f82ed
Gerrit-Change-Number: 67237
Gerrit-PatchSet: 3
Gerrit-Owner: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Gabe Black <gabebl...@google.com>
Gerrit-CC: Nicolas Boichat <drink...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to