summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-09-11 20:43:48 +0200
committerSergei Golubchik <sergii@pisem.net>2010-09-11 20:43:48 +0200
commita3d80d952d7b99680ca4a3a89e128ecc0d490c10 (patch)
tree0d72ee69e037cdd09618ddb53652dd1b220890dc /include
parentec06ba24553d2d83b3a6a6bc4d8150910b01ee7c (diff)
parent966661c8cc75dd7d540a5fe40b4d893c40e91d26 (diff)
downloadmariadb-git-a3d80d952d7b99680ca4a3a89e128ecc0d490c10.tar.gz
merge with 5.1
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am8
-rw-r--r--include/m_string.h6
-rw-r--r--include/my_bitmap.h16
-rw-r--r--include/my_compiler.h129
-rw-r--r--include/my_global.h42
-rw-r--r--include/my_pthread.h7
-rw-r--r--include/mysql.h2
-rw-r--r--include/mysql.h.pp1
-rw-r--r--include/mysql_com.h4
-rw-r--r--include/mysys_err.h10
10 files changed, 170 insertions, 55 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 8a0b4610a90..fb5c746d129 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -43,8 +43,9 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
- wqueue.h waiting_threads.h
-EXTRA_DIST = mysql.h.pp mysql/plugin_auth.h.pp mysql/client_plugin.h.pp
+ wqueue.h waiting_threads.h my_compiler.h
+
+EXTRA_DIST = mysql.h.pp mysql/plugin_auth.h.pp mysql/client_plugin.h.pp
# Remove built files and the symlinked directories
CLEANFILES = $(BUILT_SOURCES) readline openssl
@@ -71,6 +72,3 @@ my_config.h: config.h
# generated by configure from the .h.in files
dist-hook:
$(RM) -f $(distdir)/mysql_version.h $(distdir)/my_config.h
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/include/m_string.h b/include/m_string.h
index 61b7f41a61d..26fa41d9cc4 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -33,10 +33,6 @@
/* need by my_vsnprintf */
#include <stdarg.h>
-#ifdef _AIX
-#undef HAVE_BCMP
-#endif
-
/* This is needed for the definitions of bzero... on solaris */
#if defined(HAVE_STRINGS_H)
#include <strings.h>
@@ -114,7 +110,7 @@ extern void bfill(uchar *dst,size_t len,pchar fill);
#endif
#if !defined(bzero) && !defined(HAVE_BZERO)
-extern void bzero(uchar * dst,size_t len);
+extern void bzero(void * dst,size_t len);
#endif
#if !defined(bcmp) && !defined(HAVE_BCMP)
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index 2c50ca3ec75..994c5cb4299 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -161,22 +161,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
#define bitmap_set_all(MAP) \
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
-/**
- check, set and clear a bit of interest of an integer.
-
- If the bit is out of range @retval -1. Otherwise
- bit_is_set @return 0 or 1 reflecting the bit is set or not;
- bit_do_set @return 1 (bit is set 1)
- bit_do_clear @return 0 (bit is cleared to 0)
-*/
-
-#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1)
-#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- ((I) |= (ULL(1) << (B)), 1) : -1)
-#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- ((I) &= ~(ULL(1) << (B)), 0) : -1)
-
#ifdef __cplusplus
}
#endif
diff --git a/include/my_compiler.h b/include/my_compiler.h
new file mode 100644
index 00000000000..1cd46ff4260
--- /dev/null
+++ b/include/my_compiler.h
@@ -0,0 +1,129 @@
+#ifndef MY_COMPILER_INCLUDED
+#define MY_COMPILER_INCLUDED
+
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ Header for compiler-dependent features.
+
+ Intended to contain a set of reusable wrappers for preprocessor
+ macros, attributes, pragmas, and any other features that are
+ specific to a target compiler.
+*/
+
+#include <my_global.h> /* stddef.h offsetof */
+
+/**
+ Compiler-dependent internal convenience macros.
+*/
+
+/* GNU C/C++ */
+#if defined __GNUC__
+/* Any after 2.95... */
+# define MY_ALIGN_EXT
+
+/* Microsoft Visual C++ */
+#elif defined _MSC_VER
+# define MY_ALIGNOF(type) __alignof(type)
+# define MY_ALIGNED(n) __declspec(align(n))
+
+/* Oracle Solaris Studio */
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# if __SUNPRO_C >= 0x590
+# define MY_ALIGN_EXT
+# endif
+
+/* IBM XL C/C++ */
+#elif defined __xlC__
+# if __xlC__ >= 0x0600
+# define MY_ALIGN_EXT
+# endif
+
+/* HP aCC */
+#elif defined(__HP_aCC) || defined(__HP_cc)
+# if (__HP_aCC >= 60000) || (__HP_cc >= 60000)
+# define MY_ALIGN_EXT
+# endif
+#endif
+
+#ifdef MY_ALIGN_EXT
+/** Specifies the minimum alignment of a type. */
+# define MY_ALIGNOF(type) __alignof__(type)
+/** Determine the alignment requirement of a type. */
+# define MY_ALIGNED(n) __attribute__((__aligned__((n))))
+#endif
+
+/**
+ Generic compiler-dependent features.
+*/
+#ifndef MY_ALIGNOF
+# ifdef __cplusplus
+ template<typename type> struct my_alignof_helper { char m1; type m2; };
+ /* Invalid for non-POD types, but most compilers give the right answer. */
+# define MY_ALIGNOF(type) offsetof(my_alignof_helper<type>, m2)
+# else
+# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2)
+# endif
+#endif
+
+/**
+ C++ Type Traits
+*/
+
+#ifdef __cplusplus
+
+/**
+ Opaque storage with a particular alignment.
+*/
+# if defined(MY_ALIGNED)
+/* Partial specialization used due to MSVC++. */
+template<size_t alignment> struct my_alignment_imp;
+template<> struct MY_ALIGNED(1) my_alignment_imp<1> {};
+template<> struct MY_ALIGNED(2) my_alignment_imp<2> {};
+template<> struct MY_ALIGNED(4) my_alignment_imp<4> {};
+template<> struct MY_ALIGNED(8) my_alignment_imp<8> {};
+template<> struct MY_ALIGNED(16) my_alignment_imp<16> {};
+/* ... expand as necessary. */
+# else
+template<size_t alignment>
+struct my_alignment_imp { double m1; };
+# endif
+
+/**
+ A POD type with a given size and alignment.
+
+ @remark If the compiler does not support a alignment attribute
+ (MY_ALIGN macro), the default alignment of a double is
+ used instead.
+
+ @tparam size The minimum size.
+ @tparam alignment The desired alignment: 1, 2, 4, 8 or 16.
+*/
+template <size_t size, size_t alignment>
+struct my_aligned_storage
+{
+ union
+ {
+ char data[size];
+ my_alignment_imp<alignment> align;
+ };
+};
+
+#endif /* __cplusplus */
+
+#include <my_attribute.h>
+
+#endif /* MY_COMPILER_INCLUDED */
diff --git a/include/my_global.h b/include/my_global.h
index 13802804f91..9281e9cc13e 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -567,18 +567,17 @@ int __void__;
#endif
#endif /* DONT_DEFINE_VOID */
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
-#define LINT_INIT(var) var=0 /* No uninitialize-warning */
-#else
-#define LINT_INIT(var)
-#endif
-
-#include <my_valgrind.h>
+/*
+ Deprecated workaround for false-positive uninitialized variables
+ warnings. Those should be silenced using tool-specific heuristics.
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_valgrind)
-#define VALGRIND_OR_LINT_INIT(var) var=0
+ Enabled by default for g++ due to the bug referenced below.
+*/
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ (defined(__GNUC__) && defined(__cplusplus))
+#define LINT_INIT(var) var= 0
#else
-#define VALGRIND_OR_LINT_INIT(var)
+#define LINT_INIT(var)
#endif
#ifdef _WIN32
@@ -589,19 +588,22 @@ int __void__;
#define SO_EXT ".so"
#endif
-/*
+/*
Suppress uninitialized variable warning without generating code.
The _cplusplus is a temporary workaround for C++ code pending a fix
- for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
+ for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
- !defined(__GNUC__)
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
+/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x
#endif
+#include <my_valgrind.h>
+
/* Define some useful general macros */
#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))
@@ -617,12 +619,12 @@ typedef unsigned short ushort;
#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
-#define swap_variables(t, a, b) { t swap_dummy; swap_dummy= a; a= b; b= swap_dummy; }
+#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
#define test(a) ((a) ? 1 : 0)
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
-#define test_all_bits(a,b) (((a) & (b)) == (b))
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
+#define test_all_bits(a,b) (((a) & (b)) == (b))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
/* Define some general constants */
@@ -643,7 +645,7 @@ typedef unsigned short ushort;
#define my_const_cast(A) (A)
#endif
-#include <my_attribute.h>
+#include <my_compiler.h>
/*
Wen using the embedded library, users might run into link problems,
@@ -679,7 +681,7 @@ C_MODE_END
# endif
#endif
-typedef char my_bool; /* Small bool */
+typedef char my_bool; /* Small bool; Needed by my_dbug.h */
#include <my_dbug.h>
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
@@ -958,13 +960,11 @@ typedef long long my_ptrdiff_t;
#define ALIGN_MAX_UNIT (sizeof(double))
/* Size to make adressable obj. */
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A), sizeof(double)))
+/* Offset of field f in structure t */
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
-#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
-#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
-
/*
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
diff --git a/include/my_pthread.h b/include/my_pthread.h
index ee5a77f0216..f7aad5dec64 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -276,13 +276,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
-#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
+#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \
+ IF_DBUG(int l_rc); \
DBUG_ASSERT((A) != 0); \
sigemptyset(&l_set); \
l_s.sa_handler = (B); \
l_s.sa_mask = l_set; \
l_s.sa_flags = 0; \
- l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
+ IF_DBUG(l_rc=) sigaction((A), &l_s, NULL); \
DBUG_ASSERT(l_rc == 0); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
@@ -757,7 +758,7 @@ extern uint thd_lib_detected;
The implementation is guaranteed to be thread safe, on all platforms.
Note that the calling code should *not* assume the counter is protected
by the mutex given, as the implementation of these helpers may change
- to use my_atomic operations instead.
+ to use atomic operations instead.
*/
/*
diff --git a/include/mysql.h b/include/mysql.h
index 52475dbc0dd..cbdfb8387c6 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -44,7 +44,9 @@ extern "C" {
#endif
#ifndef _global_h /* If not standard header */
+#ifndef MYSQL_ABI_CHECK
#include <sys/types.h>
+#endif
#ifdef __LCC__
#include <winsock2.h> /* For windows */
#endif
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index 88a2dce1555..48d3b804dd9 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -1,4 +1,3 @@
-#include <sys/types.h>
typedef char my_bool;
typedef int my_socket;
#include "mysql_version.h"
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 093807a65cb..affd24a4636 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -27,6 +27,10 @@
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
+#define MYSQL50_TABLE_NAME_PREFIX "#mysql50#"
+#define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1)
+#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH)
+
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
#define LIST_PROCESS_HOST_LEN 64
diff --git a/include/mysys_err.h b/include/mysys_err.h
index defdaa71fa3..bbb7f6de7d8 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -62,10 +62,12 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29
#define EE_FILE_NOT_CLOSED 30
-#define EE_CANT_CHMOD 31
-#define EE_CANT_SEEK 32
-#define EE_CANT_COPY_OWNERSHIP 33
-#define EE_ERROR_LAST 33 /* Copy last error nr */
+#define EE_CHANGE_OWNERSHIP 31
+#define EE_CHANGE_PERMISSIONS 32
+#define EE_CANT_CHMOD 33
+#define EE_CANT_SEEK 34
+#define EE_CANT_COPY_OWNERSHIP 35
+#define EE_ERROR_LAST 35 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */