If normal user code that includes <limits> gets this warning (built with
an installed compiler), that needs fixing in some way. If not, what is
different about how GCC uses its own libstdc++? (For example, it's
important to include system headers with -isystem not -I, does GCC get
this right when building with the libstdc++ from a previous stage of
bootstrap?)
No, normal user code doesn't get the warning, only gcc. On your clue I
checked stage 2 flags though, and it turns out that libstdc++ headers
are normally included with -I, except with -isystem in lean mode.
(Indeed, `make bootstrap-lean` builds fine with my patch 2/2 sans the
changes to compile flags, whereas `make bootstrap` fails without them.)
The differentiation between normal and lean modes were added in [1] as a
fix for PR58572 [2], before which it was always -I since forever [3].
I can create a separate patch to use -isystem unconditionally, however
there seems to be a contradiction between what you're stating about its
use and what earlier authors did. Can you advise?
BR,
Gábor
[1]
https://gcc.gnu.org/cgit/gcc/commit/?id=3b9edeac73a88b00a06b1822a25fdd287315b146
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58572
[3]
https://gcc.gnu.org/cgit/gcc/commit/?id=f61428ed3c6921fb19b70d103d32ba072f6dadcd