From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OaAmGlwImWnQcQMAWB0awg (envelope-from ) for ; Fri, 20 Feb 2026 20:20:28 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=M4Q8Z0aV; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6198C1E0BA; Fri, 20 Feb 2026 20:20:28 -0500 (EST) 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 AD28E1E08D for ; Fri, 20 Feb 2026 20:20:27 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 053F54BAD151 for ; Sat, 21 Feb 2026 01:20:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 053F54BAD151 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=M4Q8Z0aV Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 9E9914B9DB69 for ; Sat, 21 Feb 2026 01:19:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E9914B9DB69 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9E9914B9DB69 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771636776; cv=none; b=hTlXDW1dkK+ldXjP6unfiDDF1jNRa4iN0oDlG7ghCK7HJTTuXvUcbtISNbxvAS//rsgDqeAj9toFXW5fIqKuV666kViJKvp/WDtiq1XoKJbKzBMrCtcV0AJ31Az3S5VXBUI9/gMwHtb2K9ku5BlN6EXRyy8QODsuGhc0UBZV8rM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771636776; c=relaxed/simple; bh=PYD06/jrC0mZyB6iThJjO7c6lsIcKBPiYB6f4tqhrnk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IyQ7Z6fBdkfPv1/rLPDqx0PI5BSA2BZv2z9pwJqpqf5sHCDypZGjh1+aVmPctC4Cdw7NWQPco2ylNV504d+EV5x1q3CUaWl9sy3lfAei5ZvSSxt4W0r84Sh6TLLCK7gZd5kxH5a5IK/iF9W1Cej9h7aJzu56Zzc6zw6hW1uEeDk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E9914B9DB69 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 61L1JUkJ209427 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Feb 2026 20:19:34 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 61L1JUkJ209427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1771636775; bh=HDwqvJpi6ZnmMHmQtx+cZKV3/EKH+zyFDRssZfBqcXo=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=M4Q8Z0aVaUtiaSWNq6IqrQaDgyBZq0/iwil0Q2fUDl7LF0XGKxtrvrruLit8BYfpb NKE6a3NeYNmplLJ16w1FsR288Dc5GAFQHZvUyzdm14StS9/VcF4+OZvvYz6cqVNdAB Pnp0AjOjInTTahdHBe9xiB28xe/YFGIz9e8+TNNdjMHayG6zLdhZPGweVTrn1NNd3I Y5qNTk39kNyPeFVb0cn6E74QxhNq+ruGbbMbEzd32A3pYviCunyvCTW9GoaQ9yI1qI VHPexK3IG0xFPozKMQ8hdwuNqBcOAI1wBo21UlG2EB1XZ1dcAFKncHwCvsD/T+ECe1 FqSBk5D/D42xw== Received: by simark.ca (Postfix) id 7FA131E0BA; Fri, 20 Feb 2026 20:19:29 -0500 (EST) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 3/3] gdb: use enumerate in gdbtypes.c Date: Fri, 20 Feb 2026 20:19:00 -0500 Message-ID: <20260221011924.2029855-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260221011924.2029855-1-simon.marchi@polymtl.ca> References: <20260220202002.860008-1-simon.marchi@efficios.com> <20260221011924.2029855-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 21 Feb 2026 01:19:30 +0000 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 From: Simon Marchi Use the new enumerate util to move to a range-based loop, while keeping the counter. Change-Id: If82eaec7afa4e78fa51e973fae4d0ecef728ea95 --- gdb/gdbtypes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 2b6244d6f38b..73f65e72b167 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -44,6 +44,7 @@ #include "rust-lang.h" #include "ada-lang.h" #include "extract-store-integer.h" +#include "gdbsupport/enumerate.h" /* The value of an invalid conversion badness. */ #define INVALID_CONVERSION 100 @@ -4765,12 +4766,12 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) static void print_args (gdb::array_view args, int spaces) { - for (int i = 0; i < args.size (); i++) + for (auto [i, arg] : gdb::ranges::views::enumerate (args)) { gdb_printf - ("%*s[%d] name '%s'\n", spaces, "", i, - args[i].name () != NULL ? args[i].name () : ""); - recursive_dump_type (args[i].type (), spaces + 2); + ("%*s[%zu] name '%s'\n", spaces, "", i, + arg.name () != nullptr ? arg.name () : ""); + recursive_dump_type (arg.type (), spaces + 2); } } -- 2.53.0