From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 5D53B3854802 for ; Thu, 4 Mar 2021 14:31:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5D53B3854802 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 12CA1117E74; Thu, 4 Mar 2021 09:31:25 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YXr-JDgMQLg5; Thu, 4 Mar 2021 09:31:25 -0500 (EST) Received: from murgatroyd.Home (71-211-165-100.hlrn.qwest.net [71.211.165.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id C1F80117E6E; Thu, 4 Mar 2021 09:31:24 -0500 (EST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed] Use "bool" in ada-lang.c Date: Thu, 4 Mar 2021 07:31:22 -0700 Message-Id: <20210304143122.4030062-1-tromey@adacore.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Mar 2021 14:31:27 -0000 Christian suggested switching an "int" in ada-lang.c to "bool" instead. This patch makes this change. Tested on x86-64 Fedora 32. gdb/ChangeLog 2021-03-04 Tom Tromey * ada-lang.c (struct match_data) : Now bool. (aux_add_nonlocal_symbols): Update. (ada_add_block_symbols): Change "found_sym" to bool. --- gdb/ChangeLog | 6 ++++++ gdb/ada-lang.c | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index f8bf407fa6c..bb50222f81c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -5299,7 +5299,7 @@ struct match_data struct objfile *objfile = nullptr; std::vector *resultp; struct symbol *arg_sym = nullptr; - int found_sym = 0; + bool found_sym = false; }; /* A callback for add_nonlocal_symbols that adds symbol, found in BSYM, @@ -5324,7 +5324,7 @@ aux_add_nonlocal_symbols (struct block_symbol *bsym, add_defn_to_vec (*data->resultp, fixup_symbol_section (data->arg_sym, data->objfile), block); - data->found_sym = 0; + data->found_sym = false; data->arg_sym = NULL; } else @@ -5335,7 +5335,7 @@ aux_add_nonlocal_symbols (struct block_symbol *bsym, data->arg_sym = sym; else { - data->found_sym = 1; + data->found_sym = true; add_defn_to_vec (*data->resultp, fixup_symbol_section (sym, data->objfile), block); @@ -5531,7 +5531,7 @@ add_nonlocal_symbols (std::vector &result, if (ada_add_block_renamings (result, global_block, lookup_name, domain)) - data.found_sym = 1; + data.found_sym = true; } } @@ -5998,11 +5998,11 @@ ada_add_block_symbols (std::vector &result, /* A matching argument symbol, if any. */ struct symbol *arg_sym; /* Set true when we find a matching non-argument symbol. */ - int found_sym; + bool found_sym; struct symbol *sym; arg_sym = NULL; - found_sym = 0; + found_sym = false; for (sym = block_iter_match_first (block, lookup_name, &iter); sym != NULL; sym = block_iter_match_next (lookup_name, &iter)) @@ -6015,7 +6015,7 @@ ada_add_block_symbols (std::vector &result, arg_sym = sym; else { - found_sym = 1; + found_sym = true; add_defn_to_vec (result, fixup_symbol_section (sym, objfile), block); @@ -6027,7 +6027,7 @@ ada_add_block_symbols (std::vector &result, /* Handle renamings. */ if (ada_add_block_renamings (result, block, lookup_name, domain)) - found_sym = 1; + found_sym = true; if (!found_sym && arg_sym != NULL) { @@ -6039,7 +6039,7 @@ ada_add_block_symbols (std::vector &result, if (!lookup_name.ada ().wild_match_p ()) { arg_sym = NULL; - found_sym = 0; + found_sym = false; const std::string &ada_lookup_name = lookup_name.ada ().lookup_name (); const char *name = ada_lookup_name.c_str (); size_t name_len = ada_lookup_name.size (); @@ -6069,7 +6069,7 @@ ada_add_block_symbols (std::vector &result, arg_sym = sym; else { - found_sym = 1; + found_sym = true; add_defn_to_vec (result, fixup_symbol_section (sym, objfile), block); -- 2.26.2