summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-26 13:12:57 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-26 13:13:54 -0700
commitd699ecb701ac42e5f50b4ec00c162c4dc9532b91 (patch)
treec3dd99b645b5c7aa5c5de7815437a607c0aaf48b /scope.h
parent02c01adb33bc4dde0147539d95b275937329f6c4 (diff)
downloadperl-d699ecb701ac42e5f50b4ec00c162c4dc9532b91.tar.gz
Restore special blocks to working order
I accidentally broke these in commit 85ffec3682, yet everything passed for me under threads+mad. PL_compcv is usually restored to its previous value at the end of newATTRSUB when LEAVE_SCOPE is called. But BEGIN blocks are called before that. I needed PL_compcv to be restored to its previ- ous value before it was called, so I added LEAVE_SCOPE before process_special_blocks. But that caused the name to be freed before S_process_special_blocks got a chance to look at it. So I have now added a new parameter to S_process_special_blocks to allow *it* to call LEAVE_SCOPE after it determines that it is a BEGIN block, but before it calls it.
Diffstat (limited to 'scope.h')
-rw-r--r--scope.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/scope.h b/scope.h
index 0fad9a38a4..447d22e5ff 100644
--- a/scope.h
+++ b/scope.h
@@ -162,7 +162,9 @@ scope has the given name. Name must be a literal string.
#define ENTER_with_name(name) ENTER
#define LEAVE_with_name(name) LEAVE
#endif
-#define LEAVE_SCOPE(old) if (PL_savestack_ix > old) leave_scope(old)
+#define LEAVE_SCOPE(old) STMT_START { \
+ if (PL_savestack_ix > old) leave_scope(old); \
+ } STMT_END
#define SAVEI8(i) save_I8((I8*)&(i))
#define SAVEI16(i) save_I16((I16*)&(i))