trace-projections: make block macro a bit safer, more idiomatic
authorPhil Miller <mille121@illinois.edu>
Tue, 13 Mar 2012 20:45:30 +0000 (15:45 -0500)
committerPhil Miller <mille121@illinois.edu>
Tue, 13 Mar 2012 22:41:49 +0000 (17:41 -0500)
src/ck-perf/trace-projections.h

index 754c1078c844022c607ea33186b8f9cb03293cc2..3e03d4d43760ece7e6344cd5ffac1dcfa77774be 100644 (file)
 
 // Macro to make projections check for errors before an fprintf succeeds.
 #define CheckAndFPrintF(f,string,data) \
-{ \
+do { \
   int result = fprintf(f,string,data); \
   if (result == -1) { \
     CmiAbort("Projections I/O error!"); \
   } \
-}
+} while(false)
 
 /// a log entry in trace projection
 class LogEntry {