* lib/string.in.h: Use _GL_ATTRIBUTE_NONNULL_IF_NONZERO instead of
_GL_ARG_NONNULL in mempcpy. This matches the spirit of N3322.
mempcpy(NULL, ptr, 0) returns NULL + 0 which is valid after N3322.
---
 ChangeLog       | 7 +++++++
 lib/string.in.h | 6 ++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4f62c653c0..436beb8e26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-07-31  Lasse Collin  <[email protected]>
+
+       string-h: Use _GL_ATTRIBUTE_NONNULL_IF_NONZERO in mempcpy.
+       * lib/string.in.h: Use _GL_ATTRIBUTE_NONNULL_IF_NONZERO instead of
+       _GL_ARG_NONNULL in mempcpy. This matches the spirit of N3322.
+       mempcpy(NULL, ptr, 0) returns NULL + 0 which is valid after N3322.
+
 2026-07-31  Lasse Collin  <[email protected]>
 
        string-h: Use _GL_ATTRIBUTE_NONNULL_IF_NONZERO in strnlen.
diff --git a/lib/string.in.h b/lib/string.in.h
index bc6e1e5f9e..f21ebce70f 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -482,7 +482,8 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often 
quadratic - "
 _GL_FUNCDECL_RPL (mempcpy, void *,
                   (void *restrict __dest, void const *restrict __src,
                    size_t __n),
-                  _GL_ARG_NONNULL ((1, 2)));
+                  _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
+                  _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
 _GL_CXXALIAS_RPL (mempcpy, void *,
                   (void *restrict __dest, void const *restrict __src,
                    size_t __n));
@@ -491,7 +492,8 @@ _GL_CXXALIAS_RPL (mempcpy, void *,
 _GL_FUNCDECL_SYS (mempcpy, void *,
                   (void *restrict __dest, void const *restrict __src,
                    size_t __n),
-                  _GL_ARG_NONNULL ((1, 2)));
+                  _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
+                  _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
 #  endif
 _GL_CXXALIAS_SYS (mempcpy, void *,
                   (void *restrict __dest, void const *restrict __src,
-- 
2.55.0


Reply via email to