From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 405883858C2C for ; Thu, 1 Jun 2023 20:06:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 405883858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685650013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uUviIUYcvRhoQKpUawKPHl1DwwQhJYxiI7LuTUJoc/8=; b=jQxX8BLzdL83BL9aNqUh0m50OKfG8l6tLnOzjVnhy9QI+Sd1neKjpED6Kc9HJAn2GxIRZY Jj64MgN/dlboqh7KXhxAFzDYpd6mq0pgoGZgPRZS/riQE38/Zsq8O5aRRBSV3sU/++tl0H mCHANRuCUNQi0+vk1p0MkjLezOligd0= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-quA8z9ZQPTabIeVBBtR-FA-1; Thu, 01 Jun 2023 16:06:52 -0400 X-MC-Unique: quA8z9ZQPTabIeVBBtR-FA-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2af31539394so12224681fa.3 for ; Thu, 01 Jun 2023 13:06:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685650010; x=1688242010; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uUviIUYcvRhoQKpUawKPHl1DwwQhJYxiI7LuTUJoc/8=; b=kNiN03B+8JPmRCt+KXcKyi0vb1sEq8Kt771QG4hohkb9ru04hR/I277i7XRsMKXgNy q58gtdZiCYiud11tumHFNDZBvkl/oQ4lZp4yvIp1Z8g7utBMVBoZa8T/wkRK5hexcPEF RBxKSP+mepjl40Aaltas/qMmcqfsaHET3Pywf7SEOt+Vs7OsxoKjufeusFaHZEhULkMq OA96hiWA+jVyWsbyHzVwLm13SKxg+DVHVydxpL3YO0kUhMz/6/s7jliLOZ4a+H42M5Zf yMYjBLy/mOLJ/NQDa816wtDkFqcBac4r8VFU9t12gWiUh7koAZzwNh62DuCBq7k/pkBg JBbQ== X-Gm-Message-State: AC+VfDzYIWOQhmgXyeVgeI1l+2zTTi8u/LOAEXcRbl9/wf9Or+DeOGdR e5uXJa2b4DTliQ2Xn2s8LGKMBt+GQGb08+SQqwSH1wPbktzGDLgIoM7PyKfLB/zpiXz3V6Jh+JL XpOXcO8VsPOVH8eHG0NE50xpatbpR5tQ= X-Received: by 2002:a2e:9b89:0:b0:2b1:a8e9:d0f0 with SMTP id z9-20020a2e9b89000000b002b1a8e9d0f0mr334774lji.18.1685650010802; Thu, 01 Jun 2023 13:06:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DqNimceY/EiYaS2HLkHTJ8npzgRcot/8VaE+NqvOGp1jC09cAs+py8jfand6V+KYF3Va4w8OwOQ+VK5+DZZk= X-Received: by 2002:a2e:9b89:0:b0:2b1:a8e9:d0f0 with SMTP id z9-20020a2e9b89000000b002b1a8e9d0f0mr334760lji.18.1685650010398; Thu, 01 Jun 2023 13:06:50 -0700 (PDT) MIME-Version: 1.0 References: <20230429101640.1697750-1-arsen@aarsen.me> <20230429101640.1697750-2-arsen@aarsen.me> In-Reply-To: <20230429101640.1697750-2-arsen@aarsen.me> From: Jonathan Wakely Date: Thu, 1 Jun 2023 21:06:39 +0100 Message-ID: Subject: Re: [PATCH 1/2] libstdc++: Implement more maintainable header To: =?UTF-8?Q?Arsen_Arsenovi=C4=87?= Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="00000000000015f8c505fd16fa55" X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --00000000000015f8c505fd16fa55 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 29 Apr 2023 at 11:25, Arsen Arsenovi=C4=87 via Libstdc++ < libstdc++@gcc.gnu.org> wrote: > This commit replaces the ad-hoc logic in with an AutoGen > database that (mostly) declaratively generates a version.h bit which > combines all of the FTM logic across all headers together. > > This generated header defines macros of the form __glibcxx_foo, > equivalent to their __cpp_lib_foo variants, according to rules specified > in version.def and, optionally, if __glibcxx_want_foo or > __glibcxx_want_all are defined, also defines __cpp_lib_foo forms with > the same definition. > > libstdc++-v3/ChangeLog: > > * include/Makefile.am (bits_freestanding): Add version.h. > (allcreated): Add version.h. > (${bits_srcdir}/version.h): New rule. Regenerates > version.h out of version.{def,tpl}. > * include/Makefile.in: Regenerate. > * include/bits/version.def: New file. Declares a list of > all feature test macros, their values and their preconditions. > * include/bits/version.tpl: New file. Turns version.def > into a sequence of #if blocks. > * include/bits/version.h: New file. Generated from > version.def. > * include/std/version: Replace with a __glibcxx_want_all define > and bits/version.h include. > --- > libstdc++-v3/include/Makefile.am | 10 +- > libstdc++-v3/include/Makefile.in | 10 +- > libstdc++-v3/include/bits/version.def | 1591 ++++++++++++++++++++ > libstdc++-v3/include/bits/version.h | 1937 +++++++++++++++++++++++++ > libstdc++-v3/include/bits/version.tpl | 209 +++ > libstdc++-v3/include/std/version | 350 +---- > 6 files changed, 3758 insertions(+), 349 deletions(-) > create mode 100644 libstdc++-v3/include/bits/version.def > create mode 100644 libstdc++-v3/include/bits/version.h > create mode 100644 libstdc++-v3/include/bits/version.tpl > > diff --git a/libstdc++-v3/include/Makefile.am > b/libstdc++-v3/include/Makefile.am > index a880e8ee227..a07b4c18585 100644 > --- a/libstdc++-v3/include/Makefile.am > +++ b/libstdc++-v3/include/Makefile.am > @@ -154,6 +154,7 @@ bits_freestanding =3D \ > ${bits_srcdir}/stl_raw_storage_iter.h \ > ${bits_srcdir}/stl_relops.h \ > ${bits_srcdir}/stl_uninitialized.h \ > + ${bits_srcdir}/version.h \ > ${bits_srcdir}/string_view.tcc \ > ${bits_srcdir}/uniform_int_dist.h \ > ${bits_srcdir}/unique_ptr.h \ > @@ -1113,7 +1114,8 @@ allcreated =3D \ > ${host_builddir}/c++config.h \ > ${host_builddir}/largefile-config.h \ > ${thread_host_headers} \ > - ${pch_build} > + ${pch_build} \ > + ${bits_srcdir}/version.h > > # Here are the rules for building the headers > all-local: ${allstamped} ${allcreated} > @@ -1463,6 +1465,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output} > -mkdir -p ${pch3_output_builddir} > $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@ > > +# AutoGen . > +${bits_srcdir}/version.h: ${bits_srcdir}/version.def \ > + ${bits_srcdir}/version.tpl > + cd $(@D) && \ > + autogen version.def > It looks like this will regenerate the bits/version.h file if it's older than the definitions or the autogen template, right? Generally we don't want to touch anything in the source tree as part of a normal build. It's OK to do that when configured with --enable-maintainer-mode (which nobody working on libstdc++ actually uses, because it causes problems IME) or via a dedicated target which is not built by default (e.g. doc/Makefile.am has the doc-html-docbook-regenerate target, which is isn't a prereq of any other targets so it's only run if you explicitly request it). The problem with modifying the source tree as part of a normal build is that it might be on read-only media, and so the build will fail if this target can't be updated. We would also want to add the version.h header to the contrib/gcc_update script that updates the timestamps of generated files, so that they are always newer than their prereqs. Maybe the best option here is to assume that version.h is always up to date, and add a custom target to regen it manually, which we can run after editing the .def or .tpl files. What do you think? My only other concern with this patch is that I don't speak lisp so the Guile code in version.tpl is opaque and unmaintainable for me. That is fixable though. --00000000000015f8c505fd16fa55--