Use Error_puts instead of Error where possible
This commit is contained in:
parent
f82ba904bd
commit
a99b07c98e
|
@ -40,8 +40,10 @@ void Warning(const char *fmt,...) __attribute_format_printf(1, 2); //print ou
|
|||
#define Warning(F,...) dxx_call_printf_checked(Warning,Warning_puts,(),(F),##__VA_ARGS__)
|
||||
void set_warn_func(void (*f)(const char *s));//specifies the function to call with warning messages
|
||||
void clear_warn_func();//say this function no longer valid
|
||||
void Error_puts(const char *func, unsigned line, const char *str) __noreturn __attribute_nonnull();
|
||||
#define Error_puts(F) Error_puts(__func__, __LINE__,F)
|
||||
void Error(const char *func, unsigned line, const char *fmt,...) __noreturn __attribute_format_printf(3, 4); //exit with error code=1, print message
|
||||
#define Error(F,...) ((Error)(__func__, __LINE__, (F), ## __VA_ARGS__))
|
||||
#define Error(F,...) dxx_call_printf_checked(Error,(Error_puts),(__func__, __LINE__),(F),##__VA_ARGS__)
|
||||
#define Assert assert
|
||||
#ifndef NDEBUG //macros for debugging
|
||||
|
||||
|
|
|
@ -59,6 +59,15 @@ static void print_exit_message(const char *exit_message)
|
|||
con_puts(CON_CRITICAL, exit_message);
|
||||
}
|
||||
|
||||
void (Error_puts)(const char *func, const unsigned line, const char *str)
|
||||
{
|
||||
char exit_message[MAX_MSG_LEN]; // don't put the new line in for dialog output
|
||||
snprintf(exit_message, sizeof(exit_message), "%s:%u: error: %s", func, line, str);
|
||||
Int3();
|
||||
print_exit_message(exit_message);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//terminates with error code 1, printing message
|
||||
void (Error)(const char *func, const unsigned line, const char *fmt,...)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue