From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-dev+bounces-101402-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 1C7DA158041
	for <garchives@archives.gentoo.org>; Sat,  9 Mar 2024 20:00:11 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id AA79AE2A44;
	Sat,  9 Mar 2024 20:00:06 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5B6B0E2A32
	for <gentoo-dev@lists.gentoo.org>; Sat,  9 Mar 2024 20:00:06 +0000 (UTC)
Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-dc745927098so2839681276.3
        for <gentoo-dev@lists.gentoo.org>; Sat, 09 Mar 2024 12:00:04 -0800 (PST)
X-Gm-Message-State: AOJu0YyVfgJM0EXG0j6+7AYzXQ98J9aazAeP5hzMVJIn2zAqtRmswXGi
	eR7qvwrfqy36t0PC3eOtumATpYCi27LdthPnXeIJnezEdsU2faqyD0q8GXt4iNa+WjdRzb/s87M
	KRMv5haDMs39cm3uQiOa/YTeKEJk=
X-Google-Smtp-Source: AGHT+IGkUP2SpAOdg90i7umFpbaY6ZBcPAZiAEd93s+Sv2CrcNDpedmxx90khPKmB8ohJGJboV/fu/0ZEGYWE/qPp2I=
X-Received: by 2002:a25:d810:0:b0:dcc:787:e8f9 with SMTP id
 p16-20020a25d810000000b00dcc0787e8f9mr1746872ybg.51.1710014401162; Sat, 09
 Mar 2024 12:00:01 -0800 (PST)
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@lists.gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
MIME-Version: 1.0
References: <20240305171812.125985-1-mgorny@gentoo.org> <20240305171812.125985-5-mgorny@gentoo.org>
In-Reply-To: <20240305171812.125985-5-mgorny@gentoo.org>
From: Mike Gilbert <floppym@gentoo.org>
Date: Sat, 9 Mar 2024 14:59:50 -0500
X-Gmail-Original-Message-ID: <CAJ0EP41-GTFPdLyswVbA0ZXVssHDptC8aFWe5U4RQ5HHrudNLg@mail.gmail.com>
Message-ID: <CAJ0EP41-GTFPdLyswVbA0ZXVssHDptC8aFWe5U4RQ5HHrudNLg@mail.gmail.com>
Subject: Re: [gentoo-dev] [PATCH v2 4/7] distutils-r1.eclass: Make vars local
 before calling filter-lto
To: gentoo-dev@lists.gentoo.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 4fd00ebe-3aae-46ba-8590-d16eb1e28eaf
X-Archives-Hash: c5665eabf61e90c69f44adc4f07e8b49

On Tue, Mar 5, 2024 at 12:16=E2=80=AFPM Micha=C5=82 G=C3=B3rny <mgorny@gent=
oo.org> wrote:
>
> Make LTO filtering local to the compilation code.  This avoids disabling
> LTO for non-Python parts of an ebuild.
>
> Signed-off-by: Micha=C5=82 G=C3=B3rny <mgorny@gentoo.org>
> ---
>  eclass/distutils-r1.eclass | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
> index ee1dcef24ff6..134cb39f276a 100644
> --- a/eclass/distutils-r1.eclass
> +++ b/eclass/distutils-r1.eclass
> @@ -1828,6 +1828,10 @@ distutils-r1_run_phase() {
>                 # Rust extensions are incompatible with C/C++ LTO compile=
r
>                 # see e.g. https://bugs.gentoo.org/910220
>                 if has cargo ${INHERITED}; then
> +                       local x
> +                       for x in $(all-flag-vars); do
> +                               local -x "${x}=3D${!x}"
> +                       done
>                         filter-lto
>                 fi
>         fi

I had never thought to loop over all-flag-vars like this. Added to my
mental code repo, thanks!