Remove NDEBUG (assert() disable) define from the X Server.

A few pieces of code were abusing this define for other purposes, which are
converted to #ifndef DEBUG instead.  There should be no ABI consequences
to this change.

The rationale is that having the define in xorg-server.h also disables
assert() drivers, which is unexpected, and also difficult to avoid since
xorg-server.h is included in their config.h, and you can't put a #undef in
config.h.  As for removing it from the server instead of moving it to an
internal header, we probably shouldn't have unnecessary assert()s in
critical server paths anyway, and if we do we could #define NDEBUG in the
specific cases needed.
This commit is contained in:
Eric Anholt 2008-04-10 10:33:11 -07:00
parent 7909ebe7f1
commit a7e3ad1c6b
9 changed files with 6 additions and 27 deletions

View File

@ -1099,8 +1099,6 @@ AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrappe
if test "x$DEBUGGING" = xyes; then
AC_DEFINE(DEBUG, 1, [Enable debugging code])
else
AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])

View File

@ -28,7 +28,6 @@
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#undef NDEBUG /* No, really. The whole point of this module is to crash. */
#include "ephyr.h"
#include "exa_priv.h"

View File

@ -31,11 +31,11 @@
#include <assert.h>
#include "os.h"
#ifdef NDEBUG
#ifndef DEBUG
/*we are not in debug mode*/
#define EPHYR_LOG(...)
#define EPHYR_LOG_ERROR(...)
#endif /*NDEBUG*/
#endif /*!DEBUG*/
#define ERROR_LOG_LEVEL 3
#define INFO_LOG_LEVEL 4

View File

@ -1744,7 +1744,7 @@ KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
return keyboard;
}
#ifndef NDEBUG
#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@ -1777,7 +1777,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
#endif
#endif /* DEBUG */
static void
KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)

View File

@ -977,7 +977,7 @@ KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
return keyboard;
}
#ifndef NDEBUG
#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@ -1010,7 +1010,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
#endif
#endif /* DEBUG */
static void
KdQueueEvent (xEvent *ev)

View File

@ -76,13 +76,7 @@
#include "quartzKeyboard.h"
#include "quartzAudio.h"
#ifdef NDEBUG
#undef NDEBUG
#include <assert.h>
#define NDEBUG 1
#else
#include <assert.h>
#endif
#define AltMask Mod1Mask
#define MetaMask Mod2Mask

View File

@ -41,13 +41,7 @@
#include "opaque.h"
#include "micmap.h"
#ifdef NDEBUG
#undef NDEBUG
#include <assert.h>
#define NDEBUG 1
#else
#include <assert.h>
#endif
char **envpGlobal; // argcGlobal and argvGlobal
// are from dix/globals.c

View File

@ -264,9 +264,6 @@
/* Support MIT-SHM Extension */
#undef MITSHM
/* Disable some debugging code */
#undef NDEBUG
/* Enable some debugging code */
#undef DEBUG

View File

@ -52,9 +52,6 @@
/* Support MIT-SHM Extension */
#undef MITSHM
/* Disable some debugging code */
#undef NDEBUG
/* Need XFree86 helper functions */
#undef NEED_XF86_PROTOTYPES