@@ -12,7 +12,9 @@
#include <cctype>
#include <cerrno>
#include <cfloat>
+#if __cplusplus < 201703L
#include <ciso646>
+#endif
#include <climits>
#include <clocale>
#include <cmath>
@@ -498,4 +498,12 @@ to be used with <code class="code">std::basic_istream</code>.
longer allowed in C++20 mode.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="api.rel_151"></a><code class="constant">15</code></h3></div></div></div><p>
Enabled debug assertions by default for unoptimized builds.
+</p><p>
+Added warnings when including the headers that were deprecated in C++17
+and removed in C++20:
+<code class="filename"><ccomplex></code>,
+<code class="filename"><ciso646></code>,
+<code class="filename"><cstdalign></code>,
+<code class="filename"><cstdbool></code>, and
+<code class="filename"><ctgmath></code>.
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="abi.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="appendix_porting.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="backwards.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ABI Policy and Guidelines </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Backwards Compatibility</td></tr></table></div></body></html>
\ No newline at end of file
@@ -1135,6 +1135,16 @@ to be used with <code>std::basic_istream</code>.
Enabled debug assertions by default for unoptimized builds.
</para>
+<para>
+Added warnings when including the headers that were deprecated in C++17
+and removed in C++20:
+<filename class="headerfile"><ccomplex></filename>,
+<filename class="headerfile"><ciso646></filename>,
+<filename class="headerfile"><cstdalign></filename>,
+<filename class="headerfile"><cstdbool></filename>, and
+<filename class="headerfile"><ctgmath></filename>.
+</para>
+
</section>
</section>
@@ -32,7 +32,9 @@
#include <bits/c++config.h>
#if __cplusplus >= 201103L
-# include <ccomplex>
+extern "C++" {
+#include <complex>
+}
#endif
#if __cplusplus >= 201103L && defined(__STRICT_ANSI__)
@@ -32,11 +32,12 @@
#include <bits/c++config.h>
#if __cplusplus >= 201103L
-# include <ctgmath>
-#else
-# if _GLIBCXX_HAVE_TGMATH_H
-# include_next <tgmath.h>
-# endif
+# include <cmath>
+extern "C++" {
+# include <complex>
+}
+#elif _GLIBCXX_HAVE_TGMATH_H
+# include_next <tgmath.h>
#endif
#endif
@@ -41,4 +41,13 @@ extern "C++" {
#include <complex>
}
+#if __cplusplus >= 202002L && ! _GLIBCXX_USE_DEPRECATED
+# error "<ccomplex> is not a standard header in C++20, use <complex> instead"
+#elif __cplusplus >= 201703L && defined __DEPRECATED
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions"
+# warning "<ccomplex> is deprecated in C++17, use <complex> instead"
+# pragma GCC diagnostic pop
+#endif
+
#endif
@@ -38,4 +38,13 @@
#include <bits/c++config.h>
+#if __cplusplus >= 202002L && ! _GLIBCXX_USE_DEPRECATED
+# error "<ciso646> is not a standard header in C++20, use <version> to detect implementation-specific macros"
+#elif __cplusplus >= 201703L && defined __DEPRECATED
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions"
+# warning "<ciso646> is deprecated in C++17, use <version> to detect implementation-specific macros"
+# pragma GCC diagnostic pop
+#endif
+
#endif
@@ -40,6 +40,14 @@
# if _GLIBCXX_HAVE_STDALIGN_H
# include <stdalign.h>
# endif
+# if __cplusplus >= 202002L && ! _GLIBCXX_USE_DEPRECATED
+# error "<cstdalign> is not a standard header in C++20, remove the #include"
+# elif __cplusplus >= 201703L && defined __DEPRECATED
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions"
+# warning "<cstdalign> is deprecated in C++17, remove the #include"
+# pragma GCC diagnostic pop
+# endif
#endif
#endif
@@ -40,6 +40,14 @@
# if _GLIBCXX_HAVE_STDBOOL_H
# include <stdbool.h>
# endif
+# if __cplusplus >= 202002L && ! _GLIBCXX_USE_DEPRECATED
+# error "<cstdbool> is not a standard header in C++20, remove the #include"
+# elif __cplusplus >= 201703L && defined __DEPRECATED
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions"
+# warning "<cstdbool> is deprecated in C++17, remove the #include"
+# pragma GCC diagnostic pop
+# endif
#endif
#endif
@@ -40,6 +40,14 @@
extern "C++" {
# include <complex>
}
+# if __cplusplus >= 202002L && ! _GLIBCXX_USE_DEPRECATED
+# error "<ctgmath> is not a standard header in C++20, use <complex> or <cmath> instead"
+# elif __cplusplus >= 201703L && defined __DEPRECATED
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions"
+# warning "<ctgmath> is deprecated in C++17, use <complex> or <cmath> instead"
+# pragma GCC diagnostic pop
+# endif
#endif
#endif
@@ -37,4 +37,14 @@
#endif
#include <bits/c++config.h>
+
+#if __cplusplus >= 202002L && ! _GLIBCXX_USE_DEPRECATED
+# error "<ciso646> is not a standard header in C++20, use <version> to detect implementation-specific macros"
+#elif __cplusplus >= 201703L && defined __DEPRECATED
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions"
+# warning "<ciso646> is deprecated in C++17, use <version> to detect implementation-specific macros"
+# pragma GCC diagnostic pop
+#endif
+
#endif
@@ -34,7 +34,6 @@
#endif
#include <cctype>
#include <cfloat>
-#include <ciso646>
#include <climits>
#include <csetjmp>
#include <cstdarg>
@@ -43,6 +42,9 @@
#if __cplusplus >= 201103L
#include <cstdint>
+#if __cplusplus < 201703L
+#include <ciso646>
+#endif
#endif
// C++
@@ -108,7 +110,6 @@
#include <cctype>
#include <cerrno>
#include <cfloat>
-#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
@@ -124,14 +125,16 @@
#include <cwctype>
#if __cplusplus >= 201103L
-#include <ccomplex>
#include <cfenv>
#include <cinttypes>
+#include <cstdint>
+#include <cuchar>
+#if __cplusplus < 201703L
+#include <ccomplex>
#include <cstdalign>
#include <cstdbool>
-#include <cstdint>
#include <ctgmath>
-#include <cuchar>
+#endif
#endif
// C++
new file mode 100644
@@ -0,0 +1,51 @@
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated -fno-operator-names" }
+// { dg-do preprocess }
+
+#include <ciso646>
+
+// { dg-warning "deprecated" "" { target c++17_only } 0 }
+// { dg-error "not a standard header" "" { target c++20 } 0 }
+
+#ifdef and
+# error "The header <ciso646> defines a macro named and"
+#endif
+
+#ifdef and_eq
+# error "The header <ciso646> defines a macro named and_eq"
+#endif
+
+#ifdef bitand
+# error "The header <ciso646> defines a macro named bitand"
+#endif
+
+#ifdef bitor
+# error "The header <ciso646> defines a macro named bitor"
+#endif
+
+#ifdef compl
+# error "The header <ciso646> defines a macro named compl"
+#endif
+
+#ifdef not
+# error "The header <ciso646> defines a macro named not"
+#endif
+
+#ifdef not_eq
+# error "The header <ciso646> defines a macro named not_eq"
+#endif
+
+#ifdef or
+# error "The header <ciso646> defines a macro named or"
+#endif
+
+#ifdef or_eq
+# error "The header <ciso646> defines a macro named or_eq"
+#endif
+
+#ifdef xor
+# error "The header <ciso646> defines a macro named xor"
+#endif
+
+#ifdef xor_eq
+# error "The header <ciso646> defines a macro named xor_eq"
+#endif
new file mode 100644
@@ -0,0 +1,49 @@
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated -fno-operator-names" }
+// { dg-do preprocess }
+// { dg-bogus "deprecated" "C++17 deprecated <ciso646> but not <iso646.h>" }
+
+#include <iso646.h>
+
+#ifdef and
+# error "The header <iso646.h> defines a macro named and"
+#endif
+
+#ifdef and_eq
+# error "The header <iso646.h> defines a macro named and_eq"
+#endif
+
+#ifdef bitand
+# error "The header <iso646.h> defines a macro named bitand"
+#endif
+
+#ifdef bitor
+# error "The header <iso646.h> defines a macro named bitor"
+#endif
+
+#ifdef compl
+# error "The header <iso646.h> defines a macro named compl"
+#endif
+
+#ifdef not
+# error "The header <iso646.h> defines a macro named not"
+#endif
+
+#ifdef not_eq
+# error "The header <iso646.h> defines a macro named not_eq"
+#endif
+
+#ifdef or
+# error "The header <iso646.h> defines a macro named or"
+#endif
+
+#ifdef or_eq
+# error "The header <iso646.h> defines a macro named or_eq"
+#endif
+
+#ifdef xor
+# error "The header <iso646.h> defines a macro named xor"
+#endif
+
+#ifdef xor_eq
+# error "The header <iso646.h> defines a macro named xor_eq"
+#endif
@@ -1,8 +1,13 @@
-// { dg-options "-D_GLIBCXX_USE_DEPRECATED=1 -Wno-deprecated" }
-// { dg-do preprocess { target c++11 } }
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do preprocess }
#include <cstdalign>
+// { dg-error "ISO C.. 2011" "" { target c++98_only } 0 }
+// { dg-warning "deprecated" "" { target c++17_only } 0 }
+// { dg-error "not a standard header" "" { target c++20 } 0 }
+
+#if __cplusplus >= 201103L
#ifndef __alignas_is_defined
# error "The header <cstdalign> fails to define a macro named __alignas_is_defined"
#elif __alignas_is_defined != 1
@@ -22,3 +27,4 @@
#ifdef alignof
# error "The header <cstdalign> defines a macro named alignof"
#endif
+#endif
new file mode 100644
@@ -0,0 +1,25 @@
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do preprocess { target c++11 } }
+// { dg-bogus "deprecated" "C++17 deprecated <cstdalign> but not <stdalign.h>" }
+
+#include <stdalign.h>
+
+#ifndef __alignas_is_defined
+# error "The header <stdalign.h> fails to define a macro named __alignas_is_defined"
+#elif __alignas_is_defined != 1
+# error "__alignas_is_defined is not defined to 1 in <stdalign.h>"
+#endif
+
+#ifndef __alignof_is_defined
+# error "The header <stdalign.h> fails to define a macro named __alignof_is_defined"
+#elif __alignof_is_defined != 1
+# error "__alignof_is_defined is not defined to 1 in <stdalign.h>"
+#endif
+
+#ifdef alignas
+# error "The header <stdalign.h> defines a macro named alignas"
+#endif
+
+#ifdef alignof
+# error "The header <stdalign.h> defines a macro named alignof"
+#endif
deleted file mode 100644
@@ -1,24 +0,0 @@
-// { dg-options "-std=gnu++98" }
-// { dg-do compile { target c++98_only } }
-
-// Copyright (C) 2011-2024 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <cstdalign>
-
-// { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
-
@@ -1,4 +1,5 @@
-// { dg-do compile { target c++11 } }
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do preprocess }
// Copyright (C) 2012-2024 Free Software Foundation, Inc.
//
@@ -19,6 +20,11 @@
#include <cstdbool>
+// { dg-error "ISO C.. 2011" "" { target c++98_only } 0 }
+// { dg-warning "deprecated" "" { target c++17_only } 0 }
+// { dg-error "not a standard header" "" { target c++20 } 0 }
+
+#if __cplusplus >= 201103L
#ifndef __bool_true_false_are_defined
# error "The header <cstdbool> fails to define a macro named __bool_true_false_are_defined"
#endif
@@ -34,3 +40,4 @@
#ifdef false
# error "The header <cstdbool> defines a macro named false"
#endif
+#endif
new file mode 100644
@@ -0,0 +1,21 @@
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do preprocess { target c++11 } }
+// { dg-bogus "deprecated" "C++17 deprecated <cstdbool> but not <stdbool.h>" }
+
+#include <stdbool.h>
+
+#ifndef __bool_true_false_are_defined
+# error "The header <stdbool.h> fails to define a macro named __bool_true_false_are_defined"
+#endif
+
+#ifdef bool
+# error "The header <stdbool.h> defines a macro named bool"
+#endif
+
+#ifdef true
+# error "The header <stdbool.h> defines a macro named true"
+#endif
+
+#ifdef false
+# error "The header <stdbool.h> defines a macro named false"
+#endif
deleted file mode 100644
@@ -1,26 +0,0 @@
-// { dg-options "-std=gnu++98" }
-// { dg-do compile { target c++98_only } }
-
-// Copyright (C) 2007-2024 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <cstdbool>
-
-// { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
-
-
-
new file mode 100644
@@ -0,0 +1,10 @@
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do compile }
+
+#include <ccomplex>
+
+std::complex<double> d;
+
+// { dg-error "ISO C.. 2011" "" { target c++98_only } 0 }
+// { dg-warning "deprecated" "" { target c++17_only } 0 }
+// { dg-error "not a standard header" "" { target c++20 } 0 }
new file mode 100644
@@ -0,0 +1,10 @@
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do compile }
+// { dg-bogus "deprecated" "C++17 deprecated <ccomplex> but not <complex.h>" }
+
+#include <complex.h>
+
+#if __cplusplus < 201103L
+# undef complex
+#endif
+std::complex<double> d; // { dg-error "does not name a template" "" { target c++98_only } 0 }
deleted file mode 100644
@@ -1,26 +0,0 @@
-// { dg-options "-std=gnu++98" }
-// { dg-do compile { target c++98_only } }
-
-// Copyright (C) 2007-2024 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <ccomplex>
-
-// { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
-
-
-
@@ -15,8 +15,13 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-do compile { target c++11 } }
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do compile }
#include <ctgmath>
-std::complex<double> d;
+std::complex<double> d; // { dg-error "does not name a template" "" { target c++98_only } 0 }
+
+// { dg-error "ISO C.. 2011" "" { target c++98_only } 0 }
+// { dg-warning "deprecated" "" { target c++17_only } 0 }
+// { dg-error "not a standard header" "" { target c++20 } 0 }
new file mode 100644
@@ -0,0 +1,10 @@
+// { dg-options "-D_GLIBCXX_USE_DEPRECATED=0 -Wdeprecated" }
+// { dg-do compile }
+// { dg-bogus "deprecated" "C++17 deprecated <ctgmath> but not <tgmath.h>" }
+
+#include <tgmath.h>
+
+#if __cplusplus < 201103L
+# undef complex
+#endif
+std::complex<double> d; // { dg-error "does not name a template" "" { target c++98_only } 0 }
deleted file mode 100644
@@ -1,26 +0,0 @@
-// { dg-options "-std=gnu++98" }
-// { dg-do compile { target c++98_only } }
-
-// Copyright (C) 2007-2024 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <ctgmath>
-
-// { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
-
-
-
@@ -53,7 +53,6 @@
#include <cctype>
#include <cerrno>
#include <cfloat>
-#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
@@ -53,7 +53,6 @@
#include <cctype>
#include <cerrno>
#include <cfloat>
-#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>