diff options
-rw-r--r-- | elaborate.cxx | 2 | ||||
-rw-r--r-- | staptree.cxx | 2 | ||||
-rw-r--r-- | staptree.h | 1 | ||||
-rw-r--r-- | tapset-perfmon.cxx | 1 | ||||
-rw-r--r-- | tapset-procfs.cxx | 1 | ||||
-rw-r--r-- | tapsets.cxx | 3 | ||||
-rwxr-xr-x | testsuite/semok/thirtyeight.stp | 10 |
7 files changed, 18 insertions, 2 deletions
diff --git a/elaborate.cxx b/elaborate.cxx index 12dbce3a..f442aceb 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -2013,7 +2013,7 @@ void semantic_pass_opt1 (systemtap_session& s, bool& relaxed_p) if (ftv.traversed.find(fd) == ftv.traversed.end()) { if (fd->tok->location.file->name == s.user_file->name && // !tapset - ! s.suppress_warnings) + ! s.suppress_warnings && ! fd->synthetic) s.print_warning ("eliding unused function '" + fd->name + "'", fd->tok); else if (s.verbose>2) clog << "Eliding unused function " << fd->name diff --git a/staptree.cxx b/staptree.cxx index f01e895e..9276586b 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -164,7 +164,7 @@ vardecl::compatible_arity (int a) functiondecl::functiondecl (): - body (0) + body (0), synthetic (false) { } @@ -486,6 +486,7 @@ struct functiondecl: public symboldecl std::vector<vardecl*> locals; std::vector<vardecl*> unused_locals; statement* body; + bool synthetic; functiondecl (); void print (std::ostream& o) const; void printsig (std::ostream& o) const; diff --git a/tapset-perfmon.cxx b/tapset-perfmon.cxx index 56abb997..0c1fec53 100644 --- a/tapset-perfmon.cxx +++ b/tapset-perfmon.cxx @@ -49,6 +49,7 @@ perfmon_var_expanding_visitor::visit_target_symbol (target_symbol *e) // Synthesize a function. functiondecl *fdecl = new functiondecl; + fdecl->synthetic = true; fdecl->tok = e->tok; embeddedcode *ec = new embeddedcode; ec->tok = e->tok; diff --git a/tapset-procfs.cxx b/tapset-procfs.cxx index 1ac67e53..aea01a7a 100644 --- a/tapset-procfs.cxx +++ b/tapset-procfs.cxx @@ -444,6 +444,7 @@ procfs_var_expanding_visitor::visit_target_symbol (target_symbol* e) // Synthesize a function. functiondecl *fdecl = new functiondecl; + fdecl->synthetic = true; fdecl->tok = e->tok; embeddedcode *ec = new embeddedcode; ec->tok = e->tok; diff --git a/tapsets.cxx b/tapsets.cxx index 3c1ea5d2..1ffbcec8 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2512,6 +2512,7 @@ dwarf_var_expanding_visitor::visit_target_symbol (target_symbol *e) // Synthesize a function. functiondecl *fdecl = new functiondecl; + fdecl->synthetic = true; fdecl->tok = e->tok; embeddedcode *ec = new embeddedcode; ec->tok = e->tok; @@ -2860,6 +2861,7 @@ void dwarf_cast_expanding_visitor::visit_cast_op (cast_op* e) // Synthesize a function. functiondecl *fdecl = new functiondecl; + fdecl->synthetic = true; fdecl->tok = e->tok; fdecl->type = type; fdecl->name = fname; @@ -5950,6 +5952,7 @@ tracepoint_var_expanding_visitor::visit_target_symbol_arg (target_symbol* e) // Synthesize a function to dereference the dwarf fields, // with a pointer parameter that is the base tracepoint variable functiondecl *fdecl = new functiondecl; + fdecl->synthetic = true; fdecl->tok = e->tok; embeddedcode *ec = new embeddedcode; ec->tok = e->tok; diff --git a/testsuite/semok/thirtyeight.stp b/testsuite/semok/thirtyeight.stp new file mode 100755 index 00000000..aedbab08 --- /dev/null +++ b/testsuite/semok/thirtyeight.stp @@ -0,0 +1,10 @@ +#! stap -Wp2 + +# Each of the @defined should be a valid symbol, and sometimes their expansion +# leads to a new function declaration. We don't want to get warnings when such +# functions turn out to be unused and are elided. + +probe kernel.function("sys_open") { println(@defined($mode) ? 1 : $nosuchvar) } +probe kernel.trace("sched_switch")? { println(@defined($next->pid) ? 1 : $nosuchvar) } +probe procfs.write { println(@defined($value) ? 1 : $nosuchvar) } +probe begin { println(@defined(@cast(0, "task_struct")->pid) ? 1 : $nosuchvar) } |