This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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] codecvt<wchar_t, char, mbstate_t>


Benjamin Kosnik wrote:
> >Yes, this locale does not make much sense, since the US does 
> not use Euro.
> >en_US.ISO-8859-1 or en_US.UTF-8 might be better.
> 
> en_US.UTF-8 sounds good. Andreas can you verify it would work?

We know it works; there are tests for that in the testsuite
(the files named 4.cc). It would be more interesting to check
de_DE.ISO-8859-15.

Perhaps we need to scan the list of installed locales to find
something with the needed charset (these tests only depend on
the charset used by the locale, the language doesn't matter).

> >std::locale create_named_locale(const char* s)
> >{
> >  locale loc;
> >  try
> >    {
> >      loc = locale("foo");  // Throws runtime_error if "foo" is

Oops. Should of course be loc = locale(s);

> >                            // not a valid locale name for this
> >                            // system.
> >    }
> 
> 
> and perhaps
> 
> #ifndef _GLIBCPP_NAMED_LOCALES
> 
> >  catch (runtime_error&)
> >    {
> >      exit(77); // Dejagnu magic number so this doesn't count
> >                // in the summary
> >    }
> 
> #endif
> 
> >  return loc;
> >}
> >
> >and then replace
> >
> >locale loc ("foo");
> >
> >with
> >
> >locale loc (create_named_locale("foo"));
> 
> 
> I like this idea very much. If Dejagnu can be taught to learn error
> codes than everything will be much better, and all the tests that are
> currently throwing uncaught exceptions can be suitably 
> modified to XFAIL
> on these hosts.
> 
> That was kind of my plan at the beginning, but I didn't do the last
> step. Also, I got a bit enthralled by the verbose terminate 
> handler. Can
> you figure out how to do it?

I'll look at it. 

> There is no configure-time way to figure out if named locales are
> working. This stuff is the closest:

We can use setlocale(LCALL, "foo"); to check if the locale "foo" is
available.

> /config/locale/g*/c_locale.h:
> #define _GLIBCPP_C_LOCALE_GNU 
> 
> -benjamin

Petur


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