Workaround 'condition is redundant or null deref is possible' cppcheck FP
[platform/upstream/libgc.git] / cord / cordprnt.c
index 7eaf372..70972af 100644 (file)
 #define CONV_RESULT_LEN 50      /* Maximum length of any        */
                                 /* conversion with default      */
                                 /* width and prec.              */
+#if defined(CPPCHECK)
+# define MACRO_BLKSTMT_BEGIN {
+# define MACRO_BLKSTMT_END   }
+#else
+# define MACRO_BLKSTMT_BEGIN do {
+# define MACRO_BLKSTMT_END   } while (0)
+#endif
 
-#define OUT_OF_MEMORY do { \
+#define OUT_OF_MEMORY MACRO_BLKSTMT_BEGIN \
                         if (CORD_oom_fn != 0) (*CORD_oom_fn)(); \
                         fprintf(stderr, "Out of memory\n"); \
                         abort(); \
-                      } while (0)
+                      MACRO_BLKSTMT_END
 
 static int ec_len(CORD_ec x)
 {