diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-08-02 13:50:28 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-08-02 13:52:46 -0400 |
commit | 1384b663414d5380e25b21457e71458078ded8d5 (patch) | |
tree | 64dae603e54cfc86726b95015ae8ffd3d75da8f9 | |
parent | 67e704a6b1aa140d00d8fe4040fc6e76e7cac2fb (diff) | |
download | systemtap-steved-1384b663414d5380e25b21457e71458078ded8d5.tar.gz systemtap-steved-1384b663414d5380e25b21457e71458078ded8d5.tar.xz systemtap-steved-1384b663414d5380e25b21457e71458078ded8d5.zip |
c code generation: assert C indentation/nesting cancels out at appropriate points
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | translate.cxx | 11 |
2 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2008-08-02 Frank Ch. Eigler <fche@elastic.org> + + * translate.h (translator_output::assert_0_indent): New function. + * translate.cxx (emit_*): Add a couple of calls to confirm + newline(1)/(-1) nest matching. + 2008-07-23 Frank Ch. Eigler <fche@elastic.org> From James Bottomley <James.Bottomley@HansenPartnership.com>: diff --git a/translate.cxx b/translate.cxx index 5956cba7..03ac0941 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4714,6 +4714,7 @@ translate_pass (systemtap_session& s) s.up->emit_global_init (s.globals[i]); } s.op->newline(-1) << "};"; + s.op->assert_0_indent(); for (unsigned i=0; i<s.functions.size(); i++) { @@ -4721,6 +4722,7 @@ translate_pass (systemtap_session& s) s.op->newline(); s.up->emit_functionsig (s.functions[i]); } + s.op->assert_0_indent(); for (unsigned i=0; i<s.functions.size(); i++) { @@ -4728,6 +4730,7 @@ translate_pass (systemtap_session& s) s.op->newline(); s.up->emit_function (s.functions[i]); } + s.op->assert_0_indent(); // Run a varuse_collecting_visitor over probes that need global // variable locks. We'll use this information later in @@ -4738,18 +4741,21 @@ translate_pass (systemtap_session& s) if (s.probes[i]->needs_global_locks()) s.probes[i]->body->visit (&cup.vcv_needs_global_locks); } + s.op->assert_0_indent(); for (unsigned i=0; i<s.probes.size(); i++) { if (pending_interrupts) return 1; s.up->emit_probe (s.probes[i]); } + s.op->assert_0_indent(); s.op->newline(); s.up->emit_module_init (); + s.op->assert_0_indent(); s.op->newline(); s.up->emit_module_exit (); - + s.op->assert_0_indent(); s.op->newline(); // XXX impedance mismatch @@ -4760,17 +4766,20 @@ translate_pass (systemtap_session& s) s.op->newline() << "void probe_exit () {"; s.op->newline(1) << "systemtap_module_exit ();"; s.op->newline(-1) << "}"; + s.op->assert_0_indent(); for (unsigned i=0; i<s.globals.size(); i++) { s.op->newline(); s.up->emit_global_param (s.globals[i]); } + s.op->assert_0_indent(); emit_symbol_data (s); s.op->newline() << "MODULE_DESCRIPTION(\"systemtap-generated probe\");"; s.op->newline() << "MODULE_LICENSE(\"GPL\");"; + s.op->assert_0_indent(); } catch (const semantic_error& e) { |