This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Build error for wcwidth and gcvt
- From: Kota Uchida <uchan0+newlib at gmail dot com>
- To: newlib at sourceware dot org
- Date: Sat, 20 Jul 2019 17:50:22 +0900
- Subject: Build error for wcwidth and gcvt
Hi All,
This is my first mail to newlib community.
I've send this mail because I found some build errors
on newlib's master branch.
Cygwin: unbreak the build with GCC 7
6b7723a83032bd355d3c529d957fe209cb35b4d9
I encountered 2 errors about wcwidth and gcvt.
I've pushed simple patches to forked repository:
https://github.com/uchan-nos/newlib-cygwin/commits/fix-build
Problem 1: Type confliction for wcwith.
wcwidth is declared in newlib/libc/include/wchar.h
as `int wcwidth(const wchar_t);`.
But wcwdth is defined in newlib/libc/string/wcwidth.c
as `int wcwidth(const wint_t wc)`.
These 2 declarations conflicted in my build.
How to fix this problem may not be obvious...
Modifying wint_t --> wchar_t will suppress the build error,
but it may break its functionality for the values which can't
be represented by wchar_t.
Problem 2: Type confliction for gcvt.
gcvt is declared in newlib/libc/include/stdlib.h
if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112.
gcvt is marked as LEGACY in POSIX.1-2001.
gcvt is defined in newlib/libc/stdlib/efgcvt.c without if-macro
so the function is always compiled.
If you compile newlib with __POSIX_VISIBLE>=200112,
a prototype declaration for gcvt is not supplied.
This causes a build error.
(Implicit declaration of gcvt conflicts with its actual type.)
This problem can be fixed as you surround definitions for
gcvt and other family functions with if-macro:
if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112.