This changes a few explicit checks of context_stack_depth to use
outermost_context_p instead. This simplifies some future work.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* xcoffread.c (read_xcoff_symtab): Use outermost_context_p.
* dwarf2read.c (using_directives, new_symbol): Use
outermost_context_p.
* dbxread.c (process_one_symbol): Use outermost_context_p.
* coffread.c (coff_symtab_read): Use outermost_context_p.
2018-07-16 Tom Tromey <tom@tromey.com>
2018-07-16 Tom Tromey <tom@tromey.com>
+ * xcoffread.c (read_xcoff_symtab): Use outermost_context_p.
+ * dwarf2read.c (using_directives, new_symbol): Use
+ outermost_context_p.
+ * dbxread.c (process_one_symbol): Use outermost_context_p.
+ * coffread.c (coff_symtab_read): Use outermost_context_p.
+
+2018-07-16 Tom Tromey <tom@tromey.com>
+
* dwarf2read.c (using_directives, read_func_scope)
(read_lexical_block_scope): Update.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Update.
* dwarf2read.c (using_directives, read_func_scope)
(read_lexical_block_scope): Update.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Update.
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
contains number of lines to '}' */
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
contains number of lines to '}' */
- if (context_stack_depth <= 0)
+ if (outermost_context_p ())
{ /* We attempted to pop an empty context stack. */
complaint (_("`.ef' symbol without matching `.bf' "
"symbol ignored starting at symnum %d"),
{ /* We attempted to pop an empty context stack. */
complaint (_("`.ef' symbol without matching `.bf' "
"symbol ignored starting at symnum %d"),
newobj = pop_context ();
/* Stack must be empty now. */
newobj = pop_context ();
/* Stack must be empty now. */
- if (context_stack_depth > 0 || newobj == NULL)
+ if (!outermost_context_p () || newobj == NULL)
{
complaint (_("Unmatched .ef symbol(s) ignored "
"starting at symnum %d"),
{
complaint (_("Unmatched .ef symbol(s) ignored "
"starting at symnum %d"),
}
else if (strcmp (cs->c_name, ".eb") == 0)
{
}
else if (strcmp (cs->c_name, ".eb") == 0)
{
- if (context_stack_depth <= 0)
+ if (outermost_context_p ())
{ /* We attempted to pop an empty context stack. */
complaint (_("`.eb' symbol without matching `.bb' "
"symbol ignored starting at symnum %d"),
{ /* We attempted to pop an empty context stack. */
complaint (_("`.eb' symbol without matching `.bb' "
"symbol ignored starting at symnum %d"),
- if (local_symbols && context_stack_depth > 0)
+ if (local_symbols && !outermost_context_p ())
{
tmpaddr =
cs->c_value + ANOFFSET (objfile->section_offsets,
{
tmpaddr =
cs->c_value + ANOFFSET (objfile->section_offsets,
the current block. */
struct block *block;
the current block. */
struct block *block;
- if (context_stack_depth <= 0)
+ if (outermost_context_p ())
{
lbrac_mismatch_complaint (symnum);
break;
{
lbrac_mismatch_complaint (symnum);
break;
valu += function_start_offset;
valu += function_start_offset;
- if (context_stack_depth <= 0)
+ if (outermost_context_p ())
{
lbrac_mismatch_complaint (symnum);
break;
{
lbrac_mismatch_complaint (symnum);
break;
- if (context_stack_depth > 0)
+ if (!outermost_context_p ())
static struct using_direct **
using_directives (enum language language)
{
static struct using_direct **
using_directives (enum language language)
{
- if (language == language_ada && context_stack_depth == 0)
+ if (language == language_ada && outermost_context_p ())
return get_global_using_directives ();
else
return get_local_using_directives ();
return get_global_using_directives ();
else
return get_local_using_directives ();
when we do not have enough information to show inlined frames;
pretend it's a local variable in that case so that the user can
still see it. */
when we do not have enough information to show inlined frames;
pretend it's a local variable in that case so that the user can
still see it. */
- if (context_stack_depth > 0
+ if (!outermost_context_p ()
&& context_stack[context_stack_depth - 1].name != NULL)
SYMBOL_IS_ARGUMENT (sym) = 1;
attr = dwarf2_attr (die, DW_AT_location, cu);
&& context_stack[context_stack_depth - 1].name != NULL)
SYMBOL_IS_ARGUMENT (sym) = 1;
attr = dwarf2_attr (die, DW_AT_location, cu);
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
contains number of lines to '}' */
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
contains number of lines to '}' */
- if (context_stack_depth <= 0)
+ if (outermost_context_p ())
{ /* We attempted to pop an empty context stack. */
ef_complaint (cs->c_symnum);
within_function = 0;
{ /* We attempted to pop an empty context stack. */
ef_complaint (cs->c_symnum);
within_function = 0;
}
newobj = pop_context ();
/* Stack must be empty now. */
}
newobj = pop_context ();
/* Stack must be empty now. */
- if (context_stack_depth > 0 || newobj == NULL)
+ if (!outermost_context_p () || newobj == NULL)
{
ef_complaint (cs->c_symnum);
within_function = 0;
{
ef_complaint (cs->c_symnum);
within_function = 0;
}
else if (strcmp (cs->c_name, ".eb") == 0)
{
}
else if (strcmp (cs->c_name, ".eb") == 0)
{
- if (context_stack_depth <= 0)
+ if (outermost_context_p ())
{ /* We attempted to pop an empty context stack. */
eb_complaint (cs->c_symnum);
break;
{ /* We attempted to pop an empty context stack. */
eb_complaint (cs->c_symnum);
break;
eb_complaint (cs->c_symnum);
break;
}
eb_complaint (cs->c_symnum);
break;
}
- if (local_symbols && context_stack_depth > 0)
+ if (local_symbols && !outermost_context_p ())
{
/* Make a block for the local symbols within. */
finish_block (newobj->name, &local_symbols,
{
/* Make a block for the local symbols within. */
finish_block (newobj->name, &local_symbols,