From b684a62f8b7787c34bf9a40154e71910299bfaa5 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 16 Apr 2018 22:05:17 +0200 Subject: [PATCH] Add more local information about the origin of a failure. --- m-core.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/m-core.h b/m-core.h index 6f7259c8..c0107ef3 100644 --- a/m-core.h +++ b/m-core.h @@ -1862,17 +1862,19 @@ m_core_hash (const void *str, size_t length) #include #include #define M_INIT_FAILURE() do { \ - fprintf(stderr, "ERROR: Can not initialize data.\n"); \ + fprintf(stderr, "ERROR: Can not initialize data in (%s:%s:%d).\n", \ + __FILE__, __func__, __LINE__); \ abort(); \ } while (0) #endif #ifndef M_ASSERT_INIT -#define M_ASSERT_INIT(expr) do { \ - if (!(expr)) { \ - fprintf(stderr, "ERROR: Can not initialize data: %s\n", #expr); \ - abort(); \ - } } while (0) +#define M_ASSERT_INIT(expr) do { \ + if (!(expr)) { \ + fprintf(stderr, "ERROR: Can not initialize data in (%s:%s:%d): %s\n", \ + __FILE__, __func__, __LINE__, #expr); \ + abort(); \ + } } while (0) #endif #endif