From f46567543d097e68433f658f482f4d87a8bc9001 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Wed, 7 Sep 2011 17:30:39 +0000 Subject: [PATCH] Changed debugging to use inline function rather than macro --- motorApp/MotorSrc/motorRecord.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc index 8a0157e3..aa7a5a7b 100644 --- a/motorApp/MotorSrc/motorRecord.cc +++ b/motorApp/MotorSrc/motorRecord.cc @@ -155,6 +155,7 @@ HeadURL: $URL$ #include #include +#include #include #include #include @@ -173,20 +174,19 @@ HeadURL: $URL$ #include "motor.h" #include "epicsExport.h" -/*----------------debugging-----------------*/ - -#if defined(TOOL_FAMILY) && (TOOL_FAMILY == gnu) - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= motorRecordDebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int motorRecordDebug = 0; extern "C" {epicsExportAddress(int, motorRecordDebug);} +/*----------------debugging-----------------*/ + +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + va_list pVar; + va_start(pVar, format); + if (level < motorRecordDebug) vprintf(format, pVar); + va_end(pVar); + #endif +} /*** Forward references ***/