1 |
vapier 12/08/28 21:52:08 |
2 |
|
3 |
Added: gmock-1.4.0-more-gcc-4.7.patch |
4 |
Log: |
5 |
Add another fix from upstream for building with gcc-4.7. |
6 |
|
7 |
(Portage version: 2.2.0_alpha120/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-cpp/gmock/files/gmock-1.4.0-more-gcc-4.7.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-cpp/gmock/files/gmock-1.4.0-more-gcc-4.7.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-cpp/gmock/files/gmock-1.4.0-more-gcc-4.7.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: gmock-1.4.0-more-gcc-4.7.patch |
16 |
=================================================================== |
17 |
taken from upstream repo |
18 |
|
19 |
------------------------------------------------------------------------ |
20 |
r245 | zhanyong.wan | 2009-12-02 03:36:42 -0500 (Wed, 02 Dec 2009) | 2 lines |
21 |
|
22 |
Fixes a C++-standard-compliance bug in gmock-printers.h. |
23 |
|
24 |
|
25 |
Index: include/gmock/gmock-printers.h |
26 |
=================================================================== |
27 |
--- include/gmock/gmock-printers.h (revision 244) |
28 |
+++ include/gmock/gmock-printers.h (revision 245) |
29 |
@@ -434,63 +434,10 @@ inline void PrintTo(const ::std::wstring |
30 |
// Overload for ::std::tr1::tuple. Needed for printing function |
31 |
// arguments, which are packed as tuples. |
32 |
|
33 |
-typedef ::std::vector<string> Strings; |
34 |
- |
35 |
-// This helper template allows PrintTo() for tuples and |
36 |
-// UniversalTersePrintTupleFieldsToStrings() to be defined by |
37 |
-// induction on the number of tuple fields. The idea is that |
38 |
-// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N |
39 |
-// fields in tuple t, and can be defined in terms of |
40 |
-// TuplePrefixPrinter<N - 1>. |
41 |
- |
42 |
-// The inductive case. |
43 |
-template <size_t N> |
44 |
-struct TuplePrefixPrinter { |
45 |
- // Prints the first N fields of a tuple. |
46 |
- template <typename Tuple> |
47 |
- static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) { |
48 |
- TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os); |
49 |
- *os << ", "; |
50 |
- UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type> |
51 |
- ::Print(::std::tr1::get<N - 1>(t), os); |
52 |
- } |
53 |
- |
54 |
- // Tersely prints the first N fields of a tuple to a string vector, |
55 |
- // one element for each field. |
56 |
- template <typename Tuple> |
57 |
- static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) { |
58 |
- TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings); |
59 |
- ::std::stringstream ss; |
60 |
- UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss); |
61 |
- strings->push_back(ss.str()); |
62 |
- } |
63 |
-}; |
64 |
- |
65 |
-// Base cases. |
66 |
-template <> |
67 |
-struct TuplePrefixPrinter<0> { |
68 |
- template <typename Tuple> |
69 |
- static void PrintPrefixTo(const Tuple&, ::std::ostream*) {} |
70 |
- |
71 |
- template <typename Tuple> |
72 |
- static void TersePrintPrefixToStrings(const Tuple&, Strings*) {} |
73 |
-}; |
74 |
-template <> |
75 |
-template <typename Tuple> |
76 |
-void TuplePrefixPrinter<1>::PrintPrefixTo(const Tuple& t, ::std::ostream* os) { |
77 |
- UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>:: |
78 |
- Print(::std::tr1::get<0>(t), os); |
79 |
-} |
80 |
- |
81 |
// Helper function for printing a tuple. T must be instantiated with |
82 |
// a tuple type. |
83 |
template <typename T> |
84 |
-void PrintTupleTo(const T& t, ::std::ostream* os) { |
85 |
- *os << "("; |
86 |
- TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>:: |
87 |
- PrintPrefixTo(t, os); |
88 |
- *os << ")"; |
89 |
-} |
90 |
+void PrintTupleTo(const T& t, ::std::ostream* os); |
91 |
|
92 |
// Overloaded PrintTo() for tuples of various arities. We support |
93 |
// tuples of up-to 10 fields. The following implementation works |
94 |
@@ -725,6 +672,64 @@ void UniversalPrint(const T& value, ::st |
95 |
UniversalPrinter<T>::Print(value, os); |
96 |
} |
97 |
|
98 |
+typedef ::std::vector<string> Strings; |
99 |
+ |
100 |
+// This helper template allows PrintTo() for tuples and |
101 |
+// UniversalTersePrintTupleFieldsToStrings() to be defined by |
102 |
+// induction on the number of tuple fields. The idea is that |
103 |
+// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N |
104 |
+// fields in tuple t, and can be defined in terms of |
105 |
+// TuplePrefixPrinter<N - 1>. |
106 |
+ |
107 |
+// The inductive case. |
108 |
+template <size_t N> |
109 |
+struct TuplePrefixPrinter { |
110 |
+ // Prints the first N fields of a tuple. |
111 |
+ template <typename Tuple> |
112 |
+ static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) { |
113 |
+ TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os); |
114 |
+ *os << ", "; |
115 |
+ UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type> |
116 |
+ ::Print(::std::tr1::get<N - 1>(t), os); |
117 |
+ } |
118 |
+ |
119 |
+ // Tersely prints the first N fields of a tuple to a string vector, |
120 |
+ // one element for each field. |
121 |
+ template <typename Tuple> |
122 |
+ static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) { |
123 |
+ TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings); |
124 |
+ ::std::stringstream ss; |
125 |
+ UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss); |
126 |
+ strings->push_back(ss.str()); |
127 |
+ } |
128 |
+}; |
129 |
+ |
130 |
+// Base cases. |
131 |
+template <> |
132 |
+struct TuplePrefixPrinter<0> { |
133 |
+ template <typename Tuple> |
134 |
+ static void PrintPrefixTo(const Tuple&, ::std::ostream*) {} |
135 |
+ |
136 |
+ template <typename Tuple> |
137 |
+ static void TersePrintPrefixToStrings(const Tuple&, Strings*) {} |
138 |
+}; |
139 |
+template <> |
140 |
+template <typename Tuple> |
141 |
+void TuplePrefixPrinter<1>::PrintPrefixTo(const Tuple& t, ::std::ostream* os) { |
142 |
+ UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>:: |
143 |
+ Print(::std::tr1::get<0>(t), os); |
144 |
+} |
145 |
+ |
146 |
+// Helper function for printing a tuple. T must be instantiated with |
147 |
+// a tuple type. |
148 |
+template <typename T> |
149 |
+void PrintTupleTo(const T& t, ::std::ostream* os) { |
150 |
+ *os << "("; |
151 |
+ TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>:: |
152 |
+ PrintPrefixTo(t, os); |
153 |
+ *os << ")"; |
154 |
+} |
155 |
+ |
156 |
// Prints the fields of a tuple tersely to a string vector, one |
157 |
// element for each field. See the comment before |
158 |
// UniversalTersePrint() for how we define "tersely". |
159 |
|
160 |
------------------------------------------------------------------------ |