changeset f959b7f89d4d in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=f959b7f89d4d
description:
        sim: make warning for absent optional parameters optional

        This is in support of tag-based checkpoint versioning. It should be
        possible to examine an optional parameter in a checkpoint during
        unserialization and not have it throw a warning.

diffstat:

 src/sim/serialize.cc |  8 +++++---
 src/sim/serialize.hh |  8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 2763a59c73ff -r f959b7f89d4d src/sim/serialize.cc
--- a/src/sim/serialize.cc      Tue Sep 01 15:50:33 2015 -0500
+++ b/src/sim/serialize.cc      Wed Sep 02 15:19:43 2015 -0500
@@ -223,12 +223,13 @@
 
 template <class T>
 bool
-optParamIn(CheckpointIn &cp, const string &name, T &param)
+optParamIn(CheckpointIn &cp, const string &name, T &param, bool warn)
 {
     const string &section(Serializable::currentSection());
     string str;
     if (!cp.find(section, name, str) || !parseParam(str, param)) {
-        warn("optional parameter %s:%s not present\n", section, name);
+        if (warn)
+            warn("optional parameter %s:%s not present\n", section, name);
         return false;
     } else {
         return true;
@@ -384,7 +385,8 @@
     template void                                                       \
     paramIn(CheckpointIn &cp, const string &name, type & param);        \
     template bool                                                       \
-    optParamIn(CheckpointIn &cp, const string &name, type & param);     \
+    optParamIn(CheckpointIn &cp, const string &name, type & param,      \
+               bool warn);                                              \
     template void                                                       \
     arrayParamOut(CheckpointOut &os, const string &name,                \
                   type const *param, unsigned size);                    \
diff -r 2763a59c73ff -r f959b7f89d4d src/sim/serialize.hh
--- a/src/sim/serialize.hh      Tue Sep 01 15:50:33 2015 -0500
+++ b/src/sim/serialize.hh      Wed Sep 02 15:19:43 2015 -0500
@@ -100,13 +100,15 @@
 }
 
 template <class T>
-bool optParamIn(CheckpointIn &cp, const std::string &name, T &param);
+bool optParamIn(CheckpointIn &cp, const std::string &name, T &param,
+                bool warn = true);
 
 template <typename DataType, typename BitUnion>
 bool optParamIn(CheckpointIn &cp, const std::string &name,
-                BitfieldBackend::BitUnionOperators<DataType, BitUnion> &p)
+                BitfieldBackend::BitUnionOperators<DataType, BitUnion> &p,
+                bool warn = true)
 {
-    return optParamIn(cp, name, p.__data);
+    return optParamIn(cp, name, p.__data, warn);
 }
 
 template <class T>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to