From 032760cdf02b03c4815b4c840e19a97b294b083e Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 29 Jun 2011 09:20:22 +0200 Subject: [PATCH] Assert in POP_PARENT() that the statement pushed in the corresponding PUSH_PARENT() is still on top. --- parser.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/parser.c b/parser.c index 2bbdbf4..67f83ea 100644 --- a/parser.c +++ b/parser.c @@ -111,10 +111,11 @@ static declaration_t **incomplete_arrays; static elf_visibility_tag_t default_visibility = ELF_VISIBILITY_DEFAULT; -#define PUSH_PARENT(stmt) \ - statement_t *const prev_parent = current_parent; \ - ((void)(current_parent = (stmt))) -#define POP_PARENT() ((void)(current_parent = prev_parent)) +#define PUSH_PARENT(stmt) \ + statement_t *const new_parent = (stmt); \ + statement_t *const old_parent = current_parent; \ + ((void)(current_parent = new_parent)) +#define POP_PARENT() (assert(current_parent == new_parent), (void)(current_parent = old_parent)) /** special symbol used for anonymous entities. */ static symbol_t *sym_anonymous = NULL; -- 2.20.1