From: Bruno Haible Date: Wed, 26 Jul 2023 11:40:06 +0000 (+0200) Subject: wctype, wctrans: Require a non-NULL argument. X-Git-Tag: v1.0~1032 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=97978417e8e3609a8c26e85276b91fb12330876e;p=gnulib.git wctype, wctrans: Require a non-NULL argument. * lib/wctype.in.h: Add placeholder for definition of _GL_ARG_NONNULL. (wctype, wctrans): Mark with _GL_ARG_NONNULL ((1)). * modules/wctype-h (Depends-on): Add snippet/arg-nonnull. (Makefile.am): Substitute $(ARG_NONNULL_H) into wctype.h. --- diff --git a/ChangeLog b/ChangeLog index 32ffeea69d..e3d2ce44ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-07-26 Bruno Haible + + wctype, wctrans: Require a non-NULL argument. + * lib/wctype.in.h: Add placeholder for definition of _GL_ARG_NONNULL. + (wctype, wctrans): Mark with _GL_ARG_NONNULL ((1)). + * modules/wctype-h (Depends-on): Add snippet/arg-nonnull. + (Makefile.am): Substitute $(ARG_NONNULL_H) into wctype.h. + 2023-07-25 Bruno Haible iswctype: Add tests. diff --git a/lib/wctype.in.h b/lib/wctype.in.h index 227fdac24b..926a78d621 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -81,6 +81,8 @@ _GL_INLINE_HEADER_BEGIN /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ +/* The definition of _GL_ARG_NONNULL is copied here. */ + /* The definition of _GL_WARN_ON_USE is copied here. */ /* Solaris 2.6 includes which includes which @@ -631,7 +633,8 @@ typedef void * wctype_t; /* Get a descriptor for a wide character property. */ #if @GNULIB_WCTYPE@ # if !@HAVE_WCTYPE_T@ -_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); +_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name) + _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); # if __GLIBC__ >= 2 @@ -695,7 +698,8 @@ typedef void * wctrans_t; /* Get a descriptor for a wide character case conversion. */ #if @GNULIB_WCTRANS@ # if !@HAVE_WCTRANS_T@ -_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); +_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name) + _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); # if __GLIBC__ >= 2 diff --git a/modules/wctype-h b/modules/wctype-h index 2d0392a9c6..d5cc890aee 100644 --- a/modules/wctype-h +++ b/modules/wctype-h @@ -11,6 +11,7 @@ Depends-on: extern-inline gen-header include_next +snippet/arg-nonnull snippet/c++defs snippet/warn-on-use @@ -25,7 +26,7 @@ lib_SOURCES += wctype-h.c # We need the following in order to create when the system # doesn't have one that works with the given compiler. -wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) +wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%' $(gl_V_at)$(SED_HEADER_STDOUT) \ -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ @@ -54,6 +55,7 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ $(srcdir)/wctype.in.h > $@-t $(AM_V_at)mv $@-t $@