From patchwork Mon Nov 1 21:33:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 69846 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 C8259B6EF1 for ; Tue, 2 Nov 2010 08:33:14 +1100 (EST) Received: (qmail 29028 invoked by alias); 1 Nov 2010 21:33:12 -0000 Received: (qmail 28996 invoked by uid 22791); 1 Nov 2010 21:33:10 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Nov 2010 21:33:05 +0000 Received: by wya21 with SMTP id 21so5969062wya.20 for ; Mon, 01 Nov 2010 14:33:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.127.66 with SMTP id f2mr2797104wbs.81.1288647182359; Mon, 01 Nov 2010 14:33:02 -0700 (PDT) Received: by 10.216.240.132 with HTTP; Mon, 1 Nov 2010 14:33:02 -0700 (PDT) In-Reply-To: References: Date: Mon, 1 Nov 2010 21:33:02 +0000 Message-ID: Subject: Re: [v3] backport r163282 to 4.5 branch to fix libstdc++/45999 From: Jonathan Wakely To: "libstdc++" , gcc-patches 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 On 18 October 2010 20:10, Jonathan Wakely wrote: > Not a regression, but the python pretty printers are a highly visible > feature of GCC 4.5 and GDB 7 amd I think it's worth backporting this > fairly safe change to support vector, so checked in to 4.5 > branch. > > 2010-10-18  Jonathan Wakely   > >        Backport from mainline: >        2010-08-16  Chris Moller   > >        http://sourceware.org/bugzilla/show_bug.cgi?id=11874 >        * python/libstdcxx/v6/printers.py (StdVectorPrinter): Added stuff >        to handle pretty-printing of std::vector. > > Tested x86_64-linux with GDB 7.1-34.fc13 The vector printer doesn't work with python 2.4, fixed by the attached on trunk and 4.5 branch Tested x86_64/Linux with python 2.6 by me and by the reporter with python 2.4 2010-11-01 Jonathan Wakely PR libstdc++/45999 * python/libstdcxx/v6/printers.py (StdVectorPrinter): Replace conditional expression with backward-compatible if-else. Index: python/libstdcxx/v6/printers.py =================================================================== --- python/libstdcxx/v6/printers.py (revision 166146) +++ python/libstdcxx/v6/printers.py (working copy) @@ -177,7 +177,10 @@ class StdVectorPrinter: if self.item == self.finish and self.so >= self.fo: raise StopIteration elt = self.item.dereference() - obit = 1 if elt & (1 << self.so) else 0 + if elt & (1 << self.so): + obit = 1 + else: + obit = 0 self.so = self.so + 1 if self.so >= self.isize: self.item = self.item + 1