Flush stderr after printing debug messages experimental_memory_mapper_v2

Fri, 12 Apr 2013 12:37:34 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Fri, 12 Apr 2013 12:37:34 +0100
branch
experimental_memory_mapper_v2
changeset 143
0fa6f5a480a6
parent 142
cfa30b1cd92f
child 144
609707511166

Flush stderr after printing debug messages

src/utils.h file | annotate | diff | revisions
     1.1 --- a/src/utils.h	Fri Apr 12 12:37:13 2013 +0100
     1.2 +++ b/src/utils.h	Fri Apr 12 12:37:34 2013 +0100
     1.3 @@ -5,11 +5,11 @@
     1.4  
     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 +#  define LOG(x, ...) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); fflush(stderr); } while (0)
    1.10 +#  define LOGS(x) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); fflush(stderr); } 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 -#  define LOG_IFS(cond, x) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } while (0)
    1.14 +#  define LOG_IF(cond, x, ...) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); fflush(stderr); } while (0)
    1.15 +#  define LOG_IFS(cond, x) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); fflush(stderr); } while (0)
    1.16  #else
    1.17  #define LOG(x, ...)
    1.18  #define LOGS(x)