(*vex_failure_exit)();
}
+/* To be used in assert-like (i.e. should never ever happen) situations */
__attribute__ ((noreturn))
void vpanic ( const HChar* str )
{
}
}
-UInt vex_printf ( const HChar* format, ... )
+static UInt vex_vprintf ( const HChar* format, va_list vargs )
{
UInt ret;
- va_list vargs;
- va_start(vargs,format);
n_myprintf_buf = 0;
myprintf_buf[n_myprintf_buf] = 0;
(*vex_log_bytes)( myprintf_buf, n_myprintf_buf );
}
+ return ret;
+}
+
+UInt vex_printf ( const HChar* format, ... )
+{
+ UInt ret;
+ va_list vargs;
+ va_start(vargs, format);
+ ret = vex_vprintf(format, vargs);
va_end(vargs);
return ret;
}
+/* Use this function to communicate to users that a (legitimate) situation
+ occured that we cannot handle (yet). */
+__attribute__ ((noreturn))
+void vfatal ( const HChar* format, ... )
+{
+ va_list vargs;
+ va_start(vargs, format);
+ vex_vprintf( format, vargs );
+ va_end(vargs);
+ vex_printf("Cannot continue. Good-bye\n\n");
+
+ (*vex_failure_exit)();
+}
/* A general replacement for sprintf(). */
__attribute__ ((__noreturn__))
extern void vpanic ( const HChar* str );
+__attribute__ ((__noreturn__)) __attribute__ ((format (printf, 1, 2)))
+extern void vfatal ( const HChar* format, ... );
+
/* Printing */