From 2318a2863baac836a341cdcb8fa3d4a3e702c7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 17 Apr 2025 17:14:32 +0200 Subject: [PATCH] libcamera: base: log: Inline `LOG()` into `ASSERT()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- include/libcamera/base/log.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h index cc50415e..0751387a 100644 --- a/include/libcamera/base/log.h +++ b/include/libcamera/base/log.h @@ -132,8 +132,9 @@ LogMessage _log(const LogCategory &category, LogSeverity severity, #ifndef NDEBUG #define ASSERT(condition) static_cast(({ \ 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(false && (condition))