summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/my_global.h9
-rw-r--r--mysys/thr_alarm.c3
-rw-r--r--mysys/thr_lock.c2
3 files changed, 9 insertions, 5 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 39947735f3c..a7ec41068b3 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -614,12 +614,17 @@ C_MODE_END
#define _STATIC_VARARGS(X) X
#define _PC(X) X
+/* The DBUG_ON flag always takes precedence over default DBUG_OFF */
#if defined(DBUG_ON) && defined(DBUG_OFF)
#undef DBUG_OFF
#endif
-#if defined(_lint) && !defined(DBUG_OFF)
-#define DBUG_OFF
+/* We might be forced to turn debug off, if not turned off already */
+#if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF)
+# define DBUG_OFF
+# ifdef DBUG_ON
+# undef DBUG_ON
+# endif
#endif
#include <my_dbug.h>
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index dcb41837d96..c55cc32b47d 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -15,8 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* To avoid problems with alarms in debug code, we disable DBUG here */
-#undef DBUG_OFF
-#define DBUG_OFF
+#define FORCE_DBUG_OFF
#include <my_global.h>
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 36cb83ae754..a2c42ee326c 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -72,7 +72,7 @@ multiple read locks.
*/
#if !defined(MAIN) && !defined(DBUG_OFF) && !defined(EXTRA_DEBUG)
-#define DBUG_OFF
+#define FORCE_DBUG_OFF
#endif
#include "mysys_priv.h"