This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [libstdc++] Don't access fpos_t.__state on uClibc w/o wchar support


Bernardo Innocenti wrote:
> Don't access __state member of fpos_t when building on uClibc with
> wchar support disabled.
> 
> +#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_WCHAR__)
>    template<>
>      inline mbstate_t
>      fpos<mbstate_t>::state() const { return _M_pos.__state; }
> @@ -132,6 +133,7 @@
>        _M_pos.__pos = __off;
>        _M_pos.__state = __st;
>      }
> +#endif /* !__UCLIBC__ || __UCLIBC_HAS_WCHAR__ */

This won't work once there is support for stateful characters in
basic_filebuf. This also disables the constructor that takes streamoff,
which will break basic_filebuf even without stateful conversions.

Gabriel Dos Reis wrote:
>Why can't you use the standard idiom
>
>  #if _GLIBCXX_USE_WCHAR_T

This won't work because fpos<mbstate_t> is also used for narrow streams.

The correct fix for this is to not implement fpos<> in terms of fpos_t,
which is how things were until this checkin:

2003-07-03  Benjamin Kosnik  <bkoz@redhat.com>

	* include/Makefile.am (target_headers): Add fpos.h
	(bits_headers): Remove.
	* include/Makefile.in: Regenerate.
	* configure.in: Add FPOS_INC_SRCDIR, substitute it.
	* configure: Regenerate.
	* configure.host: Add fpos_include_dir.
	* config/os/gnu-linux/fpos.h: New.
	* config/os/generic/fpos.h: Add.
	* include/bits/fpos.h: Remove.

If you do this, it should also fix PR 11450. Having only one version
of fpos<> for all platforms should also make the move to 64-bit
streamoff easier.

Regards,
Petur


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