1.1 diff -r 5bbe76e71698 -r 22452603e214 src/utils.h 1.2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 +++ b/src/utils.h Tue Dec 28 19:55:13 2010 +0000 1.4 @@ -0,0 +1,14 @@ 1.5 +#ifndef _H_UTILS 1.6 +#define _H_UTILS 1.7 + 1.8 +#ifndef NDEBUG 1.9 +/// Log a message to stderr 1.10 +# define LOG(x, ...) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0) 1.11 +/// Log a message to stderr if 'cond' is true 1.12 +# define LOG_IF(cond, x, ...) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0) 1.13 +#else 1.14 +#define LOG(x, ...) 1.15 +#define LOG_IF(cond, x, ...) 1.16 +#endif 1.17 + 1.18 +#endif // _H_UTILS