From patchwork Mon Dec 18 14:13:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19330 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 A0B09C3237 for ; Mon, 18 Dec 2023 14:13:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 07F2A62B32; Mon, 18 Dec 2023 15:13:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1702908789; bh=D7nNueHVX+YCX+0yqOkSt3pzs9Bazc8fsWoAehPPl7E=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=2CPkcXRDbWl7TIz4Yq7/myNvPGTzcj9NYU/5BARqj7DO6PX9XU1gHa7RpPba+uXuv AamMaF2R2qXk35pjlkSfFgFqlu3/TUJRaIouTt+VkwfCs5+QZiGTPeez+mRUDv6gd5 zYiokpO4t6YW1vUl0u+BQntE5HcOYTlbPF3QTDCPC46q8EQq5lRlY9X3fMi30XKPAJ qflLFvErtE7G88c5zUicm4XFKw8DHLpoLnqAuZZthpOoOjlY94KUmcmb2HbtWQyGfQ ArcdDOpjHz3hrZLIvJh200sKTDQeiL4LWjaTrUXXSF+w8B2nmnf4F3dOOWC+zwDPlt wp0Mryet0ZeXw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9924E61D93 for ; Mon, 18 Dec 2023 15:13:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PqSAgvme"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 58E1157E; Mon, 18 Dec 2023 15:12:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1702908737; bh=D7nNueHVX+YCX+0yqOkSt3pzs9Bazc8fsWoAehPPl7E=; h=From:To:Cc:Subject:Date:From; b=PqSAgvmeKb/RxobfPxvZnj3Lu2JA1fyNedBK9CWqKLNzf09IkK35dBQ0AJOyVhkR7 x52JcTx8YfQ4EUh51V1LAAML0MBxxUQ01TwPqs7HRJLfWLADhPkqvFog/QFWZJPqzT 8HqDRpok/wqDUEB/ab+6rr8bRRUhopik+eTHK1fA= To: libcamera-devel@lists.libcamera.org Date: Mon, 18 Dec 2023 16:13:13 +0200 Message-ID: <20231218141313.29898-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: camera: Fix unused variable compiler warning 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: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Cc: inimcoder@gmail.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When compiling with gcc 8.4.0, the compiler throws an unused variable warning: ../src/libcamera/camera.cpp: In member function ‘libcamera::CameraConfiguration::Status libcamera::CameraConfiguration::validateColorSpaces(libcamera::CameraConfiguration::ColorSpaceFlags)’: ../src/libcamera/camera.cpp:497:19: error: unused variable ‘i’ [-Werror=unused-variable] for (auto [i, cfg] : utils::enumerate(config_)) { ^ While the code compiles fine with 8.3.0 and 8.5.0, gcc is right here, the 'i' variable is unused. It turns out that the code can be simplified, as the commit that removed usage of the variable kept the now unneeded utils::enumerate() call. Simplify the code and fix the warning in one go. Fixes: 13986d6ce3ab ("libcamera: camera: Fix validateColorSpaces to choose "main" colour space") Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/camera.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 41d6e6e5c166c267e7a15a7b0c1d930bddcbc6b8 diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 0ad1a4b50447..a71dc933b911 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -494,7 +494,7 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF std::optional colorSpace; Size size; - for (auto [i, cfg] : utils::enumerate(config_)) { + for (StreamConfiguration &cfg : config_) { if (!cfg.colorSpace) continue;