From patchwork Wed Apr 4 04:40:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 26586 Received: (qmail 85339 invoked by alias); 4 Apr 2018 04:40:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 85195 invoked by uid 89); 4 Apr 2018 04:40:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Apr 2018 04:40:52 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 8569029D7B64 for ; Tue, 3 Apr 2018 23:40:51 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 3aE7fhf5fntAo3aE7fJpE0; Tue, 03 Apr 2018 23:40:51 -0500 Received: from 75-166-37-45.hlrn.qwest.net ([75.166.37.45]:43166 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1f3aE7-000hxu-Ae; Tue, 03 Apr 2018 23:40:51 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 02/10] Fix some indentation in linespec.c Date: Tue, 3 Apr 2018 22:40:41 -0600 Message-Id: <20180404044049.31481-3-tom@tromey.com> In-Reply-To: <20180404044049.31481-1-tom@tromey.com> References: <20180404044049.31481-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1f3aE7-000hxu-Ae X-Source-Sender: 75-166-37-45.hlrn.qwest.net (bapiya.Home) [75.166.37.45]:43166 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This removes some leftover comments and fixes the indentation in a couple of spots in linespec.c. gdb/ChangeLog 2018-04-03 Tom Tromey * linespec.c (linespec_parse_basic): Reindent. --- gdb/ChangeLog | 4 ++ gdb/linespec.c | 137 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 71 insertions(+), 70 deletions(-) diff --git a/gdb/linespec.c b/gdb/linespec.c index 31ebca37c4..a081a8bebf 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1897,68 +1897,66 @@ linespec_parse_basic (linespec_parser *parser) } else { - /* XXX Reindent before pushing. */ - - /* Try looking it up as a function/method. */ - find_linespec_symbols (PARSER_STATE (parser), - PARSER_RESULT (parser)->file_symtabs, name, - PARSER_EXPLICIT (parser)->func_name_match_type, - &symbols, &minimal_symbols); + /* Try looking it up as a function/method. */ + find_linespec_symbols (PARSER_STATE (parser), + PARSER_RESULT (parser)->file_symtabs, name, + PARSER_EXPLICIT (parser)->func_name_match_type, + &symbols, &minimal_symbols); - if (symbols != NULL || minimal_symbols != NULL) - { - PARSER_RESULT (parser)->function_symbols = symbols; - PARSER_RESULT (parser)->minimal_symbols = minimal_symbols; - PARSER_EXPLICIT (parser)->function_name = name; - symbols = NULL; - discard_cleanups (cleanup); - } - else - { - /* NAME was not a function or a method. So it must be a label - name or user specified variable like "break foo.c:$zippo". */ - labels = find_label_symbols (PARSER_STATE (parser), NULL, - &symbols, name); - if (labels != NULL) + if (symbols != NULL || minimal_symbols != NULL) { - PARSER_RESULT (parser)->labels.label_symbols = labels; - PARSER_RESULT (parser)->labels.function_symbols = symbols; - PARSER_EXPLICIT (parser)->label_name = name; + PARSER_RESULT (parser)->function_symbols = symbols; + PARSER_RESULT (parser)->minimal_symbols = minimal_symbols; + PARSER_EXPLICIT (parser)->function_name = name; symbols = NULL; discard_cleanups (cleanup); } - else if (token.type == LSTOKEN_STRING - && *LS_TOKEN_STOKEN (token).ptr == '$') + else { - /* User specified a convenience variable or history value. */ - PARSER_EXPLICIT (parser)->line_offset - = linespec_parse_variable (PARSER_STATE (parser), name); + /* NAME was not a function or a method. So it must be a label + name or user specified variable like "break foo.c:$zippo". */ + labels = find_label_symbols (PARSER_STATE (parser), NULL, + &symbols, name); + if (labels != NULL) + { + PARSER_RESULT (parser)->labels.label_symbols = labels; + PARSER_RESULT (parser)->labels.function_symbols = symbols; + PARSER_EXPLICIT (parser)->label_name = name; + symbols = NULL; + discard_cleanups (cleanup); + } + else if (token.type == LSTOKEN_STRING + && *LS_TOKEN_STOKEN (token).ptr == '$') + { + /* User specified a convenience variable or history value. */ + PARSER_EXPLICIT (parser)->line_offset + = linespec_parse_variable (PARSER_STATE (parser), name); - if (PARSER_EXPLICIT (parser)->line_offset.sign == LINE_OFFSET_UNKNOWN) + if (PARSER_EXPLICIT (parser)->line_offset.sign == LINE_OFFSET_UNKNOWN) + { + /* The user-specified variable was not valid. Do not + throw an error here. parse_linespec will do it for us. */ + PARSER_EXPLICIT (parser)->function_name = name; + discard_cleanups (cleanup); + return; + } + + /* The convenience variable/history value parsed correctly. + NAME is no longer needed. */ + do_cleanups (cleanup); + } + else { - /* The user-specified variable was not valid. Do not - throw an error here. parse_linespec will do it for us. */ + /* The name is also not a label. Abort parsing. Do not throw + an error here. parse_linespec will do it for us. */ + + /* Save a copy of the name we were trying to lookup. */ PARSER_EXPLICIT (parser)->function_name = name; discard_cleanups (cleanup); return; } - - /* The convenience variable/history value parsed correctly. - NAME is no longer needed. */ - do_cleanups (cleanup); - } - else - { - /* The name is also not a label. Abort parsing. Do not throw - an error here. parse_linespec will do it for us. */ - - /* Save a copy of the name we were trying to lookup. */ - PARSER_EXPLICIT (parser)->function_name = name; - discard_cleanups (cleanup); - return; } } - } int previous_qc = parser->completion_quote_char; @@ -2027,29 +2025,28 @@ linespec_parse_basic (linespec_parser *parser) } else { - /* XXX Reindent before pushing. */ - - /* Grab a copy of the label's name and look it up. */ - name = copy_token_string (token); - cleanup = make_cleanup (xfree, name); - labels = find_label_symbols (PARSER_STATE (parser), - PARSER_RESULT (parser)->function_symbols, - &symbols, name); + /* Grab a copy of the label's name and look it up. */ + name = copy_token_string (token); + cleanup = make_cleanup (xfree, name); + labels + = find_label_symbols (PARSER_STATE (parser), + PARSER_RESULT (parser)->function_symbols, + &symbols, name); - if (labels != NULL) - { - PARSER_RESULT (parser)->labels.label_symbols = labels; - PARSER_RESULT (parser)->labels.function_symbols = symbols; - PARSER_EXPLICIT (parser)->label_name = name; - symbols = NULL; - discard_cleanups (cleanup); - } - else - { - /* We don't know what it was, but it isn't a label. */ - undefined_label_error (PARSER_EXPLICIT (parser)->function_name, - name); - } + if (labels != NULL) + { + PARSER_RESULT (parser)->labels.label_symbols = labels; + PARSER_RESULT (parser)->labels.function_symbols = symbols; + PARSER_EXPLICIT (parser)->label_name = name; + symbols = NULL; + discard_cleanups (cleanup); + } + else + { + /* We don't know what it was, but it isn't a label. */ + undefined_label_error + (PARSER_EXPLICIT (parser)->function_name, name); + } }