[1/2] fix conflicting types (wint_t)

Message ID 20190722231445.15990-1-uchan0+newlib@gmail.com
State New
Headers show
Series
  • [1/2] fix conflicting types (wint_t)
Related show

Commit Message

Kota Uchida July 22, 2019, 11:14 p.m.
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(-)

-- 
2.17.1

Patch

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);