From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +dfGMciR9GoTUgIAWB0awg (envelope-from ) for ; Wed, 11 Nov 2026 11:03:20 -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=IBTjEJ59; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C78DF1E089; Wed, 11 Nov 2026 11:03:20 -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 97421378002 for ; Wed, 11 Nov 2026 11:03:19 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 307BE4B9208A for ; Wed, 11 Nov 2026 16:03:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 307BE4B9208A 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=IBTjEJ59 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 1D5584B920AA for ; Wed, 11 Nov 2026 15:59:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1D5584B920AA 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 1D5584B920AA Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::229 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794412766; cv=none; b=nsxS7JowJwGsiwtP4h4WIwPkXSa+24JBEhfVjN+E21eUZLP+uN05vqsf/h39Ge58LRmfnWyUSg0Yc+IL9yXteJwNH0XNDFbPpqxKztITPdfEGd2B9C+/scq6FfdphO7T90kt90x/lyhcrWUPPjGAyIIY+CCsiL5dd+zda3RqpI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794412766; c=relaxed/simple; bh=xpwzNQKe1iRkalV9f2sIv3M0Z53ybJt637Z5Qjz5o0s=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=tgjP2Nkpy3F0lc2q+ADammyHteAjNrCMdrsSzYK/da2NVA7UCIZgrnpfeXSkwrWykJ2tOm8u16xZ9yaMk/p+dF+l86EHUMATsuAAKqv4SHDzCVfkl/xzSJmKJkvrlD7WkDV5ZffRogrCeX/v+Zps3mQHFBjYh5q+u6gcQeN4XpU= 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=IBTjEJ59 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D5584B920AA Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-55650fe1f0dso1703023b6e.2 for ; Wed, 11 Nov 2026 07:59:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1794412765; x=1795017565; 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=e5h725fEajqRavVpf+VZ0ilt+J4uW+hbnFZaP/yyUkI=; b=IBTjEJ59mQQv8y0oo0QQRt0pLHiPY2P9CxnjBLcnuhZuqOddHWvUnuhYnwoD/6QAez fbVDgdbpksNMfYtrvkOB0y0H3q9MHD/Ki5dygmoD0TUXpcLvfF6v21j+gU6+UB0QR689 xVYioklhDsopCikKPhj/S2HaLKbrrGfJgSrIAi/rADGpZupPjOgks6xXw0Zf/GVfkRTH Ihm5zM2oPZwVVFBc5Na9iZx1Bsb0UV43fNgzZjHyOJ4seJC5cQG+gMfnS3cA/ZYEAcIG bE3mOPI/rdaSb2tNDA3uauVx7P1VXezE0jZRAyvAhIcyMkZ+HWi0WnNGTUgqVXOmiiAr EX3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794412765; x=1795017565; 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=e5h725fEajqRavVpf+VZ0ilt+J4uW+hbnFZaP/yyUkI=; b=0FNCtc7jM8pQs+ClO5n/3zz4Ot5OhoGXZhU9nQAzzOXewYuvSdDn9uabZY76TTWOgJ lb5axB10xcYiDBHdySeTyGbcf4eNcko7qkl20hGSfU5FU0e+15sdMBYDXoQPoHd1jPFI BMkb0zly/EooO1ExXWdl2DPWvmE8tPCKlLnPWk67370g2UZ9QlGXx3vUSm+tOcCPPj2c sPnT08zvAj6fdE/t1YRaKZmIvZQz3bidLRPeVJ+xENVQ0pyX6ylD11hF7cPPdeVlmVsX I1V71/EPopu02XGZYH+CMOhcp5tL2mmg3it3xKADDG1jibbUH1iGCPIl1cLezRzVxWg5 kWCA== X-Gm-Message-State: APuU4Z8CArWlPqqtE2ujRHCtpcsauxOeiyEAq4To7qds6eqT0ovChy7d n6j2pZd+ZxvC9YyfCUDZ+Jmq0z+oWUgad66/0Fff39bb2p0xvnvYo631AI0cV8M36ApXc3sTEng 5eHV2tA== X-Gm-Gg: AYBFou39+QPW/bXxuwliNyFsYUKcUC3cPZegSjrEglrcHzNjlxlLe/HbJOv2psOMMjR 1YTLB6+0Oc8MhY0zkPCbDaekAsvRs0LZ/icvTAc9/r6q1jdlyeyJEcDHt8W97OcljNjSWbufiwA OXusII8qV3mr/r0nPKXm+r8StBOoL3CeAMXKtmwF+4juLVorrOgpqExnLdFYDKJ0WLthcloM1H6 rh+XCaUrO3/UZ6OY/N9WV7RArgvmhmiMuvIQlnM4iWSfZQBILEB0rWsZ9X9tM7pgrcNv/5k04Lb o/a6PTmlZoqjp9E2Yi73qw4BIOZ3uUM2ksPlMNIjUVWgCtqaEhWsOLPispTkAcR1CvABlA2zBhP sFQUYMKj4aJY/DUb1I1zz90mOvXJvxAI2p2ivI+LDyaNLeQ5ZavVCjRrBAJTUUTOjisCA/F2XII ItzzdGPLv1EmBiiGh4qOsjRdWoNT3wZdwUUEENL6Ny756/SjZvZzA47jkzPt1g+rS8SspT1a0Ev xEaDNNMqsBjldMlsmwYSV+kj4DeKloGP3puRxYvxUEP91X8+ubzs61oDZuxXRqg0dBYMzbcwgjD rekA2ps0XA47wupXhHITqn6DWhrCb4jQSR108W6gQ/Ky9UpFeEHJrF4M6VPse+YP3Q2phZeClR/ LOomaWnNp X-Received: by 2002:a05:6808:6401:b0:4d6:90d3:e185 with SMTP id 5614622812f47-56b97d0d831mr2236218b6e.46.1794412765351; Wed, 11 Nov 2026 07:59:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 07:59:25 -0800 (PST) From: Tom Tromey Date: Wed, 11 Nov 2026 08:59:00 -0700 Subject: [PATCH v2 12/15] Make gdb::span conform more closely to C++20 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261111-span-part-1-v2-12-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 This removes the single-object constructors from gdb::span, making it conform more closely to C++20. Also, the cbegin and cend methods are removed. These do not appear until C++23. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31422 --- gdbsupport/span.h | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/gdbsupport/span.h b/gdbsupport/span.h index 27791394d3d..e3e3ddcbbd7 100644 --- a/gdbsupport/span.h +++ b/gdbsupport/span.h @@ -33,10 +33,7 @@ The main intent of span is to use it as function input parameter type, making it possible to pass in any sequence of contiguous objects, irrespective of whether the objects live on the - stack or heap and what actual container owns them. Implicit - construction from the element type is supported too, making it easy - to call functions that expect an array of elements when you only - have one element (usually on the stack). For example: + stack or heap and what actual container owns them. For example: struct A { .... }; void function (gdb::span as); @@ -44,12 +41,10 @@ std::vector std_vec = ...; std::array std_array = ...; A array[] = {...}; - A elem; function (std_vec); function (std_array); function (array); - function (elem); Views can be either mutable or const. A const view is simply created by specifying a const T as span template parameter, @@ -88,7 +83,6 @@ class span using reference = T &; using const_reference = const T &; using size_type = size_t; - using const_iterator = const T *; using iterator = T *; /* Default construction creates an empty view. */ @@ -96,24 +90,6 @@ class span : m_array (nullptr), m_size (0) {} - /* Create a span over a single object of the type of an - span element. The created view as size==1. This is - templated on U to allow constructing a span over a - (non-const) T. The "convertible" requirement makes sure that you - can't create an span over a const T. */ - template>> - constexpr span (U &elem) noexcept - : m_array (&elem), m_size (1) - {} - - /* Same as above, for rvalue references. */ - template>> - constexpr span (U &&elem) noexcept - : m_array (&elem), m_size (1) - {} - /* Create a span from a pointer to an array and an element count. */ template