From d05afacedffd5cb39194a4f2a4dba41cc30c299a Mon Sep 17 00:00:00 2001 From: Jannick Date: Sat, 5 Jun 2021 19:22:26 +0200 Subject: [PATCH] m4 1.4.19: tests - refine error messages * tests/macros.h: - append to failed assert error message the system error message if available, "No error message" otherwise. --- tests/macros.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/macros.h b/tests/macros.h index fccfc50..81d0b0d 100644 --- a/tests/macros.h +++ b/tests/macros.h @@ -20,6 +20,8 @@ #include #include +#include +#include #ifndef FALLTHROUGH # if (__GNUC__ >= 7) || (__clang_major__ >= 10) @@ -56,8 +58,9 @@ { \ if (!(expr)) \ { \ - fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n", \ - __FILE__, __LINE__, #expr); \ + fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed: %s\n", \ + __FILE__, __LINE__, #expr, \ + errno ? strerror(errno) : "No error message"); \ fflush (ASSERT_STREAM); \ abort (); \ } \ -- 2.31.1.windows.1