Sub-scopes are no longer taken when a parent should not be

This commit is contained in:
Pierre Pronchery 2008-06-04 15:37:48 +00:00
parent c85694ebfb
commit 4c8dc326b7

View File

@ -35,8 +35,8 @@
#include "cpp.h" #include "cpp.h"
#ifdef DEBUG #ifdef DEBUG
# define DEBUG_SCOPE() fprintf(stderr, "DEBUG: %s(%p) %zu %d\n", __func__, \ # define DEBUG_SCOPE() fprintf(stderr, "DEBUG: %s(%p) %zu scope=%d\n", \
cpp, _cpp_scope_get_count(cpp), _cpp_scope_get(cpp)) __func__, cpp, _cpp_scope_get_count(cpp), _cpp_scope_get(cpp))
#else #else
# define DEBUG_SCOPE() # define DEBUG_SCOPE()
#endif #endif
@ -393,7 +393,7 @@ static int _cpp_scope_push(Cpp * cpp, CppScope scope)
cpp = cpp->parent; cpp = cpp->parent;
if(_cpp_scope_get(cpp) != CPP_SCOPE_TAKING) if(_cpp_scope_get(cpp) != CPP_SCOPE_TAKING)
scope = _cpp_scope_get(cpp); scope = CPP_SCOPE_TAKEN;
if((p = realloc(cpp->scopes, sizeof(*p) * (cpp->scopes_cnt + 1))) if((p = realloc(cpp->scopes, sizeof(*p) * (cpp->scopes_cnt + 1)))
== NULL) == NULL)
return error_set_code(1, "%s", strerror(errno)); return error_set_code(1, "%s", strerror(errno));