public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Eli Schwartz <eschwartz93@gmail.com>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH v2 4/7] distutils-r1.eclass: Make vars local before calling filter-lto
Date: Sat, 9 Mar 2024 20:58:28 -0500	[thread overview]
Message-ID: <ce53fdcf-af22-48d6-aded-96b36e1cef19@gmail.com> (raw)
In-Reply-To: <CAJ0EP41-GTFPdLyswVbA0ZXVssHDptC8aFWe5U4RQ5HHrudNLg@mail.gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1636 bytes --]

On 3/9/24 2:59 PM, Mike Gilbert wrote:
> On Tue, Mar 5, 2024 at 12:16 PM Michał Górny <mgorny@gentoo.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ł Górny <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 compiler
>>                 # 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}=${!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!


To be fair, when I suggested this in review of the patch it wasn't my
idea either. I shamelessly stole it from... flag-o-matic.eclass, where
it is used by filter-flags, replace-flags, is-flagq, strip-flags, get-flag.

filter-flags in turn is used by filter-lto, hence all-flag-vars is the
direct API that governs what variables filter-lto will modify. It seemed
fitting to single-source that information.


-- 
Eli Schwartz

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 18399 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-03-10  1:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 17:16 [gentoo-dev] [PATCH v2 0/7] distutils-r1.eclass + python-utils-r1.eclass + meson.eclass: combined patches Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 1/7] distutils-r1.eclass: Remove -Werror... hack (now in cython) Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 2/7] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 3/7] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 4/7] distutils-r1.eclass: Make vars local before calling filter-lto Michał Górny
2024-03-09 19:59   ` Mike Gilbert
2024-03-10  1:58     ` Eli Schwartz [this message]
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 5/7] python-utils-r1.eclass: Fix python_doheader install location with ROOT Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 6/7] meson.eclass: move python_export_utf8_locale to meson_src_configure Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 7/7] distutils-r1.eclass: wire up meson-python to meson.eclass Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce53fdcf-af22-48d6-aded-96b36e1cef19@gmail.com \
    --to=eschwartz93@gmail.com \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox