From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mYI/Mt3Q/Go0qBkAWB0awg (envelope-from ) for ; Tue, 17 Nov 2026 17:10:37 -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=NXL4OkOA; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C53F51E0C7; Tue, 17 Nov 2026 17:10:37 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 BB83D1E0BC for ; Tue, 17 Nov 2026 17:10:35 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D5AA94BA7984 for ; Tue, 17 Nov 2026 22:10:34 +0000 (GMT) Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 77BD14BA2E08 for ; Tue, 17 Nov 2026 22:10:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 77BD14BA2E08 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 77BD14BA2E08 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794953408; cv=none; b=SkWVMoGANZHPUnlMDrAcU3ROQb+D6aDnKu9Y37UJzrYBA6P4eBI7OF/zZKfjuYEdKMTT16PHASN5drJvG5KsCweaVT5a8LAB4rCkyzuYqHwolfzWd6TUiz+WtKpwoRM3XwdvoSt7Bxz/knlvkfjcMcXgtVy3/he/nZP12ZsTrwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794953408; c=relaxed/simple; bh=f/VHehAT0+cGLFCw0fhtritW7nek2Qc9ydm51iJd8v0=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Te7WlHuCgYJTMQIjfKF9pxreTEcUNptNlThC0L0qc96FphMgBqMhXrBOCRQBj9LSNjMFEj0U5ylj79q7vY5M50eewbyRTQrhHTkOFnhmhSJeEf7tUm7OBPH/P1TghdjoGn7IG/vb5q11uD7NkQbrO5lEkHcLclsjyN13YoVimgk= 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=NXL4OkOA DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77BD14BA2E08 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=NXL4OkOA Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-843cf077f10so356287a34.1 for ; Tue, 17 Nov 2026 14:10:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1794953407; x=1795558207; 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=7v4O2p2tOeC3WwVAbsl+c1ObLCLtQ1EUc7w/mg36wYM=; b=NXL4OkOAYuv0z+KYZQh3fwsdknBlDeVNZDyw/GK/YnbyaF3kwJucppgQF16MmAtG3s hVjjIjdH3DPdu6ygn5OD4aMbTIoqMdJWd/W+n94bpuO54v5GCcQVxZe9Mwr92PHaUuUf pt0b3yAIWm8wvyAhDXRN7DaqimFF9z46MTEEUea/GYZqtOsLydXXl0wC8+ATZ1j4ptqr xgwqwuS32xWu9hNqrwX96Zr1IGHxGz2g2M7YMqp8lJ7E0Prd1o3YdXcvnmLC6HBHGlTB jsoh3l5vHR7ygUY9feMcNPc1eXIozJexljRKjGXzih6mPr+ZnAKZWSDNtxIHsNWkw8g4 bMhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794953407; x=1795558207; 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=7v4O2p2tOeC3WwVAbsl+c1ObLCLtQ1EUc7w/mg36wYM=; b=yubrVxfHEnP5BoPsEokFAOG2c8X6YtFgXQjI5oW4AcQl6hfXUJSHFI/tI+FqFbRXf/ 8U1qHA+EpYicD6kcmfq+7zKPVhVzja3OATZxGl30UOZwUPgCzc7DwVveknKu2RrCGnzU GQwWqov8jBz+T2LxT27Thgub/6gBwV1QTnFCHSgbVIP4+YCMay3Y9YjsuB4zp4wPQx+r HNpYHb6RFvBXqnHW2SfNzjOTdJF+Y3AEziPldK//+T7m+w8fiNdtsUsm6OMOXA44parR AykU9xb4xLch76T9koOIpefrF+UypST75K1MtnwJcMCX+B8WEdFhy9mbFTruI9k05pP3 GJfw== X-Gm-Message-State: APuU4Z9aveM+YN7lMAsTIaXx0kGbAyB8aE4Ec6AOwLBpBy+pRfDqCNkS Ij3qgPJC69ePJavF7XXRJuNcQOJR7sF0coYuiNOKLnQu0kMir7AbFGwcwvYLONgRuizmTJd+cVz ns3Wn7A== X-Gm-Gg: AYBFou1Eak5SBGmXMy+kv6IkR/5bF60mbFpoflGOEVp34TCSFgZc1xhVJna80A0rzeP BYwFe9H44K2fwaDyVlD7TJKxXjeO5bMX/pmbnTRgUH/ZngHCMHnjbBAh7+BaXZzr/cdlJstqG4l K+3+dhKDB3YmcrwEiIWtzaK0fh7UYsCmmAN5PHPLfzoHEO26TqGhEvczpHPM+xtX+4PvXuiQsIt 3I8CDy8cznmR5eGTo/dOdiEY7R+6PzEN9FIzCV1dO3IF8VUnJPPL5QCX41c08hawGHzFXdnhsX6 jCB119gfbtWoJXpUibAeQf63lslXsCHiFH8PCmpPSerZzmHLZSDXAYMTmTQrPFlmDwkpimvpu5C fku2EvwlsoOSxPYyPc34FC7q2oYy1ia5l1UHn0CKnsniSnkNtpg9UwWL0jPoug1ROISvC7goBlq 96aB/3iFKKlxJUEKnBDJ3Ve6iWvfwRyBgGBFcAwhVDhJKoX9hUkY9HlYdfoVeyFOpGXqDUpOvom eyCA6+5Hh5lSitKckJ9HwMJD5pDggkbeDImh7Fx3JWifWXaHArruCh71OMjhQtdh0YdCz/CYlV7 UYZtv5b5MK48g9E/fjIWFdiGjdOXcRt1IxedJK0Nanqo3zoijkAjJzgVNkAd6A== X-Received: by 2002:a05:6830:4486:b0:862:ac8c:2078 with SMTP id 46e09a7af769-862f092ca48mr662100a34.9.1794953406768; Tue, 17 Nov 2026 14:10:06 -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 46e09a7af769-862f01d4764sm545498a34.5.2026.11.17.14.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 14:10:06 -0800 (PST) From: Tom Tromey Date: Tue, 17 Nov 2026 15:10:01 -0700 Subject: [PATCH v3 05/17] Remove operator== and operator!= from gdb::span MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261117-span-part-1-v3-5-40b8b11d2d8c@adacore.com> References: <20261117-span-part-1-v3-0-40b8b11d2d8c@adacore.com> In-Reply-To: <20261117-span-part-1-v3-0-40b8b11d2d8c@adacore.com> To: gdb-patches@sourceware.org Cc: Tom Tromey , Simon Marchi 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 gdb::span currently provides operator== and operator!=. However, these aren't part of the C++20 std::span. There, instead, one must use std::ranges::equal for deep equality. This patch changes gdb::span to be similar, introducing gdb::ranges::equal. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31422 Approved-By: Simon Marchi --- gdb/dwarf2/read-debug-names.c | 9 ++++++--- gdb/value.c | 2 +- gdbsupport/span.h | 14 +++++--------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index a1e9d8c12ee..ca3b46fc9b1 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -817,17 +817,20 @@ read_debug_names_from_section (dwarf2_per_objfile *per_objfile, aug_repr.c_str ()); } - if (augmentation_string == gdb::make_span (dwarf5_augmentation_1)) + if (gdb::ranges::equal (augmentation_string, + gdb::make_span (dwarf5_augmentation_1))) { warning (_(".debug_names created by an old version of gdb; ignoring")); return false; } - else if (augmentation_string == gdb::make_span (dwarf5_augmentation_2)) + else if (gdb::ranges::equal (augmentation_string, + gdb::make_span (dwarf5_augmentation_2))) { map.augmentation_is_gdb = true; map.gdb_augmentation_version = 2; } - else if (augmentation_string == gdb::make_span (dwarf5_augmentation_3)) + else if (gdb::ranges::equal (augmentation_string, + gdb::make_span (dwarf5_augmentation_3))) { map.augmentation_is_gdb = true; map.gdb_augmentation_version = 3; diff --git a/gdb/value.c b/gdb/value.c index ea967462629..0efceb32c7d 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -4387,7 +4387,7 @@ static bool check_ranges_vector (gdb::span ranges, gdb::span expected) { - return ranges == expected; + return gdb::ranges::equal (ranges, expected); } /* Test the insert_into_bit_range_vector function. */ diff --git a/gdbsupport/span.h b/gdbsupport/span.h index 80f6b46030c..b246c58588f 100644 --- a/gdbsupport/span.h +++ b/gdbsupport/span.h @@ -225,13 +225,16 @@ void copy (gdb::span src, gdb::span dest) std::copy_backward (src.begin (), src.end (), dest.end ()); } +namespace ranges +{ + /* Compare LHS and RHS for (deep) equality. That is, whether LHS and RHS have the same sizes, and whether each pair of elements of LHS and RHS at the same position compares equal. */ template bool -operator== (const gdb::span &lhs, const gdb::span &rhs) +equal (const gdb::span &lhs, const gdb::span &rhs) { if (lhs.size () != rhs.size ()) return false; @@ -243,14 +246,7 @@ operator== (const gdb::span &lhs, const gdb::span &rhs) return true; } -/* Compare two spans for inequality. */ - -template -bool -operator!= (const gdb::span &lhs, const gdb::span &rhs) -{ - return !(lhs == rhs); -} +} /* namespace ranges */ /* Create a span from a pointer to an array and an element count. -- 2.56.0