common: allow printf-like formatted assert messages.
authorKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 11 Dec 2014 11:59:42 +0000 (13:59 +0200)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Fri, 12 Dec 2014 15:37:33 +0000 (17:37 +0200)
src/common/macros.h

index c58f180..bee5741 100644 (file)
 
 /** Assertions. */
 #ifndef NDEBUG
-#    define MRP_ASSERT(expr, msg) do {                                    \
+#    define MRP_ASSERT(expr, fmt, args...) do {                           \
         if (!(expr)) {                                                    \
-            printf("assertion '%s' failed at %s@%s:%d: %s\n", #expr,      \
-                   __FUNCTION__, __FILE__, __LINE__, msg);                \
+            printf("assertion '%s' failed at %s@%s:%d: "fmt"\n", #expr,   \
+                   __FUNCTION__, __FILE__, __LINE__, ## args);          \
             abort();                                                      \
         }                                                                 \
     } while (0)