From b7004e4110933fa14d2aa3b60adc000a8b93289d Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 27 Jun 2007 10:41:44 +0000 Subject: [PATCH] Minor debug changes git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@137 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst_debug.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 3b9fc14e2..1c9a3695d 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -35,6 +35,11 @@ #endif #ifdef DEBUG + +#ifndef EXTRACHECKS +#define EXTRACHECKS +#endif + #ifndef CONFIG_DEBUG_BUGVERBOSE #define sBUG() do { \ printk(KERN_CRIT "BUG at %s:%d\n", \ @@ -44,6 +49,7 @@ #else #define sBUG() BUG() #endif + #define sBUG_ON(p) do { \ if (unlikely(p)) { \ printk(KERN_CRIT "BUG at %s:%d (%s)\n", \ @@ -51,9 +57,23 @@ BUG(); \ } \ } while (0) + #else + #define sBUG() BUG() #define sBUG_ON(p) BUG_ON(p) + +#endif + +#ifndef WARN_ON_ONCE +#define WARN_ON_ONCE(condition) ({ \ + static int __warned; \ + typeof(condition) __ret_warn_once = (condition); \ + \ + if (unlikely(__ret_warn_once)) \ + __warned = 1; \ + unlikely(__ret_warn_once); \ +}) #endif #ifdef EXTRACHECKS