From patchwork Thu Jan 15 11:16:30 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: 25815 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 7BD80C3274 for ; Thu, 15 Jan 2026 11:16:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F2A9461FBC; Thu, 15 Jan 2026 12:16:36 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="d5qth5Tu"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5202E61FBB for ; Thu, 15 Jan 2026 12:16:33 +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 DCBF14D3 for ; Thu, 15 Jan 2026 12:16:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1768475765; bh=ANyZ0k0cKLK4B/teK0xo6/5jNKA5jRhJmA+LsaNSOgw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=d5qth5TuYsY3mAfNOzwxmCFbfrlK2bjy84TBcROh8CwnJ85KtQMIxZrZT/97bmBJ9 K05OM5lBQ9KwUq7teGBHbXMJG4xgm3WyyLZbcnt1j7c9CC9GA8zNlnALiHkHnqUEzt 1PByy8HwqwEFh0QgF/RkM2DlOSTVzxL0fsgcM5gM= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 3/3] libcamera: base: utils: Fix names of `operator<<` for `Duration` Date: Thu, 15 Jan 2026 12:16:30 +0100 Message-ID: <20260115111630.1892890-3-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115111630.1892890-1-barnabas.pocze@ideasonboard.com> References: <20260115111630.1892890-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" In order for ADL to find the function, it must be in the namespace of any of its arguments. Previously, however, that was not the case, and it has only really worked by accident and could be easily made to fail by introducing other `operator<<` overloads. For example, a user of this function in `libcamera::ipa` would no longer compile after introducing an `operator<<` into the `libcamera::ipa` namespace as that would essentially hide this overload, and without ADL it would not be found. So move the function into the `utils` namespace. Fixes: 5055ca747c4c ("libcamera: utils: Add helper class for std::chrono::duration") Signed-off-by: Barnabás Pőcze --- include/libcamera/base/utils.h | 6 +++--- src/libcamera/base/utils.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h index 6ce1ace43..fc4f5079c 100644 --- a/include/libcamera/base/utils.h +++ b/include/libcamera/base/utils.h @@ -423,10 +423,10 @@ scope_exit(EF) -> scope_exit; #endif /* __DOXYGEN__ */ -} /* namespace utils */ - #ifndef __DOXYGEN__ -std::ostream &operator<<(std::ostream &os, const utils::Duration &d); +std::ostream &operator<<(std::ostream &os, const Duration &d); #endif +} /* namespace utils */ + } /* namespace libcamera */ diff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp index 2c3f2b7e6..42a516097 100644 --- a/src/libcamera/base/utils.cpp +++ b/src/libcamera/base/utils.cpp @@ -655,10 +655,8 @@ void ScopeExitActions::release() actions_.clear(); } -} /* namespace utils */ - #ifndef __DOXYGEN__ -std::ostream &operator<<(std::ostream &os, const utils::Duration &d) +std::ostream &operator<<(std::ostream &os, const Duration &d) { std::ostringstream s; @@ -671,4 +669,6 @@ std::ostream &operator<<(std::ostream &os, const utils::Duration &d) } #endif +} /* namespace utils */ + } /* namespace libcamera */