Hi Tor,
On 5/25/10 11:40 AM, Tor Didriksen wrote:
> #At file:///export/home/didrik/repo/trunk-bugfixing-cflags/ based on
> revid:mattias.jonsson@stripped
>
> 3059 Tor Didriksen 2010-05-25
> Bug #53445 Build with -Wall and fix warnings that it generates
>
> Add -Wall to gcc/g++
> Fix (almost) all warnings reported in dbg and opt mode.
Some comments below.
> @ cmd-line-utils/libedit/filecomplete.c
> Remove unused auto variables.
> @ configure.cmake
> Add -Wall to gcc.
> @ extra/comp_err.c
> Cast to correct type.
> @ extra/perror.c
> Fix segfault (but warnings about deprecated features remain)
> @ extra/yassl/taocrypt/include/runtime.hpp
> Comparing two literals was reported as undefined behaviour.
> @ mysys/lf_alloc-pin.c
> Initialize pointer.
> @ sql/mysqld.cc
> Use UNINIT_VAR rather than LINT_INIT.
> @ sql/partition_info.cc
> Use UNINIT_VAR rather than LINT_INIT.
> @ sql/rpl_handler.cc
> Use char[] rather than unsigned long[] array for placement buffer.
> @ sql/spatial.cc
> Use char[] rather than unsigned void*[] array for placement buffer.
> @ sql/spatial.h
> Use char[] rather than unsigned void*[] array for placement buffer.
> @ sql/sql_partition.cc
> Initialize auto variable.
> @ sql/sql_table.cc
> Initialize auto variables.
> Add parens around assignment within if()
> @ sql/sys_vars.cc
> Use UNINIT_VAR.
> @ storage/innobase/os/os0file.c
> Init first slot in auto variable.
> @ storage/myisam/mi_create.c
> Use UNINIT_VAR rather than LINT_INIT.
> @ storage/myisam/mi_open.c
> Remove (wrong) casting.
> @ storage/myisam/mi_page.c
> Remove (wrong) casting.
> @ storage/myisam/mi_search.c
> Cast to uchar* rather than char*.
> @ strings/ctype-ucs2.c
> Use UNINIT_VAR rather than LINT_INIT.
> Add (uchar*) casting.
> @ strings/dtoa.c
> Perform operations on union variables rather than on doubles.
[..]
> === modified file 'sql/rpl_handler.cc'
> --- a/sql/rpl_handler.cc 2010-03-31 14:05:33 +0000
> +++ b/sql/rpl_handler.cc 2010-05-25 14:40:56 +0000
> @@ -89,11 +89,11 @@ int get_user_var_str(const char *name, c
>
> int delegates_init()
> {
> - static unsigned long trans_mem[sizeof(Trans_delegate) / sizeof(unsigned long) +
> 1];
> - static unsigned long storage_mem[sizeof(Binlog_storage_delegate) / sizeof(unsigned
> long) + 1];
> + static char trans_mem[sizeof(Trans_delegate)];
> + static char storage_mem[sizeof(Binlog_storage_delegate)];
> #ifdef HAVE_REPLICATION
> - static unsigned long transmit_mem[sizeof(Binlog_transmit_delegate) /
> sizeof(unsigned long) + 1];
> - static unsigned long relay_io_mem[sizeof(Binlog_relay_IO_delegate)/
> sizeof(unsigned long) + 1];
> + static char transmit_mem[sizeof(Binlog_transmit_delegate)];
> + static char relay_io_mem[sizeof(Binlog_relay_IO_delegate)];
> #endif
This seems to undo the fix for Bug#40244:
http://lists.mysql.com/commits/85190
I guess this could be solved with one of the ALIGN macros.
> if (!(transaction_delegate= new (trans_mem) Trans_delegate)
>
[..]
> === modified file 'sql/spatial.h'
> --- a/sql/spatial.h 2010-03-31 14:05:33 +0000
> +++ b/sql/spatial.h 2010-05-25 14:40:56 +0000
> @@ -267,14 +267,7 @@ public:
> virtual int geometry_n(uint32 num, String *result) const { return -1; }
>
> public:
> - static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id)
> - {
> - Class_info *ci;
> - if (!(ci= find_class((int) type_id)))
> - return NULL;
> - (*ci->m_create_func)((void *)buffer);
> - return my_reinterpret_cast(Geometry *)(buffer);
> - }
> + static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id);
>
> static Geometry *construct(Geometry_buffer *buffer,
> const char *data, uint32 data_len);
> @@ -535,7 +528,7 @@ public:
> const int geometry_buffer_size= sizeof(Gis_point);
> struct Geometry_buffer
> {
> - void *arr[(geometry_buffer_size - 1)/sizeof(void *) + 1];
> + char arr[geometry_buffer_size];
Perhaps this was also attempting alignment or something like?
> };
>
> #endif /*HAVE_SPATAIAL*/
>
[..]
> === modified file 'strings/dtoa.c'
> --- a/strings/dtoa.c 2010-04-11 06:52:42 +0000
> +++ b/strings/dtoa.c 2010-05-25 14:40:56 +0000
> @@ -547,18 +547,18 @@ typedef uint32 ULong;
> typedef int64 LLong;
> typedef uint64 ULLong;
dtoa.. sigh.
> -typedef union { double d; ULong L[2]; } U;
> +typedef union { double d; ULong L[2]; } U_double;
Most of those seems to be fixed in the upstream dtoa, perhaps we should
update our version? http://www.netlib.org/fp/dtoa.c
Otherwise, the changes looks good. Will take another look once you
update the patch addressing the issues above.
Regards,
Davi Arnaut