public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Reduce/remove dependencies on _GLIBCXX_USE_C99_STDINT_TR1
@ 2018-07-26 14:02 jwakely
  2018-07-26 14:02 ` [PATCH 2/8] Remove char16_t and char32_t dependency on <stdint.h> jwakely
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: jwakely @ 2018-07-26 14:02 UTC (permalink / raw)
  To: libstdc++, gcc-patches

From: Jonathan Wakely <jwakely@redhat.com>

Currently huge swathes of the library are only enabled conditionally by:

#ifdef _GLIBCXX_USE_C99_STDINT_TR1

This macro was created as part of the TR1 implementation, to detect whether
the C++98 compiler has access to a working <stdint.h> header from C99. In
C++11 that header is required, and may even be provided by GCC itself. Having
a large portion of the C++11 library depend on a feature that is almost
guaranteed to be present for C++11 just complicates and obfuscates the code.

There are also a number of places that use features that depend on the macro,
but aren't guarded by the macro. This means if the macro were to be undefined
for some target, the library wouldn't even build!

Several of the dependencies turn out to be unnecessary. For example every
instantiation of strings and streams using char16_t was guarded by the macro,
because char_traits wants to use std::uint_least16_t (and similarly for
char32_t). We can define good-enough char_traits specializations even if the
<stdint.h> types are not available. Every use of <chrono> is guarded by the
macro, because <chrono> depends on <ratio> and that uses std::intmax_t and
std::uintmax_t. By defining those two types in <cstdint> even when we don't
have a working <stdint.h> we can define most of the C++11 concurrency library
unconditionally (or to be only conditional on _GLIBCXX_HAS_GTHREADS).

The remaining dependencies are related to <random>, which makes heavy use of
the <stdint.h> types. I haven't tried to do anything about that, but have
added some missing checks for the macro, and some missing dg-require-cstdint
directives to tests that depend on <random> or <tr1/random>.

Tested powerpc64le-linux, committed to trunk.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-07-26 16:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26 14:02 [PATCH 0/8] Reduce/remove dependencies on _GLIBCXX_USE_C99_STDINT_TR1 jwakely
2018-07-26 14:02 ` [PATCH 2/8] Remove char16_t and char32_t dependency on <stdint.h> jwakely
2018-07-26 15:52   ` Marek Polacek
2018-07-26 15:59     ` Jonathan Wakely
2018-07-26 16:00       ` Jonathan Wakely
2018-07-26 14:02 ` [PATCH 6/8] Remove dg-require-cstdint directive from tests jwakely
2018-07-26 14:02 ` [PATCH 3/8] Modify some library internals to work without <stdint.h> jwakely
2018-07-26 14:02 ` [PATCH 4/8] Add missing checks for _GLIBCXX_USE_C99_STDINT_TR1 jwakely
2018-07-26 14:02 ` [PATCH 1/8] Remove <chrono> dependency on _GLIBCXX_USE_C99_STDINT_TR1 jwakely
2018-07-26 14:02 ` [PATCH 5/8] Remove dg-require-cstdint directive from tests jwakely
2018-07-26 14:02 ` [PATCH 8/8] Add missing dg-require-cstdint directives to tests jwakely
2018-07-26 14:02 ` [PATCH 7/8] Remove dg-require-cstdint directive from tests jwakely
2018-07-26 15:59 ` [PATCH 0/8] Reduce/remove dependencies on _GLIBCXX_USE_C99_STDINT_TR1 Cesar Philippidis
2018-07-26 16:03   ` Jonathan Wakely

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).