diff options
author | Josh Stone <jistone@redhat.com> | 2009-07-31 17:24:13 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-07-31 17:34:42 -0700 |
commit | dc5a09fc9a61c8b33078164b6855dea54a33627c (patch) | |
tree | a1877ba1c9b69a0cb189ce97092888c84ca6e0ab /tapset-mark.cxx | |
parent | c67847a0d05f8c7207513e79378fc8d84563e109 (diff) | |
download | systemtap-steved-dc5a09fc9a61c8b33078164b6855dea54a33627c.tar.gz systemtap-steved-dc5a09fc9a61c8b33078164b6855dea54a33627c.tar.xz systemtap-steved-dc5a09fc9a61c8b33078164b6855dea54a33627c.zip |
Unify no-component assertions on target variables
There are several tapsets that can't deal with component dereferences on
their target variables, and they all check-and-throw in the same way.
This refactors the checks into a target_symbol member.
* staptree.cxx (target_symbol::assert_no_components): New.
* tapsets.cxx (tracepoint_var_expanding_visitor::visit_target_symbol_arg,
tracepoint_var_expanding_visitor::visit_target_symbol_context): Use
the new assertion function to check for no components.
* tapset-mark.cxx (mark_var_expanding_visitor::visit_target_symbol_arg,
mark_var_expanding_visitor::visit_target_symbol_context): Ditto.
* tapset-perfmon.cxx (perfmon_var_expanding_visitor::visit_target_symbol): Ditto.
* tapset-procfs.cxx (procfs_var_expanding_visitor::visit_target_symbol): Ditto.
* tapset-utrace.cxx (utrace_var_expanding_visitor::visit_target_symbol_arg,
utrace_var_expanding_visitor::visit_target_symbol_context): Ditto.
Diffstat (limited to 'tapset-mark.cxx')
-rw-r--r-- | tapset-mark.cxx | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/tapset-mark.cxx b/tapset-mark.cxx index fcde9ed5..59334729 100644 --- a/tapset-mark.cxx +++ b/tapset-mark.cxx @@ -103,23 +103,7 @@ mark_var_expanding_visitor::visit_target_symbol_arg (target_symbol* e) if (is_active_lvalue (e)) throw semantic_error("write to marker parameter not permitted", e->tok); - if (e->components.size() > 0) - { - switch (e->components[0].type) - { - case target_symbol::comp_literal_array_index: - throw semantic_error("marker argument may not be used as array", - e->tok); - break; - case target_symbol::comp_struct_member: - throw semantic_error("marker argument may not be used as a structure", - e->tok); - break; - default: - throw semantic_error ("invalid marker argument use", e->tok); - break; - } - } + e->assert_no_components("marker"); // Remember that we've seen a target variable. target_symbol_seen = true; @@ -138,23 +122,7 @@ mark_var_expanding_visitor::visit_target_symbol_context (target_symbol* e) if (is_active_lvalue (e)) throw semantic_error("write to marker '" + sname + "' not permitted", e->tok); - if (e->components.size() > 0) - { - switch (e->components[0].type) - { - case target_symbol::comp_literal_array_index: - throw semantic_error("marker '" + sname + "' may not be used as array", - e->tok); - break; - case target_symbol::comp_struct_member: - throw semantic_error("marker '" + sname + "' may not be used as a structure", - e->tok); - break; - default: - throw semantic_error ("invalid marker '" + sname + "' use", e->tok); - break; - } - } + e->assert_no_components("marker"); if (e->base_name == "$format" || e->base_name == "$name") { string fname; |