From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ddb8MlPc/WlniyMAWB0awg (envelope-from ) for ; Fri, 08 May 2026 08:51:31 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VQUgK8C3; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BD5D31E067; Fri, 08 May 2026 08:51:31 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,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 387751E067 for ; Fri, 08 May 2026 08:51:31 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0C264BA2E10 for ; Fri, 8 May 2026 12:51:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0C264BA2E10 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VQUgK8C3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id AC02A4BA2E39 for ; Fri, 8 May 2026 12:50:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC02A4BA2E39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AC02A4BA2E39 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778244635; cv=none; b=LsSNALJpng5pxNnQ0J3GTXIQlld2VPZ/wIJbTVIVqgSInNOav69klzF8o+KjnAVZBT1jNsjL9d1qPCvwDqRcKhKyzdfx7Do5BAjEXORbkmpD+6YwbjRBT3+WGIJ/w6RVGNCNoGN2wBz35xhRIqOdxrFup99Z2yW+J6bIW07hV44= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778244635; c=relaxed/simple; bh=v81KQ4wqYTI8tTW73E+6jP4xJNEX/mwVCnDVHF3pLYw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uTe4WpFZIwhCXhyT9Vdf2K6e9ghOH4MDyvneicdR7OAwspx0DW98UB5xNxdHt5Uq5T8OWrD09ma7my+uBhWtfelXkXaa0+tkHDUTRqFcGpp2otoZN456O51GywDv1fUiG5MHHULmCVvDvkEhWQbmOZJXGBQcznIk2AvUyaIhJU0= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VQUgK8C3 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC02A4BA2E39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778244635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Fm/aUdbFNfFVz4d0WZ3iDIZWoweBha2rp1lc7WRjezY=; b=VQUgK8C3eR6RVtZwFXDYVwXNZ0YRMM1gGgL8WZadtVzsdrJe0PctK76UEmFn/wlPasJIcz AtVzmmJFuIVFUQsHTI0Obv1+0FyGWoGgB8zkBO8QU91Ogy7f4qf5i53EgJ2SzDgv8P7Tt4 7BttjAG4lmhDTJtxZV1+rbQeDZS2MX4= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-581-bkDS4wbDM9O0i31rFidS1g-1; Fri, 08 May 2026 08:50:34 -0400 X-MC-Unique: bkDS4wbDM9O0i31rFidS1g-1 X-Mimecast-MFC-AGG-ID: bkDS4wbDM9O0i31rFidS1g_1778244633 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-48a589c7879so22293235e9.1 for ; Fri, 08 May 2026 05:50:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778244633; x=1778849433; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Fm/aUdbFNfFVz4d0WZ3iDIZWoweBha2rp1lc7WRjezY=; b=ZgxdYP6gZcSyUMGa/G3bGWG1/nvhjX2EggKHfuKYBNsGQs6sIqSIXCj6NjM/YHujYL OjWFr23mJrV+WBQbLK+YTiHV+0bycLWiY4cwkJVbTZg9ze+qjnTtK9slsyOAojIXRAZC 1BjirxtLHmgvDzwiO9XHKuulIn0v/zey3qmn8WHfgoJpL9qrm9sWajDBpz8uJQ0eLIMi gE80aydSFlCb442wAmBT4GhqxYR0KhmBuzJ82uK61kjI54b3PRCiUtsKUehkZg0qOaqg Cc9/MJINriazOAcwZOHFHdoQoEzgax7thBj5CyCkvCoYQrYpw5hSd5drtJJJlnHKZkTk d1tg== X-Forwarded-Encrypted: i=1; AFNElJ/1qtyk6FJhOiorrI4F2h5BTAhBNKEUvqpPLBXLl2lAAu3MoZCmEJ51GWn0++//0fNNJrYJxM9TcI68bg==@sourceware.org X-Gm-Message-State: AOJu0YzNw5K1IXFUzZWe/PZr2TpngHKDSzTP00dT6k74bWzDyvbE6UZW q83tLw8Sz5dQWOzCHt9Jhac8G9+E7Gh+q+4J4IMtJzuxTHaXF43VIkVYjzwaTKNiGopQpd1Z8Y4 +DQV7dzhLmBPR/EV8dKDhkx2CbxdgrfBjxsaPrred6T+STws4alk4PprtjJ4eESQ= X-Gm-Gg: AeBDieusqxpBz6BfK0omuoEQvuMr+jwDMsg6Auvbmiowok71kguj14wePS6/fXvQWDw 06cV+I32qVPCgXqPr3ve/w6gzhqjK3ZJQEa1K1/OAhtCgWJBj4/ok2PJeIPGu8rLrDI2gjqwZt3 5R+Z+nkg2uyWGLNOPX920td9r3daATJKMs7cEE2/4z4rxwf+Hag+PSjIik6zet5A3huSKXTqg6B QPJjT09f2nfiLrVHwZKUl7BXgJsvykLptxf2E8fQCXMrrGb9ESwT3iMi3bDDwllWx3tkbTGLpnB KXIvTH8T1YRmdr3yweehSVZDM/vI40fo2ZSAMj/ktcaJJIv1ZlOeppbXKmrQ/xZmYgqw8gYUQOg I8kyvJhsdHB5El2BW X-Received: by 2002:a05:600c:3e86:b0:48a:5339:a46 with SMTP id 5b1f17b1804b1-48e5dffabcamr104154665e9.9.1778244632588; Fri, 08 May 2026 05:50:32 -0700 (PDT) X-Received: by 2002:a05:600c:3e86:b0:48a:5339:a46 with SMTP id 5b1f17b1804b1-48e5dffabcamr104154065e9.9.1778244632083; Fri, 08 May 2026 05:50:32 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e642f9461sm19802145e9.11.2026.05.08.05.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 05:50:31 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , gdb-patches@sourceware.org Cc: Tom Tromey Subject: Re: [PATCH 1/2] Use bool in ada_add_all_symbols In-Reply-To: <20260424-ada-bool-again-v1-1-cb63db324fff@adacore.com> References: <20260424-ada-bool-again-v1-0-cb63db324fff@adacore.com> <20260424-ada-bool-again-v1-1-cb63db324fff@adacore.com> Date: Fri, 08 May 2026 13:50:30 +0100 Message-ID: <87cxz6dq09.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: W7ICK8E0ZC_r2CQleJyww1YvyG1qaKRkjARfY-AHOP8_1778244633 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Tom Tromey writes: > 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 I found the description in this comment for what FULL_SEARCH actually does really confusing. I noticed that you replaced non-zero with false not true, which is an inversion of the logic. I thought I'd just read the comment and check the code, then I'd know if this was a fix or not. But I cannot tell from the comment what the code is supposed to do, so I'm stuck. All I know is that the code didn't change, but the comment has flipped logic, and the commit message doesn't call this out as a fix, so I wanted to check with you. > 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 While here it would be good to capitalise FULL_SEARCH. Also non-zero became false here instead of true, as with ada_add_all_symbols, is this intentional? The actual code changes look fine though. Approved-By: Andrew Burgess Thanks, Andrew