As proposed below I also updated gcc-13 branch.

    libstdc++: [_GLIBCXX_DEBUG] Define __cpp_lib_null_iterators

    _GLIBCXX_DEBUG has now fully N3344 compliant iterator checks, we can define
    __cpp_lib_null_iterators macros like the normal mode.

    libstdc++-v3/ChangeLog:

            * include/std/iterator (__cpp_lib_null_iterators): Define regardless of
            _GLIBCXX_DEBUG.
            * include/std/version (__cpp_lib_null_iterators): Likewise.

François


On 20/03/2024 10:02, Jonathan Wakely wrote:
On Wed, 20 Mar 2024 at 05:59, François Dumont wrote:
Thanks to you doc:

      libstdc++: [_GLIBCXX_DEBUG] Define __[glibcxx,cpp_lib]_null_iterators

      _GLIBCXX_DEBUG has now fully N3344 compliant iterator checks, we
can define
      __glibcxx_null_iterators and __cpp_lib_null_iterators macros like
the normal
      mode.

      libstdc++-v3/ChangeLog:

              * version.def (null_iterators): Remove extra_cond.
              * version.h: Regenerate.

Ok to commit ?
Please don't bother talking about __glibcxx_null_iterators in the
commit message, that's an implementation detail that always mirrors
the standard-defined __cpp_lib_null_iterators one. The first line of
the commit will be much easier to read without that.

OK with that change, thanks.

I already noticed that GCC 13 has no version.h file so no backport question.
It has no version.h but it still has the macros:

include/std/iterator:# define __cpp_lib_null_iterators 201304L
include/std/version:# define __cpp_lib_null_iterators 201304L

Those definitions can be made to not depend on _GLIBCXX_DEBUG.
diff --git a/libstdc++-v3/include/std/iterator 
b/libstdc++-v3/include/std/iterator
index 695e18e2c47..a0a8eac570b 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -67,7 +67,7 @@
 #endif
 #include <bits/range_access.h>
 
-#if __cplusplus >= 201402L && ! defined _GLIBCXX_DEBUG // PR libstdc++/70303
+#if __cplusplus >= 201402L
 # define __cpp_lib_null_iterators 201304L
 #endif
 
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index bd1bee0190d..ee515c4e66c 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -81,9 +81,7 @@
 #define __cpp_lib_integral_constant_callable 201304L
 #define __cpp_lib_is_final 201402L
 #define __cpp_lib_make_reverse_iterator 201402L
-#ifndef _GLIBCXX_DEBUG // PR libstdc++/70303
-# define __cpp_lib_null_iterators 201304L
-#endif
+#define __cpp_lib_null_iterators 201304L
 #define __cpp_lib_robust_nonmodifying_seq_ops 201304L
 #define __cpp_lib_transformation_trait_aliases 201304L
 #define __cpp_lib_transparent_operators 201510L

Reply via email to