From 50bd97a9436afe01606ad0cef323e7bda4d77e9b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Feb 2007 16:59:57 +0200 Subject: Fixed compiler warnings (for linux and win32 and win64) Fixed a couple of usage of not initialized warnings (unlikely cases) client/mysqldump.c: Fixed compiler warnings from 'max' build client/mysqltest.c: Removed compiler warnings cmd-line-utils/readline/xmalloc.c: Fixed compiler warnings from 'max' build extra/comp_err.c: Fixed compiler warnings from 'max' build extra/yassl/include/openssl/ssl.h: Changed prototype for SSL_set_fd() to fix compiler warnings (and possible errors) on windows 64 bit extra/yassl/include/socket_wrapper.hpp: Moved socket_t to ssl.h, to be able to removed compiler warnings on windows 64 bit extra/yassl/src/ssl.cpp: Changed prototype for SSL_set_fd() to fix compiler warnings (and possible errors) on windows 64 bit extra/yassl/taocrypt/src/integer.cpp: Fixed compiler warnings include/my_global.h: Added my_offsetof() macro from 5.1 to get rid of compiler warnings innobase/include/ut0byte.ic: Fixed compiler warnings on win64 innobase/include/ut0ut.ic: Fixed compiler warnings on win64 libmysql/libmysql.def: Fixed compiler warnings on win64 myisam/mi_packrec.c: Fixed compiler warnings on win64 myisam/myisamchk.c: Fixed compiler warnings from 'max' build mysys/base64.c: Fixed compiler warnings on win64 mysys/mf_keycache.c: Fixed compiler warnings from 'max' build mysys/my_getopt.c: Fixed compiler warnings from 'max' build mysys/my_init.c: Fixed compiler warnings from 'max' build mysys/my_thr_init.c: Fixed compiler warnings mysys/ptr_cmp.c: Fixed compiler warnings from 'max' build ndb/include/kernel/signaldata/DictTabInfo.hpp: Fixed compiler warnings server-tools/instance-manager/mysql_connection.cc: Fixed compiler warnings server-tools/instance-manager/mysqlmanager.cc: Fixed compiler warnings sql/filesort.cc: Initalize variable that was used unitialized in error conditions sql/ha_berkeley.cc: Moved get_auto_primary_key() here as int5store() gives (wrong) compiler warnings in win64 sql/ha_berkeley.h: Moved get_auto_primary_key() to ha_berkeley.cc sql/ha_innodb.cc: Fixed compiler warnings sql/item.cc: Fixed compiler warnings from 'max' build sql/item_timefunc.cc: Fixed compiler warnings sql/mysqld.cc: Fixed compiler warnings sql/sql_acl.cc: Fixed compiler warnings from 'max' build sql/sql_base.cc: Fixed compiler warnings from 'max' build sql/sql_insert.cc: Initialize variable that may be used unitialized on error conditions (not fatal) sql/sql_prepare.cc: Fixed compiler warnings from 'max' build sql/sql_select.cc: Fixed compiler warnings sql/sql_show.cc: Fixed compiler warnings sql/udf_example.def: Fixed compiler warnings on win64 sql/unireg.cc: Initialize variable that may be used unitialized on error conditions strings/ctype-ucs2.c: Fixed compiler warnings strings/ctype-utf8.c: Fixed compiler warnings strings/decimal.c: Fixed compiler warnings support-files/compiler_warnings.supp: Ignore warnings from sql_yacc.cc that are hard to remove Ignore some not important warnings from windows 64 bit build tools/mysqlmanager.c: Fixed compiler warnings --- include/my_global.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/my_global.h b/include/my_global.h index 23fe71caa8d..21fe1ebc3cb 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -846,6 +846,21 @@ typedef long long my_ptrdiff_t; #define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B)) +/* + Custom version of standard offsetof() macro which can be used to get + offsets of members in class for non-POD types (according to the current + version of C++ standard offsetof() macro can't be used in such cases and + attempt to do so causes warnings to be emitted, OTOH in many cases it is + still OK to assume that all instances of the class has the same offsets + for the same members). + + This is temporary solution which should be removed once File_parser class + and related routines are refactored. +*/ + +#define my_offsetof(TYPE, MEMBER) \ + ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) + #define NullS (char *) 0 /* Nowdays we do not support MessyDos */ #ifndef NEAR -- cgit v1.2.1