public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Arsen Arsenović" <arsen@aarsen.me>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org, "Arsen Arsenović" <arsen@aarsen.me>
Subject: [PATCH 0/2] Unify and deduplicate FTM code
Date: Sat, 29 Apr 2023 12:16:38 +0200	[thread overview]
Message-ID: <20230429101640.1697750-1-arsen@aarsen.me> (raw)

Greetings!

This patch set replaces all code that involves defining feature test
macros based on loosely put together conditionals in the standard
library with a unified helper for specifying and requiring feature test
macros, as well as updating most usage sites, many of which have been
migrated to following a pattern similar, in structure, to:

  ...
  #define __glibcxx_want_foo
  #include <bits/version.h>
  ...
  namespace std {
  ...
  #ifdef __cpp_lib_foo
    template<typename T>
    void foonicate(T&& t)
    { __builtin_foonicate_address(std::__addressof(t)); }
  #endif // __cpp_lib_foo
  ...
  } // namespace std

In the future this should aid in preventing <version> from being
dishonest about what the implementation provides, as well as reducing
the amount of finicky work it takes to update FTMs.

Note that this patchset is not perfect.  The usage sites of various
feature test macros still include "wide" condition blocks that shadow
over the blocks that check for FTMs, mostly in places where features
with FTMs are the exception, rather than the norm.

That said, using a pair of scripts[1][2], I've tested that the code
emitted in bits/stdc++.h remains unchanged (save for a misdeclared
__cpp_lib_constexpr_string in !HOSTED), as well as regression-tested
--enable-languages=c,c++,lto on x86_64-pc-linux-gnu, and ran the
libstdc++ testsuite with

  --target_board="unix{,-std=c++98,-std=gnu++11,-std=gnu++20,
  -D_GLIBCXX_USE_CXX11_ABI=0/-D_GLIBCXX_DEBUG,-D_GLIBCXX_DEBUG,
  -std=gnu++23}{-fno-freestanding,-ffreestanding}"

(without the line breaks) to find no relevant failures.

OK for trunk?

Thanks in advance, have a lovely day.

[1] https://git.sr.ht/~arsen/scripts/tree/master/item/difall.bash
[2] https://git.sr.ht/~arsen/scripts/tree/master/item/vercmp.bash

Arsen Arsenović (2):
  libstdc++: Implement more maintainable <version> header
  libstdc++: Replace all manual FTM definitions and use

 libstdc++-v3/include/Makefile.am              |   10 +-
 libstdc++-v3/include/Makefile.in              |   10 +-
 libstdc++-v3/include/bits/algorithmfwd.h      |    7 +-
 libstdc++-v3/include/bits/align.h             |    8 +-
 libstdc++-v3/include/bits/alloc_traits.h      |   11 +-
 libstdc++-v3/include/bits/allocator.h         |    3 +-
 libstdc++-v3/include/bits/atomic_base.h       |   14 +-
 libstdc++-v3/include/bits/atomic_wait.h       |   10 +-
 libstdc++-v3/include/bits/basic_string.h      |   24 +-
 libstdc++-v3/include/bits/char_traits.h       |   11 +-
 libstdc++-v3/include/bits/chrono.h            |   18 +-
 libstdc++-v3/include/bits/cow_string.h        |    9 +-
 libstdc++-v3/include/bits/erase_if.h          |   11 +-
 libstdc++-v3/include/bits/forward_list.h      |    6 +-
 libstdc++-v3/include/bits/hashtable.h         |    9 +-
 libstdc++-v3/include/bits/ios_base.h          |    6 +-
 libstdc++-v3/include/bits/move.h              |    8 +-
 .../include/bits/move_only_function.h         |    9 +-
 libstdc++-v3/include/bits/node_handle.h       |    8 +-
 libstdc++-v3/include/bits/ptr_traits.h        |   15 +-
 libstdc++-v3/include/bits/range_access.h      |   16 +-
 libstdc++-v3/include/bits/ranges_algo.h       |   27 +-
 libstdc++-v3/include/bits/ranges_cmp.h        |   14 +-
 libstdc++-v3/include/bits/shared_ptr.h        |   10 +-
 libstdc++-v3/include/bits/shared_ptr_atomic.h |    6 +-
 libstdc++-v3/include/bits/shared_ptr_base.h   |   17 +-
 libstdc++-v3/include/bits/specfun.h           |    6 +-
 libstdc++-v3/include/bits/stl_algo.h          |   20 +-
 libstdc++-v3/include/bits/stl_algobase.h      |   13 +-
 libstdc++-v3/include/bits/stl_function.h      |   28 +-
 libstdc++-v3/include/bits/stl_iterator.h      |   21 +-
 libstdc++-v3/include/bits/stl_list.h          |    6 +-
 libstdc++-v3/include/bits/stl_map.h           |    6 +-
 libstdc++-v3/include/bits/stl_pair.h          |   12 +-
 libstdc++-v3/include/bits/stl_queue.h         |    9 +-
 libstdc++-v3/include/bits/stl_stack.h         |    7 +-
 libstdc++-v3/include/bits/stl_tree.h          |    7 +-
 libstdc++-v3/include/bits/stl_uninitialized.h |    9 +-
 libstdc++-v3/include/bits/stl_vector.h        |    4 +-
 libstdc++-v3/include/bits/unique_ptr.h        |   13 +-
 libstdc++-v3/include/bits/unordered_map.h     |    8 +-
 .../include/bits/uses_allocator_args.h        |   10 +-
 libstdc++-v3/include/bits/utility.h           |   21 +-
 libstdc++-v3/include/bits/version.def         | 1591 ++++++++++++++
 libstdc++-v3/include/bits/version.h           | 1937 +++++++++++++++++
 libstdc++-v3/include/bits/version.tpl         |  209 ++
 .../include/c_compatibility/stdatomic.h       |    9 +-
 libstdc++-v3/include/c_global/cmath           |   18 +-
 libstdc++-v3/include/c_global/cstddef         |    9 +-
 libstdc++-v3/include/std/algorithm            |   10 +-
 libstdc++-v3/include/std/any                  |    9 +-
 libstdc++-v3/include/std/array                |    9 +-
 libstdc++-v3/include/std/atomic               |   67 +-
 libstdc++-v3/include/std/barrier              |   11 +-
 libstdc++-v3/include/std/bit                  |   30 +-
 libstdc++-v3/include/std/bitset               |    7 +-
 libstdc++-v3/include/std/charconv             |   11 +-
 libstdc++-v3/include/std/complex              |   11 +-
 libstdc++-v3/include/std/concepts             |   10 +-
 libstdc++-v3/include/std/coroutine            |   20 +-
 libstdc++-v3/include/std/deque                |    9 +-
 libstdc++-v3/include/std/execution            |   10 +-
 libstdc++-v3/include/std/expected             |    8 +-
 libstdc++-v3/include/std/filesystem           |    9 +-
 libstdc++-v3/include/std/format               |   19 +-
 libstdc++-v3/include/std/forward_list         |   10 +-
 libstdc++-v3/include/std/functional           |   39 +-
 libstdc++-v3/include/std/iomanip              |    9 +-
 libstdc++-v3/include/std/iterator             |    5 +-
 libstdc++-v3/include/std/latch                |   10 +-
 libstdc++-v3/include/std/list                 |   10 +-
 libstdc++-v3/include/std/memory               |   15 +-
 libstdc++-v3/include/std/memory_resource      |   20 +-
 libstdc++-v3/include/std/mutex                |    8 +-
 libstdc++-v3/include/std/numbers              |    8 +-
 libstdc++-v3/include/std/numeric              |   35 +-
 libstdc++-v3/include/std/optional             |   15 +-
 libstdc++-v3/include/std/ranges               |   60 +-
 libstdc++-v3/include/std/semaphore            |    9 +-
 libstdc++-v3/include/std/shared_mutex         |   12 +-
 libstdc++-v3/include/std/source_location      |    9 +-
 libstdc++-v3/include/std/span                 |   11 +-
 libstdc++-v3/include/std/spanstream           |   11 +-
 libstdc++-v3/include/std/stacktrace           |   10 +-
 libstdc++-v3/include/std/stop_token           |    5 +-
 libstdc++-v3/include/std/string               |    9 +-
 libstdc++-v3/include/std/string_view          |   23 +-
 libstdc++-v3/include/std/syncstream           |   17 +-
 libstdc++-v3/include/std/thread               |    3 +
 libstdc++-v3/include/std/tuple                |   25 +-
 libstdc++-v3/include/std/type_traits          |  141 +-
 libstdc++-v3/include/std/utility              |   38 +-
 libstdc++-v3/include/std/variant              |   13 +-
 libstdc++-v3/include/std/vector               |    9 +-
 libstdc++-v3/include/std/version              |  350 +--
 libstdc++-v3/libsupc++/compare                |   11 +-
 libstdc++-v3/libsupc++/exception              |    6 +-
 libstdc++-v3/libsupc++/new                    |   20 +-
 libstdc++-v3/libsupc++/typeinfo               |    7 +-
 .../array/tuple_interface/get_neg.cc          |    6 +-
 100 files changed, 4445 insertions(+), 1064 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

-- 
2.40.1


             reply	other threads:[~2023-04-29 10:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29 10:16 Arsen Arsenović [this message]
2023-04-29 10:16 ` [PATCH 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
2023-06-01 20:06   ` Jonathan Wakely
2023-08-07 17:22     ` Arsen Arsenović
2023-04-29 10:16 ` [PATCH 2/2] libstdc++: Replace all manual FTM definitions and use Arsen Arsenović
2023-06-01 20:30   ` Jonathan Wakely
2023-08-07 17:34     ` Arsen Arsenović
2023-08-07 17:38     ` Arsen Arsenović
2023-05-08 23:08 ` Ping: [PATCH 0/2] Unify and deduplicate FTM code Arsen Arsenović

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=20230429101640.1697750-1-arsen@aarsen.me \
    --to=arsen@aarsen.me \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).