From patchwork Mon Mar 23 10:27:19 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: 26315 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 32FC0C32F5 for ; Mon, 23 Mar 2026 10:27:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C70862764; Mon, 23 Mar 2026 11:27:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="I/krynXv"; dkim-atps=neutral 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 C26D562737 for ; Mon, 23 Mar 2026 11:27:27 +0100 (CET) Received: from pb-laptop.local (185.221.143.129.nat.pool.zt.hu [185.221.143.129]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5BF37591; Mon, 23 Mar 2026 11:26:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1774261571; bh=87Zl8dAVhoX7TEAN+gzR8eiODF1j0cJrZ90GT79RjCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I/krynXvefRNBnQavvkr6G0UNOsIrpzFPek5IpIt33I3rCFOvY0k5uTz/IGye1a68 uO53zy9lYf6ow4o8Ix+lR5+Cn5I4yEnNjDLvdY4cu2O/SfR7YsxGn48N0qy59Xb7pq nGW+cMxz1dU+GFuoPB+/zOEiJskh4Ek+pr2tQai8= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Laurent Pinchart Subject: [RFC PATCH v2 2/7] meson: Ignore `Wredundant-move` with GCC 11 and above Date: Mon, 23 Mar 2026 11:27:19 +0100 Message-ID: <20260323102724.1385487-3-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323102724.1385487-1-barnabas.pocze@ideasonboard.com> References: <20260323102724.1385487-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 C++20 mode, object slicing in a return statement triggers automatic move since GCC 11, and using `std::move()` emits `-Wredundant-move` in those same GCC versions. So disable the warning in those as well. This is relevant for `valueOrTuple()` in `py_helpers.cpp`, which returns a `py::tuple` as `py::object`. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- meson.build | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 82867f82b..fa38fa2c0 100644 --- a/meson.build +++ b/meson.build @@ -159,16 +159,17 @@ if cc.get_id() == 'gcc' error('gcc version is too old, libcamera requires 9.0 or newer') endif - # gcc 13 implements the C++23 version of automatic move from local - # variables in return statements (see - # https://en.cppreference.com/w/cpp/language/return). As a result, some - # previously required explicit std::move() in return statements generate - # warnings. Those moves can't be removed as older compiler versions could - # use copy constructors instead of move constructors. The easiest fix is to - # disable the warning. With -Wpessimizing-move enabled, the compiler will - # still warn of pessimizing moves, only the redundant but not pessimizing - # moves will be ignored. - if cc.version().version_compare('>=13') + # In C++20 mode, prior to gcc 11, object slicing in a return statement didn't + # perform automatic move. It required explicit std::move() usage, which now + # generate warnings. Those moves can't be removed as older compiler versions + # could use copy constructors instead of move constructors. The easiest fix + # is to disable the warning. With -Wpessimizing-move enabled, the compiler + # will still warn of pessimizing moves, only the redundant but not + # pessimizing moves will be ignored. + # + # \todo When dropping support for compilers older than gcc 11, drop the + # argument and remove the unneeded std::move() calls. + if cc.version().version_compare('>=11') cpp_arguments += [ '-Wno-redundant-move', ]