From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oWF/LnKD62nn2zgAWB0awg (envelope-from ) for ; Fri, 24 Apr 2026 10:51:30 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=QmYps5c+; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BA3CA1E0BA; Fri, 24 Apr 2026 10:51:30 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 23E0B1E067 for ; Fri, 24 Apr 2026 10:51:30 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 9EA4B4BB5938 for ; Fri, 24 Apr 2026 14:51:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EA4B4BB5938 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=QmYps5c+ Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 2F4524BB3BB8 for ; Fri, 24 Apr 2026 14:50:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F4524BB3BB8 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F4524BB3BB8 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777042230; cv=none; b=WjikWYfxEnLjSzB7aNrC3X49v267PRRwQXHt253VqVzZwLArgI9QTzUDXwFCyGxUU4KNI4r6vKZ+fpI5qWbmblq82QV8dThoq/IYLp2KoiFlSK/Hz6yXW5ZXtVvxoBoc59HGLJMxvRMlh/QgEpOiNWJk5G0Qi1UrxWO3f7H36x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777042230; c=relaxed/simple; bh=pIrhrf36ApXDp35/tfaHGOlq8j1c+XPeNHg00ZmSEJA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=NS6Nxdqion4+mhLu408P5nXyVct2F9hCvgtcr+omia0mSmaANIIwinM/MrZN/IdX6ORV5IM/nUjXtg93FpFWFrIpAtijFNtb/UGXHck7A3pfJcvUQimu+g0rY7ZVZ426hvVkffZ1RShxZOiCgljWfuKibFg8DfTnpsU+0+SixmQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F4524BB3BB8 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-7dcdd23fcdfso2226195a34.3 for ; Fri, 24 Apr 2026 07:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1777042229; x=1777647029; darn=sourceware.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DTS1sxxheJcOVB535qAbeJzQ2SVzqgvwocdum/7CW8g=; b=QmYps5c+8n2Wel9pPMAg6nTgLfh7JW5Kw4ZXbQ/prU5tDkydCoTWvVO17zvrjNU/qH aC1BJcVBIAyWkijL89iNSzU9f1NN26ghIo/RQYLqfeO7k6IM+duUMRWHMbOG4djoU5bS PNDLgSsnKmzjmfFGegZq3n7vShvoacPiM3wtqCwC0c3l1fT8ax4af6yCFzrOeOhxTD4y Z2DqYC1cyfpJDuHy1YJbVrxHvvdLznRtBe+441xLhRZ8Qmt+RyBfAkBZII3qxi5O2YnQ t4Ow6qydxhQBkEJhMz/yuRCS/xsmXja6W4VD+3GUpVXWFNN3WD2LwKPVWkvDyO6M6w18 riHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777042229; x=1777647029; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=DTS1sxxheJcOVB535qAbeJzQ2SVzqgvwocdum/7CW8g=; b=WIcQ6cptlU9OL7m+QQea7EecIn8cFM8Z/nMUtqCYcLPxjTXrqlpCj/kvh+1HT316AN rv+RiaeE8otoaH7nCGM8X8QxVYlNLgDzEYv6RNUltB2m/HGVrtH5TyW3wXnQJsV04fRB IOUZtAyT/j/s/PqvT2BESpb6T/c3MDFdzzARFQyxQMMea4oiEjnWYAU0+VqybIxXsbkK KOyAjA8SiUd1zb2cW3UCQbu8YrLGiEHFRFvI/SbOzP6iPu3TDcdHeXWKfT8YSZ73Xjiu ApSVarKQiZWJTbJDTDSuB80YBld3ymGLEXUtDBun25ehWamPpA5GGI41DjOM4cPIO389 xl/w== X-Gm-Message-State: AOJu0Yxl7iOzEMaT4afscq7OCoHxtbhDwhBN/6Z7PfFmSwXLeDQ7Gt6e bG/gdPVI+iNPQwHyPldjyrstvEEr22rMv6e+/3DPguLMAtXPO0HqNxSBEJVBoG2IKN3eslaoVxH /gpw= X-Gm-Gg: AeBDies3zJgBCuV71rBFYQaDXTEc6JfOZR2UwV0R1LGRF8+sNCfqLlfCUpcI+AUpJP5 k3m9SWS7ms5j+DLM5sz5Azvo75rpPRnYki4HhO5DHvSuP2gjyyPEgCqlzFbO44oi6aSXQD5uhae HyGHQeeB2y2Ks2aSxPWpX68pobTmaRiBfb4Y58XzGjB907mwYGSA3gctt9QLkG9sZ87wvrTtIlR 1KvA6tCIWm8evO1tzgTXwToeAwQ8YCwUtzs5VovZ7AKN+nFBsDU3oL2nb/M2OBlKHUs2RDkeyOy +fFuQVyKwlVgax1hX3lxjqYiRkwMGEZkUyf9f8SEKoYyt0BFesqm84IxNWB/Fe1/wucpK1GBIcS +sejpFs+5qmyCLf4IKjgnFShpIOCHc1jztt6dw+RZ1bLD2AZxWXMEm9qAh3Nx6ie0HBArvRfr74 t0gLm7qHpfj3GqXxKbSzBBjf6bzUN+M/hy97XTZy8eZISG3ecR4Fw7+csjyAzeaWHk X-Received: by 2002:a05:6820:c2cc:10b0:689:dfc8:5e3c with SMTP id 006d021491bc7-69462e21091mr11848037eaf.3.1777042229343; Fri, 24 Apr 2026 07:50:29 -0700 (PDT) Received: from [192.168.0.26] (75-166-225-82.hlrn.qwest.net. [75.166.225.82]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-42fe61449bcsm5147552fac.11.2026.04.24.07.50.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2026 07:50:29 -0700 (PDT) From: Tom Tromey Date: Fri, 24 Apr 2026 08:50:26 -0600 Subject: [PATCH 1/2] Use bool in ada_add_all_symbols MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260424-ada-bool-again-v1-1-cb63db324fff@adacore.com> References: <20260424-ada-bool-again-v1-0-cb63db324fff@adacore.com> In-Reply-To: <20260424-ada-bool-again-v1-0-cb63db324fff@adacore.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This changes ada_add_all_symbols to use bool, then fixes up the callers. --- gdb/ada-lang.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 71a338ce17e..afdd59965fd 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -104,7 +104,7 @@ static void ada_add_block_symbols (std::vector &, static void ada_add_all_symbols (std::vector &, const struct block *, const lookup_name_info &lookup_name, - domain_search_flags, int, int *); + domain_search_flags, bool, bool *); static bool is_nonfunction (const std::vector &); @@ -5528,7 +5528,7 @@ ada_add_block_renamings (std::vector &result, lookup_name_info decl_lookup_name (r_name, lookup_name.match_type ()); ada_add_all_symbols (result, block, decl_lookup_name, domain, - 1, NULL); + true, nullptr); } } return result.size () != defns_mark; @@ -5612,10 +5612,10 @@ add_nonlocal_symbols (std::vector &result, } /* Find symbols in DOMAIN matching LOOKUP_NAME, in BLOCK and, if - FULL_SEARCH is non-zero, enclosing scope and in global scopes, + FULL_SEARCH is true, enclosing scope and in global scopes, returning the number of matches. Add these to RESULT. - When FULL_SEARCH is non-zero, any non-function/non-enumeral + When FULL_SEARCH is false, any non-function/non-enumeral symbol match within the nest of blocks whose innermost member is BLOCK, is the one match returned (no other matches in that or enclosing blocks is returned). If there are any matches in or @@ -5633,13 +5633,13 @@ ada_add_all_symbols (std::vector &result, const struct block *block, const lookup_name_info &lookup_name, domain_search_flags domain, - int full_search, - int *made_global_lookup_p) + bool full_search, + bool *made_global_lookup_p) { struct symbol *sym; - if (made_global_lookup_p) - *made_global_lookup_p = 0; + if (made_global_lookup_p != nullptr) + *made_global_lookup_p = false; /* Special case: If the user specifies a symbol name inside package Standard, do a non-wild matching of the symbol name without @@ -5679,8 +5679,8 @@ ada_add_all_symbols (std::vector &result, return; } - if (made_global_lookup_p) - *made_global_lookup_p = 1; + if (made_global_lookup_p != nullptr) + *made_global_lookup_p = true; /* Search symbols from all global blocks. */ @@ -5694,12 +5694,12 @@ ada_add_all_symbols (std::vector &result, } /* Find symbols in DOMAIN matching LOOKUP_NAME, in BLOCK and, if FULL_SEARCH - is non-zero, enclosing scope and in global scopes. + is true, enclosing scope and in global scopes. Returns (SYM,BLOCK) tuples, indicating the symbols found and the blocks and symbol tables (if any) in which they were found. - When full_search is non-zero, any non-function/non-enumeral + When full_search is false, any non-function/non-enumeral symbol match within the nest of blocks whose innermost member is BLOCK, is the one match returned (no other matches in that or enclosing blocks is returned). If there are any matches in or @@ -5712,9 +5712,9 @@ static std::vector ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name, const struct block *block, domain_search_flags domain, - int full_search) + bool full_search) { - int syms_from_global_search; + bool syms_from_global_search; std::vector results; ada_add_all_symbols (results, block, lookup_name, @@ -5745,11 +5745,11 @@ ada_lookup_symbol_list (const char *name, const struct block *block, symbol_name_match_type name_match_type = name_match_type_from_name (name); lookup_name_info lookup_name (name, name_match_type); - return ada_lookup_symbol_list_worker (lookup_name, block, domain, 1); + return ada_lookup_symbol_list_worker (lookup_name, block, domain, true); } /* The result is as for ada_lookup_symbol_list with FULL_SEARCH set - to 1, but choosing the first symbol found if there are multiple + to true, but choosing the first symbol found if there are multiple choices. */ block_symbol @@ -11510,7 +11510,7 @@ get_var_value (const char *name, const char *err_msg) std::vector syms = ada_lookup_symbol_list_worker (lookup_name, get_selected_block (0), - SEARCH_VFT, 1); + SEARCH_VFT, true); if (syms.size () != 1) { @@ -13702,7 +13702,7 @@ class ada_language : public language_defn for_each_symbol_callback_ftype callback) const override { std::vector results - = ada_lookup_symbol_list_worker (name, block, domain, 0); + = ada_lookup_symbol_list_worker (name, block, domain, false); for (block_symbol &sym : results) callback (&sym); } -- 2.53.0