From 09b9a1600fe9e41ea74f1546ec762a3a0b805f6d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 7 Sep 2023 14:39:12 +0200 Subject: [PATCH] uchar: Fix references to overridden functions with GNULIB_NAMESPACE. * lib/uchar.in.h (btoc32, c32isalnum, c32isalpha, c32isblank, c32iscntrl, c32isdigit, c32isgraph, c32islower, c32isprint, c32ispunct, c32isspace, c32isupper, c32isxdigit, c32tolower, c32toupper, c32width, c32snrtombs, c32srtombs, c32swidth, c32tob, mbsnrtoc32s, mbsrtoc32s): Use GNULIB_NAMESPACE:: prefix to refer to the gnulib overridden function. * modules/uchar (Depends-on): Add wctype-h. (Makefile.am): Substitute GNULIB_BTOWC, GNULIB_ISWDIGIT, GNULIB_ISWXDIGIT, GNULIB_WCWIDTH, GNULIB_WCSNRTOMBS, GNULIB_WCSRTOMBS, GNULIB_WCSWIDTH, GNULIB_WCTOB, GNULIB_MBSNRTOWCS, GNULIB_MBSRTOWCS. --- ChangeLog | 14 ++++++ lib/uchar.in.h | 132 ++++++++++++++++++++++++++++++++++++++++--------- modules/uchar | 10 ++++ 3 files changed, 134 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2e332fcf8..7e4a5631d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2023-09-07 Bruno Haible + + uchar: Fix references to overridden functions with GNULIB_NAMESPACE. + * lib/uchar.in.h (btoc32, c32isalnum, c32isalpha, c32isblank, + c32iscntrl, c32isdigit, c32isgraph, c32islower, c32isprint, c32ispunct, + c32isspace, c32isupper, c32isxdigit, c32tolower, c32toupper, c32width, + c32snrtombs, c32srtombs, c32swidth, c32tob, mbsnrtoc32s, mbsrtoc32s): + Use GNULIB_NAMESPACE:: prefix to refer to the gnulib overridden + function. + * modules/uchar (Depends-on): Add wctype-h. + (Makefile.am): Substitute GNULIB_BTOWC, GNULIB_ISWDIGIT, + GNULIB_ISWXDIGIT, GNULIB_WCWIDTH, GNULIB_WCSNRTOMBS, GNULIB_WCSRTOMBS, + GNULIB_WCSWIDTH, GNULIB_WCTOB, GNULIB_MBSNRTOWCS, GNULIB_MBSRTOWCS. + 2023-09-07 Bruno Haible tests: Fix some clang -Wimplicit-fallthrough warnings. diff --git a/lib/uchar.in.h b/lib/uchar.in.h index 98d37f96d0..97852f1bd1 100644 --- a/lib/uchar.in.h +++ b/lib/uchar.in.h @@ -162,7 +162,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE _GL_ATTRIBUTE_PURE wint_t btoc32 (int c) { - return btowc (c); + return +# if @GNULIB_BTOWC@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + btowc (c); } _GL_END_C_LINKAGE # else @@ -180,7 +184,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isalnum (wint_t wc) { - return iswalnum (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswalnum (wc); } _GL_END_C_LINKAGE # else @@ -195,7 +203,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isalpha (wint_t wc) { - return iswalpha (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswalpha (wc); } _GL_END_C_LINKAGE # else @@ -210,7 +222,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isblank (wint_t wc) { - return iswblank (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswblank (wc); } _GL_END_C_LINKAGE # else @@ -225,7 +241,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32iscntrl (wint_t wc) { - return iswcntrl (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswcntrl (wc); } _GL_END_C_LINKAGE # else @@ -240,7 +260,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isdigit (wint_t wc) { - return iswdigit (wc); + return +# if @GNULIB_ISWDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswdigit (wc); } _GL_END_C_LINKAGE # else @@ -255,7 +279,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isgraph (wint_t wc) { - return iswgraph (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswgraph (wc); } _GL_END_C_LINKAGE # else @@ -270,7 +298,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32islower (wint_t wc) { - return iswlower (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswlower (wc); } _GL_END_C_LINKAGE # else @@ -285,7 +317,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isprint (wint_t wc) { - return iswprint (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswprint (wc); } _GL_END_C_LINKAGE # else @@ -300,7 +336,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32ispunct (wint_t wc) { - return iswpunct (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswpunct (wc); } _GL_END_C_LINKAGE # else @@ -315,7 +355,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isspace (wint_t wc) { - return iswspace (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswspace (wc); } _GL_END_C_LINKAGE # else @@ -330,7 +374,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isupper (wint_t wc) { - return iswupper (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswupper (wc); } _GL_END_C_LINKAGE # else @@ -345,7 +393,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32isxdigit (wint_t wc) { - return iswxdigit (wc); + return +# if @GNULIB_ISWXDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswxdigit (wc); } _GL_END_C_LINKAGE # else @@ -363,7 +415,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE wint_t c32tolower (wint_t wc) { - return towlower (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towlower (wc); } _GL_END_C_LINKAGE # else @@ -378,7 +434,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE wint_t c32toupper (wint_t wc) { - return towupper (wc); + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towupper (wc); } _GL_END_C_LINKAGE # else @@ -396,7 +456,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32width (char32_t wc) { - return wcwidth (wc); + return +# if @GNULIB_WCWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcwidth (wc); } _GL_END_C_LINKAGE # else @@ -442,7 +506,11 @@ _GL_INLINE _GL_ARG_NONNULL ((2)) size_t c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len, mbstate_t *ps) { - return wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps); + return +# if @GNULIB_WCSNRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps); } _GL_END_C_LINKAGE # else @@ -465,7 +533,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE _GL_ARG_NONNULL ((2)) size_t c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps) { - return wcsrtombs (dest, (const wchar_t **) srcp, len, ps); + return +# if @GNULIB_WCSRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcsrtombs (dest, (const wchar_t **) srcp, len, ps); } _GL_END_C_LINKAGE # else @@ -511,7 +583,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE _GL_ARG_NONNULL ((1)) int c32swidth (const char32_t *s, size_t n) { - return wcswidth ((const wchar_t *) s, n); + return +# if @GNULIB_WCSWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcswidth ((const wchar_t *) s, n); } _GL_END_C_LINKAGE # else @@ -532,7 +608,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE int c32tob (wint_t wc) { - return wctob (wc); + return +# if @GNULIB_WCTOB@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wctob (wc); } _GL_END_C_LINKAGE # else @@ -614,7 +694,11 @@ _GL_INLINE _GL_ARG_NONNULL ((2)) size_t mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps) { - return mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps); + return +# if @GNULIB_MBSNRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps); } _GL_END_C_LINKAGE # else @@ -637,7 +721,11 @@ _GL_BEGIN_C_LINKAGE _GL_INLINE _GL_ARG_NONNULL ((2)) size_t mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps) { - return mbsrtowcs ((wchar_t *) dest, srcp, len, ps); + return +# if @GNULIB_MBSRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + mbsrtowcs ((wchar_t *) dest, srcp, len, ps); } _GL_END_C_LINKAGE # else diff --git a/modules/uchar b/modules/uchar index b7d3a82a9b..dff08c5478 100644 --- a/modules/uchar +++ b/modules/uchar @@ -41,6 +41,7 @@ uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR16_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR16_T)|g' \ -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR32_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR32_T)|g' \ -e 's/@''GNULIB_BTOC32''@/$(GNULIB_BTOC32)/g' \ + -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ -e 's/@''GNULIB_C32ISALNUM''@/$(GNULIB_C32ISALNUM)/g' \ -e 's/@''GNULIB_C32ISALPHA''@/$(GNULIB_C32ISALPHA)/g' \ -e 's/@''GNULIB_C32ISBLANK''@/$(GNULIB_C32ISBLANK)/g' \ @@ -62,11 +63,20 @@ uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's/@''GNULIB_C32STOMBS''@/$(GNULIB_C32STOMBS)/g' \ -e 's/@''GNULIB_C32SWIDTH''@/$(GNULIB_C32SWIDTH)/g' \ -e 's/@''GNULIB_C32TOB''@/$(GNULIB_C32TOB)/g' \ + -e 's/@''GNULIB_ISWDIGIT''@/$(GNULIB_ISWDIGIT)/g' \ + -e 's/@''GNULIB_ISWXDIGIT''@/$(GNULIB_ISWXDIGIT)/g' \ -e 's/@''GNULIB_MBRTOC16''@/$(GNULIB_MBRTOC16)/g' \ -e 's/@''GNULIB_MBRTOC32''@/$(GNULIB_MBRTOC32)/g' \ -e 's/@''GNULIB_MBSNRTOC32S''@/$(GNULIB_MBSNRTOC32S)/g' \ + -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \ -e 's/@''GNULIB_MBSRTOC32S''@/$(GNULIB_MBSRTOC32S)/g' \ + -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \ -e 's/@''GNULIB_MBSTOC32S''@/$(GNULIB_MBSTOC32S)/g' \ + -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \ + -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \ + -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ + -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ + -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \ -e 's|@''HAVE_C32RTOMB''@|$(HAVE_C32RTOMB)|g' \ -e 's|@''HAVE_MBRTOC16''@|$(HAVE_MBRTOC16)|g' \ -e 's|@''HAVE_MBRTOC32''@|$(HAVE_MBRTOC32)|g' \ -- 2.39.5