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.129.124]) by sourceware.org (Postfix) with ESMTPS id 49E823858C52 for ; Mon, 6 Feb 2023 20:48:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49E823858C52 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=1675716511; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zO/GBW+S/rkwn1VvQdkI4+X4NEJgC/HlV+QBJu6cxJI=; b=bwOsSsJJ1nRBsTbRO+XFNFevpmEU5ecqJYUFoDk8HD5mLrzmo2Q/0DMKlOJe7N3USDgkID zB58Je49DDnMhNZVfaiiuNNjv0KN8XbT7elF1F9c/5WYAlCFwn29zkrRXfXUhqjSNq5VvK rpteolOojR7XCTJtwaGZ1c2O9recKQg= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-319-UAFFOjQqPv6DoeYIETukxA-1; Mon, 06 Feb 2023 15:48:30 -0500 X-MC-Unique: UAFFOjQqPv6DoeYIETukxA-1 Received: by mail-lf1-f71.google.com with SMTP id a20-20020ac25214000000b004b57756f937so5281738lfl.3 for ; Mon, 06 Feb 2023 12:48:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=zO/GBW+S/rkwn1VvQdkI4+X4NEJgC/HlV+QBJu6cxJI=; b=sZx0g+kHgVNjLlsl9Ynf/2fh77JirJ7D1DScDjgyP6OoJ9DSFieXmKPHZBzTlrK/ZT F+As6/aQDBAPIghUoZpk3oCfZyoe64fJFPjWo1wd7Fm/VHCyXiebrK8jf7cxprEe4TYA RXALTgVAVseuHFiN5W5CgA2z0K8cn0yZ3M7IHXciOZNjbSHPVaHy4VVVU7HmFhdcr2qo /wo3TIQUp2y3jmD9rdrs1apidAen9xTPwc8isKPRmTApiWDMSSHhPygE/21QwEUJHVba pY5BSC7SzRssE0/Nu/Rrdvox6N1PJR2Z6rP1az4PUq1Spau1M6PFa5vq1kQNKrRXJwIS 8tdA== X-Gm-Message-State: AO0yUKVvsJBDxjbjXqwk9bdDvHKfqsbr2UwAJ7QpQ7U2vkSjYjYkDQuU bwcDiGD2mjSqZwTq4sgNhjOODgkDUjqcldDUzJYkpN3yuxWmQdfDiP7XmHSyWgPxG/lyBb+MmAc h8USNXIhIlLqYt2SnD0aV/V1FBnrlheE= X-Received: by 2002:a2e:680a:0:b0:28e:9e65:36be with SMTP id c10-20020a2e680a000000b0028e9e6536bemr95459lja.92.1675716508826; Mon, 06 Feb 2023 12:48:28 -0800 (PST) X-Google-Smtp-Source: AK7set8fbYD8rHKJ/sUEz6UN+08zzIT3glL1FlS83Rl2B1VFyPhCyiOsjc1jilsE8udk/CAGh8rajWQW80+y3y8CHqc= X-Received: by 2002:a2e:680a:0:b0:28e:9e65:36be with SMTP id c10-20020a2e680a000000b0028e9e6536bemr95456lja.92.1675716508390; Mon, 06 Feb 2023 12:48:28 -0800 (PST) MIME-Version: 1.0 References: <20230123124145.965541-1-arsen@aarsen.me> In-Reply-To: <20230123124145.965541-1-arsen@aarsen.me> From: Jonathan Wakely Date: Mon, 6 Feb 2023 20:48:17 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Document P1642 and extensions To: =?UTF-8?Q?Arsen_Arsenovi=C4=87?= Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 23 Jan 2023 at 12:49, Arsen Arsenovi=C4=87 via Libstdc++ wrote: > > libstdc++-v3/ChangeLog: > > * doc/xml/manual/using.xml: Document newly-freestanding > headers and the effect of the -ffreestanding flag. > * doc/xml/manual/status_cxx2023.xml: Document P1642R11 as > completed. > * doc/xml/manual/configure.xml: Document that hosted installs > respect __STDC_HOSTED__. > * doc/xml/manual/test.xml: Document how to run tests in > freestanding mode. > --- > Afternoon, > > This patch documents the freestanding changes that are to be included in > GCC 13. This revision assumes the changes submitted earlier about > building a nearly empty library in freestanding, and simplifies the > linking section a bit as a result. Due to -ffreestanding now working on > hosted builds of libstdc++, however, it still includes the advice of > ``gcc -lsupc++'' for those that are using hosted builds. Pushed to trunk, thanks! > > Thanks in advance, have a great day. > > libstdc++-v3/doc/xml/manual/configure.xml | 5 +- > .../doc/xml/manual/status_cxx2023.xml | 11 ++++ > libstdc++-v3/doc/xml/manual/test.xml | 14 ++++ > libstdc++-v3/doc/xml/manual/using.xml | 66 +++++++++++++++++-- > 4 files changed, 88 insertions(+), 8 deletions(-) > > diff --git a/libstdc++-v3/doc/xml/manual/configure.xml b/libstdc++-v3/doc= /xml/manual/configure.xml > index 8b3b8cab8c7..7ff07aea886 100644 > --- a/libstdc++-v3/doc/xml/manual/configure.xml > +++ b/libstdc++-v3/doc/xml/manual/configure.xml > @@ -362,7 +362,10 @@ > built. The C++ Standard also describes a > freestanding environment, in which only a > minimal set of headers are provided. This option builds such an > - environment. > + environment. Note that a hosted library installs headers that stil= l can > + be used in non hosted environments, as the library checks for > + __STDC_HOSTED__, however, a library configured with > + --disable-hosted-libstdcxx will not install unusable h= eaders. > > > > diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2023.xml b/libstdc++-v= 3/doc/xml/manual/status_cxx2023.xml > index 365df505f54..f23c64d6a29 100644 > --- a/libstdc++-v3/doc/xml/manual/status_cxx2023.xml > +++ b/libstdc++-v3/doc/xml/manual/status_cxx2023.xml > @@ -566,6 +566,17 @@ or any notes about the implementation. > > > > + > + Easy [utilities], [ranges], and [iterators] > + > + > + P1642R11 > + > + > + 13.1 > + > + > + > > > > diff --git a/libstdc++-v3/doc/xml/manual/test.xml b/libstdc++-v3/doc/xml/= manual/test.xml > index 7bc6e339723..964c53d2632 100644 > --- a/libstdc++-v3/doc/xml/manual/test.xml > +++ b/libstdc++-v3/doc/xml/manual/test.xml > @@ -350,6 +350,20 @@ cat 27_io/objects/char/3_xin.in | a.out > > > > + > + If you wish to run the testsuite in a freestanding configuration, = you can > + pass the -ffreestanding flag. Doing so will run the = tests > + that do not require hosted features, and emit a > + UNSUPPORTED for those that do. To run tests in= the > + freestanding configuration, you still need to build for a target y= ou can > + run programs on, e.g. x86_64-pc-linux-gnu, as a few t= ests > + still execute the code they build. Here's an example of how to ru= n the > + testsuite with libstdc++ in freestanding mode: > + > + make check-target-libstdc++-v3 RUNTESTFLAGS=3D'--target_board=3Dunix= /-ffreestanding' > + > + > + > > You can run the tests with a compiler and library that have > already been installed. Make sure that the compiler (e.g., > diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml= /manual/using.xml > index 9c444dd2997..7f011a6d931 100644 > --- a/libstdc++-v3/doc/xml/manual/using.xml > +++ b/libstdc++-v3/doc/xml/manual/using.xml > @@ -132,6 +132,17 @@ > > > > + > + -ffreestanding > + > + Limits the library to its freestanding subset. Headers that are > + not supported in freestanding will emit a "This header is not ava= ilable > + in freestanding mode" error. > + Headers that are in the freestanding subset partially will not ex= pose > + functionality that is not part of the freestanding subset. > + > + > + > > > > @@ -1523,19 +1534,60 @@ namespace gtk > > > > - There exists a library that offers runtime support for > - just these headers, and it is called > - libsupc++.a. To use it= , compile with gcc instead of g++, li= ke so: > + > + As of GCC 13, libstdc++ implements P1642, which brings in many mo= re > + headers, as well a quite a few ones not covered by the paper. > + > + In general, if a feature does not require traditionally libc-prov= ided > + facilities, or dynamic memory allocation, it's enabled in the > + freestanding subset. In addition, if only a subset of a header > + requires such features, it is partially included. Some examples > + include: > + > + > + > + > + > + string_view > + > + > + > + > + tuple > + > + > + > + > + bitset > + > + > + > + > + > + Currently, this subset includes all of the iterator APIs (includi= ng the > + ranges APIs) that do not involve streams, the entire C++ algorith= ms > + library, excluding parallel algorithms, and a large part of the > + utilities library. This is on top of the headers included in the= lists > + above. > + > + > + > + If you're using a libstdc++ configured for hosted environments, a= nd > + would like to not involve the libraries libstdc++ would depend on= in > + your programs, you will need to use gcc to lin= k your > + application with only libsupc++.a= , > + like so: > > > > - gcc foo.cc -lsupc++ > + gcc -ffreestanding foo.cc -lsupc++ > > > > - No attempt is made to verify that only the minimal subset > - identified above is actually used at compile time. Violations > - are diagnosed as undefined symbols at link time. > + If you configured libstdc++ with > + --disable-hosted-libstdcxx, however, you can use the > + normal g++ command to link, as this configurat= ion > + provides a (nearly) empty libstdc= ++.a. > > > > -- > 2.39.1 >