From patchwork Thu Sep 27 20:33:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 187478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 44C392C00B4 for ; Fri, 28 Sep 2012 06:33:20 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1349382801; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=YgTpo/e4K1vEw88Zi86P Gih7lfw=; b=oQ8oMwjWy8vOPjHr5+QTsNcHnVa8uJ0SIOb1Vq8J93xKxa3nhMYd I8YZ8kHm0tX6OsvZ+1Q7x7UYIe2evwBwKYdLAGh/pU1sVsyrF31/eHZqhGZdj7sO LJHpAgk5zdAEJp3NgwzDrTY2byK6Q9/w5oHgpqoDyyAtAgALpg/+mQw= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=HcXVqZiOyhcsO9z7REYwBxwv7cCqBpDz/DbxxCGcFBTQdL/cZCqyIrZ5rKVakR LA++SnqPXv78DFCeqFtDqZYG2+CXBG/H5mWkJsr2W+I5DIvxGOxMrWlACfNJf2zW fzApRnyg0kYlN9QZclk74ixsMnIu47evfKIecccbI2JvY=; Received: (qmail 26963 invoked by alias); 27 Sep 2012 20:33:14 -0000 Received: (qmail 26948 invoked by uid 22791); 27 Sep 2012 20:33:13 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Sep 2012 20:33:09 +0000 Received: by iebc13 with SMTP id c13so6516682ieb.20 for ; Thu, 27 Sep 2012 13:33:08 -0700 (PDT) Received: by 10.42.61.196 with SMTP id v4mr4001529ich.24.1348777988269; Thu, 27 Sep 2012 13:33:08 -0700 (PDT) Received: from gnu-tools-1.localdomain (76-220-57-190.lightspeed.sntcca.sbcglobal.net. [76.220.57.190]) by mx.google.com with ESMTPS id aa4sm13533300igc.15.2012.09.27.13.33.06 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:33:07 -0700 (PDT) Received: by gnu-tools-1.localdomain (Postfix, from userid 1000) id 19A481A479E; Thu, 27 Sep 2012 13:33:05 -0700 (PDT) Date: Thu, 27 Sep 2012 13:33:05 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org Subject: PATCH: [4.6 Regression] 22_locale/num_put/put/char/9780-2.cc Message-ID: <20120927203304.GA9965@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, This patch backports revision 182385 from trunk to 4.6 branch. Tested on Linux/x86-64. OK to install? Thanks. H.J. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index aa94768..ff4b13e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2012-09-27 H.J. Lu + + Backport from mainline + 2011-12-15 Benjamin Kosnik + + * testsuite/22_locale/num_put/put/char/9780-2.cc: Add test for "C" + locale, add sanity checks in case of grouping. + 2012-07-22 Jonathan Wakely PR libstdc++/53270 diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc index 7993691..5cf0d04 100644 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc @@ -1,7 +1,7 @@ // { dg-require-namedlocale "de_DE" } // { dg-require-namedlocale "es_ES" } -// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -22,23 +22,60 @@ #include #include -int main() +// Make sure that formatted output uses the locale in the output stream. +using namespace std; +locale l1 = locale("de_DE"); +const num_put& np = use_facet >(l1); +const numpunct& npunct = use_facet >(l1); + +void test01() { - using namespace std; + bool test __attribute__((unused)) = true; + + locale l2 = locale("C"); + const numpunct& npunct2 = use_facet >(l2); + char c = npunct2.thousands_sep(); + string s = npunct2.grouping(); + + ostringstream oss; + oss.imbue(l2); + + long l = 1234567890; + np.put(oss.rdbuf(), oss, ' ', l); + string res = oss.str(); + + VERIFY( res == "1234567890" ); +} +void test02() +{ bool test __attribute__((unused)) = true; - locale l1 = locale("de_DE"); + locale l2 = locale("es_ES"); - - const num_put& np = use_facet >(l1); + const numpunct& npunct3 = use_facet >(l2); + char c = npunct3.thousands_sep(); + string s = npunct3.grouping(); + ostringstream oss; oss.imbue(l2); long l = 1234567890; - np.put(oss.rdbuf(), oss, ' ', l); // 1234567890 + np.put(oss.rdbuf(), oss, ' ', l); string res = oss.str(); - - VERIFY( res == "1234567890" ); + if (!s.empty()) + VERIFY( res == "1.234.567.890" ); + else + VERIFY( res == "1234567890" ); +} + +int main() +{ + // Sanity check. + char c = npunct.thousands_sep(); + string s = npunct.grouping(); + + test01(); + test02(); return 0; }