[PATCH] Fix clocale=generic and clocale=ieee_1003.1-2001 (was Re: cannot build trunk: abi_check doesn't link)

Jakub Jelinek jakub@redhat.com
Fri Sep 6 16:10:00 GMT 2002


On Fri, Sep 06, 2002 at 03:18:32PM -0700, Per Bothner wrote:
> Can somebody fix this problem before the weekend, please?

> /home/bothner/GNU/linux-gcc/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so: 
> undefined reference to `std::messages<wchar_t>::do_get(int, int, int, std::basic_string<wchar_t, std::char_traits<wchar_t>,  std::allocator<wchar_t> > const&) const'

The following patch fixes it for me with --enable-clocale=generic, but I
don't know if it is the right solution. Benjamin?

2002-09-07  Jakub Jelinek  <jakub@redhat.com>

	* config/locale/generic/messages_members.cc: Add specialization for
	messages<wchar_t>.
	* config/locale/ieee_1003.1-20021/messages_members.cc: Likewise.

--- libstdc++-v3/config/locale/generic/messages_members.cc.jj	2002-03-13 02:02:33.000000000 +0100
+++ libstdc++-v3/config/locale/generic/messages_members.cc	2002-09-07 00:57:33.000000000 +0200
@@ -42,4 +42,11 @@ namespace std
     string
     messages<char>::do_get(catalog, int, int, const string& __dfault) const
     { return __dfault; }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+  template<>
+    wstring
+    messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
+    { return __dfault; }
+#endif
 }
--- libstdc++-v3/config/locale/ieee_1003.1-2001/messages_members.cc.jj	2002-03-13 02:02:59.000000000 +0100
+++ libstdc++-v3/config/locale/ieee_1003.1-2001/messages_members.cc	2002-09-07 01:05:50.000000000 +0200
@@ -46,4 +46,16 @@ namespace std
       nl_catd __nlc = reinterpret_cast<nl_catd>(__c);
       return string(catgets(__nlc, __setid, __msgid, __dfault.c_str())); 
     }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+  template<>
+    wstring
+    messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
+    {
+      nl_catd __nlc = reinterpret_cast<nl_catd>(__c);
+      char* __msg = catgets(__nlc, __setid, __msgid, 
+			    _M_convert_to_char(__dfault));
+      return _M_convert_from_char(__msg);
+    }
+#endif
 }


	Jakub



More information about the Libstdc++ mailing list