From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id DGc4Fw7CmGnAKQMAWB0awg (envelope-from ) for ; Fri, 20 Feb 2026 15:20:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 2E1CE1E09A; Fri, 20 Feb 2026 15:20:30 -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.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 6030B1E09A for ; Fri, 20 Feb 2026 15:20:29 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id A9EC84BAD17A for ; Fri, 20 Feb 2026 20:20:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9EC84BAD17A Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0EE374BAD151 for ; Fri, 20 Feb 2026 20:20:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EE374BAD151 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0EE374BAD151 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771618806; cv=none; b=SR+aA9VahVh8yl1Ce+s6zAYE4gqOANFoOTddhURhuYp+SK44lHPg8/pcA8S51FS93XWpwx6z4XCjyP2JzgWLqUtHwHXYLQ5/CrGfcm9oZBUaOGbZeQUfr5fa08KHktu2LB/wq6ZUbTNgIjnn8tmBKywkGZhX13cSFfgEEkwjyeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771618806; c=relaxed/simple; bh=wlMDko5ZkLpilepF5OvtyznrBlCjPqK7f84jJIT3R48=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eNWz6owrydfKOTcV/ORmLeOmHb1uuajNcXv4a6kiIiaRMwey8m5hee8gILHtX18ZfLTTqz0IXaaVSVusmnExErCfNzT9nTZj9NFtLmJxQvWBD/+vAcYiM2cYgP8lzXgsnpTaBWkyK/CByM4B3+wgJJkBx9rPWfOwLsjio0bZpoA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0EE374BAD151 Received: by simark.ca (Postfix) id 763761E0BA; Fri, 20 Feb 2026 15:20:04 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/3] gdb: use enumerate in gdbtypes.c Date: Fri, 20 Feb 2026 15:19:43 -0500 Message-ID: <20260220202002.860008-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260220202002.860008-1-simon.marchi@efficios.com> References: <20260220202002.860008-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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..396588e70e0c 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::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