Changed diagnostic message macro 'Debug' to Mark Rivers inline variable argument function calls.

This commit is contained in:
Ron Sluiter
2011-11-29 20:50:00 +00:00
parent 3ffcf86930
commit 52f6723b39
2 changed files with 27 additions and 24 deletions

View File

@@ -29,19 +29,20 @@ extern struct driver_table MCB4B_access;
#define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5)
#ifdef __GNUG__
#ifdef DEBUG
volatile int devMCB4BDebug = 0;
#define Debug(L, FMT, V...) { if(L <= devMCB4BDebug) \
{ errlogPrintf("%s(%d):",__FILE__,__LINE__); \
errlogPrintf(FMT,##V); } }
#else
#define Debug(L, FMT, V...)
#endif
#else
#define Debug()
#endif
volatile int devMCB4BDebug = 0;
extern "C" {epicsExportAddress(int, devMCB4BDebug);}
static inline void Debug(int level, const char *format, ...) {
#ifdef DEBUG
if (level < devMCB4BDebug)
{
va_list pVar;
va_start(pVar, format);
vprintf(format, pVar);
va_end(pVar);
}
#endif
}
/* Debugging levels:
* devMCB4BDebug >= 3 Print new part of command and command string so far

View File

@@ -35,18 +35,20 @@
#define BUFF_SIZE 100 /* Maximum length of string to/from MCB4B */
#ifdef __GNUG__
#ifdef DEBUG
volatile int drvMCB4BDebug = 0;
#define Debug(L, FMT, V...) { if(L <= drvMCB4BDebug) \
{ printf("%s(%d):",__FILE__,__LINE__); \
printf(FMT,##V); } }
#else
#define Debug(L, FMT, V...)
#endif
#else
#define Debug()
#endif
volatile int drvMCB4BDebug = 0;
extern "C" {epicsExportAddress(int, drvMCB4BDebug);}
static inline void Debug(int level, const char *format, ...) {
#ifdef DEBUG
if (level < drvMCB4BDebug)
{
va_list pVar;
va_start(pVar, format);
vprintf(format, pVar);
va_end(pVar);
}
#endif
}
/* Debugging notes:
* drvMCB4BDebug == 0 No debugging information is printed