libcamera: base: log: Inline LOG() into ASSERT()

Avoid the conditional logic in the expansion of `LOG()` inside `ASSERT()` by
directly calling `_log(...)` with the appropriate parameters.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2025-04-17 17:14:32 +02:00
parent 75c963146e
commit 2318a2863b

View File

@@ -132,8 +132,9 @@ LogMessage _log(const LogCategory &category, LogSeverity severity,
#ifndef NDEBUG
#define ASSERT(condition) static_cast<void>(({ \
if (!(condition)) \
LOG(Fatal) << "assertion \"" #condition "\" failed in " \
<< __func__ << "()"; \
_log(LogCategory::defaultCategory(), LogFatal).stream() \
<< "assertion \"" #condition "\" failed in " \
<< __func__ << "()"; \
}))
#else
#define ASSERT(condition) static_cast<void>(false && (condition))