[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: *c32*: Inline most functions on glibc and musl libc
From: |
Bruno Haible |
Subject: |
Re: *c32*: Inline most functions on glibc and musl libc |
Date: |
Wed, 05 Apr 2023 17:51:42 +0200 |
I wrote:
> * lib/uchar.in.h: Invoke _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
> (btoc32): Inline if _GL_WCHAR_T_IS_UCS4.
> (c32isalnum, c32isalpha, c32isblank, c32iscntrl, c32isdigit, c32isgraph,
> c32islower, c32isprint, c32ispunct, c32isspace, c32isupper,
> c32isxdigit): Inline if
> _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t.
> (c32snrtombs, c32srtombs, c32stombs, c32tob, mbsnrtoc32s, mbsrtoc32s,
> mbstoc32s): Inline if _GL_WCHAR_T_IS_UCS4.
Oops, this produces compilation errors in C++ mode:
In file included from ../../gltests/test-uchar-c++.cc:22:
...
../gllib/uchar.h: In function 'int c32isblank(wint_t)':
../gllib/uchar.h:521:10: error: 'iswblank' was not declared in this scope
521 | return iswblank (wc);
| ^~~~~~~~
../gllib/uchar.h: In function 'int c32iscntrl(wint_t)':
../gllib/uchar.h:534:10: error: 'iswcntrl' was not declared in this scope
534 | return iswcntrl (wc);
| ^~~~~~~~
This patch fixes it.
2023-04-05 Bruno Haible <bruno@clisp.org>
uchar: Fix recent change.
* lib/uchar.in.h: Include <string.h>, <wctype.h>.
diff --git a/lib/uchar.in.h b/lib/uchar.in.h
index 7c20ddd878..b5554c64b6 100644
--- a/lib/uchar.in.h
+++ b/lib/uchar.in.h
@@ -49,6 +49,10 @@
/* Get mbstate_t, size_t. */
#include <wchar.h>
+/* For the inline functions. */
+#include <string.h>
+#include <wctype.h>
+
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
#ifndef _GL_ATTRIBUTE_PURE