Add stringization of nhassert expression.
This commit is contained in:
+1
-1
@@ -2021,7 +2021,7 @@ E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2);
|
|||||||
E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2);
|
E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2);
|
||||||
E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2);
|
E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2);
|
||||||
E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2);
|
E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2);
|
||||||
E void FDECL(nhassert_failed, (const char *, int));
|
E void FDECL(nhassert_failed, (const char *, const char *, int));
|
||||||
|
|
||||||
/* ### polyself.c ### */
|
/* ### polyself.c ### */
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -428,7 +428,7 @@ struct savefile_info {
|
|||||||
/* Supply nhassert macro if not supplied by port */
|
/* Supply nhassert macro if not supplied by port */
|
||||||
#ifndef nhassert
|
#ifndef nhassert
|
||||||
#define nhassert(expression) (void)((!!(expression)) || \
|
#define nhassert(expression) (void)((!!(expression)) || \
|
||||||
(nhassert_failed(__FILE__, __LINE__), 0))
|
(nhassert_failed(#expression, __FILE__, __LINE__), 0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* GLOBAL_H */
|
#endif /* GLOBAL_H */
|
||||||
|
|||||||
+3
-2
@@ -621,7 +621,8 @@ VA_DECL(const char *, str)
|
|||||||
|
|
||||||
/* nhassert_failed is called when an nhassert's condition is false */
|
/* nhassert_failed is called when an nhassert's condition is false */
|
||||||
void
|
void
|
||||||
nhassert_failed(filepath, line)
|
nhassert_failed(expression, filepath, line)
|
||||||
|
const char* expression;
|
||||||
const char * filepath;
|
const char * filepath;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
@@ -633,7 +634,7 @@ nhassert_failed(filepath, line)
|
|||||||
filename = (filename == NULL ? strrchr(filepath, '\\') : filename);
|
filename = (filename == NULL ? strrchr(filepath, '\\') : filename);
|
||||||
filename = (filename == NULL ? filepath : filename + 1);
|
filename = (filename == NULL ? filepath : filename + 1);
|
||||||
|
|
||||||
impossible("nhassert failed in file '%s' at line %d", filename, line);
|
impossible("nhassert(%s) failed in file '%s' at line %d", expression, filename, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*pline.c*/
|
/*pline.c*/
|
||||||
|
|||||||
Reference in New Issue
Block a user