https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92546
Bug ID: 92546
Summary: [10 Regression] Large increase in preprocessed file
sizes in C++2a mode
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
For <array>:
: | g++ -std=c++11 -P -E -x c++ - -include array | wc -l
5141
: | g++ -std=c++14 -P -E -x c++ - -include array | wc -l
5376
: | g++ -std=c++17 -P -E -x c++ - -include array | wc -l
5814
: | g++ -std=c++2a -P -E -x c++ - -include array | wc -l
7729
Some of this increase is due to the extra std::ranges code in
<bits/range_access.h> so maybe that should be in a separate header, which is
only included where needed. However, with GCC 9 <array> was 12kloc even in
C++11 mode, so it's already much better (that changed with r272011).
For <vector> the increase for C++20 is much worse:
: | g++ -std=c++2a -P -E -x c++ - -include array | wc -l
7729
: | g++ -std=c++11 -P -E -x c++ - -include vector | wc -l
9191
: | g++ -std=c++14 -P -E -x c++ - -include vector | wc -l
9377
: | g++ -std=c++17 -P -E -x c++ - -include vector | wc -l
9910
: | g++ -std=c++2a -P -E -x c++ - -include vector | wc -l
18279
I think this is due to including the whole of <bits/stl_algo.h> in order to use
std::remove and std::remove_if. Those two algos should be moved to another
header (maybe <bits/stl_algobase.h> which is already included).