This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] don't generate empty struct global


Impact: clean up

struct global will keep the defined global variables. It will be generated but no reference even no global variables. like,

static struct {
} global = {

};

This patch will skip the struct if no global variable.

diff --git a/translate.cxx b/translate.cxx
index 530b077..5c11855 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4950,6 +4950,7 @@ translate_pass (systemtap_session& s)
           s.op->newline() << s.embeds[i]->code << "\n";
         }

+      if (s.globals.size()>0) {
       s.op->newline() << "static struct {";
       s.op->indent(1);
       for (unsigned i=0; i<s.globals.size(); i++)
@@ -4965,6 +4966,7 @@ translate_pass (systemtap_session& s)
         }
       s.op->newline(-1) << "};";
       s.op->assert_0_indent();
+      }

for (map<string,functiondecl*>::iterator it = s.functions.begin(); it != s.functions.end(); it++)
{



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]