[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
uchar: Fix references to overridden functions with GNULIB_NAMESPACE
From: |
Bruno Haible |
Subject: |
uchar: Fix references to overridden functions with GNULIB_NAMESPACE |
Date: |
Thu, 07 Sep 2023 17:34:56 +0200 |
clang 16 also produces these warnings:
../gllib/uchar.h:696:10: warning: The symbol ::iswalnum refers to the system
function. Use gnulib::iswalnum instead. [-Wuser-defined-warnings]
../gllib/uchar.h:711:10: warning: The symbol ::iswalpha refers to the system
function. Use gnulib::iswalpha instead. [-Wuser-defined-warnings]
../gllib/uchar.h:726:10: warning: The symbol ::iswblank refers to the system
function. Use gnulib::iswblank instead. [-Wuser-defined-warnings]
../gllib/uchar.h:741:10: warning: The symbol ::iswcntrl refers to the system
function. Use gnulib::iswcntrl instead. [-Wuser-defined-warnings]
../gllib/uchar.h:756:10: warning: The symbol ::iswdigit refers to the system
function. Use gnulib::iswdigit instead. [-Wuser-defined-warnings]
../gllib/uchar.h:771:10: warning: The symbol ::iswgraph refers to the system
function. Use gnulib::iswgraph instead. [-Wuser-defined-warnings]
../gllib/uchar.h:786:10: warning: The symbol ::iswlower refers to the system
function. Use gnulib::iswlower instead. [-Wuser-defined-warnings]
../gllib/uchar.h:801:10: warning: The symbol ::iswprint refers to the system
function. Use gnulib::iswprint instead. [-Wuser-defined-warnings]
../gllib/uchar.h:816:10: warning: The symbol ::iswpunct refers to the system
function. Use gnulib::iswpunct instead. [-Wuser-defined-warnings]
../gllib/uchar.h:831:10: warning: The symbol ::iswspace refers to the system
function. Use gnulib::iswspace instead. [-Wuser-defined-warnings]
../gllib/uchar.h:846:10: warning: The symbol ::iswupper refers to the system
function. Use gnulib::iswupper instead. [-Wuser-defined-warnings]
../gllib/uchar.h:861:10: warning: The symbol ::iswxdigit refers to the system
function. Use gnulib::iswxdigit instead. [-Wuser-defined-warnings]
../gllib/uchar.h:879:10: warning: The symbol ::towlower refers to the system
function. Use gnulib::towlower instead. [-Wuser-defined-warnings]
../gllib/uchar.h:894:10: warning: The symbol ::towupper refers to the system
function. Use gnulib::towupper instead. [-Wuser-defined-warnings]
../gllib/uchar.h:912:10: warning: The symbol ::wcwidth refers to the system
function. Use gnulib::wcwidth instead. [-Wuser-defined-warnings]
../gllib/uchar.h:958:10: warning: The symbol ::wcsnrtombs refers to the system
function. Use gnulib::wcsnrtombs instead. [-Wuser-defined-warnings]
../gllib/uchar.h:981:10: warning: The symbol ::wcsrtombs refers to the system
function. Use gnulib::wcsrtombs instead. [-Wuser-defined-warnings]
../gllib/uchar.h:1027:10: warning: The symbol ::wcswidth refers to the system
function. Use gnulib::wcswidth instead. [-Wuser-defined-warnings]
../gllib/uchar.h:1130:10: warning: The symbol ::mbsnrtowcs refers to the system
function. Use gnulib::mbsnrtowcs instead. [-Wuser-defined-warnings]
../gllib/uchar.h:1153:10: warning: The symbol ::mbsrtowcs refers to the system
function. Use gnulib::mbsrtowcs instead. [-Wuser-defined-warnings]
../gllib/uchar.h:1216:10: warning: The symbol ::wctype refers to the system
function. Use gnulib::wctype instead. [-Wuser-defined-warnings]
../gllib/uchar.h:1239:10: warning: The symbol ::iswctype refers to the system
function. Use gnulib::iswctype instead. [-Wuser-defined-warnings]
../gllib/uchar.h:1280:10: warning: The symbol ::wctrans refers to the system
function. Use gnulib::wctrans instead. [-Wuser-defined-warnings]
../gllib/uchar.h:1302:10: warning: The symbol ::towctrans refers to the system
function. Use gnulib::towctrans instead. [-Wuser-defined-warnings]
The cause is that when, in C++ mode, GNULIB_NAMESPACE is defined, the function
overrides provided by <wchar.h> and <wctype.h> are not named 'rpl_<func>'
but 'GNULIB_NAMESPACE::<func>'. However, the inline functions in uchar.h need
to invoke the overridden, not the system functions. This patch fixes it.
2023-09-07 Bruno Haible <bruno@clisp.org>
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,
c32_get_type_test, c32_apply_type_test, c32_get_mapping,
c32_apply_mapping): 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,
GNULIB_WCTYPE, GNULIB_ISWCTYPE, GNULIB_WCTRANS, GNULIB_TOWCTRANS.
diff --git a/lib/uchar.in.h b/lib/uchar.in.h
index 3193340242..1856aec823 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
@@ -700,7 +788,11 @@ _GL_BEGIN_C_LINKAGE
_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t
c32_get_type_test (const char *name)
{
- return wctype (name);
+ return
+# if @GNULIB_WCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
+ GNULIB_NAMESPACE::
+# endif
+ wctype (name);
}
_GL_END_C_LINKAGE
# else
@@ -723,7 +815,11 @@ _GL_BEGIN_C_LINKAGE
_GL_INLINE int
c32_apply_type_test (wint_t wc, c32_type_test_t property)
{
- return iswctype (wc, property);
+ return
+# if @GNULIB_ISWCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
+ GNULIB_NAMESPACE::
+# endif
+ iswctype (wc, property);
}
_GL_END_C_LINKAGE
# else
@@ -764,7 +860,11 @@ _GL_BEGIN_C_LINKAGE
_GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t
c32_get_mapping (const char *name)
{
- return wctrans (name);
+ return
+# if @GNULIB_WCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+ GNULIB_NAMESPACE::
+# endif
+ wctrans (name);
}
_GL_END_C_LINKAGE
# else
@@ -786,7 +886,11 @@ _GL_BEGIN_C_LINKAGE
_GL_INLINE _GL_ARG_NONNULL ((2)) wint_t
c32_apply_mapping (wint_t wc, c32_mapping_t mapping)
{
- return towctrans (wc, mapping);
+ return
+# if @GNULIB_TOWCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+ GNULIB_NAMESPACE::
+# endif
+ towctrans (wc, mapping);
}
_GL_END_C_LINKAGE
# else
diff --git a/modules/uchar b/modules/uchar
index c1e8c689af..8a3839d894 100644
--- a/modules/uchar
+++ b/modules/uchar
@@ -16,6 +16,7 @@ extern-inline
assert-h
stdint
wchar
+wctype-h
configure.ac:
gl_UCHAR_H
@@ -41,6 +42,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' \
@@ -66,11 +68,24 @@ uchar.h: uchar.in.h $(top_builddir)/config.status
$(CXXDEFS_H) $(ARG_NONNULL_H)
-e
's/@''GNULIB_C32_APPLY_TYPE_TEST''@/$(GNULIB_C32_APPLY_TYPE_TEST)/g' \
-e 's/@''GNULIB_C32_GET_MAPPING''@/$(GNULIB_C32_GET_MAPPING)/g' \
-e
's/@''GNULIB_C32_GET_TYPE_TEST''@/$(GNULIB_C32_GET_TYPE_TEST)/g' \
+ -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/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_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/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_WCTRANS''@/$(GNULIB_WCTRANS)/g' \
+ -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/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' \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- uchar: Fix references to overridden functions with GNULIB_NAMESPACE,
Bruno Haible <=