add single-string logging functions to work around gcc warning

Thu, 03 Mar 2011 08:15:09 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Thu, 03 Mar 2011 08:15:09 +0000
changeset 98
d1af20db5f02
parent 97
240e195e4bed
child 99
2d06b823a015

add single-string logging functions to work around gcc warning

src/utils.h file | annotate | diff | revisions
     1.1 diff -r 240e195e4bed -r d1af20db5f02 src/utils.h
     1.2 --- a/src/utils.h	Wed Mar 02 07:16:32 2011 +0000
     1.3 +++ b/src/utils.h	Thu Mar 03 08:15:09 2011 +0000
     1.4 @@ -6,11 +6,15 @@
     1.5  #ifndef NDEBUG
     1.6  /// Log a message to stderr
     1.7  #  define LOG(x, ...) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0)
     1.8 +#  define LOGS(x) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } while (0)
     1.9  /// Log a message to stderr if 'cond' is true
    1.10  #  define LOG_IF(cond, x, ...) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0)
    1.11 +#  define LOG_IFS(cond, x) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } while (0)
    1.12  #else
    1.13  #define LOG(x, ...)
    1.14 +#define LOGS(x)
    1.15  #define LOG_IF(cond, x, ...)
    1.16 +#define LOG_IFS(cond, x)
    1.17  #endif
    1.18  
    1.19  /// Get the number of elements in an array