From cd1c6e220de1730615c145b5337f7cce554dfdae Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 10 Nov 2010 19:14:47 -0200 Subject: Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c Bug#57994: Compiler flag change build error : my_redel.c Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc Fix assorted compiler generated warnings. cmd-line-utils/readline/bind.c: Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c Initialize variable to work around a false positive warning. include/m_string.h: Bug#57994: Compiler flag change build error : my_redel.c The expansion of stpcpy (in glibc) causes warnings if the return value of strmov is not being used. Since stpcpy is a GNU extension and the expansion ends up using a built-in provided by GCC, use the compiler provided built-in directly when possible. include/my_compiler.h: Define a dummy MY_GNUC_PREREQ when not compiling with GCC. libmysql/libmysql.c: Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure Variable might not be used in some cases. So, tag it as unused. mysys/mf_keycache.c: Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c Use UNINIT_VAR to work around a false positive warning. mysys/my_getncpus.c: Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c Declare variable in the same block where it is used. regex/regexec.c: Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c Work around a compiler bug which causes the cast to not be enforced. sql/debug_sync.cc: Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc Use UNINIT_VAR to work around a false positive warning. sql/handler.cc: Use UNINIT_VAR to work around a false positive warning. sql/slave.cc: Use UNINIT_VAR to work around a false positive warning. sql/sql_partition.cc: Use UNINIT_VAR to work around a false positive warning. storage/myisam/ft_nlq_search.c: Use UNINIT_VAR to work around a false positive warning. storage/myisam/mi_create.c: Use UNINIT_VAR to work around a false positive warning. storage/myisammrg/myrg_open.c: Use UNINIT_VAR to work around a false positive warning. tests/mysql_client_test.c: Change function to take a pointer to const, no need for a cast. --- include/m_string.h | 4 +++- include/my_compiler.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/m_string.h b/include/m_string.h index 3e5cd063b7b..933da84c336 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -73,7 +73,9 @@ extern "C" { extern void *(*my_str_malloc)(size_t); extern void (*my_str_free)(void *); -#if defined(HAVE_STPCPY) +#if MY_GNUC_PREREQ(3, 4) +#define strmov(dest, src) __builtin_stpcpy(dest, src) +#elif defined(HAVE_STPCPY) #define strmov(A,B) stpcpy((A),(B)) #ifndef stpcpy extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ diff --git a/include/my_compiler.h b/include/my_compiler.h index c7d334999d0..5f898621159 100644 --- a/include/my_compiler.h +++ b/include/my_compiler.h @@ -76,6 +76,11 @@ /** Generic (compiler-independent) features. */ + +#ifndef MY_GNUC_PREREQ +# define MY_GNUC_PREREQ(maj, min) (0) +#endif + #ifndef MY_ALIGNOF # ifdef __cplusplus template struct my_alignof_helper { char m1; type m2; }; -- cgit v1.2.1 From c324624291a8c7cfbfcc728ce9fa86feb8d4e904 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 17 Nov 2010 07:41:29 -0200 Subject: Bug#57994: Compiler flag change build error : my_redel.c Use __builtin_stpcpy only if the system supports stpcpy. This is necessary as in some cases a call to stpcpy will be emitted if the built-in can not optimized. include/m_string.h: The expansion of stpcpy (in glibc) causes warnings if the return value of strmov is not being used. Since stpcpy is a GNU extension and the expansion ends up using a built-in provided by GCC, use the compiler provided built-in directly when possible. Nonetheless, the C library must have stpcpy as a call be emitted if the built-in can not optimized. --- include/m_string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/m_string.h b/include/m_string.h index 933da84c336..c963e605501 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -73,8 +73,8 @@ extern "C" { extern void *(*my_str_malloc)(size_t); extern void (*my_str_free)(void *); -#if MY_GNUC_PREREQ(3, 4) -#define strmov(dest, src) __builtin_stpcpy(dest, src) +#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) +#define strmov(A,B) __builtin_stpcpy((A),(B)) #elif defined(HAVE_STPCPY) #define strmov(A,B) stpcpy((A),(B)) #ifndef stpcpy -- cgit v1.2.1