From patchwork Mon Jan 19 11:31:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 25850 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C2F09C327D for ; Mon, 19 Jan 2026 11:31:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7903B61FCA; Mon, 19 Jan 2026 12:31:16 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GKHIiId4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 903E261FC0 for ; Mon, 19 Jan 2026 12:31:08 +0100 (CET) Received: from pb-laptop.local (185.221.143.114.nat.pool.zt.hu [185.221.143.114]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 50A80C79 for ; Mon, 19 Jan 2026 12:30:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1768822238; bh=PA3i2QUDvbgwK1eYqs0+mNuHHaAHoiKgE3WuGpC/PmE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GKHIiId4CiGYg5Tvw63+5aJOy1dI33leVFcwVWHd0MB3xpwU0Lf274HwRl2GMWDXB yskox5S92qq4ZCBzaoJdHnMgpLLTTwbnUd5pDnXPBoC5I49iCWrSKqbRXAGRvJTb0D UBg7ir6Jj4KfyfqdOi1399jYt5q7OiuwsGu9/K3M= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 5/5] libcamera: base: log: Inline `LOG()` into `ASSERT()` Date: Mon, 19 Jan 2026 12:31:03 +0100 Message-ID: <20260119113104.3560802-6-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119113104.3560802-1-barnabas.pocze@ideasonboard.com> References: <20260119113104.3560802-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h index dbd14951c..8419300a5 100644 --- a/include/libcamera/base/log.h +++ b/include/libcamera/base/log.h @@ -130,9 +130,11 @@ LogMessage _log(const LogCategory &category, LogSeverity severity, #ifndef NDEBUG #define ASSERT(condition) static_cast(({ \ - if (!(condition)) \ - LOG(Fatal) << "assertion \"" #condition "\" failed in " \ - << __func__ << "()"; \ + if (!(condition)) { \ + _log(LogCategory::defaultCategory(), LogFatal).stream() \ + << "assertion \"" #condition "\" failed in " \ + << __func__ << "()"; \ + } \ })) #else #define ASSERT(condition) static_cast(false && (condition))