summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-11-25 00:57:34 +0200
committerMichael Widenius <monty@askmonty.org>2010-11-25 00:57:34 +0200
commit1a6373e8e2f0c8c5ca6b8ef5076dcb2948eeb41a (patch)
treeff2e875015b39ca3c66eba19d145dd014d4e768e /include
parentb16c389248d03f0c3de549884f607f3f191827b4 (diff)
parent5e100a64b51aa2dd09a9a1679413fa03797a95a2 (diff)
downloadmariadb-git-1a6373e8e2f0c8c5ca6b8ef5076dcb2948eeb41a.tar.gz
Merge with MySQL 5.1.53
Open issues: - A better fix for #57688; Igor is working on this - Test failure in index_merge_innodb.test ; Igor promised to look at this - Some Innodb tests fails (need to merge with latest xtradb) ; Kristian promised to look at this. - Failing tests: innodb_plugin.innodb_bug56143 innodb_plugin.innodb_bug56632 innodb_plugin.innodb_bug56680 innodb_plugin.innodb_bug57255 - Werror is disabled; Should be enabled after merge with xtradb.
Diffstat (limited to 'include')
-rw-r--r--include/my_compiler.h13
-rw-r--r--include/my_dbug.h46
-rw-r--r--include/my_pthread.h3
3 files changed, 54 insertions, 8 deletions
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 7d0d04764b3..cadde5df06a 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -515,7 +515,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);