libstdc++: Reduce header dependencies for C++20 (PR 92546)
authorJonathan Wakely <jwakely@redhat.com>
Mon, 17 Feb 2020 15:25:33 +0000 (15:25 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 17 Feb 2020 15:43:43 +0000 (15:43 +0000)
commit9cd4eeefcc641dd70d026e08e9d218101b826c52
tree56fbd7edf0607751c80663be94d29d83e0217fd0
parentc03b53da9129ae2d5ac9629c4b874d0981a7d418
libstdc++: Reduce header dependencies for C++20 (PR 92546)

In C++20 <memory> depends on <bits/ranges_unitialized.h> which
depends on <bits/random.h> just for a single concept. Including
<bits/random.h> also requires including <cmath>, which is huge due to
the C++17 special functions.

This change moves the concept to the <bits/uniform_int_dist.h> internal
header that exists so that <bits/stl_algobase.h> doesn't need to include
<bits/random.h>.

PR libstdc++/92546 (partial)
* include/bits/random.h (uniform_random_bit_generator): Move definition
to <bits/uniform_int_dist.h>.
* include/bits/ranges_algo.h: Include <bits/uniform_int_dist.h> instead
of <bits/random.h>.
* include/bits/ranges_algobase.h: Do not include <cmath>.
* include/bits/uniform_int_dist.h (uniform_random_bit_generator):
Move here.
* include/std/ranges: Do not include <limits>.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/random.h
libstdc++-v3/include/bits/ranges_algo.h
libstdc++-v3/include/bits/ranges_algobase.h
libstdc++-v3/include/bits/uniform_int_dist.h
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc