Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba
- pjl-misc
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Matthias Brantner |
Approved revision: | 11005 |
Merged at revision: | 11142 |
Proposed branch: | lp:~paul-lucas/zorba/pjl-misc |
Merge into: | lp:zorba |
Diff against target: |
380 lines (+115/-78) 9 files modified
include/zorba/internal/ztd.h (+12/-4) include/zorba/store_consts.h (+3/-0) src/api/CMakeLists.txt (+1/-0) src/api/store_consts.cpp (+87/-0) src/diagnostics/dict_zed_keys_h.xq (+0/-55) src/unit_tests/test_unordered_map.cpp (+4/-4) src/unit_tests/test_unordered_set.cpp (+5/-12) src/util/stl_util.h (+1/-1) src/util/string_util.h (+2/-2) |
To merge this branch: | bzr merge lp:~paul-lucas/zorba/pjl-misc |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matthias Brantner | Approve | ||
Paul J. Lucas | Approve | ||
Review via email: mp+138054@code.launchpad.net |
Commit message
1. Added operator<< for SchemaTypeCode to (a) print it better and (b) eliminate warning.
2. Eliminated a few other warnings as well.
Description of the change
1. Added operator<< for SchemaTypeCode to (a) print it better and (b) eliminate warning.
2. Eliminated a few other warnings as well.
Paul J. Lucas (paul-lucas) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
The attempt to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba failed. Below is the output from the failed tests.
CMake Error at /home/ceej/
Validation queue job pjl-misc-
final status was:
4 tests did not succeed - changes not commited.
Error in read script: /home/ceej/
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
The attempt to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba failed. Below is the output from the failed tests.
CMake Error at /home/ceej/
Validation queue job pjl-misc-
final status was:
4 tests did not succeed - changes not commited.
Error in read script: /home/ceej/
Paul J. Lucas (paul-lucas) wrote : | # |
Chris claims the RQ is fixed now.
- 11004. By Paul J. Lucas
-
Merge from trunk.
- 11005. By Paul J. Lucas
-
Fix of MSVC++ 4800 warning.
Matthias Brantner (matthias-brantner) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job pjl-misc-
All tests succeeded!
Preview Diff
1 | === modified file 'include/zorba/internal/ztd.h' |
2 | --- include/zorba/internal/ztd.h 2012-09-19 21:16:15 +0000 |
3 | +++ include/zorba/internal/ztd.h 2012-12-08 00:11:21 +0000 |
4 | @@ -84,7 +84,7 @@ |
5 | * \internal |
6 | * This namespace is used only to bundle the implementation details for |
7 | * implementing \c has_insertion_operator<T>. |
8 | - * This implementation is based on http://stackoverflow.com/questions/4434569/ |
9 | + * This implementation is based on http://stackoverflow.com/q/4434569/ |
10 | */ |
11 | namespace has_insertion_operator_impl { |
12 | typedef char no; |
13 | @@ -410,12 +410,20 @@ |
14 | } |
15 | |
16 | /** |
17 | - * Converts the the built-in \c bool value to an explicit \c bool value. |
18 | + * Converts the given value to an explicit \c bool value. |
19 | * |
20 | - * @param value The \c bool value to convert. |
21 | + * @tparam T The type of the value to convert. |
22 | + * @param value The value to convert. |
23 | * @return Return said value. |
24 | */ |
25 | - static type value_of( bool value ) { |
26 | + template<typename T> static |
27 | + typename std::enable_if<ZORBA_TR1_NS::is_convertible<T,bool>::value, |
28 | + type>::type |
29 | + value_of( T const &value ) { |
30 | + // |
31 | + // Using a template here eliminates a MSVC++ 4800 warning: |
32 | + // "forcing value to 'true' or 'false' (performance warning)" |
33 | + // |
34 | return value ? true_value() : false_value(); |
35 | } |
36 | }; |
37 | |
38 | === modified file 'include/zorba/store_consts.h' |
39 | --- include/zorba/store_consts.h 2012-09-19 21:16:15 +0000 |
40 | +++ include/zorba/store_consts.h 2012-12-08 00:11:21 +0000 |
41 | @@ -16,6 +16,7 @@ |
42 | #ifndef ZORBA_STORE_STORE_CONSTS_H |
43 | #define ZORBA_STORE_STORE_CONSTS_H |
44 | |
45 | +#include <iostream> |
46 | #include <string> |
47 | #include <zorba/config.h> |
48 | |
49 | @@ -89,6 +90,8 @@ |
50 | XS_LAST |
51 | }; |
52 | |
53 | +std::ostream& operator<<( std::ostream&, SchemaTypeCode ); |
54 | + |
55 | |
56 | class ZORBA_DLL_PUBLIC StoreConsts |
57 | { |
58 | |
59 | === modified file 'src/api/CMakeLists.txt' |
60 | --- src/api/CMakeLists.txt 2012-10-08 12:09:36 +0000 |
61 | +++ src/api/CMakeLists.txt 2012-12-08 00:11:21 +0000 |
62 | @@ -57,6 +57,7 @@ |
63 | zorba_functions.cpp |
64 | annotationimpl.cpp |
65 | auditimpl.cpp |
66 | + store_consts.cpp |
67 | streambuf.cpp |
68 | transcode_streambuf.cpp |
69 | uuid.cpp |
70 | |
71 | === added file 'src/api/store_consts.cpp' |
72 | --- src/api/store_consts.cpp 1970-01-01 00:00:00 +0000 |
73 | +++ src/api/store_consts.cpp 2012-12-08 00:11:21 +0000 |
74 | @@ -0,0 +1,87 @@ |
75 | +/* |
76 | + * Copyright 2006-2008 The FLWOR Foundation. |
77 | + * |
78 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
79 | + * you may not use this file except in compliance with the License. |
80 | + * You may obtain a copy of the License at |
81 | + * |
82 | + * http://www.apache.org/licenses/LICENSE-2.0 |
83 | + * |
84 | + * Unless required by applicable law or agreed to in writing, software |
85 | + * distributed under the License is distributed on an "AS IS" BASIS |
86 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
87 | + * See the License for the specific language governing permissions and |
88 | + * limitations under the License. |
89 | + */ |
90 | + |
91 | +#include <zorba/store_consts.h> |
92 | + |
93 | +namespace zorba { |
94 | +namespace store { |
95 | + |
96 | +/////////////////////////////////////////////////////////////////////////////// |
97 | + |
98 | +std::ostream& operator<<( std::ostream &o, SchemaTypeCode c ) { |
99 | + static char const *const s[] = { |
100 | + "xs:anyAtomicType", // 0 |
101 | + "xs:string", // 1 |
102 | + "xs:normalizedString", // 2 |
103 | + "xs:token", // 3 |
104 | + "xs:language", // 4 |
105 | + "xs:NMTOKEN", // 5 |
106 | + "xs:Name", // 6 |
107 | + "xs:NCName", // 7 |
108 | + "xs:ID", // 8 |
109 | + "xs:IDREF", // 9 |
110 | + "xs:ENTITY", // 10 |
111 | + "xs:untypedAtomic", // 11 |
112 | + "xs:dateTime", // 12 |
113 | + "xs:date", // 13 |
114 | + "xs:time", // 14 |
115 | + "xs:duration", // 15 |
116 | + "xs:dayTimeDuration", // 16 |
117 | + "xs:yearMonthDuration", // 17 |
118 | + "xs:float", // 18 |
119 | + "xs:double", // 19 |
120 | + "xs:decimal", // 20 |
121 | + "xs:integer", // 21 |
122 | + "xs:nonPositiveInteger", // 22 |
123 | + "xs:negativeInteger", // 23 |
124 | + "xs:long", // 24 |
125 | + "xs:int", // 25 |
126 | + "xs:short", // 26 |
127 | + "xs:byte", // 27 |
128 | + "xs:nonNegativeInteger", // 28 |
129 | + "xs:unsignedLong", // 29 |
130 | + "xs:unsignedInt", // 30 |
131 | + "xs:unsignedShort", // 31 |
132 | + "xs:unsignedByte", // 32 |
133 | + "xs:positiveInteger", // 33 |
134 | + "xs:gYearMonth", // 34 |
135 | + "xs:gYear", // 35 |
136 | + "xs:gMonthDay", // 36 |
137 | + "xs:gDay", // 37 |
138 | + "xs:gMonth", // 38 |
139 | + "xs:boolean", // 39 |
140 | + "xs:base64Binary", // 40 |
141 | + "xs:hexBinary", // 41 |
142 | + "xs:anyURI", // 42 |
143 | + "xs:QNAME", // 43 |
144 | + "xs:NOTATION", // 44 |
145 | + "js:null", // 45 |
146 | + }; |
147 | + |
148 | + if ( c >= 0 && c < XS_LAST ) |
149 | + o << s[ c ]; |
150 | + else |
151 | + o << "[illegal type code: " << (int)c << ']'; |
152 | + |
153 | + return o; |
154 | +}; |
155 | + |
156 | +/////////////////////////////////////////////////////////////////////////////// |
157 | + |
158 | +} // namespace store |
159 | +} // namespace zorba |
160 | + |
161 | +/* vim:set et sw=2 ts=2: */ |
162 | |
163 | === added file 'src/diagnostics/dict_zed_keys_h.xq' |
164 | --- src/diagnostics/dict_zed_keys_h.xq 1970-01-01 00:00:00 +0000 |
165 | +++ src/diagnostics/dict_zed_keys_h.xq 2012-12-08 00:11:21 +0000 |
166 | @@ -0,0 +1,55 @@ |
167 | +(: |
168 | + : Copyright 2006-2009 The FLWOR Foundation. |
169 | + : |
170 | + : Licensed under the Apache License, Version 2.0 (the "License"); |
171 | + : you may not use this file except in compliance with the License. |
172 | + : You may obtain a copy of the License at |
173 | + : |
174 | + : http://www.apache.org/licenses/LICENSE-2.0 |
175 | + : |
176 | + : Unless required by applicable law or agreed to in writing, software |
177 | + : distributed under the License is distributed on an "AS IS" BASIS, |
178 | + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
179 | + : See the License for the specific language governing permissions and |
180 | + : limitations under the License. |
181 | +:) |
182 | + |
183 | +import module namespace util = "http://www.zorba-xquery.com/diagnostic/util" at "diagnostic_util.xq"; |
184 | + |
185 | +declare function local:make-zed-defines( $doc ) as xs:string* |
186 | +{ |
187 | + for $entry in ( $doc//entry ) |
188 | + let $key := $entry/@key |
189 | + return |
190 | + if ( contains( $key, ' ' ) ) |
191 | + then () |
192 | + else |
193 | + let $full_key := |
194 | + if ( $entry/parent::diagnostic ) |
195 | + then concat( $entry/parent::diagnostic/@code, "_", $key ) |
196 | + else $key |
197 | + return concat( "#define ZED_", $full_key, ' "~', $full_key, '"' ) |
198 | +}; |
199 | + |
200 | +declare variable $input external; |
201 | + |
202 | +string-join( |
203 | + ( util:copyright(), |
204 | + '#ifndef ZORBA_DIAGNOSTICS_ZED_KEYS', |
205 | + '#define ZORBA_DIAGNOSTICS_ZED_KEYS', |
206 | + '', |
207 | + local:make-zed-defines( $input ), |
208 | + '', |
209 | + '#endif /* ZORBA_DIAGNOSTICS_ZED_KEYS */', |
210 | + '/*', |
211 | + ' * Local variables:', |
212 | + ' * mode: c++', |
213 | + ' * End:', |
214 | + ' */', |
215 | + '/* vim:set et sw=2 ts=2: */' |
216 | + ), |
217 | + $util:newline |
218 | +), |
219 | +$util:newline |
220 | + |
221 | +(: vim:set syntax=xquery et sw=2 ts=2: :) |
222 | |
223 | === removed file 'src/diagnostics/dict_zed_keys_h.xq' |
224 | --- src/diagnostics/dict_zed_keys_h.xq 2012-09-18 02:14:50 +0000 |
225 | +++ src/diagnostics/dict_zed_keys_h.xq 1970-01-01 00:00:00 +0000 |
226 | @@ -1,55 +0,0 @@ |
227 | -(: |
228 | - : Copyright 2006-2009 The FLWOR Foundation. |
229 | - : |
230 | - : Licensed under the Apache License, Version 2.0 (the "License"); |
231 | - : you may not use this file except in compliance with the License. |
232 | - : You may obtain a copy of the License at |
233 | - : |
234 | - : http://www.apache.org/licenses/LICENSE-2.0 |
235 | - : |
236 | - : Unless required by applicable law or agreed to in writing, software |
237 | - : distributed under the License is distributed on an "AS IS" BASIS, |
238 | - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
239 | - : See the License for the specific language governing permissions and |
240 | - : limitations under the License. |
241 | -:) |
242 | - |
243 | -import module namespace util = "http://www.zorba-xquery.com/diagnostic/util" at "diagnostic_util.xq"; |
244 | - |
245 | -declare function local:make-zed-defines( $doc ) as xs:string* |
246 | -{ |
247 | - for $entry in ( $doc//entry ) |
248 | - let $key := $entry/@key |
249 | - return |
250 | - if ( contains( $key, ' ' ) ) |
251 | - then () |
252 | - else |
253 | - let $full_key := |
254 | - if ( $entry/parent::diagnostic ) |
255 | - then concat( $entry/parent::diagnostic/@code, "_", $key ) |
256 | - else $key |
257 | - return concat( "#define ZED_", $full_key, ' "~', $full_key, '"' ) |
258 | -}; |
259 | - |
260 | -declare variable $input external; |
261 | - |
262 | -string-join( |
263 | - ( util:copyright(), |
264 | - '#ifndef ZORBA_DIAGNOSTICS_ZED_KEYS', |
265 | - '#define ZORBA_DIAGNOSTICS_ZED_KEYS', |
266 | - '', |
267 | - local:make-zed-defines( $input ), |
268 | - '', |
269 | - '#endif /* ZORBA_DIAGNOSTICS_ZED_KEYS */', |
270 | - '/*', |
271 | - ' * Local variables:', |
272 | - ' * mode: c++', |
273 | - ' * End:', |
274 | - ' */', |
275 | - '/* vim:set et sw=2 ts=2: */' |
276 | - ), |
277 | - $util:newline |
278 | -), |
279 | -$util:newline |
280 | - |
281 | -(: vim:set syntax=xquery et sw=2 ts=2: :) |
282 | |
283 | === modified file 'src/unit_tests/test_unordered_map.cpp' |
284 | --- src/unit_tests/test_unordered_map.cpp 2012-06-26 01:08:10 +0000 |
285 | +++ src/unit_tests/test_unordered_map.cpp 2012-12-08 00:11:21 +0000 |
286 | @@ -194,8 +194,9 @@ |
287 | } |
288 | |
289 | static void test_rehash() { |
290 | - unordered_map<int,int> m; |
291 | - unordered_map<int,int>::size_type const initial_buckets = m.bucket_count(); |
292 | + typedef unordered_map<int,int> map_type; |
293 | + map_type m; |
294 | + map_type::size_type const initial_buckets = m.bucket_count(); |
295 | |
296 | // Add elements until bucket_count() changes which implies a rehash was done. |
297 | for ( int i = 0; m.bucket_count() == initial_buckets; ++i ) |
298 | @@ -204,8 +205,7 @@ |
299 | ASSERT_TRUE( m.bucket_count() > initial_buckets ); |
300 | |
301 | // Ensure all the elements are still there. |
302 | - unordered_map<int,int>::size_type const size = m.size(); |
303 | - for ( int i = 0; i < size; ++i ) |
304 | + for ( int i = 0; (unsigned)i < m.size(); ++i ) |
305 | ASSERT_TRUE_AND_NO_EXCEPTION( m.at( i ) == i ); |
306 | } |
307 | |
308 | |
309 | === modified file 'src/unit_tests/test_unordered_set.cpp' |
310 | --- src/unit_tests/test_unordered_set.cpp 2012-06-26 01:08:10 +0000 |
311 | +++ src/unit_tests/test_unordered_set.cpp 2012-12-08 00:11:21 +0000 |
312 | @@ -38,12 +38,6 @@ |
313 | return result; |
314 | } |
315 | |
316 | -static void print_exception( char const *expr, int line, |
317 | - std::exception const &e ) { |
318 | - assert_true( expr, line, false ); |
319 | - cout << "+ exception: " << e.what() << endl; |
320 | -} |
321 | - |
322 | #define ASSERT_TRUE( EXPR ) assert_true( #EXPR, __LINE__, !!(EXPR) ) |
323 | |
324 | /////////////////////////////////////////////////////////////////////////////// |
325 | @@ -168,10 +162,11 @@ |
326 | } |
327 | |
328 | static void test_rehash() { |
329 | - unordered_set<int> set; |
330 | - unordered_set<int>::const_iterator i; |
331 | + typedef unordered_set<int> set_type; |
332 | + set_type set; |
333 | + set_type::const_iterator i; |
334 | |
335 | - unordered_set<int>::size_type const initial_buckets = set.bucket_count(); |
336 | + set_type::size_type const initial_buckets = set.bucket_count(); |
337 | |
338 | // Add elements until bucket_count() changes which implies a rehash was done. |
339 | for ( int n = 0; set.bucket_count() == initial_buckets; ++n ) |
340 | @@ -180,11 +175,9 @@ |
341 | ASSERT_TRUE( set.bucket_count() > initial_buckets ); |
342 | |
343 | // Ensure all the elements are still there. |
344 | - unordered_set<int>::size_type const size = set.size(); |
345 | - for ( int n = 0; n < size; ++n ) { |
346 | + for ( int n = 0; (unsigned)n < set.size(); ++n ) |
347 | if ( ASSERT_TRUE( (i = set.find( n )) != set.end() ) ) |
348 | ASSERT_TRUE( *i == n ); |
349 | - } |
350 | } |
351 | |
352 | static void test_swap() { |
353 | |
354 | === modified file 'src/util/stl_util.h' |
355 | --- src/util/stl_util.h 2012-11-29 03:48:40 +0000 |
356 | +++ src/util/stl_util.h 2012-12-08 00:11:21 +0000 |
357 | @@ -365,7 +365,7 @@ |
358 | // warning-free. |
359 | // |
360 | // Note: the use of "!!" is to work around a compiler problem on Windows; |
361 | -// see: http://stackoverflow.com/questions/9285657/sfinae-differentiation-between-signed-and-unsigned |
362 | +// see http://stackoverflow.com/q/9285657 |
363 | // |
364 | |
365 | template<typename N1,typename N2> inline |
366 | |
367 | === modified file 'src/util/string_util.h' |
368 | --- src/util/string_util.h 2012-09-19 21:16:15 +0000 |
369 | +++ src/util/string_util.h 2012-12-08 00:11:21 +0000 |
370 | @@ -46,8 +46,8 @@ |
371 | * the resultant string to some function. See the BUILD_STRING macro for usage. |
372 | * Note that you can use either "<<" or "," to taste. |
373 | * |
374 | - * See http://stackoverflow.com/questions/5666678/ as to why a class like this |
375 | - * is needed rather than just using an ostringstream directly. |
376 | + * See http://stackoverflow.com/q/5666678 as to why a class like this is |
377 | + * needed rather than just using an ostringstream directly. |
378 | */ |
379 | class string_builder { |
380 | public: |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ pjl-misc- 2012-12- 05T04-55- 07.832Z/ log.html
Log at: http://