From patchwork Thu Aug 1 14:57:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1967807 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=eCZwAsue; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZXsx4b90z1ybV for ; Fri, 2 Aug 2024 01:28:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ADD133860776 for ; Thu, 1 Aug 2024 15:28:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id B8761384F4BF for ; Thu, 1 Aug 2024 15:00:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B8761384F4BF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B8761384F4BF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524474; cv=none; b=SmdEFsq4llGSFIe9eNvnZmQE+Tk0GnMAqPiVG9nDzhojm2eQIlI9RAwoNT2D0JClokxmqZPB7h8OAUiUt46EY+fGZ8M5FIQN98fWE+2RMlqvE/PmK1q3BdesvSMSNgjvEXqo7K520VeqEq0/zUPqgbUGdvLdKZ5CWvCMc0V/rLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524474; c=relaxed/simple; bh=EFk7M8ZHjIXSqbdqqb0YO9s4k8p4mq1BLwI+RkWWit8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PPxUC8LpF9p/0quJVZbKVNN9VQRijRVe2ma4cqi+cjWvcEeJ3eJFT8lxczlFaXcd6uvXfJz8T0EgajPOvw8GVCaVfWTAWvDivJ6c9gidKuCUPrlL+L/ifv9xGDAizXPOxI522AvL2QzTRwdKs/CR1sW7pXwSGA0chQup6QirR0c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5af6a1afa7bso7884528a12.1 for ; Thu, 01 Aug 2024 08:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1722524429; x=1723129229; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ilb9/PzPPGt8T0dCsCwO0PHcl9tYAX0RFjWh7PWikVk=; b=eCZwAsueRZHXs9mlySgCoVCWdWMxO6fXV9zRP5S2FkllCbwRSYmetzAr51IMicGgsD ZNwpRirTZ2jbg2H1GSRrcorF7O30w1dQNi+aj7lOywfkil+1nHz/pVunYcL85KkkA0s4 HtkvAwyk6z08y04opeE+rs89zEOr0r5nSs/nYoEi65kp9AU61nBppkVDTb4cSb9/0Oo8 bo2GQJzb0TCvhAq5Hm+xIK0kxhctefEWes55FW9avvPx32I/kXmiSJc0rYXL3naKZF7v 25RoPoh+DM99jIYKOQBFhJHkgjAOr4jv3hfAoP27pG6TgrfDdIxevxU/l71kVn/tMizH 8vvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722524429; x=1723129229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ilb9/PzPPGt8T0dCsCwO0PHcl9tYAX0RFjWh7PWikVk=; b=dGxXTX8NJrmbKAANbN+BKy1hvc3p0Y9DnByOyj/lUPWqis51UcWs/KFu66KZlnpGVb jWat5yNco6y22HNoJROoc/EGBBXF/EqNjiOsZlXJREbBx5d0e+7DnquL4eO4xTQ0Iq3m q3o2O22cRb6gFekJ+7pJyVjU7pMKamtbysIPMblyejkFVLZqTf0G9If0j9WWXAs4FG7J GjBMbbfeeRfzlGEY9SpNhFYUrNC9y25k5VyAELnlEbj8RA1l+c7MZjHEiRGfYkKN0e9y IaPg/DSQkKX50dlqyS67KpkVYebyO0s/UXC5KxHVjSfbmFGqjn44ZXBgogQP+t7ul5yD in/g== X-Gm-Message-State: AOJu0YzAr/j44AMly/DDgupdFS9PfkcUNTK01eURhZ/3J+L8bmpwxR6k kUKXYR9VTh96r7zPqiVSQ/n5SV6+GagnF2q/qOvqohlB9MXUzT54Bd4YzxLHJbyj9Yzv/VctVQW maMAm X-Google-Smtp-Source: AGHT+IFEDsgQJQWzDTlXWMJLewQobq6ssbFNJ+eOAbu5tP3JiuZWHUiibWebfMlAr/k1ZJuWEU82zA== X-Received: by 2002:a05:6402:75a:b0:5a2:2101:a70f with SMTP id 4fb4d7f45d1cf-5b7f3cc7fb0mr410404a12.16.1722524428841; Thu, 01 Aug 2024 08:00:28 -0700 (PDT) Received: from platypus.lan ([2a04:cec2:9:dc84:3622:6733:ff49:ee91]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63590592sm10252456a12.25.2024.08.01.08.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 08:00:28 -0700 (PDT) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Pierre-Emmanuel Patry Subject: [PATCH 102/125] gccrs: Change dfs function return type to support gcc 4.8 Date: Thu, 1 Aug 2024 16:57:38 +0200 Message-ID: <20240801145809.366388-104-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801145809.366388-2-arthur.cohen@embecosm.com> References: <20240801145809.366388-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Pierre-Emmanuel Patry GCC 4.8 does not handle pair with references correctly. We need to use a properly typed struct instead. gcc/rust/ChangeLog: * resolve/rust-forever-stack.h: Change dfs function prototype and declare dfs return type structure. * resolve/rust-forever-stack.hxx: Adapt dfs function to the new return type. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resolve/rust-forever-stack.h | 8 ++++++-- gcc/rust/resolve/rust-forever-stack.hxx | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index 3dab45e7e77..72b96bff3b3 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -596,10 +596,14 @@ private: SegIterator iterator); /* Helper functions for forward resolution (to_canonical_path, to_rib...) */ + struct DfsResult + { + Node &first; + std::string second; + }; // FIXME: Documentation - tl::optional> dfs (Node &starting_point, - NodeId to_find); + tl::optional dfs (Node &starting_point, NodeId to_find); // FIXME: Documentation tl::optional dfs_rib (Node &starting_point, NodeId to_find); }; diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index 6b622b8aef1..2c3cba59448 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -468,7 +468,7 @@ ForeverStack::resolve_path (const std::vector &segments) } template -tl::optional::Node &, std::string>> +tl::optional::DfsResult> ForeverStack::dfs (ForeverStack::Node &starting_point, NodeId to_find) { auto values = starting_point.rib.get_values (); @@ -498,7 +498,7 @@ ForeverStack::to_canonical_path (NodeId id) // back up to the root (parent().parent().parent()...) accumulate link // segments reverse them that's your canonical path - return dfs (root, id).map ([this, id] (std::pair tuple) { + return dfs (root, id).map ([this, id] (DfsResult tuple) { auto containing_node = tuple.first; auto name = tuple.second;