]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix up <ext/pointer.h> [PR121827]
authorJakub Jelinek <jakub@redhat.com>
Mon, 8 Sep 2025 09:49:58 +0000 (11:49 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 14 Oct 2025 19:11:08 +0000 (21:11 +0200)
During the tests mentioned in
https://gcc.gnu.org/pipermail/gcc-patches/2025-August/692482.html
(but dunno why I haven't noticed it back in August but only when testing
https://gcc.gnu.org/pipermail/gcc-patches/2025-September/694527.html )
I've noticed two ext header problems.
One is that #include <ext/pointer.h> got broken with the
r13-3037-g18f176d0b25591e28 change and since then is no longer
self-contained, as it includes iosfwd only if _GLIBCXX_HOSTED is defined
but doesn't actually include bits/c++config.h to make sure it is defined,
then includes a bunch of headers which do include bits/c++config.h and
finally uses in #if _GLIBCXX_HOSTED guarded code what is declared in iosfwd.
The other problem is that ext/cast.h is also not a self-contained header,
but that one has
/** @file ext/cast.h
 *  This is an internal header file, included by other library headers.
 *  Do not attempt to use it directly. @headername{ext/pointer.h}
 */
comment, so I think we just shouldn't include it in extc++.h and let
ext/pointer.h include it.

2025-09-08  Jakub Jelinek  <jakub@redhat.com>

PR libstdc++/121827
* include/precompiled/extc++.h: Don't include ext/cast.h which is an
internal header.
* include/ext/pointer.h: Include bits/c++config.h before
#if _GLIBCXX_HOSTED.

(cherry picked from commit 592bafb26eb1fd50979f6cdf2176897c4a02c281)

libstdc++-v3/include/ext/pointer.h
libstdc++-v3/include/precompiled/extc++.h

index f066ee9e8a8ce91ff7f77aea9133a6e21e43a05b..5f0988f20f1f8358f6a2b8f4f26458bd0786c0f9 100644 (file)
@@ -38,6 +38,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #if _GLIBCXX_HOSTED
 #  include <iosfwd>
 #endif
index 651b9da280289b79c64ce1a396cee348b4947e56..44174f7465a6f22c4c3008e7f1186772229d1da1 100644 (file)
@@ -37,7 +37,6 @@
 #endif
 #include <ext/alloc_traits.h>
 #include <ext/atomicity.h>
-#include <ext/cast.h>
 #include <ext/iterator>
 #include <ext/numeric_traits.h>
 #include <ext/pointer.h>