This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 1/2] fix conflicting types (wint_t)
- From: uchan0+newlib at gmail dot com
- To: newlib at sourceware dot org
- Cc: uchan-nos <uchan0 at gmail dot com>
- Date: Tue, 23 Jul 2019 08:14:44 +0900
- Subject: [PATCH 1/2] fix conflicting types (wint_t)
From: uchan-nos <uchan0@gmail.com>
---
newlib/libc/include/wchar.h | 6 +++++-
newlib/libc/string/wcwidth.c | 10 ++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h
index c04a6510e..a68cf5be6 100644
--- a/newlib/libc/include/wchar.h
+++ b/newlib/libc/include/wchar.h
@@ -179,8 +179,12 @@ extern size_t wcsxfrm_l (wchar_t *__restrict, const wchar_t *__restrict, size_t,
#endif
#if __XSI_VISIBLE
+# ifdef __CYGWIN__
+int wcwidth (const wint_t);
+# else
int wcwidth (const wchar_t);
-#endif
+# endif
+#endif // __XSI_VISIBLE
wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
int wmemcmp (const wchar_t *, const wchar_t *, size_t);
wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict,
diff --git a/newlib/libc/string/wcwidth.c b/newlib/libc/string/wcwidth.c
index 62e76edc3..a4b520bbe 100644
--- a/newlib/libc/string/wcwidth.c
+++ b/newlib/libc/string/wcwidth.c
@@ -225,10 +225,16 @@ __wcwidth (const wint_t ucs)
#endif /* _MB_CAPABLE */
}
+#ifdef __CYGWIN__
+#define WCHAR_TYPE wint_t
+#else
+#define WCHAR_TYPE wchar_t
+#endif
+
int
-wcwidth (const wint_t wc)
+wcwidth (const WCHAR_TYPE wc)
{
- wint_t wi = wc;
+ WCHAR_TYPE wi = wc;
#ifdef _MB_CAPABLE
wi = _jp2uc (wi);
--
2.17.1