From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114468 invoked by alias); 23 May 2018 04:59:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 113589 invoked by uid 89); 23 May 2018 04:59:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.65.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 May 2018 04:59:06 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 1C2BF400CBC7C for ; Tue, 22 May 2018 23:59:05 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id LLrdfrojCPvAdLLrdf7FH1; Tue, 22 May 2018 23:59:05 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:56108 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fLLrc-003S5D-ST; Tue, 22 May 2018 23:59:04 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 20/42] Use outermost_context_p in more places Date: Wed, 23 May 2018 04:59:00 -0000 Message-Id: <20180523045851.11660-21-tom@tromey.com> In-Reply-To: <20180523045851.11660-1-tom@tromey.com> References: <20180523045851.11660-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fLLrc-003S5D-ST X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:56108 X-Source-Auth: tom+tromey.com X-Email-Count: 21 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-05/txt/msg00596.txt.bz2 This changes a few explicit checks of context_stack_depth to use outermost_context_p instead. This simplifies some future work. gdb/ChangeLog 2018-05-22 Tom Tromey * 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. --- gdb/ChangeLog | 8 ++++++++ gdb/coffread.c | 8 ++++---- gdb/dbxread.c | 6 +++--- gdb/dwarf2read.c | 4 ++-- gdb/xcoffread.c | 8 ++++---- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/gdb/coffread.c b/gdb/coffread.c index 2e5bf9bcab..85718b252a 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1092,7 +1092,7 @@ coff_symtab_read (minimal_symbol_reader &reader, /* { 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 (&symfile_complaints, _("`.ef' symbol without matching `.bf' " @@ -1104,7 +1104,7 @@ coff_symtab_read (minimal_symbol_reader &reader, newobj = pop_context (); /* Stack must be empty now. */ - if (context_stack_depth > 0 || newobj == NULL) + if (!outermost_context_p () || newobj == NULL) { complaint (&symfile_complaints, _("Unmatched .ef symbol(s) ignored " @@ -1159,7 +1159,7 @@ coff_symtab_read (minimal_symbol_reader &reader, } 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 (&symfile_complaints, _("`.eb' symbol without matching `.bb' " @@ -1177,7 +1177,7 @@ coff_symtab_read (minimal_symbol_reader &reader, symnum); break; } - if (local_symbols && context_stack_depth > 0) + if (local_symbols && !outermost_context_p ()) { tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 127ae5bdf8..ed6e6be458 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2557,7 +2557,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, the current block. */ struct block *block; - if (context_stack_depth <= 0) + if (outermost_context_p ()) { lbrac_mismatch_complaint (symnum); break; @@ -2626,7 +2626,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, valu += function_start_offset; - if (context_stack_depth <= 0) + if (outermost_context_p ()) { lbrac_mismatch_complaint (symnum); break; @@ -2950,7 +2950,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, break; } - if (context_stack_depth > 0) + if (!outermost_context_p ()) { struct block *block; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index ec62a23091..b39c14365a 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -11140,7 +11140,7 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu) 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 (); @@ -21472,7 +21472,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, 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); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 21d107f78d..89896baded 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1395,7 +1395,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) /* { 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; @@ -1403,7 +1403,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) } 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; @@ -1488,7 +1488,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) } 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; @@ -1499,7 +1499,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst) 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, -- 2.13.6