Improve the assertion output so that it is less suggestive of a bug in the mps and more suggestive of a problem that needs investigation.

Copied from Perforce
 Change: 186032
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-05-12 15:59:21 +01:00
parent 77a107dd22
commit 7d539cd4bc

View file

@ -61,13 +61,19 @@ int mps_lib_fputs(const char *s, mps_lib_FILE *stream)
}
static void mps_lib_assert_fail_default(const char *file,
unsigned line,
static void mps_lib_assert_fail_default(const char *file, unsigned line,
const char *condition)
{
(void)fflush(stdout); /* synchronize */
(void)fprintf(stderr, "%s:%u: MPS ASSERTION FAILED: %s\n", file, line, condition);
(void)fflush(stderr); /* make sure the message is output */
/* Synchronize with stdout. */
(void)fflush(stdout);
(void)fprintf(stderr,
"The MPS detected a problem!\n"
"%s:%u: MPS ASSERTION FAILED: %s\n"
"See the \"Assertions\" section in the reference manual:\n"
"http://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\n",
file, line, condition);
/* Ensure the message is output even if stderr is buffered. */
(void)fflush(stderr);
ASSERT_ABORT(); /* see config.h */
}