[PATCH 03/10] The bits/types/*.h treatment for stdio and wchar.

Zack Weinberg zackw@panix.com
Sat May 20 21:05:00 GMT 2017


On 05/10/2017 07:52 AM, Zack Weinberg wrote:
> On Tue, May 9, 2017 at 5:34 PM, Joseph Myers <joseph@codesourcery.com> wrote:
>>> +# ifdef __WINT_TYPE__
>>> +    __WINT_TYPE__ __wch;
>>> +# else
>>> +    wint_t __wch;
>>> +# endif
>>
>> I'm concerned about the possible dependency this introduces on wint_t
>> having already been defined, if bits/types/__mbstate_t.h is included with
>> a compiler that does not define __WINT_TYPE__ (e.g. GCC 2.95 or earlier).
>>
>> Previously, wchar.h would attempt to get a wint_t definition under
>> conditions that included !defined __WINT_TYPE__ - that is, it might
>> spuriously define wint_t when only asked to define __mbstate_t, given such
>> a compiler, but wouldn't define __mbstate_t in terms of an undefined type
>> wint_t.
>>
>> Maybe you need a header that ensures __WINT_TYPE__ is always defined,
>> separate from bits/types/wint_t.h?
> 
> Ugh, you're right.  I don't know how I managed to miss that.  Will fix.

What I've decided to do about this is duplicate the

#ifndef __WINT_TYPE__
# define __WINT_TYPE__ unsigned int
#endif

in __mbstate_t.h and then use __WINT_TYPE__ unconditionally in the
structure definition.  Sound good?

zw



More information about the Libc-alpha mailing list