From e8fbc5e8b71db38b83a215498ab34936689c3175 Mon Sep 17 00:00:00 2001 From: graydon Date: Wed, 5 Oct 2005 00:43:14 +0000 Subject: 2005-10-04 Graydon Hoare PR 1131. * tapsets.cxx (target_variable_flavour_calculating_visitor::visit_target_symbol) (var_expanding_copy_visitor::visit_target_symbol): Require guru mode for writing to target vars. * testsuite/buildok/twenty.stp: Test writing to target vars. --- tapsets.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 311c237d..5a7a0726 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1583,6 +1583,9 @@ target_variable_flavour_calculating_visitor::visit_target_symbol (target_symbol try { bool lvalue = is_active_lvalue(e); + if (lvalue && !q.sess.guru_mode) + throw semantic_error("Writing to target variable outside of guru mode", e->tok); + flavour += lvalue ? 'w' : 'r'; exp_type ty; string expr = q.dw.literal_stmt_for_local(scope_die, @@ -2214,6 +2217,10 @@ var_expanding_copy_visitor::visit_target_symbol (target_symbol *e) embeddedcode *ec = new embeddedcode; ec->tok = e->tok; bool lvalue = is_active_lvalue(e); + + if (lvalue && !q.sess.guru_mode) + throw semantic_error("Illegal target variable access", e->tok); + string fname = (string(lvalue ? "set" : "get") + "_" + e->base_name.substr(1) + "_" + lex_cast(tick++)); -- cgit