From: Joel Holdsworth Date: Sat, 18 Feb 2012 09:29:04 +0000 (+0000) Subject: Added INFO, WARN and ERR macros X-Git-Tag: sigrok-firmware-fx2lafw-0.1.0~73 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=8ee491edbe31d980abe261307ef893bce9a16760;p=sigrok-firmware-fx2lafw.git Added INFO, WARN and ERR macros --- diff --git a/debug.h b/debug.h index 790327bf..5cb6861e 100644 --- a/debug.h +++ b/debug.h @@ -20,10 +20,43 @@ #ifdef DEBUG +#define ERRF(fmt, ...) \ + do { debugf("E " fmt, __VA_ARGS__); \ + while(1); } while(0) +#define ERR(msg) \ + ERRF("%s", msg) + +#define WARNF(fmt, ...) \ + debugf("W " fmt, __VA_ARGS__) +#define WARN(msg) \ + WARNF("%s", msg) + +#define INFOF(fmt, ...) \ + debugf("I " fmt, __VA_ARGS__) +#define INFO(msg) \ + INFOF("%s", msg) + /** * A printf the prints messages through the UART * EP6. */ void debugf(const char *format, ...); +#else + +#define ERRF(fmt, ...) \ + ((void) 0) +#define ERR(msg) \ + ((void) 0) + +#define WARNF(fmt, ...) \ + ((void) 0) +#define WARN(msg) \ + ((void) 0) + +#define INFOF(fmt, ...) \ + ((void) 0) +#define INFO(msg) \ + ((void) 0) + #endif