[patch] bootstrap/69464 Avoid including all of <random> in <algorithm>

Jonathan Wakely jwakely@redhat.com
Mon Jan 25 16:44:00 GMT 2016


In C++11 mode <algorithm> defines std::shuffle which uses
std::uniform_int_distribution. It doesn't need the rest of <random>,
which is huge, especially on x86 with SSE3 support, where pmmintrin.h
is pulled in.

This moves the definition of std::uniform_int_distribution to a new
header, and makes <algorithm> include that instead of <random>.  That
removes 23kloc from <algorithm>, making it much less of a problem for
the rest of the compiler to use <algorithm> during bootstrap.

The change revealed a few testsuite bugs where tests (incorrectly)
relied on <algorithm> pulling in <memory> or <vector> indirectly.
It's likely that some programs will stop compiling because of this
change, the fix will be to add the necessary headers.

Tested x86_64-linux and powerpc64-linux, committed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 25033 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20160125/19416258/attachment.bin>


More information about the Libstdc++ mailing list