3756 Jon Olav Hauglid 2012-04-27
Bug#13945257 NEW COMPILATION ERRORS/WARNINGS WITH XCODE 4.3.2
Fix various new compiler warnings and one compiler error
reported by Clang 3.1 / XCode 4.3.2 of Mac OSX.
See per-file messages for details.
@ libmysqld/lib_sql.cc
Fixed warning: implicit conversion from 'unsigned long' to 'int'
changes value from 18446744073709551615 to -1
[-Wconstant-conversion]
@ sql/field.cc
Fixed warning: using the result of an assignment as a condition
without parentheses [-Wparentheses]
@ sql/item_buff.cc
Fixed warning: length modifier 'L' results in undefined behavior
or no effect with 'd' conversion specifier [-Wformat]
@ sql/item_timefunc.cc
Fixed warning: argument to 'sizeof' in 'memset' call is the same
expression as the destination; did you mean to dereference it?
[-Wsizeof-pointer-memaccess]
@ sql/log.cc
Fixed warning: equality comparison with extraneous parentheses
[-Wparentheses-equality]
@ sql/log_event.cc
Fixed warning: implicit conversion from 'ulong' (aka 'unsigned long')
to 'uint' (aka 'unsigned int') changes value from 18446744073709551615
to 4294967295 [-Wconstant-conversion]
@ sql/opt_sum.cc
Fixed warning: equality comparison with extraneous parentheses
[-Wparentheses-equality]
@ sql/sql_time.cc
Fixed warning: using the result of an assignment as a condition
without parentheses [-Wparentheses]
@ sql/table.h
Fixed warning: destination for this 'memset' call is a pointer to
dynamic class 'TABLE'; vtable pointer will be overwritten
[-Wdynamic-class-memaccess]
@ storage/csv/ha_tina.cc
Fixed warning: equality comparison with extraneous parentheses
[-Wparentheses-equality]
@ storage/federated/ha_federated.cc
Fixed warning: equality comparison with extraneous parentheses
[-Wparentheses-equality]
@ storage/innobase/fil/fil0fil.cc
Fixed warning: 'nonnull' attribute applied to function with no
pointer arguments
@ storage/innobase/include/dict0dict.h
Fixed warning: 'nonnull' attribute applied to function with no
pointer arguments
@ storage/innobase/include/fil0fil.h
Fixed warning: 'nonnull' attribute applied to function with no
pointer arguments
@ storage/innobase/include/fts0priv.ic
Fixed warning: attribute declaration must precede definition
@ storage/innobase/include/fts0types.ic
Fixed warning: attribute declaration must precede definition
@ unittest/gunit/decimal-t.cc
Fixed warning: data argument not used by format string
[-Wformat-extra-args]
@ unittest/gunit/dynarray-t.cc
Fixed error: call to function 'operator<<' that is neither visible
in the template definition nor found by argument-dependent lookup
modified:
libmysqld/lib_sql.cc
sql/field.cc
sql/item_buff.cc
sql/item_timefunc.cc
sql/log.cc
sql/log_event.cc
sql/opt_sum.cc
sql/sql_time.cc
sql/table.h
storage/csv/ha_tina.cc
storage/federated/ha_federated.cc
storage/innobase/fil/fil0fil.cc
storage/innobase/include/dict0dict.h
storage/innobase/include/fil0fil.h
storage/innobase/include/fts0priv.ic
storage/innobase/include/fts0types.ic
unittest/gunit/decimal-t.cc
unittest/gunit/dynarray-t.cc
3755 sayantan.dutta@stripped 2012-04-27
Bug #13979491 - MTR HANGS FOREVER ON WINDOWS AFTER "TOO MANY TESTS FAILED"
modified:
mysql-test/mysql-test-run.pl
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc 2012-04-13 12:00:39 +0000
+++ b/libmysqld/lib_sql.cc 2012-04-27 11:57:38 +0000
@@ -448,7 +448,8 @@ static MYSQL_RES * emb_store_result(MYSQ
int emb_read_change_user_result(MYSQL *mysql)
{
mysql->net.read_pos= (uchar*)""; // fake an OK packet
- return mysql_errno(mysql) ? packet_error : 1 /* length of the OK packet */;
+ return mysql_errno(mysql) ? static_cast<int>packet_error :
+ 1 /* length of the OK packet */;
}
MYSQL_METHODS embedded_methods=
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2012-04-12 14:29:14 +0000
+++ b/sql/field.cc 2012-04-27 11:57:38 +0000
@@ -5565,7 +5565,7 @@ Field_time_common::convert_number_to_TIM
Both number_to_time() call and negative nanoseconds value
affect ltime->neg, hence "|=" to combine them:
*/
- if (ltime->neg|= (nanoseconds < 0))
+ if ((ltime->neg|= (nanoseconds < 0)))
nanoseconds= -nanoseconds;
ltime->second_part= 0;
return time_add_nanoseconds_with_round(ltime, nanoseconds, warnings);
=== modified file 'sql/item_buff.cc'
--- a/sql/item_buff.cc 2012-04-24 08:04:39 +0000
+++ b/sql/item_buff.cc 2012-04-27 11:57:38 +0000
@@ -129,7 +129,7 @@ bool Cached_item_int::cmp(void)
{
DBUG_ENTER("Cached_item_int::cmp");
longlong nr=item->val_int();
- DBUG_PRINT("info", ("old: %Ld, new: %Ld", value, nr));
+ DBUG_PRINT("info", ("old: %lld, new: %lld", value, nr));
if (null_value != item->null_value || nr != value)
{
null_value= item->null_value;
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2012-04-25 07:55:02 +0000
+++ b/sql/item_timefunc.cc 2012-04-27 11:57:38 +0000
@@ -2792,7 +2792,7 @@ bool Item_func_timediff::get_time(MYSQL_
if (l_time1.neg != l_time2.neg)
l_sign= -l_sign;
- memset(l_time3, 0, sizeof(l_time3));
+ memset(l_time3, 0, sizeof(*l_time3));
l_time3->neg= calc_time_diff(&l_time1, &l_time2, l_sign,
&seconds, µseconds);
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2012-03-12 22:08:24 +0000
+++ b/sql/log.cc 2012-04-27 11:57:38 +0000
@@ -1423,7 +1423,7 @@ static int find_uniq_filename(char *name
my_dirend(dir_info);
/* check if reached the maximum possible extension number */
- if ((max_found == MAX_LOG_UNIQUE_FN_EXT))
+ if (max_found == MAX_LOG_UNIQUE_FN_EXT)
{
sql_print_error("Log filename extension number exhausted: %06lu. \
Please fix this by archiving old logs and \
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2012-04-26 10:33:24 +0000
+++ b/sql/log_event.cc 2012-04-27 11:57:38 +0000
@@ -1316,7 +1316,8 @@ Log_event* Log_event::read_log_event(IO_
Log_event *res= 0;
#ifndef max_allowed_packet
THD *thd=current_thd;
- uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~(ulong)0;
+ ulong max_allowed_packet= thd ? thd->variables.max_allowed_packet :
+ ~(ulong)0;
#endif
ulong const max_size=
=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc 2012-04-26 10:33:24 +0000
+++ b/sql/opt_sum.cc 2012-04-27 11:57:38 +0000
@@ -81,7 +81,7 @@ static ulonglong get_exact_record_count(
for (TABLE_LIST *tl= tables; tl; tl= tl->next_leaf)
{
ha_rows tmp= tl->table->file->records();
- if ((tmp == HA_POS_ERROR))
+ if (tmp == HA_POS_ERROR)
return ULONGLONG_MAX;
count*= tmp;
}
=== modified file 'sql/sql_time.cc'
--- a/sql/sql_time.cc 2012-03-06 14:29:42 +0000
+++ b/sql/sql_time.cc 2012-04-27 11:57:38 +0000
@@ -528,7 +528,7 @@ static bool lldiv_t_to_time(lldiv_t lld,
Both lld.quot and lld.rem can give negative result value,
thus combine them using "|=".
*/
- if (ltime->neg|= (lld.rem < 0))
+ if ((ltime->neg|= (lld.rem < 0)))
lld.rem= -lld.rem;
ltime->second_part= lld.rem / 1000;
return time_add_nanoseconds_with_round(ltime, lld.rem % 1000, warnings);
=== modified file 'sql/table.h'
--- a/sql/table.h 2012-04-16 09:26:56 +0000
+++ b/sql/table.h 2012-04-27 11:57:38 +0000
@@ -900,7 +900,11 @@ typedef Bitmap<MAX_FIELDS> Field_map;
struct TABLE
{
TABLE() {} /* Remove gcc warning */
- virtual ~TABLE() {}
+ /*
+ Since TABLE instances are often cleared using memset(), do not
+ add virtual members and do not inherit from TABLE.
+ Otherwise memset() will start overwriting the vtable pointer.
+ */
TABLE_SHARE *s;
handler *file;
=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc 2012-03-06 14:29:42 +0000
+++ b/storage/csv/ha_tina.cc 2012-04-27 11:57:38 +0000
@@ -1417,9 +1417,9 @@ int ha_tina::rnd_end()
DBUG_RETURN(-1);
/* Open the file again */
- if (((data_file= mysql_file_open(csv_key_file_data,
- share->data_file_name,
- O_RDONLY, MYF(MY_WME))) == -1))
+ if ((data_file= mysql_file_open(csv_key_file_data,
+ share->data_file_name,
+ O_RDONLY, MYF(MY_WME))) == -1)
DBUG_RETURN(my_errno ? my_errno : -1);
/*
As we reopened the data file, increase share->data_file_version
=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc 2012-03-06 14:29:42 +0000
+++ b/storage/federated/ha_federated.cc 2012-04-27 11:57:38 +0000
@@ -825,7 +825,7 @@ static int parse_url(MEM_ROOT *mem_root,
user:@hostname:port/db/table
Then password is a null string, so set to NULL
*/
- if ((share->password[0] == '\0'))
+ if (share->password[0] == '\0')
share->password= NULL;
}
else
=== modified file 'storage/innobase/fil/fil0fil.cc'
--- a/storage/innobase/fil/fil0fil.cc 2012-04-26 15:33:48 +0000
+++ b/storage/innobase/fil/fil0fil.cc 2012-04-27 11:57:38 +0000
@@ -1770,7 +1770,7 @@ fil_set_max_space_id_if_bigger(
Writes the flushed lsn and the latest archived log number to the page header
of the first page of a data file of the system tablespace (space 0),
which is uncompressed. */
-static __attribute__((nonnull, warn_unused_result))
+static __attribute__((warn_unused_result))
dberr_t
fil_write_lsn_and_arch_no_to_file(
/*==============================*/
=== modified file 'storage/innobase/include/dict0dict.h'
--- a/storage/innobase/include/dict0dict.h 2012-04-25 15:46:11 +0000
+++ b/storage/innobase/include/dict0dict.h 2012-04-27 11:57:38 +0000
@@ -814,7 +814,7 @@ ulint
dict_tf_get_format(
/*===============*/
ulint flags) /*!< in: dict_table_t::flags */
- __attribute__((nonnull, warn_unused_result));
+ __attribute__((warn_unused_result));
/********************************************************************//**
Set the various values in a dict_table_t::flags pointer. */
UNIV_INLINE
=== modified file 'storage/innobase/include/fil0fil.h'
--- a/storage/innobase/include/fil0fil.h 2012-04-11 10:25:07 +0000
+++ b/storage/innobase/include/fil0fil.h 2012-04-27 11:57:38 +0000
@@ -333,8 +333,7 @@ dberr_t
fil_write_flushed_lsn_to_data_files(
/*================================*/
lsn_t lsn, /*!< in: lsn to write */
- ulint arch_log_no) /*!< in: latest archived log file number */
- __attribute__((nonnull));
+ ulint arch_log_no); /*!< in: latest archived log file number */
/*******************************************************************//**
Reads the flushed lsn, arch no, and tablespace flag fields from a data
file at database startup. */
=== modified file 'storage/innobase/include/fts0priv.ic'
--- a/storage/innobase/include/fts0priv.ic 2012-02-01 06:17:47 +0000
+++ b/storage/innobase/include/fts0priv.ic 2012-04-27 11:57:38 +0000
@@ -57,3 +57,42 @@ fts_read_object_id(
return(sscanf(str, IB_ID_FMT, id) == 2);
}
+/******************************************************************//**
+Compare two fts_trx_table_t instances.
+@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
+UNIV_INLINE
+int
+fts_trx_table_cmp(
+/*==============*/
+ const void* p1, /*!< in: id1 */
+ const void* p2) /*!< in: id2 */
+{
+ const dict_table_t* table1 = (*(const fts_trx_table_t**) p1)->table;
+ const dict_table_t* table2 = (*(const fts_trx_table_t**) p2)->table;
+
+ return((table1->id > table2->id)
+ ? 1
+ : (table1->id == table2->id)
+ ? 0
+ : -1);
+}
+
+/******************************************************************//**
+Compare a table id with a fts_trx_table_t table id.
+@return < 0 if n1 < n2, 0 if n1 == n2,> 0 if n1 > n2 */
+UNIV_INLINE
+int
+fts_trx_table_id_cmp(
+/*=================*/
+ const void* p1, /*!< in: id1 */
+ const void* p2) /*!< in: id2 */
+{
+ const ullint* table_id = (const ullint*) p1;
+ const dict_table_t* table2 = (*(const fts_trx_table_t**) p2)->table;
+
+ return((*table_id > table2->id)
+ ? 1
+ : (*table_id == table2->id)
+ ? 0
+ : -1);
+}
=== modified file 'storage/innobase/include/fts0types.ic'
--- a/storage/innobase/include/fts0types.ic 2011-11-30 10:09:12 +0000
+++ b/storage/innobase/include/fts0types.ic 2012-04-27 11:57:38 +0000
@@ -37,46 +37,6 @@ extern const ulint UTF8_ERROR;
#define fts_utf8_is_valid(b) (((b) & 0xC0) == 0x80)
/******************************************************************//**
-Compare two fts_trx_table_t instances.
-@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
-UNIV_INLINE
-int
-fts_trx_table_cmp(
-/*==============*/
- const void* p1, /*!< in: id1 */
- const void* p2) /*!< in: id2 */
-{
- const dict_table_t* table1 = (*(const fts_trx_table_t**) p1)->table;
- const dict_table_t* table2 = (*(const fts_trx_table_t**) p2)->table;
-
- return((table1->id > table2->id)
- ? 1
- : (table1->id == table2->id)
- ? 0
- : -1);
-}
-
-/******************************************************************//**
-Compare a table id with a fts_trx_table_t table id.
-@return < 0 if n1 < n2, 0 if n1 == n2,> 0 if n1 > n2 */
-UNIV_INLINE
-int
-fts_trx_table_id_cmp(
-/*=================*/
- const void* p1, /*!< in: id1 */
- const void* p2) /*!< in: id2 */
-{
- const ullint* table_id = (const ullint*) p1;
- const dict_table_t* table2 = (*(const fts_trx_table_t**) p2)->table;
-
- return((*table_id > table2->id)
- ? 1
- : (*table_id == table2->id)
- ? 0
- : -1);
-}
-
-/******************************************************************//**
Duplicate an UTF-8 string.
@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
UNIV_INLINE
=== modified file 'unittest/gunit/decimal-t.cc'
--- a/unittest/gunit/decimal-t.cc 2011-08-26 07:06:35 +0000
+++ b/unittest/gunit/decimal-t.cc 2012-04-27 11:57:38 +0000
@@ -420,8 +420,10 @@ void do_test_pr(const char *s1, int prec
int slen= sizeof(s2);
int res;
- sprintf(s, filler ? "'%s', %d, %d, '%c'" : "'%s', %d, %d, '\\0'",
- s1, prec, dec, filler);
+ if (filler)
+ sprintf(s, "'%s', %d, %d, '%c'", s1, prec, dec, filler);
+ else
+ sprintf(s, "'%s', %d, %d, '\\0'", s1, prec, dec);
end= strend(s1);
string2decimal(s1, &a, &end);
res= decimal2string(&a, s2, &slen, prec, dec, filler);
=== modified file 'unittest/gunit/dynarray-t.cc'
--- a/unittest/gunit/dynarray-t.cc 2012-02-07 11:56:30 +0000
+++ b/unittest/gunit/dynarray-t.cc 2012-04-27 11:57:38 +0000
@@ -83,6 +83,19 @@ static inline bool operator==(const Key_
}
+static inline std::ostream &operator<<(std::ostream &s, const Key_use &v)
+{
+ return s << "{"
+ << v.table->tablenr << ", "
+ << v.key << ", "
+ << v.keypart << ", "
+ << v.used_tables << ", "
+ << v.optimize
+ << "}"
+ ;
+}
+
+
namespace {
/*
@@ -108,19 +121,6 @@ inline int sort_keyuse(Key_use *a, Key_u
}
-std::ostream &operator<<(std::ostream &s, const Key_use &v)
-{
- return s << "{"
- << v.table->tablenr << ", "
- << v.key << ", "
- << v.keypart << ", "
- << v.used_tables << ", "
- << v.optimize
- << "}"
- ;
-}
-
-
// We generate some random data at startup, for testing of sorting.
void generate_test_data(Key_use *keys, TABLE *tables, int n)
{
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (jon.hauglid:3755 to 3756) Bug#13945257 | Jon Olav Hauglid | 2 May |