Misc fixes and improvements.
This commit is contained in:
parent
0e7bd08cbd
commit
50b3d7b3e3
|
@ -167,7 +167,7 @@ int dbch_x11drv = 155;
|
|||
|
||||
#define DEBUG_CHANNEL_COUNT 156
|
||||
|
||||
char debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {
|
||||
char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {
|
||||
{1, 1, 0, 0},
|
||||
{1, 1, 0, 0},
|
||||
{1, 1, 0, 0},
|
||||
|
|
|
@ -14,23 +14,24 @@
|
|||
|
||||
enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
|
||||
|
||||
extern char debug_msg_enabled[][__DBCL_COUNT];
|
||||
extern char __debug_msg_enabled[][__DBCL_COUNT];
|
||||
|
||||
extern const char * const debug_cl_name[__DBCL_COUNT];
|
||||
extern const char * const debug_ch_name[];
|
||||
|
||||
#define __DEBUGGING(dbcl,dbch) (debug_msg_enabled[(dbch)][(dbcl)])
|
||||
#define __GET_DEBUGGING(dbcl,dbch) (__debug_msg_enabled[(dbch)][(dbcl)])
|
||||
#define __SET_DEBUGGING(dbcl,dbch,on) (__debug_msg_enabled[(dbch)][(dbcl)] = (on))
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __FUNCTION__ ""
|
||||
#endif
|
||||
|
||||
#define __DPRINTF(dbcl,dbch) \
|
||||
(!__DEBUGGING(dbcl,dbch) || \
|
||||
(!__GET_DEBUGGING(dbcl,dbch) || \
|
||||
(dbg_printf("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __FUNCTION__),0)) \
|
||||
? 0 : dbg_printf
|
||||
|
||||
#define __DUMMY_DPRINTF() 1 ? 0 : ((int (*)(char *, ...)) NULL)
|
||||
#define __DUMMY_DPRINTF 1 ? 0 : ((int (*)(char *, ...)) NULL)
|
||||
|
||||
|
||||
/* Exported definitions and macros */
|
||||
|
@ -51,21 +52,21 @@ extern const char * const debug_ch_name[];
|
|||
/* use configure to allow user to compile out debugging messages */
|
||||
|
||||
#ifndef NO_TRACE_MSGS
|
||||
#define TRACE __DPRINTF(__DBCL_TRACE,DBCH_DEFAULT)
|
||||
#define TRACE __DPRINTF(__DBCL_TRACE,*DBCH_DEFAULT)
|
||||
#define TRACE_(ch) __DPRINTF(__DBCL_TRACE,dbch_##ch)
|
||||
#define TRACE_ON(ch) __DEBUGGING(__DBCL_TRACE,dbch_##ch)
|
||||
#define TRACE_ON(ch) __GET_DEBUGGING(__DBCL_TRACE,dbch_##ch)
|
||||
#else
|
||||
#define TRACE_(ch) __DUMMY_DPRINTF
|
||||
#define TRACE_ON(ch) 0
|
||||
#endif /* NO_TRACE_MSGS */
|
||||
|
||||
#ifndef NO_DEBUG_MSGS
|
||||
#define WARN __DPRINTF(__DBCL_WARN,DBCH_DEFAULT)
|
||||
#define WARN __DPRINTF(__DBCL_WARN,*DBCH_DEFAULT)
|
||||
#define WARN_(ch) __DPRINTF(__DBCL_WARN,dbch_##ch)
|
||||
#define WARN_ON(ch) __DEBUGGING(__DBCL_WARN,dbch_##ch)
|
||||
#define FIXME __DPRINTF(__DBCL_FIXME,DBCH_DEFAULT)
|
||||
#define WARN_ON(ch) __GET_DEBUGGING(__DBCL_WARN,dbch_##ch)
|
||||
#define FIXME __DPRINTF(__DBCL_FIXME,*DBCH_DEFAULT)
|
||||
#define FIXME_(ch) __DPRINTF(__DBCL_FIXME,dbch_##ch)
|
||||
#define FIXME_ON(ch) __DEBUGGING(__DBCL_FIXME,dbch_##ch)
|
||||
#define FIXME_ON(ch) __GET_DEBUGGING(__DBCL_FIXME,dbch_##ch)
|
||||
#else
|
||||
#define WARN __DUMMY_DPRINTF
|
||||
#define WARN_(ch) __DUMMY_DPRINTF
|
||||
|
@ -78,15 +79,18 @@ extern const char * const debug_ch_name[];
|
|||
/* define error macro regardless of what is configured */
|
||||
/* Solaris got an 'ERR' define in <sys/reg.h> */
|
||||
#undef ERR
|
||||
#define ERR __DPRINTF(__DBCL_ERR,DBCH_DEFAULT)
|
||||
#define ERR __DPRINTF(__DBCL_ERR,*DBCH_DEFAULT)
|
||||
#define ERR_(ch) __DPRINTF(__DBCL_ERR,dbch_##ch)
|
||||
#define ERR_ON(ch) __DEBUGGING(__DBCL_ERR,dbch_##ch)
|
||||
#define ERR_ON(ch) __GET_DEBUGGING(__DBCL_ERR,dbch_##ch)
|
||||
|
||||
#define DECLARE_DEBUG_CHANNEL(ch) \
|
||||
extern const int dbch_##ch;
|
||||
#define DEFAULT_DEBUG_CHANNEL(ch) \
|
||||
extern const int dbch_##ch; static const int *const DBCH_DEFAULT = &dbch_##ch;
|
||||
|
||||
#define DPRINTF dbg_printf
|
||||
#define MESSAGE dbg_printf
|
||||
|
||||
#ifdef OLD_DEBUG_MACROS
|
||||
/* transition macros */
|
||||
#undef TRACE
|
||||
|
@ -98,7 +102,6 @@ extern const char * const debug_ch_name[];
|
|||
#define FIXME(ch, fmt, args...) FIXME_(ch)(fmt, ## args)
|
||||
#define ERR(ch, fmt, args...) ERR_(ch)(fmt, ## args)
|
||||
#define MSG(format, args...) fprintf(stderr, format, ## args)
|
||||
#define DPRINTF dbg_printf
|
||||
#define DUMP dbg_printf
|
||||
#endif
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ BOOL MAIN_ParseDebugOptions(char *options)
|
|||
for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
|
||||
for(j=0; j<DEBUG_CLASS_COUNT; j++)
|
||||
if(cls == -1 || cls == j)
|
||||
debug_msg_enabled[i][j]=(*options=='+');
|
||||
__SET_DEBUGGING( i, j, (*options=='+') );
|
||||
}
|
||||
else if (!lstrncmpiA(options+1, "relay=", 6) ||
|
||||
!lstrncmpiA(options+1, "snoop=", 6))
|
||||
|
@ -232,7 +232,7 @@ BOOL MAIN_ParseDebugOptions(char *options)
|
|||
if (debug_ch_name && (!lstrncmpiA(debug_ch_name[i],options+1,5))){
|
||||
for(j=0; j<DEBUG_CLASS_COUNT; j++)
|
||||
if(cls == -1 || cls == j)
|
||||
debug_msg_enabled[i][j]=TRUE;
|
||||
__SET_DEBUGGING( i, j, 1 );
|
||||
break;
|
||||
}
|
||||
/* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
|
||||
|
@ -272,7 +272,7 @@ BOOL MAIN_ParseDebugOptions(char *options)
|
|||
if (debug_ch_name && (!lstrncmpiA(options+1,debug_ch_name[i],l-1))){
|
||||
for(j=0; j<DEBUG_CLASS_COUNT; j++)
|
||||
if(cls == -1 || cls == j)
|
||||
debug_msg_enabled[i][j]=(*options=='+');
|
||||
__SET_DEBUGGING( i, j, (*options=='+') );
|
||||
break;
|
||||
}
|
||||
if (i==DEBUG_CHANNEL_COUNT)
|
||||
|
|
|
@ -38,7 +38,7 @@ echo "#define DEBUG_CHANNEL_COUNT $chno"
|
|||
|
||||
count=1
|
||||
echo
|
||||
echo 'char debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {'
|
||||
echo 'char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {'
|
||||
for ch in $DEBUG_CHANNELS
|
||||
do
|
||||
if [ "${count}" != "${chno}" ]; then
|
||||
|
|
Loading…
Reference in New Issue