This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH 03/10] The bits/types/*.h treatment for stdio and wchar.


On Tue, 9 May 2017, Zack Weinberg wrote:

> diff --git a/wcsmbs/bits/types/__mbstate_t.h b/wcsmbs/bits/types/__mbstate_t.h
> new file mode 100644
> index 0000000000..8eb95372f1
> --- /dev/null
> +++ b/wcsmbs/bits/types/__mbstate_t.h
> @@ -0,0 +1,19 @@
> +#ifndef ____mbstate_t_defined
> +#define ____mbstate_t_defined 1
> +
> +/* Conversion state information.  */
> +typedef struct
> +{
> +  int __count;
> +  union
> +  {
> +# 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?

I have not exhaustively reviewed the rest of the patch.

-- 
Joseph S. Myers
joseph@codesourcery.com


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