[PATCH 6/8] Fix -Woverloaded-virtual warnings when building with clang

Tom Stellard tstellar@redhat.com
Mon Nov 30 19:58:39 GMT 2020


---
 elaborate.cxx |  8 +++++++-
 elaborate.h   |  3 ++-
 main.cxx      |  2 +-
 tapsets.cxx   | 15 +++++++++------
 4 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/elaborate.cxx b/elaborate.cxx
index b069fb5ba..28cd326d6 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -78,10 +78,16 @@ derived_probe::derived_probe (probe *p, probe_point *l, bool rewrite_loc):
   this->locations.push_back (l);
 }
 
+void
+derived_probe::printsig_nonest (ostream& o) const
+{
+  probe::printsig (o);
+}
 
 void
-derived_probe::printsig (ostream& o, bool nest) const
+derived_probe::printsig (ostream& o) const
 {
+  bool nest = true;
   probe::printsig (o);
 
   if (nest)
diff --git a/elaborate.h b/elaborate.h
index 860068620..935027f40 100644
--- a/elaborate.h
+++ b/elaborate.h
@@ -203,7 +203,8 @@ struct derived_probe: public probe
   virtual void join_group (systemtap_session& s) = 0;
   virtual probe_point* sole_location () const;
   virtual probe_point* script_location () const;
-  virtual void printsig (std::ostream &o, bool nest=true) const;
+  virtual void printsig (std::ostream &o) const override;
+  void printsig_nonest (std::ostream &o) const;
   // return arguments of probe if there
   virtual void getargs (std::list<std::string> &) const {}
   void printsig_nested (std::ostream &o) const;
diff --git a/main.cxx b/main.cxx
index f3a0d9830..b41cb58a6 100644
--- a/main.cxx
+++ b/main.cxx
@@ -177,7 +177,7 @@ printscript(systemtap_session& s, ostream& o)
                     {
                       // We want to print the probe point signature (without the nested components).
                       std::ostringstream sig;
-                      p->printsig(sig, false);
+                      p->printsig_nonest(sig);
 
                       if (s.dump_mode == systemtap_session::dump_matched_probes_vars && isatty(STDOUT_FILENO))
                         o << s.colorize(sig.str(), "source");
diff --git a/tapsets.cxx b/tapsets.cxx
index 52c59fa50..b235e72fd 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -559,7 +559,7 @@ struct dwarf_derived_probe: public generic_kprobe_derived_probe
   interned_string user_lib;
   bool access_vars;
 
-  void printsig (std::ostream &o, bool nest=true) const;
+  void printsig (std::ostream &o) const;
   virtual void join_group (systemtap_session& s);
   void emit_probe_local_init(systemtap_session& s, translator_output * o);
   void getargs(std::list<std::string> &arg_set) const;
@@ -5320,8 +5320,9 @@ dwarf_atvar_expanding_visitor::visit_atvar_op (atvar_op* e)
 
 
 void
-dwarf_derived_probe::printsig (ostream& o, bool nest) const
+dwarf_derived_probe::printsig (ostream& o) const
 {
+  bool nest = true;
   // Instead of just printing the plain locations, we add a PC value
   // as a comment as a way of telling e.g. apart multiple inlined
   // function instances.  This is distinct from the verbose/clog
@@ -10191,7 +10192,7 @@ struct kprobe_derived_probe: public generic_kprobe_derived_probe
   string path;
   string library;
   bool access_var;
-  void printsig (std::ostream &o, bool nest=true) const;
+  void printsig (std::ostream &o) const;
   void join_group (systemtap_session& s);
 };
 
@@ -10320,8 +10321,9 @@ kprobe_derived_probe::kprobe_derived_probe (systemtap_session& sess,
   this->sole_location()->components = comps;
 }
 
-void kprobe_derived_probe::printsig (ostream& o, bool nest) const
+void kprobe_derived_probe::printsig (ostream& o) const
 {
+  bool nest = true;
   sole_location()->print (o);
   o << " /* " << " name = " << symbol_name << "*/";
 
@@ -10553,7 +10555,7 @@ struct hwbkpt_derived_probe: public derived_probe
   string symbol_name;
   unsigned int hwbkpt_access,hwbkpt_len;
 
-  void printsig (std::ostream &o, bool nest) const;
+  void printsig (std::ostream &o) const;
   void join_group (systemtap_session& s);
 };
 
@@ -10620,8 +10622,9 @@ hwbkpt_derived_probe::hwbkpt_derived_probe (probe *base,
   this->sole_location()->components = comps;
 }
 
-void hwbkpt_derived_probe::printsig (ostream& o, bool nest) const
+void hwbkpt_derived_probe::printsig (ostream& o) const
 {
+  bool nest = true;
   sole_location()->print (o);
 
   if (nest)
-- 
2.26.2



More information about the Systemtap mailing list