This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/8] Reduce/remove dependencies on _GLIBCXX_USE_C99_STDINT_TR1

From: Jonathan Wakely <>

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]