From: Georg Baum Date: Thu, 12 Oct 2006 19:18:17 +0000 (+0000) Subject: Work around a gcc bug on systems where wchar_t is not used as lyx::char_type X-Git-Tag: 1.6.10~12402 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b0297263dfca56a3dc12987d5c71a8293152d2a3;p=lyx.git Work around a gcc bug on systems where wchar_t is not used as lyx::char_type git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15312 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/docstream.C b/src/support/docstream.C index 24c08ee18c..b6c592bd61 100644 --- a/src/support/docstream.C +++ b/src/support/docstream.C @@ -231,3 +231,27 @@ odocfstream::odocfstream(const char* s, std::ios_base::openmode mode) } } + +#if (!defined(HAVE_WCHAR_T) || SIZEOF_WCHAR_T != 4) && defined(__GNUC__) +// We get undefined references to these virtual methods. This looks like +// a bug in gcc. The implementation here does not do anything useful, since +// it is overriden in utf8_codecvt_facet. +namespace std { +template<> codecvt::result +codecvt::do_out(mbstate_t &, const lyx::char_type *, const lyx::char_type *, const lyx::char_type *&, + char *, char *, char *&) const { return error; } +template<> codecvt::result +codecvt::do_unshift(mbstate_t &, char *, char *, char *&) const { return error; } +template<> codecvt::result +codecvt::do_in(mbstate_t &, const char *, const char *, const char *&, + lyx::char_type *, lyx::char_type *, lyx::char_type *&) const { return error; } +template<> int codecvt::do_encoding() const throw() { return 0; } +template<> bool codecvt::do_always_noconv() const throw() { return true; } +#if __GNUC__ == 3 && __GNUC_MINOR__ < 4 +template<> int codecvt::do_length(mbstate_t const &, const char *, const char *, size_t) const { return 1; } +#else +template<> int codecvt::do_length(mbstate_t &, const char *, const char *, size_t) const { return 1; } +#endif +template<> int codecvt::do_max_length() const throw() { return 4; } +} +#endif