From 0e4c80225fc77cfa5b830ddac3f60a28d47ce7bb Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Tue, 24 Feb 2009 21:36:32 -0500 Subject: Skip generating empty struct global Impact: trivial cleanup. Avoid emitting empty struct global code that is harmless. Signed-off-by: Wenji Huang --- translate.cxx | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/translate.cxx b/translate.cxx index 135830df..655937d7 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4954,21 +4954,23 @@ translate_pass (systemtap_session& s) s.op->newline() << s.embeds[i]->code << "\n"; } - s.op->newline() << "static struct {"; - s.op->indent(1); - for (unsigned i=0; iemit_global (s.globals[i]); - } - s.op->newline(-1) << "} global = {"; - s.op->newline(1); - for (unsigned i=0; iemit_global_init (s.globals[i]); - } - s.op->newline(-1) << "};"; - s.op->assert_0_indent(); + if (s.globals.size()>0) { + s.op->newline() << "static struct {"; + s.op->indent(1); + for (unsigned i=0; iemit_global (s.globals[i]); + } + s.op->newline(-1) << "} global = {"; + s.op->newline(1); + for (unsigned i=0; iemit_global_init (s.globals[i]); + } + s.op->newline(-1) << "};"; + s.op->assert_0_indent(); + } for (map::iterator it = s.functions.begin(); it != s.functions.end(); it++) { -- cgit