Patchwork [v3] backport r163282 to 4.5 branch to fix libstdc++/45999

login
register
mail settings
Submitter Jonathan Wakely
Date Nov. 1, 2010, 9:33 p.m.
Message ID <AANLkTi=PRVFmhH9icL8ut6dH64TJYeSaZhxeqTGKBXE2@mail.gmail.com>
Download mbox | patch
Permalink /patch/69846/
State New
Headers show

Comments

Jonathan Wakely - Nov. 1, 2010, 9:33 p.m.
On 18 October 2010 20:10, Jonathan Wakely <jwakely.gcc@gmail.com> 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<bool>, so checked in to 4.5
> branch.
>
> 2010-10-18  Jonathan Wakely  <jwakely.gcc@gmail.com>
>
>        Backport from mainline:
>        2010-08-16  Chris Moller  <cmoller@redhat.com>
>
>        http://sourceware.org/bugzilla/show_bug.cgi?id=11874
>        * python/libstdcxx/v6/printers.py (StdVectorPrinter): Added stuff
>        to handle pretty-printing of std::vector<bool>.
>
> Tested x86_64-linux with GDB 7.1-34.fc13

The vector<bool> 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  <jwakely.gcc@gmail.com>

        PR libstdc++/45999
        * python/libstdcxx/v6/printers.py (StdVectorPrinter): Replace
        conditional expression with backward-compatible if-else.

Patch

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