From 7065ad84f00537046ff15555bb60de6a7db274aa Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 30 Mar 2021 19:52:04 +0100 Subject: libcamera: internal: log: Report function on asserts Report the function which fails an assertion as well as the actual assertion. This now reports as: [30:08:53.218816270] [226567] FATAL default request.cpp:150 assertion "d" failed in reuse() rather than: [30:11:05.271888926] [228531] FATAL default request.cpp:150 assertion "d" failed Reviewed-by: Jean-Michel Hautbois Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- include/libcamera/internal/log.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h index be0bab3c..b66bf55b 100644 --- a/include/libcamera/internal/log.h +++ b/include/libcamera/internal/log.h @@ -117,9 +117,10 @@ LogMessage _log(const LogCategory *category, LogSeverity severity, #endif /* __DOXYGEN__ */ #ifndef NDEBUG -#define ASSERT(condition) static_cast(({ \ - if (!(condition)) \ - LOG(Fatal) << "assertion \"" #condition "\" failed"; \ +#define ASSERT(condition) static_cast(({ \ + if (!(condition)) \ + LOG(Fatal) << "assertion \"" #condition "\" failed in " \ + << __func__ << "()"; \ })) #else #define ASSERT(condition) static_cast(false && (condition)) -- cgit v1.2.1