summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormonty@mysql.com/narttu.mysql.fi <>2007-02-22 16:59:57 +0200
committermonty@mysql.com/narttu.mysql.fi <>2007-02-22 16:59:57 +0200
commite5cc397f33e6c9916043742194bbdc809e118905 (patch)
tree260c15e9d6f383c404ea95e9e68ef07f0eba2cea /include
parent6946fa682fd6b0f90f17f1bd2bf1bdc9579c0fca (diff)
downloadmariadb-git-e5cc397f33e6c9916043742194bbdc809e118905.tar.gz
Fixed compiler warnings (for linux and win32 and win64)
Fixed a couple of usage of not initialized warnings (unlikely cases)
Diffstat (limited to 'include')
-rw-r--r--include/my_global.h15
1 files changed, 15 insertions, 0 deletions
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