aboutsummaryrefslogtreecommitdiff
path: root/gcc/selftest.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/selftest.c')
-rw-r--r--gcc/selftest.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/selftest.c b/gcc/selftest.c
index e5332db..ed6e517 100644
--- a/gcc/selftest.c
+++ b/gcc/selftest.c
@@ -29,7 +29,7 @@ int selftest::num_passes;
/* Record the successful outcome of some aspect of a test. */
void
-selftest::pass (const char */*file*/, int /*line*/, const char */*msg*/)
+selftest::pass (const location &/*loc*/, const char */*msg*/)
{
num_passes++;
}
@@ -37,22 +37,22 @@ selftest::pass (const char */*file*/, int /*line*/, const char */*msg*/)
/* Report the failed outcome of some aspect of a test and abort. */
void
-selftest::fail (const char *file, int line, const char *msg)
+selftest::fail (const location &loc, const char *msg)
{
- fprintf (stderr,"%s:%i: FAIL: %s\n", file, line, msg);
- /* TODO: add calling function name as well? */
+ fprintf (stderr,"%s:%i: %s: FAIL: %s\n", loc.m_file, loc.m_line,
+ loc.m_function, msg);
abort ();
}
/* As "fail", but using printf-style formatted output. */
void
-selftest::fail_formatted (const char *file, int line, const char *fmt, ...)
+selftest::fail_formatted (const location &loc, const char *fmt, ...)
{
va_list ap;
- fprintf (stderr, "%s:%i: FAIL: ", file, line);
- /* TODO: add calling function name as well? */
+ fprintf (stderr, "%s:%i: %s: FAIL: ", loc.m_file, loc.m_line,
+ loc.m_function);
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
@@ -63,15 +63,15 @@ selftest::fail_formatted (const char *file, int line, const char *fmt, ...)
/* Implementation detail of ASSERT_STREQ. */
void
-selftest::assert_streq (const char *file, int line,
+selftest::assert_streq (const location &loc,
const char *desc_expected, const char *desc_actual,
const char *val_expected, const char *val_actual)
{
if (0 == strcmp (val_expected, val_actual))
- ::selftest::pass (file, line, "ASSERT_STREQ");
+ ::selftest::pass (loc, "ASSERT_STREQ");
else
::selftest::fail_formatted
- (file, line, "ASSERT_STREQ (%s, %s) expected=\"%s\" actual=\"%s\"",
+ (loc, "ASSERT_STREQ (%s, %s) expected=\"%s\" actual=\"%s\"",
desc_expected, desc_actual, val_expected, val_actual);
}