This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: help on inconsistent printf() warning from gcc


On Oct 31 15:13, Craig Howland wrote:
> 
> On 10/31/2014 02:49 PM, Joel Sherrill wrote:
> >Hi
> >
> >...
> >
> >I have attached correct and incorrect test cases. I am hoping
> >someone here can give me a clue as to where to look. I am
> >wondering if this is an inconsistency across targets in the
> >C library. I did file this as GCC PR63301 but it was quickly
> >closed as invalid. But I think the inconsistent generation of
> >warnings is a bug.
> Not that this changes the behavior, but the test cases are labeled
> backwards.  After applying the wchar_t-to win_t correction that Myers points
> out, the correct format is %lc (per C99), while %C is non-standard.

%C is not exactly non-standard.  %C is allowed and documented as an
optional XSI extension in SUSv4, being equivalent to %lc:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html

But still, %lc and %C both expect an wint_t argument.  Quote from
the above SUSV4 man page:

  c
    The int argument shall be converted to an unsigned char, and the
    resulting byte shall be written.

    If an l (ell) qualifier is present, the wint_t argument shall be
    converted as if by an ls conversion specification with no precision
    and an argument that points to a two-element array of type wchar_t,
    the first element of which contains the wint_t argument to the ls
    conversion specification and the second element contains a null wide
    character.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgprp7674PBM_.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]