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: using xlocale to implement std::locale class


Paolo Carlini writes:

On 05/06/2011 12:58 AM, Paolo Carlini wrote:
Hi,
Not sure what that fail is all about. I'll see what I can figure out.
Thanks. I suspect the issue could be relatively simple and unrelated to the actual management of the message catalogs: completely similar tests, a few lines before do succeed, only different because involving the 'plain' messages facet instead of the _byname version. I can't believe the issue is very tough, and apparently Francois didn't focus much on the _byname version... Please let me know how it goes.
Ah good, I think the failing test is actually invalid. We have:

  catalog cat_de = mssg_de.open("libstdc++", loc_c, dir);
  string s01 = mssg_de.get(cat_de, 0, 0, "please");
  string s02 = mssg_de.get(cat_de, 0, 0, "thank you");
  VERIFY ( s01 == "bitte" );
  VERIFY ( s02 == "danke" );
  mssg_de.close(cat_de);

  // Check byname locale.
  catalog cat_byname = mssg_byname.open("libstdc++", loc_c, dir);
  string s03 = mssg_byname.get(cat_de, 0, 0, "please");
  string s04 = mssg_byname.get(cat_de, 0, 0, "thank you");
  VERIFY ( s03 == "bitte" );
  VERIFY ( s04 == "danke" );
  mssg_byname.close(cat_byname);

and the second couple of VERIFY fails. But the two mssg_byname.get are *not* guaranteed to work, because, per 22.2.7.1.2/1 (C++03), about do_open: "The result can be used until it is passed to close" and this condition is violated for the second pair of cat_de uses. Actually, I guess I'm going to apply the below first.

Thanks, I was about to look into this breakage myself. Francois's fix exposed this bug. Previously, the catalog value was a dummy, it was always 0. Now it will actually have to be valid.


Once this lands, some existing buggy code might break. But, it's undoubtedly the application bug, and it will be exposed as unlocalized content.


Attachment: pgp00000.pgp
Description: PGP signature


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