mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-09 17:47:25 +08:00
decl.c (ENABLE_SCOPE_CHECKING): Rename from DEBUG_BINDING_LEVELS.
* decl.c (ENABLE_SCOPE_CHECKING): Rename from DEBUG_BINDING_LEVELS. (binding_depth): Unconditionally define. (is_class_level): Likewise. (indent): Likewise. Take an indenting parameter. (push_binding_level): Remove conditional definittion. (pop_binding_level): Likewise. (suspend_binding_level): Likewise. (resume_binding_level): Likewise. (pushlevel): Likewise. (pushlevel_class): Likewise. (poplevel_class): Likewise. (pop_everything): Likewise. From-SVN: r67226
This commit is contained in:
parent
833e1a7724
commit
f37e2274d0
@ -1,3 +1,18 @@
|
||||
2003-05-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* decl.c (ENABLE_SCOPE_CHECKING): Rename from DEBUG_BINDING_LEVELS.
|
||||
(binding_depth): Unconditionally define.
|
||||
(is_class_level): Likewise.
|
||||
(indent): Likewise. Take an indenting parameter.
|
||||
(push_binding_level): Remove conditional definittion.
|
||||
(pop_binding_level): Likewise.
|
||||
(suspend_binding_level): Likewise.
|
||||
(resume_binding_level): Likewise.
|
||||
(pushlevel): Likewise.
|
||||
(pushlevel_class): Likewise.
|
||||
(poplevel_class): Likewise.
|
||||
(pop_everything): Likewise.
|
||||
|
||||
2003-05-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* name-lookup.h (global_scope_p): New macro.
|
||||
|
138
gcc/cp/decl.c
138
gcc/cp/decl.c
@ -148,10 +148,6 @@ static tree next_initializable_field (tree);
|
||||
static tree reshape_init (tree, tree *);
|
||||
static tree build_typename_type (tree, tree, tree);
|
||||
|
||||
#if defined (DEBUG_BINDING_LEVELS)
|
||||
static void indent (void);
|
||||
#endif
|
||||
|
||||
/* Erroneous argument lists can use this *IFF* they do not modify it. */
|
||||
tree error_mark_list;
|
||||
|
||||
@ -448,19 +444,23 @@ static int keep_next_level_flag;
|
||||
|
||||
static GTY(()) tree incomplete_vars;
|
||||
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
#ifndef ENABLE_SCOPE_CHECKING
|
||||
# define ENABLE_SCOPE_CHECKING 0
|
||||
#else
|
||||
# define ENABLE_SCOPE_CHECKING 1
|
||||
#endif
|
||||
|
||||
static int binding_depth = 0;
|
||||
static int is_class_level = 0;
|
||||
|
||||
static void
|
||||
indent (void)
|
||||
indent (int depth)
|
||||
{
|
||||
register unsigned i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < binding_depth*2; i++)
|
||||
for (i = 0; i < depth * 2; i++)
|
||||
putc (' ', stderr);
|
||||
}
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
|
||||
static tree pushdecl_with_scope (tree, struct cp_binding_level *);
|
||||
|
||||
@ -478,14 +478,16 @@ push_binding_level (struct cp_binding_level *newlevel,
|
||||
newlevel->more_cleanups_ok = 1;
|
||||
|
||||
newlevel->keep = keep;
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
newlevel->binding_depth = binding_depth;
|
||||
indent ();
|
||||
fprintf (stderr, "push %s level 0x%08x line %d\n",
|
||||
(is_class_level) ? "class" : "block", newlevel, input_line);
|
||||
is_class_level = 0;
|
||||
binding_depth++;
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
{
|
||||
newlevel->binding_depth = binding_depth;
|
||||
indent (binding_depth);
|
||||
verbatim ("push %s level %p line %d\n",
|
||||
(is_class_level) ? "class" : "block",
|
||||
(void *) newlevel, input_line);
|
||||
is_class_level = 0;
|
||||
binding_depth++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the innermost enclosing class scope, and reset
|
||||
@ -511,19 +513,20 @@ pop_binding_level (void)
|
||||
/* Cannot pop a level, if there are none left to pop. */
|
||||
my_friendly_assert (!global_scope_p (current_binding_level), 20030527);
|
||||
/* Pop the current level, and free the structure for reuse. */
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
binding_depth--;
|
||||
indent ();
|
||||
fprintf (stderr, "pop %s level 0x%08x line %d\n",
|
||||
(is_class_level) ? "class" : "block",
|
||||
current_binding_level, input_line);
|
||||
if (is_class_level != (current_binding_level == class_binding_level))
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
{
|
||||
indent ();
|
||||
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
|
||||
indent (--binding_depth);
|
||||
verbatim ("pop %s level %p line %d\n",
|
||||
(is_class_level) ? "class" : "block",
|
||||
(void*) current_binding_level, input_line);
|
||||
if (is_class_level != (current_binding_level == class_binding_level))
|
||||
{
|
||||
indent (binding_depth);
|
||||
verbatim ("XXX is_class_level != (current_binding_level "
|
||||
"== class_binding_level)\n");
|
||||
}
|
||||
is_class_level = 0;
|
||||
}
|
||||
is_class_level = 0;
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
{
|
||||
register struct cp_binding_level *level = current_binding_level;
|
||||
current_binding_level = current_binding_level->level_chain;
|
||||
@ -532,10 +535,9 @@ pop_binding_level (void)
|
||||
level->type_decls = NULL;
|
||||
else
|
||||
binding_table_free (level->type_decls);
|
||||
#if 0 /* defined(DEBUG_BINDING_LEVELS) */
|
||||
if (level->binding_depth != binding_depth)
|
||||
abort ();
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
my_friendly_assert (!ENABLE_SCOPE_CHECKING
|
||||
|| level->binding_depth == binding_depth,
|
||||
20030529);
|
||||
free_binding_level = level;
|
||||
find_class_binding_level ();
|
||||
}
|
||||
@ -551,19 +553,20 @@ suspend_binding_level (void)
|
||||
/* Cannot suspend a level, if there are none left to suspend. */
|
||||
my_friendly_assert (!global_scope_p (current_binding_level), 20030527);
|
||||
/* Suspend the current level. */
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
binding_depth--;
|
||||
indent ();
|
||||
fprintf (stderr, "suspend %s level 0x%08x line %d\n",
|
||||
(is_class_level) ? "class" : "block",
|
||||
current_binding_level, input_line);
|
||||
if (is_class_level != (current_binding_level == class_binding_level))
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
{
|
||||
indent ();
|
||||
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
|
||||
indent (--binding_depth);
|
||||
verbatim ("suspend %s level %p line %d\n",
|
||||
(is_class_level) ? "class" : "block",
|
||||
(void *) current_binding_level, input_line);
|
||||
if (is_class_level != (current_binding_level == class_binding_level))
|
||||
{
|
||||
indent (binding_depth);
|
||||
verbatim ("XXX is_class_level != (current_binding_level "
|
||||
"== class_binding_level)\n");
|
||||
}
|
||||
is_class_level = 0;
|
||||
}
|
||||
is_class_level = 0;
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
current_binding_level = current_binding_level->level_chain;
|
||||
find_class_binding_level ();
|
||||
}
|
||||
@ -577,14 +580,15 @@ resume_binding_level (struct cp_binding_level* b)
|
||||
/* Also, resuming a non-directly nested namespace is a no-no. */
|
||||
my_friendly_assert(b->level_chain == current_binding_level, 386);
|
||||
current_binding_level = b;
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
b->binding_depth = binding_depth;
|
||||
indent ();
|
||||
fprintf (stderr, "resume %s level 0x%08x line %d\n",
|
||||
(is_class_level) ? "class" : "block", b, input_line);
|
||||
is_class_level = 0;
|
||||
binding_depth++;
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
{
|
||||
b->binding_depth = binding_depth;
|
||||
indent (binding_depth);
|
||||
verbatim ("resume %s level %p line %d\n",
|
||||
(is_class_level) ? "class" : "block", b, input_line);
|
||||
is_class_level = 0;
|
||||
binding_depth++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a new `struct cp_binding_level'. */
|
||||
@ -789,11 +793,7 @@ pushlevel (int tag_transparent)
|
||||
return;
|
||||
|
||||
/* Reuse or create a struct for this binding level. */
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
if (0)
|
||||
#else /* !defined(DEBUG_BINDING_LEVELS) */
|
||||
if (free_binding_level)
|
||||
#endif /* !defined(DEBUG_BINDING_LEVELS) */
|
||||
if (!ENABLE_SCOPE_CHECKING && free_binding_level)
|
||||
{
|
||||
newlevel = free_binding_level;
|
||||
free_binding_level = free_binding_level->level_chain;
|
||||
@ -1553,11 +1553,7 @@ pushlevel_class (void)
|
||||
register struct cp_binding_level *newlevel;
|
||||
|
||||
/* Reuse or create a struct for this binding level. */
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
if (0)
|
||||
#else /* !defined(DEBUG_BINDING_LEVELS) */
|
||||
if (free_binding_level)
|
||||
#endif /* !defined(DEBUG_BINDING_LEVELS) */
|
||||
if (!ENABLE_SCOPE_CHECKING && free_binding_level)
|
||||
{
|
||||
newlevel = free_binding_level;
|
||||
free_binding_level = free_binding_level->level_chain;
|
||||
@ -1565,9 +1561,8 @@ pushlevel_class (void)
|
||||
else
|
||||
newlevel = make_binding_level ();
|
||||
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
is_class_level = 1;
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
is_class_level = 1;
|
||||
|
||||
push_binding_level (newlevel, 0, 0);
|
||||
|
||||
@ -1644,9 +1639,8 @@ poplevel_class (void)
|
||||
|
||||
/* Now, pop out of the binding level which we created up in the
|
||||
`pushlevel_class' routine. */
|
||||
#if defined(DEBUG_BINDING_LEVELS)
|
||||
is_class_level = 1;
|
||||
#endif /* defined(DEBUG_BINDING_LEVELS) */
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
is_class_level = 1;
|
||||
|
||||
pop_binding_level ();
|
||||
timevar_pop (TV_NAME_LOOKUP);
|
||||
@ -2361,9 +2355,8 @@ identifier_type_value (tree id)
|
||||
void
|
||||
pop_everything (void)
|
||||
{
|
||||
#ifdef DEBUG_BINDING_LEVELS
|
||||
fprintf (stderr, "XXX entering pop_everything ()\n");
|
||||
#endif
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
verbatim ("XXX entering pop_everything ()\n");
|
||||
while (!toplevel_bindings_p ())
|
||||
{
|
||||
if (current_binding_level->parm_flag == 2)
|
||||
@ -2371,9 +2364,8 @@ pop_everything (void)
|
||||
else
|
||||
poplevel (0, 0, 0);
|
||||
}
|
||||
#ifdef DEBUG_BINDING_LEVELS
|
||||
fprintf (stderr, "XXX leaving pop_everything ()\n");
|
||||
#endif
|
||||
if (ENABLE_SCOPE_CHECKING)
|
||||
verbatim ("XXX leaving pop_everything ()\n");
|
||||
}
|
||||
|
||||
/* The type TYPE is being declared. If it is a class template, or a
|
||||
|
Loading…
Reference in New Issue
Block a user