public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Build error for wcwidth and gcvt
@ 2019-07-20  8:50 Kota Uchida
  2019-07-22  9:05 ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Kota Uchida @ 2019-07-20  8:50 UTC (permalink / raw)
  To: newlib

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Build error for wcwidth and gcvt
  2019-07-20  8:50 Build error for wcwidth and gcvt Kota Uchida
@ 2019-07-22  9:05 ` Corinna Vinschen
  2019-07-22  9:47   ` Thomas Wolff
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2019-07-22  9:05 UTC (permalink / raw)
  To: Kota Uchida; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

On Jul 20 17:50, Kota Uchida wrote:
> 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

Please send them here in `git format-patch style.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Build error for wcwidth and gcvt
  2019-07-22  9:05 ` Corinna Vinschen
@ 2019-07-22  9:47   ` Thomas Wolff
  2019-07-22 10:51     ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Wolff @ 2019-07-22  9:47 UTC (permalink / raw)
  To: newlib

On 22.07.2019 11:04, Corinna Vinschen wrote:
> On Jul 20 17:50, Kota Uchida wrote:
>> 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
The first patch is not correct:
- wcwidth (const wint_t wc)
+ wcwidth (const wchar_t wc)

Note the manual page.
Even if you see the wchar_t definition for Linux/POSIX, note that 
wchar_t has 32 bits there.
On cygwin, however, wchar_t was defined to have only 16 bits, 
corresponding to the Windows UTF-16 encoding.
The wcwidth parameter type wint_t is needed to support width enquiries 
for non-BMP characters;
changing it would seriously deprive the function of part of its 
capabilities.
Thomas

> Please send them here in `git format-patch style.
>
>
> Thanks,
> Corinna
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Build error for wcwidth and gcvt
  2019-07-22  9:47   ` Thomas Wolff
@ 2019-07-22 10:51     ` Corinna Vinschen
  2019-07-22 23:26       ` Kota Uchida
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2019-07-22 10:51 UTC (permalink / raw)
  To: Thomas Wolff; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]

On Jul 22 11:46, Thomas Wolff wrote:
> On 22.07.2019 11:04, Corinna Vinschen wrote:
> > On Jul 20 17:50, Kota Uchida wrote:
> > > 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
> The first patch is not correct:
> - wcwidth (const wint_t wc)
> + wcwidth (const wchar_t wc)
> 
> Note the manual page.
> Even if you see the wchar_t definition for Linux/POSIX, note that wchar_t
> has 32 bits there.
> On cygwin, however, wchar_t was defined to have only 16 bits, corresponding
> to the Windows UTF-16 encoding.
> The wcwidth parameter type wint_t is needed to support width enquiries for
> non-BMP characters;
> changing it would seriously deprive the function of part of its
> capabilities.
> Thomas

We might need a generic and a Cygwin-specific definition in the source, i.e.

  #ifdef __CYGWIN__
  use wint_t
  #else
  use wchar_t
  #endif

The header should be kept untouched, of course.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Build error for wcwidth and gcvt
  2019-07-22 10:51     ` Corinna Vinschen
@ 2019-07-22 23:26       ` Kota Uchida
  2019-07-23  7:57         ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Kota Uchida @ 2019-07-22 23:26 UTC (permalink / raw)
  To: newlib

I got understand about wchar_t data sizes.
I fixed my patch and sent it:
https://sourceware.org/ml/newlib/2019/msg00322.html

> The header should be kept untouched, of course.

The header file (wchar.h) must be fixed in order to
match types between the header and .c file.

On Mon, Jul 22, 2019 at 7:51 PM Corinna Vinschen <vinschen@redhat.com> wrote:
>
> On Jul 22 11:46, Thomas Wolff wrote:
> > On 22.07.2019 11:04, Corinna Vinschen wrote:
> > > On Jul 20 17:50, Kota Uchida wrote:
> > > > 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
> > The first patch is not correct:
> > - wcwidth (const wint_t wc)
> > + wcwidth (const wchar_t wc)
> >
> > Note the manual page.
> > Even if you see the wchar_t definition for Linux/POSIX, note that wchar_t
> > has 32 bits there.
> > On cygwin, however, wchar_t was defined to have only 16 bits, corresponding
> > to the Windows UTF-16 encoding.
> > The wcwidth parameter type wint_t is needed to support width enquiries for
> > non-BMP characters;
> > changing it would seriously deprive the function of part of its
> > capabilities.
> > Thomas
>
> We might need a generic and a Cygwin-specific definition in the source, i.e.
>
>   #ifdef __CYGWIN__
>   use wint_t
>   #else
>   use wchar_t
>   #endif
>
> The header should be kept untouched, of course.
>
>
> Corinna
>
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Build error for wcwidth and gcvt
  2019-07-22 23:26       ` Kota Uchida
@ 2019-07-23  7:57         ` Corinna Vinschen
  2019-07-23 12:22           ` Kota Uchida
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2019-07-23  7:57 UTC (permalink / raw)
  To: uchan0+newlib; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 2198 bytes --]

On Jul 23 08:26, Kota Uchida wrote:
> I got understand about wchar_t data sizes.
> I fixed my patch and sent it:
> https://sourceware.org/ml/newlib/2019/msg00322.html
> 
> > The header should be kept untouched, of course.
> 
> The header file (wchar.h) must be fixed in order to
> match types between the header and .c file.

No, the header needs to stick to wchar_t since that's what the standard
says.  The wint_t for Cygwin is an internal implementation detail.


Corinna


> 
> On Mon, Jul 22, 2019 at 7:51 PM Corinna Vinschen <vinschen@redhat.com> wrote:
> >
> > On Jul 22 11:46, Thomas Wolff wrote:
> > > On 22.07.2019 11:04, Corinna Vinschen wrote:
> > > > On Jul 20 17:50, Kota Uchida wrote:
> > > > > 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
> > > The first patch is not correct:
> > > - wcwidth (const wint_t wc)
> > > + wcwidth (const wchar_t wc)
> > >
> > > Note the manual page.
> > > Even if you see the wchar_t definition for Linux/POSIX, note that wchar_t
> > > has 32 bits there.
> > > On cygwin, however, wchar_t was defined to have only 16 bits, corresponding
> > > to the Windows UTF-16 encoding.
> > > The wcwidth parameter type wint_t is needed to support width enquiries for
> > > non-BMP characters;
> > > changing it would seriously deprive the function of part of its
> > > capabilities.
> > > Thomas
> >
> > We might need a generic and a Cygwin-specific definition in the source, i.e.
> >
> >   #ifdef __CYGWIN__
> >   use wint_t
> >   #else
> >   use wchar_t
> >   #endif
> >
> > The header should be kept untouched, of course.
> >
> >
> > Corinna
> >
> > --
> > Corinna Vinschen
> > Cygwin Maintainer
> > Red Hat

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Build error for wcwidth and gcvt
  2019-07-23  7:57         ` Corinna Vinschen
@ 2019-07-23 12:22           ` Kota Uchida
  0 siblings, 0 replies; 7+ messages in thread
From: Kota Uchida @ 2019-07-23 12:22 UTC (permalink / raw)
  To: newlib

Thank you, Corinna.
I fixed my patch and re-submitted it.
https://sourceware.org/ml/newlib/2019/msg00330.html

I also fixed a patch for compilation error of efgcvt.c
following Yaakov's advice.
https://sourceware.org/ml/newlib/2019/msg00329.html

2019年7月23日(火) 16:56 Corinna Vinschen <vinschen@redhat.com>:
>
> On Jul 23 08:26, Kota Uchida wrote:
> > I got understand about wchar_t data sizes.
> > I fixed my patch and sent it:
> > https://sourceware.org/ml/newlib/2019/msg00322.html
> >
> > > The header should be kept untouched, of course.
> >
> > The header file (wchar.h) must be fixed in order to
> > match types between the header and .c file.
>
> No, the header needs to stick to wchar_t since that's what the standard
> says.  The wint_t for Cygwin is an internal implementation detail.
>
>
> Corinna
>
>
> >
> > On Mon, Jul 22, 2019 at 7:51 PM Corinna Vinschen <vinschen@redhat.com> wrote:
> > >
> > > On Jul 22 11:46, Thomas Wolff wrote:
> > > > On 22.07.2019 11:04, Corinna Vinschen wrote:
> > > > > On Jul 20 17:50, Kota Uchida wrote:
> > > > > > 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
> > > > The first patch is not correct:
> > > > - wcwidth (const wint_t wc)
> > > > + wcwidth (const wchar_t wc)
> > > >
> > > > Note the manual page.
> > > > Even if you see the wchar_t definition for Linux/POSIX, note that wchar_t
> > > > has 32 bits there.
> > > > On cygwin, however, wchar_t was defined to have only 16 bits, corresponding
> > > > to the Windows UTF-16 encoding.
> > > > The wcwidth parameter type wint_t is needed to support width enquiries for
> > > > non-BMP characters;
> > > > changing it would seriously deprive the function of part of its
> > > > capabilities.
> > > > Thomas
> > >
> > > We might need a generic and a Cygwin-specific definition in the source, i.e.
> > >
> > >   #ifdef __CYGWIN__
> > >   use wint_t
> > >   #else
> > >   use wchar_t
> > >   #endif
> > >
> > > The header should be kept untouched, of course.
> > >
> > >
> > > Corinna
> > >
> > > --
> > > Corinna Vinschen
> > > Cygwin Maintainer
> > > Red Hat
>
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-23 12:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-20  8:50 Build error for wcwidth and gcvt Kota Uchida
2019-07-22  9:05 ` Corinna Vinschen
2019-07-22  9:47   ` Thomas Wolff
2019-07-22 10:51     ` Corinna Vinschen
2019-07-22 23:26       ` Kota Uchida
2019-07-23  7:57         ` Corinna Vinschen
2019-07-23 12:22           ` Kota Uchida

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).