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 <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2021-03-30 19:52:04 +01:00
parent 0f2189ba30
commit 7065ad84f0

View file

@ -117,9 +117,10 @@ LogMessage _log(const LogCategory *category, LogSeverity severity,
#endif /* __DOXYGEN__ */
#ifndef NDEBUG
#define ASSERT(condition) static_cast<void>(({ \
if (!(condition)) \
LOG(Fatal) << "assertion \"" #condition "\" failed"; \
#define ASSERT(condition) static_cast<void>(({ \
if (!(condition)) \
LOG(Fatal) << "assertion \"" #condition "\" failed in " \
<< __func__ << "()"; \
}))
#else
#define ASSERT(condition) static_cast<void>(false && (condition))