From: Christoph Mallon Date: Wed, 29 Jun 2011 07:20:22 +0000 (+0200) Subject: Assert in POP_PARENT() that the statement pushed in the corresponding PUSH_PARENT... X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=032760cdf02b03c4815b4c840e19a97b294b083e;p=cparser Assert in POP_PARENT() that the statement pushed in the corresponding PUSH_PARENT() is still on top. --- 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;