]> git.pld-linux.org Git - packages/gcc.git/commitdiff
- patch pretty printers to support std::vector<bool>. auto/th/gcc-4_5_1-3
authorPaweł Sikora <pluto@pld-linux.org>
Sat, 16 Oct 2010 08:52:48 +0000 (08:52 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- release 3 for rebuild with new branch diff.

Changed files:
    gcc-python-pretty-printer-bool-vector.patch -> 1.1
    gcc.spec -> 1.636

gcc-python-pretty-printer-bool-vector.patch [new file with mode: 0644]
gcc.spec

diff --git a/gcc-python-pretty-printer-bool-vector.patch b/gcc-python-pretty-printer-bool-vector.patch
new file mode 100644 (file)
index 0000000..bf4f531
--- /dev/null
@@ -0,0 +1,85 @@
+--- libstdc++-v3/python/libstdcxx/v6/printers.py       (revision 163281)
++++ libstdc++-v3/python/libstdcxx/v6/printers.py       (revision 163282)
+@@ -153,37 +153,71 @@
+     "Print a std::vector"
+     class _iterator:
+-        def __init__ (self, start, finish):
+-            self.item = start
+-            self.finish = finish
++        def __init__ (self, start, finish, bitvec):
++            self.bitvec = bitvec
++            if bitvec:
++                self.item   = start['_M_p']
++                self.so     = start['_M_offset']
++                self.finish = finish['_M_p']
++                self.fo     = finish['_M_offset']
++                itype = self.item.dereference().type
++                self.isize = 8 * itype.sizeof
++            else:
++                self.item = start
++                self.finish = finish
+             self.count = 0
+         def __iter__(self):
+             return self
+         def next(self):
+-            if self.item == self.finish:
+-                raise StopIteration
+             count = self.count
+             self.count = self.count + 1
+-            elt = self.item.dereference()
+-            self.item = self.item + 1
+-            return ('[%d]' % count, elt)
++            if self.bitvec:
++                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
++                self.so = self.so + 1
++                if self.so >= self.isize:
++                    self.item = self.item + 1
++                    self.so = 0
++                return ('[%d]' % count, obit)
++            else:
++                if self.item == self.finish:
++                    raise StopIteration
++                elt = self.item.dereference()
++                self.item = self.item + 1
++                return ('[%d]' % count, elt)
+     def __init__(self, typename, val):
+         self.typename = typename
+         self.val = val
++        self.is_bool = val.type.template_argument(0).code  == gdb.TYPE_CODE_BOOL
+     def children(self):
+         return self._iterator(self.val['_M_impl']['_M_start'],
+-                              self.val['_M_impl']['_M_finish'])
++                              self.val['_M_impl']['_M_finish'],
++                              self.is_bool)
+     def to_string(self):
+         start = self.val['_M_impl']['_M_start']
+         finish = self.val['_M_impl']['_M_finish']
+         end = self.val['_M_impl']['_M_end_of_storage']
+-        return ('%s of length %d, capacity %d'
+-                % (self.typename, int (finish - start), int (end - start)))
++        if self.is_bool:
++            start = self.val['_M_impl']['_M_start']['_M_p']
++            so    = self.val['_M_impl']['_M_start']['_M_offset']
++            finish = self.val['_M_impl']['_M_finish']['_M_p']
++            fo     = self.val['_M_impl']['_M_finish']['_M_offset']
++            itype = start.dereference().type
++            bl = 8 * itype.sizeof
++            length   = (bl - so) + bl * ((finish - start) - 1) + fo
++            capacity = bl * (end - start)
++            return ('%s<bool> of length %d, capacity %d'
++                    % (self.typename, int (length), int (capacity)))
++        else:
++            return ('%s of length %d, capacity %d'
++                    % (self.typename, int (finish - start), int (end - start)))
+     def display_hint(self):
+         return 'array'
index 81e5a5f8726b52a52a4536d8ecc3b5a0f27b864c..cdc7bb77aaac53abc8b89c85072f7fefec497187 100644 (file)
--- a/gcc.spec
+++ b/gcc.spec
@@ -70,7 +70,7 @@ Summary(pl.UTF-8):    Kolekcja kompilatorów GNU: kompilator C i pliki współdziel
 Summary(pt_BR.UTF-8):  Coleção dos compiladores GNU: o compilador C e arquivos compartilhados
 Name:          gcc
 Version:       %{major_ver}.%{minor_ver}
-Release:       2
+Release:       3
 Epoch:         6
 License:       GPL v3+
 Group:         Development/Languages
@@ -93,6 +93,7 @@ Patch9:               %{name}-hash-style-gnu.patch
 Patch10:       %{name}-moresparcs.patch
 Patch11:       %{name}-build-id.patch
 Patch12:       %{name}-plugin-decl-hook.patch
+Patch13:       %{name}-python-pretty-printer-bool-vector.patch
 URL:           http://gcc.gnu.org/
 BuildRequires: autoconf
 %{?with_tests:BuildRequires:   autogen}
@@ -1227,6 +1228,7 @@ Statyczna biblioteki Obiektowego C - wersja 32-bitowa.
 %patch10 -p0
 %patch11 -p0
 %patch12 -p0
+%patch13 -p0
 
 mv ChangeLog ChangeLog.general
 
This page took 0.194949 seconds and 4 git commands to generate.