Merge lp:~stewart/percona-playback/compiler-warnings-2 into lp:~percona-dev/percona-playback/light

Proposed by Stewart Smith
Status: Merged
Merged at revision: 126
Proposed branch: lp:~stewart/percona-playback/compiler-warnings-2
Merge into: lp:~percona-dev/percona-playback/light
Prerequisite: lp:~stewart/percona-playback/compiler-warnings
Diff against target: 515 lines (+98/-158)
10 files modified
m4/pandora_have_libmysqlclient.m4 (+2/-1)
src/common.h (+1/-1)
src/long_string.cc (+61/-61)
src/long_string.h (+1/-1)
src/mysql_client.cc (+7/-7)
src/options.cc (+16/-11)
src/query.cc (+5/-66)
src/queue.h (+1/-1)
src/slow_query_log_parser.h (+2/-2)
src/supervisor.cc (+2/-7)
To merge this branch: bzr merge lp:~stewart/percona-playback/compiler-warnings-2
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+77457@code.launchpad.net

Description of the change

even more compiler warning fixes. with this tree, we're down to just 6.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'm4/pandora_have_libmysqlclient.m4'
2--- m4/pandora_have_libmysqlclient.m4 2011-09-29 06:41:38 +0000
3+++ m4/pandora_have_libmysqlclient.m4 2011-09-29 06:41:38 +0000
4@@ -64,10 +64,11 @@
5 AS_IF([test "x$MYSQL_CONFIG" = "xISDIR"],[
6 IBASE="-I${with_mysql}"
7 MYSQL_CONFIG="${with_mysql}/scripts/mysql_config"
8- ADDIFLAGS="$IBASE/include "
9+ ADDIFLAGS="$IBASE/include -isystem $IBASE/include"
10 ADDLDFLAGS="-L${with_mysql}/libmysql_r/.libs/ -L${with_mysql}/mysys/.libs -L${with_mysql}/mysys -L${with_mysql}/strings/.libs -L${with_mysql}/strings "
11 ],[
12 MYSQL_INCLUDES=$(${MYSQL_CONFIG} --include)
13+ MYSQL_INCLUDES="$MYSQL_INCLUDES $(echo $MYSQL_INCLUDES|sed -e 's/-I/-isystem /')"
14 MYSQL_LIBS=$(${MYSQL_CONFIG} --libs_r)
15 ])
16
17
18=== modified file 'src/common.h'
19--- src/common.h 2011-09-29 06:41:38 +0000
20+++ src/common.h 2011-09-29 06:41:38 +0000
21@@ -29,7 +29,7 @@
22 #include <boost/shared_ptr.hpp>
23 #include <pthread.h>
24
25-#if DEBUG
26+#ifdef DEBUG
27 //DEBUG
28
29 #include <cassert>
30
31=== modified file 'src/long_string.cc'
32--- src/long_string.cc 2011-09-29 06:41:38 +0000
33+++ src/long_string.cc 2011-09-29 06:41:38 +0000
34@@ -123,35 +123,35 @@
35 m_length= 0;
36 m_data[m_length]= 0;
37 }
38-void String::set(const char* data)
39-{
40- clear();
41- add_last(data);
42-}
43-void String::set(const char* data, std::size_t length)
44-{
45- clear();
46- add_last(data, length);
47-}
48-void String::set(std::string const &data)
49-{
50- clear();
51- add_last(data);
52-}
53-void String::set(String const &data)
54-{
55- clear();
56- add_last(data);
57-}
58-void String::remove_first(std::size_t length)
59+void String::set(const char* str)
60+{
61+ clear();
62+ add_last(str);
63+}
64+void String::set(const char* str, std::size_t len)
65+{
66+ clear();
67+ add_last(str, len);
68+}
69+void String::set(std::string const &str)
70+{
71+ clear();
72+ add_last(str);
73+}
74+void String::set(String const &str)
75+{
76+ clear();
77+ add_last(str);
78+}
79+void String::remove_first(std::size_t len)
80 {
81 CHECK_C_STRING_LENGTH(m_data, m_length);
82- if (m_length < length)
83- throw Too_Short_String(m_max, m_length, length);
84+ if (m_length < len)
85+ throw Too_Short_String(m_max, m_length, len);
86 else
87 {
88- m_length -= length;
89- memmove(m_data, m_data + length, m_length);
90+ m_length -= len;
91+ memmove(m_data, m_data + len, m_length);
92 m_data[m_length]= 0;
93 }
94 }
95@@ -169,30 +169,30 @@
96 CHECK_C_STRING(value);
97 add_last(value, strlen(value));
98 }
99-void String::add_last(const char* value, std::size_t length)
100+void String::add_last(const char* value, std::size_t len)
101 {
102 CHECK_C_STRING_LENGTH(m_data, m_length);
103- if((m_max - m_length) < length)
104+ if((m_max - m_length) < len)
105 {
106 std::cerr << "Too_Long_String, current:\n" << (*this);
107 std::cerr << "\nlength: " << m_length << " max: " << m_max;
108- std::cerr << "\nadd_last: " << length << "\n" << std::flush;
109- throw Too_Long_String(m_max, m_length, length);
110+ std::cerr << "\nadd_last: " << len << "\n" << std::flush;
111+ throw Too_Long_String(m_max, m_length, len);
112 }
113- memcpy(m_data + m_length, value, length);
114- m_length += length;
115+ memcpy(m_data + m_length, value, len);
116+ m_length += len;
117 m_data[ m_length ]= 0;
118 CHECK_C_STRING_LENGTH(m_data, m_length);
119 }
120-void String::add_last(std::string const &data)
121+void String::add_last(std::string const &str)
122 {
123 CHECK_C_STRING_LENGTH(m_data, m_length);
124- add_last(data.c_str(), data.length());
125+ add_last(str.c_str(), str.length());
126 }
127-void String::add_last(String const &data)
128+void String::add_last(String const &str)
129 {
130 CHECK_C_STRING_LENGTH(m_data, m_length);
131- add_last(data.data(), data.length());
132+ add_last(str.data(), str.length());
133 }
134 std::size_t String::index(char c, std::size_t from) const
135 {
136@@ -279,12 +279,12 @@
137 return p != s.length();
138 }
139
140-String_Null_Error::String_Null_Error(const char* method_name)
141+String_Null_Error::String_Null_Error(const char* where)
142 {
143- m_method_name= method_name;
144+ m_method_name= where;
145 m_method_name_c_str= m_method_name.c_str();
146 m_reason= "Impossible call method ";
147- m_reason += method_name;
148+ m_reason += where;
149 m_reason += " when Nullable_String is null";
150 m_reason_c_str= m_reason.c_str();
151 }
152@@ -300,8 +300,8 @@
153 {
154 }
155
156-Nullable_String::Nullable_String(std::size_t max) :
157- String(max), m_null(true)
158+Nullable_String::Nullable_String(std::size_t max_size) :
159+ String(max_size), m_null(true)
160 {
161 }
162 Nullable_String::Nullable_String(Nullable_String const &other) :
163@@ -349,7 +349,7 @@
164 else
165 return String::data();
166 }
167-void Nullable_String::length(std::size_t const &length)
168+void Nullable_String::length(std::size_t const &len)
169 {
170 if (m_null)
171 {
172@@ -357,7 +357,7 @@
173 throw String_Null_Error("length");
174 }
175 else
176- return String::length(length);
177+ return String::length(len);
178 }
179 std::size_t Nullable_String::length() const
180 {
181@@ -387,47 +387,47 @@
182 m_null= false;
183 String::clear();
184 }
185-void Nullable_String::set(const char* data)
186-{
187- CHECK_NULLABLE_C_STRING(data);
188- clear();
189- add_last(data);
190-}
191-void Nullable_String::set(const char* data, std::size_t length)
192-{
193- clear();
194- add_last(data, length);
195-}
196-void Nullable_String::set(std::string const &data)
197-{
198- clear();
199- add_last(data);
200+void Nullable_String::set(const char* str)
201+{
202+ CHECK_NULLABLE_C_STRING(str);
203+ clear();
204+ add_last(str);
205+}
206+void Nullable_String::set(const char* str, std::size_t l)
207+{
208+ clear();
209+ add_last(str, l);
210+}
211+void Nullable_String::set(std::string const &str)
212+{
213+ clear();
214+ add_last(str);
215 }
216 void Nullable_String::set(Nullable_String const &other)
217 {
218 clear();
219 add_last(other);
220 }
221-void Nullable_String::remove_first(std::size_t length)
222+void Nullable_String::remove_first(std::size_t n)
223 {
224 if (m_null)
225 throw String_Null_Error("remove_first");
226 else
227- String::remove_first(length);
228+ String::remove_first(n);
229 }
230 void Nullable_String::add_last(const char* value)
231 {
232 if (value)
233 add_last(value, strlen(value));
234 }
235-void Nullable_String::add_last(const char* value, std::size_t length)
236+void Nullable_String::add_last(const char* value, std::size_t len)
237 {
238 if (value)
239 {
240 if (is_null())
241 throw String_Null_Error("add_last");
242 else
243- get_string().add_last(value, length);
244+ get_string().add_last(value, len);
245 }
246 }
247 void Nullable_String::add_last(std::string const &value)
248
249=== modified file 'src/long_string.h'
250--- src/long_string.h 2011-09-29 06:41:38 +0000
251+++ src/long_string.h 2011-09-29 06:41:38 +0000
252@@ -200,7 +200,7 @@
253 static void apply(Reader &action, Nullable_String &value)
254 {
255 action.begin_compound(value);
256- action.member( (const char*)"m_null", value.m_null );
257+ action.member("m_null", value.m_null );
258 if (!value.is_null())
259 {
260 superclass(action, value.get_string());
261
262=== modified file 'src/mysql_client.cc'
263--- src/mysql_client.cc 2011-07-11 07:34:56 +0000
264+++ src/mysql_client.cc 2011-09-29 06:41:38 +0000
265@@ -215,20 +215,20 @@
266 {
267 if (::verbose_error())
268 {
269- Nullable_String &error= r.error;
270- if (error.is_null())
271+ Nullable_String &err= r.error;
272+ if (err.is_null())
273 {
274- error.set("");
275+ err.set("");
276 }
277- int old_length= (error.is_null() ? 0 : error.length());
278- int new_length= snprintf(error.data() + old_length
279- , error.max() - old_length
280+ int old_length= (err.is_null() ? 0 : err.length());
281+ int new_length= snprintf(err.data() + old_length
282+ , err.max() - old_length
283 , "%s(%d): %s"
284 , (old_length == 0 ? "" : "\n")
285 , mysql_errno(handle())
286 , mysql_error(handle()));
287 assert(new_length > 0);
288- error.length(old_length + new_length);
289+ err.length(old_length + new_length);
290 }
291 }
292 private:
293
294=== modified file 'src/options.cc'
295--- src/options.cc 2011-09-29 06:41:38 +0000
296+++ src/options.cc 2011-09-29 06:41:38 +0000
297@@ -31,12 +31,16 @@
298 #include <sys/types.h>
299 #include <errno.h>
300
301+std::size_t quiet_verbose_callback(char*, std::size_t, Query const &,
302+ Query_Result const &);
303 std::size_t status_verbose_callback(char* buffer, std::size_t length,
304 Query const &q, Query_Result const &r);
305 std::size_t full_verbose_callback(char* buffer, std::size_t length,
306 Query const &q, Query_Result const &r);
307 std::size_t custom_verbose_callback(char* buffer, std::size_t length,
308 Query const &q, Query_Result const &r);
309+std::size_t error_verbose_callback(char* buffer, std::size_t length,
310+ Query const &q, Query_Result const &r);
311
312 static const char* query_type_str(Query const &a_query)
313 {
314@@ -288,18 +292,18 @@
315 }
316 else
317 {
318- Verbose_Callback_Fill *fill= 0;
319+ Verbose_Callback_Fill *cb_fill= 0;
320 if (!custom_verbose_callback_vector.empty())
321 {
322- fill= custom_verbose_callback_vector.back().get()->fill();
323+ cb_fill= custom_verbose_callback_vector.back().get()->fill();
324 }
325- if (0 == fill)
326+ if (0 == cb_fill)
327 {
328 custom_verbose_callback_vector.push_back(Verbose_Callback_Pointer(new Verbose_Callback_Fill()));
329- fill= custom_verbose_callback_vector.back().get()->fill();
330+ cb_fill= custom_verbose_callback_vector.back().get()->fill();
331 }
332- assert(fill);
333- fill->add(*mask);
334+ assert(cb_fill);
335+ cb_fill->add(*mask);
336 }
337 }
338 }
339@@ -322,12 +326,13 @@
340 return message.str();
341 }
342 Too_Long_Argument::Too_Long_Argument(std::string const &argument_name
343- , std::string const &limitation
344- , std::string const &received) :
345-Error(generate_message_Too_Long_Argument(argument_name, limitation, received))
346+ , std::string const &arg_limitation
347+ , std::string const &arg_received) :
348+Error(generate_message_Too_Long_Argument(argument_name, arg_limitation,
349+ arg_received))
350 , m_name(argument_name)
351- , m_limitation(limitation)
352- , m_received(received)
353+ , m_limitation(arg_limitation)
354+ , m_received(arg_received)
355 {
356 }
357 std::string const& Too_Long_Argument::name() const
358
359=== modified file 'src/query.cc'
360--- src/query.cc 2011-09-29 06:41:38 +0000
361+++ src/query.cc 2011-09-29 06:41:38 +0000
362@@ -153,68 +153,7 @@
363 */
364 typedef int Query_Parse_State;
365
366-const char * to_c_str(Enum_Query_Parse parse)
367-{
368-#define CONVERT(s) case(s): return #s ;
369- switch(parse)
370- {
371- CONVERT(ZERO);
372- CONVERT(ZERO_BACK);
373- CONVERT(SLASH);
374- CONVERT(C_COMMENT);
375- CONVERT(C_COMMENT_BACK);
376- CONVERT(C_COMMENT_STAR);
377- CONVERT(MINUS);
378- CONVERT(MINUS_COMMENT);
379- CONVERT(MINUS_COMMENT_BACK);
380- CONVERT(SHARP_COMMENT);
381- CONVERT(SHARP_COMMENT_BACK);
382- CONVERT(U);
383- CONVERT(US);
384- CONVERT(USE);
385- CONVERT(UP);
386- CONVERT(UPD);
387- CONVERT(UPDA);
388- CONVERT(UPDAT);
389- CONVERT(UPDATE);
390- CONVERT(D);
391- CONVERT(DE);
392- CONVERT(DEL);
393- CONVERT(DELE);
394- CONVERT(DELET);
395- CONVERT(DELETE);
396- CONVERT(I);
397- CONVERT(IN);
398- CONVERT(INS);
399- CONVERT(INSE);
400- CONVERT(INSER);
401- CONVERT(INSERT);
402- CONVERT(S);
403- CONVERT(SE);
404- CONVERT(SET);
405- CONVERT(SEL);
406- CONVERT(SELE);
407- CONVERT(SELEC);
408- CONVERT(SELECT);
409- CONVERT(SH);
410- CONVERT(SHO);
411- CONVERT(SHOW);
412- CONVERT(SINGLE_QUOTE);
413- CONVERT(SINGLE_QUOTE_BACK);
414- CONVERT(DOUBLE_QUOTE);
415- CONVERT(DOUBLE_QUOTE_BACK);
416- CONVERT(FINAL);
417- default:
418- return "Enum_Query_Parse: unknown value";
419- };
420-#undef CONVERT
421-}
422-std::ostream& operator<<(std::ostream &s, Enum_Query_Parse parse)
423-{
424- return s << to_c_str(parse);
425-}
426-
427-Query_Parse_State query_parse_state(Enum_Query_Detect detect, Enum_Query_Type type, Enum_Query_Parse parse)
428+static Query_Parse_State query_parse_state(Enum_Query_Detect detect, Enum_Query_Type type, Enum_Query_Parse parse)
429 {
430 return static_cast<Query_Parse_State>(detect) + (static_cast<Query_Parse_State>(type) << 8) + (static_cast<Query_Parse_State>(parse) << 16);
431 }
432@@ -223,7 +162,7 @@
433 {
434 return query_parse_state(detect, eQuery_Type_Unknown, ZERO);
435 }
436-Enum_Query_Detect query_detect(Query_Parse_State state)
437+static Enum_Query_Detect query_detect(Query_Parse_State state)
438 {
439 return static_cast<Enum_Query_Detect>(state & 0xFF);
440 }
441@@ -231,14 +170,14 @@
442 {
443 return static_cast<Enum_Query_Type>((state >> 8) & 0xFF);
444 }
445-Enum_Query_Parse query_parse(Query_Parse_State state)
446+static Enum_Query_Parse query_parse(Query_Parse_State state)
447 {
448 return static_cast<Enum_Query_Parse>((state >> 16) & 0xFF);
449 }
450-std::size_t query_parse_stupid(Query_Parse_State &state, const char* data, std::size_t length)
451+static std::size_t query_parse_stupid(Query_Parse_State &state, const char* data, std::size_t length)
452 {
453 assert(eQuery_Detect_Stupid == query_detect(state));
454- const char* result= (const char*)memchr(data, ';', length);
455+ const char* result= static_cast<const char*>(memchr(data, ';', length));
456 if (result == NULL)
457 return length;
458 else
459
460=== modified file 'src/queue.h'
461--- src/queue.h 2011-09-29 06:41:38 +0000
462+++ src/queue.h 2011-09-29 06:41:38 +0000
463@@ -413,7 +413,7 @@
464 std::cout << s.str() << std::flush;*/
465 m_queue.clear();
466 }
467- bool can_push(T* a_item)
468+ bool can_push(T*)
469 {
470 /*std::ostringstream s;
471 s << *this << " : " << this << " CAN_PUSH: QUEUE SIZE IS ";
472
473=== modified file 'src/slow_query_log_parser.h'
474--- src/slow_query_log_parser.h 2011-07-11 14:41:36 +0000
475+++ src/slow_query_log_parser.h 2011-09-29 06:41:38 +0000
476@@ -51,9 +51,9 @@
477 {
478 m_scheduler->start();
479 }
480- bool run(Query const &query)
481+ bool run(Query const &q)
482 {
483- return m_scheduler->run(query);
484+ return m_scheduler->run(q);
485 }
486 void flush()
487 {
488
489=== modified file 'src/supervisor.cc'
490--- src/supervisor.cc 2011-07-11 07:34:56 +0000
491+++ src/supervisor.cc 2011-09-29 06:41:38 +0000
492@@ -22,11 +22,6 @@
493 #include "options.h"
494 #include "worker.h"
495
496-void connection_trace(void */* a_context */, Error const &a_error)
497-{
498- std::cerr << a_error << std::endl;
499-}
500-
501 static void *s_context= 0;
502 static troubles s_troubles= 0;
503 void set_troubles(void *a_context, troubles a_function)
504@@ -106,9 +101,9 @@
505 }
506 void complete(Worker *a_worker)
507 {
508- bool complete= (0 == --m_active) && (m_flush || m_stop);
509+ bool is_complete= (0 == --m_active) && (m_flush || m_stop);
510 m_join.push(a_worker);
511- if (complete)
512+ if (is_complete)
513 {
514 m_join.flush();
515 }

Subscribers

People subscribed via source and target branches