Consistently use KDEBUG. It is always defined and therefore must be

checked with "#if".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28247 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-10-20 13:06:04 +00:00
parent b2568a30b1
commit 1894a0a98b
6 changed files with 38 additions and 33 deletions
+10 -5
View File
@@ -14,12 +14,17 @@
#include <module.h>
#if DEBUG
/*
* The kernel debug level.
* Level 1 is usual asserts, > 1 should be used for very expensive runtime checks
/* KDEBUG
The kernel debug level.
Level 1 is usual asserts, > 1 should be used for very expensive runtime
checks
*/
# define KDEBUG 1
#if !defined(KDEBUG)
# if DEBUG
# define KDEBUG 1
# else
# define KDEBUG 0
# endif
#endif
#define ASSERT_ALWAYS(x) \
+8 -8
View File
@@ -18,7 +18,7 @@ struct mutex_waiter;
typedef struct mutex {
const char* name;
struct mutex_waiter* waiters;
#ifdef KDEBUG
#if KDEBUG
thread_id holder;
#else
int32 count;
@@ -31,7 +31,7 @@ typedef struct mutex {
typedef struct recursive_lock {
mutex lock;
#ifndef KDEBUG
#if !KDEBUG
thread_id holder;
#endif
int recursion;
@@ -77,7 +77,7 @@ typedef struct rw_lock {
// static initializers
#ifdef KDEBUG
#if KDEBUG
# define MUTEX_INITIALIZER(name) { name, NULL, -1, 0 }
# define RECURSIVE_LOCK_INITIALIZER(name) { MUTEX_INITIALIZER(name), 0 }
#else
@@ -130,7 +130,7 @@ extern status_t _mutex_trylock(mutex* lock);
static inline status_t
mutex_lock(mutex* lock)
{
#ifdef KDEBUG
#if KDEBUG
return _mutex_lock(lock, false);
#else
if (atomic_add(&lock->count, -1) < 0)
@@ -143,7 +143,7 @@ mutex_lock(mutex* lock)
static inline status_t
mutex_lock_threads_locked(mutex* lock)
{
#ifdef KDEBUG
#if KDEBUG
return _mutex_lock(lock, true);
#else
if (atomic_add(&lock->count, -1) < 0)
@@ -156,7 +156,7 @@ mutex_lock_threads_locked(mutex* lock)
static inline status_t
mutex_trylock(mutex* lock)
{
#ifdef KDEBUG
#if KDEBUG
return _mutex_trylock(lock);
#else
if (atomic_test_and_set(&lock->count, -1, 0) != 0)
@@ -169,7 +169,7 @@ mutex_trylock(mutex* lock)
static inline void
mutex_unlock(mutex* lock)
{
#if !defined(KDEBUG)
#if !KDEBUG
if (atomic_add(&lock->count, 1) < -1)
#endif
_mutex_unlock(lock, false);
@@ -179,7 +179,7 @@ mutex_unlock(mutex* lock)
static inline void
mutex_transfer_lock(mutex* lock, thread_id thread)
{
#ifdef KDEBUG
#if KDEBUG
lock->holder = thread;
#endif
}