This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] don't generate empty struct global
- From: Wenji Huang <wenji dot huang at oracle dot com>
- To: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Mon, 23 Feb 2009 17:42:38 +0800
- Subject: [PATCH] don't generate empty struct global
- Reply-to: wenji dot huang at oracle dot com
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++)
{