gcc/libstdc++-v3/testsuite/28_regex
Jonathan Wakely e9f64fff64 libstdc++: Reduce header dependencies in <regex>
This reduces the size of <regex> a little. This is one of the largest
and slowest headers in the library.

By using <bits/stl_algobase.h> and <bits/stl_algo.h> instead of
<algorithm> we don't need to parse all the parallel algorithms and
std::ranges:: algorithms that are not needed by <regex>. Similarly, by
using <bits/stl_tree.h> and <bits/stl_map.h> instead of <map> we don't
need to parse the definition of std::multimap.

The _State_info type is not movable or copyable, so doesn't need to use
std::unique_ptr<bool[]> to manage a bitset, we can just delete it in the
destructor. It would use a lot less space if we used a bitset instead,
but that would be an ABI break. We could do it for the versioned
namespace, but this patch doesn't do so. For future reference, using
vector<bool> would work, but would increase sizeof(_State_info) by two
pointers, because it's three times as large as unique_ptr<bool[]>. We
can't use std::bitset because the length isn't constant. We want a
bitset with a non-constant but fixed length.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex_executor.h (_State_info): Replace
	unique_ptr<bool[]> with array of bool.
	* include/bits/regex_executor.tcc: Likewise.
	* include/bits/regex_scanner.tcc: Replace std::strchr with
	__builtin_strchr.
	* include/std/regex: Replace standard headers with smaller
	internal ones.
	* testsuite/28_regex/traits/char/lookup_classname.cc: Include
	<string.h> for strlen.
	* testsuite/28_regex/traits/char/lookup_collatename.cc:
	Likewise.
2021-08-03 15:24:52 +01:00
..
algorithms Update copyright years. 2021-01-04 10:26:59 +01:00
basic_regex libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
constants Update copyright years. 2021-01-04 10:26:59 +01:00
headers/regex Update copyright years. 2021-01-04 10:26:59 +01:00
iterators Update copyright years. 2021-01-04 10:26:59 +01:00
match_results libstdc++: Remove redundant -std=gnu++17 option from PMR tests 2021-05-10 16:22:53 +01:00
regex_error Update copyright years. 2021-01-04 10:26:59 +01:00
requirements Update copyright years. 2021-01-04 10:26:59 +01:00
sub_match Update copyright years. 2021-01-04 10:26:59 +01:00
traits libstdc++: Reduce header dependencies in <regex> 2021-08-03 15:24:52 +01:00
init-list.cc Update copyright years. 2021-01-04 10:26:59 +01:00
range_access.cc Update copyright years. 2021-01-04 10:26:59 +01:00
regression.cc Update copyright years. 2021-01-04 10:26:59 +01:00
simple_c++11.cc Update copyright years. 2021-01-04 10:26:59 +01:00