aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-10-09 16:59:32 +0000
committerRichard Stallman <rms@gnu.org>1992-10-09 16:59:32 +0000
commit6ed1d6c5eda4bcf3d996aec32b510dce8e957d1d (patch)
treee5fea263537c14d30f7d2d0dc0ffbfbe0db37124
parentcb00f51acf20fd1ff03cd9d4fdb74bb12bd71da5 (diff)
downloadgcc-6ed1d6c5eda4bcf3d996aec32b510dce8e957d1d.zip
gcc-6ed1d6c5eda4bcf3d996aec32b510dce8e957d1d.tar.gz
gcc-6ed1d6c5eda4bcf3d996aec32b510dce8e957d1d.tar.bz2
(POPSTACK): Pop discarded elts off all the stacks as we go.
From-SVN: r2383
-rw-r--r--gcc/stmt.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 286fce2..4800129 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -332,6 +332,8 @@ struct nesting
/* Chain of all pending binding contours. */
struct nesting *block_stack;
+/* If any new stacks are added here, add them to POPSTACKS too. */
+
/* Chain of all pending binding contours that restore stack levels
or have cleanups. */
struct nesting *stack_block_stack;
@@ -360,17 +362,31 @@ int nesting_depth;
#define ALLOC_NESTING() \
(struct nesting *) obstack_alloc (&stmt_obstack, sizeof (struct nesting))
-/* Pop one of the sub-stacks, such as `loop_stack' or `cond_stack';
- and pop off `nesting_stack' down to the same level. */
+/* Pop the nesting stack element by element until we pop off
+ the element which is at the top of STACK.
+ Update all the other stacks, popping off elements from them
+ as we pop them from nesting_stack. */
#define POPSTACK(STACK) \
-do { int initial_depth = nesting_stack->depth; \
- do { struct nesting *this = STACK; \
- STACK = this->next; \
+do { struct nesting *target = STACK; \
+ struct nesting *this; \
+ do { this = nesting_stack; \
+ if (loop_stack == this) \
+ loop_stack = loop_stack->next; \
+ if (cond_stack == this) \
+ cond_stack = cond_stack->next; \
+ if (block_stack == this) \
+ block_stack = block_stack->next; \
+ if (stack_block_stack == this) \
+ stack_block_stack = stack_block_stack->next; \
+ if (case_stack == this) \
+ case_stack = case_stack->next; \
+ if (except_stack == this) \
+ except_stack = except_stack->next; \
+ nesting_depth = nesting_stack->depth - 1; \
nesting_stack = this->all; \
- nesting_depth = this->depth; \
obstack_free (&stmt_obstack, this); } \
- while (nesting_depth > initial_depth); } while (0)
+ while (this != target); } while (0)
/* In some cases it is impossible to generate code for a forward goto
until the label definition is seen. This happens when it may be necessary