diff options
author | Michael Widenius <monty@mysql.com> | 2010-11-30 23:11:03 +0200 |
---|---|---|
committer | Michael Widenius <monty@mysql.com> | 2010-11-30 23:11:03 +0200 |
commit | 1e5061fe3be981d6f685a2865fd1e2bcd3fcc23a (patch) | |
tree | a0c58838a4dd7bdf2ed4d739563da27727ada7b0 /include | |
parent | b2e979d868d5d5964d58c97ed9580e07f6123217 (diff) | |
parent | 6f279f40145624c1ffab06c63521f96ce4ac3a02 (diff) | |
download | mariadb-git-1e5061fe3be981d6f685a2865fd1e2bcd3fcc23a.tar.gz |
merge with 5.1
Diffstat (limited to 'include')
-rw-r--r-- | include/my_attribute.h | 13 | ||||
-rw-r--r-- | include/my_compiler.h | 13 | ||||
-rw-r--r-- | include/my_dbug.h | 46 | ||||
-rw-r--r-- | include/my_pthread.h | 3 | ||||
-rw-r--r-- | include/mysql.h | 3 | ||||
-rw-r--r-- | include/mysql.h.pp | 3 | ||||
-rw-r--r-- | include/sha1.h | 37 |
7 files changed, 102 insertions, 16 deletions
diff --git a/include/my_attribute.h b/include/my_attribute.h index 8309d85f20a..ce14a5298ec 100644 --- a/include/my_attribute.h +++ b/include/my_attribute.h @@ -30,10 +30,15 @@ #ifndef __attribute__ # if !defined(__GNUC__) # define __attribute__(A) -# elif GCC_VERSION < 2008 -# define __attribute__(A) -# elif defined(__cplusplus) && GCC_VERSION < 3004 -# define __attribute__(A) +# else +# ifndef GCC_VERSION +# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +# endif +# if GCC_VERSION < 2008 +# define __attribute__(A) +# elif defined(__cplusplus) && GCC_VERSION < 3004 +# define __attribute__(A) +# endif # endif #endif diff --git a/include/my_compiler.h b/include/my_compiler.h index 1cd46ff4260..c7d334999d0 100644 --- a/include/my_compiler.h +++ b/include/my_compiler.h @@ -32,8 +32,15 @@ /* GNU C/C++ */ #if defined __GNUC__ +/* Convenience macro to test the minimum required GCC version. */ +# define MY_GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) /* Any after 2.95... */ # define MY_ALIGN_EXT +/* Comunicate to the compiler the unreachability of the code. */ +# if MY_GNUC_PREREQ(4,5) +# define MY_ASSERT_UNREACHABLE() __builtin_unreachable() +# endif /* Microsoft Visual C++ */ #elif defined _MSC_VER @@ -67,7 +74,7 @@ #endif /** - Generic compiler-dependent features. + Generic (compiler-independent) features. */ #ifndef MY_ALIGNOF # ifdef __cplusplus @@ -79,6 +86,10 @@ # endif #endif +#ifndef MY_ASSERT_UNREACHABLE +# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0) +#endif + /** C++ Type Traits */ diff --git a/include/my_dbug.h b/include/my_dbug.h index b32f12af8a0..e1cd4e2b7dc 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & 2009 Monty Program Ab +/* Copyright (C) 2000 MySQL AB & Oracle & 2009 Monty Program Ab 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 @@ -13,8 +13,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _dbug_h -#define _dbug_h +#ifndef _my_dbug_h +#define _my_dbug_h + +#ifndef __WIN__ +#include <signal.h> +#endif /* not __WIN__ */ #if defined(__cplusplus) && !defined(DBUG_OFF) class Dbug_violation_helper @@ -128,8 +132,35 @@ extern void _db_flush_(); #define DEBUGGER_OFF do { _dbug_on_= 0; } while(0) #define DEBUGGER_ON do { _dbug_on_= 1; } while(0) #define IF_DBUG(A) A +#ifndef __WIN__ #define DBUG_ABORT() (_db_flush_(), abort()) -#else /* No debugger */ +#else +/* + Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can + call abort() instead of _exit(3) (now it would cause a "test signal" popup). +*/ +#include <crtdbg.h> +#define DBUG_ABORT() (_db_flush_(),\ + (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\ + (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\ + _exit(3)) +#endif + +/* + Make the program fail, without creating a core file. + abort() will send SIGABRT which (most likely) generates core. + Use SIGKILL instead, which cannot be caught. + We also pause the current thread, until the signal is actually delivered. + An alternative would be to use _exit(EXIT_FAILURE), + but then valgrind would report lots of memory leaks. + */ +#ifdef __WIN__ +#define DBUG_SUICIDE() DBUG_ABORT() +#else +#define DBUG_SUICIDE() (_db_flush_(), kill(getpid(), SIGKILL), pause()) +#endif + +#else /* No debugger */ #define DBUG_ENTER(a1) #define DBUG_VIOLATION_HELPER_LEAVE do { } while(0) @@ -159,9 +190,12 @@ extern void _db_flush_(); #define DEBUGGER_OFF do { } while(0) #define DEBUGGER_ON do { } while(0) #define IF_DBUG(A) -#define DBUG_ABORT() abort() +#define DBUG_ABORT() do { } while(0) +#define DBUG_SUICIDE() do { } while(0) + #endif #ifdef __cplusplus } #endif -#endif + +#endif /* _my_dbug_h */ diff --git a/include/my_pthread.h b/include/my_pthread.h index f7aad5dec64..169225c1e9b 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -517,7 +517,8 @@ int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, uint line); int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, - struct timespec *abstime, const char *file, uint line); + const struct timespec *abstime, + const char *file, uint line); void safe_mutex_global_init(void); void safe_mutex_end(FILE *file); void safe_mutex_free_deadlock_data(safe_mutex_t *mp); diff --git a/include/mysql.h b/include/mysql.h index cbdfb8387c6..19aab89283b 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -230,7 +230,8 @@ struct st_mysql_options { enum mysql_status { - MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT + MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, + MYSQL_STATUS_STATEMENT_GET_RESULT }; enum mysql_protocol_type diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 48d3b804dd9..f9f38b67f96 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -293,7 +293,8 @@ struct st_mysql_options { }; enum mysql_status { - MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT + MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, + MYSQL_STATUS_STATEMENT_GET_RESULT }; enum mysql_protocol_type { diff --git a/include/sha1.h b/include/sha1.h index e476456a9bd..787896e7476 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -6,12 +6,13 @@ 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 + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This is the header file for code which implements the Secure @@ -25,6 +26,38 @@ Please read the file sha1.c for more information. Modified 2002 by Peter Zaitsev to better follow MySQL standards + + Original Source from: http://www.faqs.org/rfcs/rfc3174.html + + Copyright (C) The Internet Society (2001). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + Acknowledgement + Funding for the RFC Editor function is currently provided by the + Internet Society. */ |