mbox series

[0/8] Reduce/remove dependencies on _GLIBCXX_USE_C99_STDINT_TR1

Message ID cover.1532613690.git.jwakely@redhat.com
Headers show
Series Reduce/remove dependencies on _GLIBCXX_USE_C99_STDINT_TR1 | expand

Message

Jonathan Wakely July 26, 2018, 2:01 p.m. UTC
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.

Comments

Cesar Philippidis July 26, 2018, 3:59 p.m. UTC | #1
On 07/26/2018 07:01 AM, jwakely@redhat.com wrote:
> From: Jonathan Wakely <jwakely@redhat.com>

It looks like you're using git send-email for this patch series. And it
seems like you made the same mistake that I did when you configured git
sendmail.from. According to the git sent-email manpage, from should be
your email address, however, it really wants it to be in of the form

  Full Name <email@foo.com>

This is not a huge deal because the email went through, but it was
something that wasn't immediately obvious to me.

Cesar
Jonathan Wakely July 26, 2018, 4:03 p.m. UTC | #2
On 26/07/18 08:59 -0700, Cesar Philippidis wrote:
>On 07/26/2018 07:01 AM, jwakely@redhat.com wrote:
>> From: Jonathan Wakely <jwakely@redhat.com>
>
>It looks like you're using git send-email for this patch series. And it
>seems like you made the same mistake that I did when you configured git
>sendmail.from. According to the git sent-email manpage, from should be
>your email address, however, it really wants it to be in of the form
>
>  Full Name <email@foo.com>
>
>This is not a huge deal because the email went through, but it was
>something that wasn't immediately obvious to me.

Indeed :-)

I already changed the config, but thanks for confirming it was what
caused the problem.