From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +RNeLF6R9GrvUAIAWB0awg (envelope-from ) for ; Wed, 11 Nov 2026 11:01:34 -0500 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=fCo2SY9M; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B000B378002; Wed, 11 Nov 2026 11:01:34 -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 1BF6D1E04F for ; Wed, 11 Nov 2026 11:01:34 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DEB304B920A9 for ; Wed, 11 Nov 2026 16:01:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DEB304B920A9 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=fCo2SY9M Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by sourceware.org (Postfix) with ESMTPS id 608F24B92091 for ; Wed, 11 Nov 2026 15:59:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 608F24B92091 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 608F24B92091 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794412759; cv=none; b=YslNcauZQWm8A/IfVtYEi2rXGFWIJCM+U+8+rLF+RKuteVnwNYsoga/Af1sA4/8Y4svsepJEH+FoUwiD3F2RsXpumwX8LOd6Azl109Al8j03H3y7d+9erXhM4TYA1aOPsrczYkBQ/kalW4TwGyRJ1znPDO4TE3gP+Djc4SSJOX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794412759; c=relaxed/simple; bh=bQwCS+lcNEsUDpGMdFnN/GvzRZpUZYTXrujqNdVKYUI=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=GSlPifS/4P1yEj5iUX0Bo5Gv9Nw/s6e8leiphZUVPKhJy0Jud6haD8bSa2QUbPy8jXYpVT0q/BmqZJAhJ8IhwI3ukNzsUwJ90J65jsVMewqtP/Pbi5p8WaHjFngIbWm2+G/1hBlPxfTp6jUCAZW3uwfsqCTxC48T9AMlGKK2Irw= ARC-Authentication-Results: i=1; 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=fCo2SY9M DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 608F24B92091 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-4adae3eb4d3so1376687fac.1 for ; Wed, 11 Nov 2026 07:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1794412759; x=1795017559; darn=sourceware.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ImKNpZiP2DTAi7A+kwLu9I4aCAoNO85KwqrYbYHWCyE=; b=fCo2SY9ML7REi1om+vs7k9f8I4qbhDJ3CnNzanLkyoRNdfKGq3IYhyG0e+3VCB7Ak+ KwpVNx3CO+iJp1PJH+wZrZMdNct5ykiR8IkUHur5/AjEP7qBAZpZBMGvlNNX0smhVHnZ vvl4/BeZxqSt2B045gCVuOvJGnAyIpu4OIYw8SumUvclxf79rSxQUvk7/PQqhHaS5HBA eSRQpkJtGykEVZNR62/ch3dwykmXPzmz2lLLISgUYQvLO+3/lqL0xRL4XO5QHEaNkTSH PkKpWqIUT7maFbNRFIw7iV4BvBG7Kq+KwjmFqW/8fkY+rM0nb2fbF0EfSomxrbVcbt1K bD6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794412759; x=1795017559; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ImKNpZiP2DTAi7A+kwLu9I4aCAoNO85KwqrYbYHWCyE=; b=DsbOZsl/K1tBLBbrxGTCAJsp24LINqLwa+YWTZbyegzjbE1NirZu8J5GJ3Cj7XWS31 PO5r7HJWCKiVfgj4kWO7nYANqYSIRY7c8Ingm8BmgVj1aLJXB5E4yjXsEOyRWe2sJrMv KHvnv0vdFnSNUwTqz+KgZ4bXlvShhEPP1ziU/6hPmGSFB1JCKVBSMsoM3yy35yW0NVvm SUQ04FsQz4d732KzxqqzppUr8ukP5xAfzFgFnu8/9tf7s/v1gvRmWAdOedq4vu6xhAlZ ysOjTb6+lrzztmaSPJMMov4QMs+NqLaqUl+pb1BuARHhb+GrfSAts9IXwpsGsNH6kULn 4rFw== X-Gm-Message-State: APuU4Z8oVulNfOY3hgnzFYm92r6w3Z6JWdV5sx85LzlrAXY1jvhf1cG+ YpKJH0KbrJcVZPmkRI2hZCnMz+bLu1pNcMoZXfBAWuLsOTWsQBQwV35ko8aY3w7FUbSUdJe+T2w jrLOxkg== X-Gm-Gg: AYBFou2086rflR3a0zAnqJIACT8G5bfjF09ubU+6hl6OsxMOWRLM+7S4lmejUq600mr +LyKsfEaqDiudOUCbteFFjllge0ZHaQ/nyk9VhReiSP5T4pUM9CEiDGZorIo0n41sQYl+S0XKnB /eh8S45+JYJNwvmL7Lrq77lbWWNiZVPzrvk8B8jDV1kt+rUz/wfDyR+hbshu7DViNBSf9mAp5eS wUzbMcLgWj4Cz6BuPjwvFbBsjQ5w6K9jJ/g7zhw4LhRCGZmaPIcnhu7FByE6uU20MUnjatk6kHp oqFI9The9MDKCs3mRNl3UYLaog/FzCDCQHk2fiVu2DSZFLndWxL31dIraJJDWgiXk1CmUP++QG8 Nq3s1YepQ3Z5f9XUgRnnCb8ubVX4jWvHF+m2bs6oZKsEShvWpFxwyLzivYJ3OXxfRy3tVh/fpVb xEvC8pm6NS21AWlaJehDT1B0+Y/AtC970wb0eQaCBZYHwg5J9+RW8Am3ipwLuC7xY9sXEZpmoCH jsuvb8cyi1b3cU5R2OTxKf9XLNrA+faB38qpR0pPQMwK6djgpnZISAtdHNeXVlck5zLoI+Ups8N 8RTfV9j0RqiKTcFeAMCIvDVP1Dy+1l6NHamPClCJWI1ky6/l3nsYaZKbfqkV1cUnoXXkA9dnq47 UwcVOQn0= X-Received: by 2002:a05:6870:818c:b0:494:c04a:1a6a with SMTP id 586e51a60fabf-4ae46c4310cmr2353776fac.55.1794412758600; Wed, 11 Nov 2026 07:59:18 -0800 (PST) Received: from [192.168.0.26] (97-122-110-129.hlrn.qwest.net. [97.122.110.129]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4ae2308e3ccsm3497521fac.15.2026.11.11.07.59.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 07:59:18 -0800 (PST) From: Tom Tromey Date: Wed, 11 Nov 2026 08:58:55 -0700 Subject: [PATCH v2 07/15] Add single-argument overloads of process_options et al MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261111-span-part-1-v2-7-cd4e33a8a723@adacore.com> References: <20261111-span-part-1-v2-0-cd4e33a8a723@adacore.com> In-Reply-To: <20261111-span-part-1-v2-0-cd4e33a8a723@adacore.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.16.0 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 The C++20 std::span doesn't allow construction from a single object, whereas gdb's old gdb::array_view did. This patch fixes one class of the resulting compilation failures by introducing single-object overloads of process_options and some related functions. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31422 --- gdb/cli/cli-option.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h index 560b189ffc9..6c5b93d1adc 100644 --- a/gdb/cli/cli-option.h +++ b/gdb/cli/cli-option.h @@ -387,6 +387,15 @@ extern bool process_options process_options_mode mode, gdb::span options_group); +/* An overload of process_options that accepts a single option. */ +static inline bool +process_options (const char **args, + process_options_mode mode, + const option_def_group &options_group) +{ + return process_options (args, mode, gdb::make_span (&options_group, 1)); +} + /* Complete ARGS on options listed by OPTIONS_GROUP. Returns true if the string has been fully parsed and there are no operands to handle by the caller. Return false if options were parsed, and @@ -397,11 +406,31 @@ extern bool complete_options process_options_mode mode, gdb::span options_group); +/* An overload of complete_options that accepts a single option. */ +static inline bool +complete_options (completion_tracker &tracker, + const char **args, + process_options_mode mode, + const option_def_group &options_group) +{ + return complete_options (tracker, args, mode, + gdb::make_span (&options_group, 1)); +} + /* Complete on all options listed by OPTIONS_GROUP. */ extern void complete_on_all_options (completion_tracker &tracker, gdb::span options_group); +/* An overload of complete_on_all_options that accepts a single + option. */ +static inline void +complete_on_all_options (completion_tracker &tracker, + const option_def_group &options_group) +{ + complete_on_all_options (tracker, gdb::make_span (&options_group, 1)); +} + /* Return a string with the result of replacing %OPTIONS% in HELP_TMLP with an auto-generated "help" string fragment for all the options in OPTIONS_GROUP. */ @@ -409,6 +438,14 @@ extern std::string build_help (const char *help_tmpl, gdb::span options_group); +/* An overload of build_help that accepts a single option. */ +static inline std::string +build_help (const char *help_tmpl, + const option_def_group &options_group) +{ + return build_help (help_tmpl, gdb::make_span (&options_group, 1)); +} + /* Install set/show commands for options defined in OPTIONS. DATA is a pointer to the structure that holds the data associated with the OPTIONS array. */ -- 2.56.0