[{"id":38383,"web_url":"https://patchwork.libcamera.org/comment/38383/","msgid":"<177428539623.4036272.15189324486421435726@ping.linuxembedded.co.uk>","date":"2026-03-23T17:03:16","subject":"Re: [RFC PATCH v2 2/7] meson: Ignore `Wredundant-move` with GCC 11\n\tand above","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2026-03-23 10:27:19)\n> In C++20 mode, object slicing in a return statement triggers automatic move\n> since GCC 11, and using `std::move()` emits `-Wredundant-move` in those\n> same GCC versions. So disable the warning in those as well.\n> \n> This is relevant for `valueOrTuple()` in `py_helpers.cpp`, which\n> returns a `py::tuple` as `py::object`.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  meson.build | 21 +++++++++++----------\n>  1 file changed, 11 insertions(+), 10 deletions(-)\n> \n> diff --git a/meson.build b/meson.build\n> index 82867f82b..fa38fa2c0 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -159,16 +159,17 @@ if cc.get_id() == 'gcc'\n>          error('gcc version is too old, libcamera requires 9.0 or newer')\n>      endif\n>  \n> -    # gcc 13 implements the C++23 version of automatic move from local\n> -    # variables in return statements (see\n> -    # https://en.cppreference.com/w/cpp/language/return). As a result, some\n> -    # previously required explicit std::move() in return statements generate\n> -    # warnings. Those moves can't be removed as older compiler versions could\n> -    # use copy constructors instead of move constructors. The easiest fix is to\n> -    # disable the warning. With -Wpessimizing-move enabled, the compiler will\n> -    # still warn of pessimizing moves, only the redundant but not pessimizing\n> -    # moves will be ignored.\n> -    if cc.version().version_compare('>=13')\n> +    # In C++20 mode, prior to gcc 11, object slicing in a return statement didn't\n> +    # perform automatic move. It required explicit std::move() usage, which now\n> +    # generate warnings. Those moves can't be removed as older compiler versions\n> +    # could use copy constructors instead of move constructors. The easiest fix\n> +    # is to disable the warning. With -Wpessimizing-move enabled, the compiler\n> +    # will still warn of pessimizing moves, only the redundant but not\n> +    # pessimizing moves will be ignored.\n> +    #\n> +    # \\todo When dropping support for compilers older than gcc 11, drop the\n> +    # argument and remove the unneeded std::move() calls.\n> +    if cc.version().version_compare('>=11')\n>          cpp_arguments += [\n>              '-Wno-redundant-move',\n>          ]\n> -- \n> 2.53.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 57678BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Mar 2026 17:03:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 126B06277D;\n\tMon, 23 Mar 2026 18:03:21 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 652DF62647\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2026 18:03:19 +0100 (CET)","from monstersaurus.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D62DBC58;\n\tMon, 23 Mar 2026 18:02:02 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZAUenUOd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774285322;\n\tbh=z799dxToMUPA5pDmniS/rdSGpbvb/sRmb7iG+z+WojI=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=ZAUenUOdgyATyqlbZMAa5EHuwhHUZA9/bAVFe/krHb+XxWDY3bamuf8gjc8OgsOe5\n\t64Wn7VOvizgK7sBVt8jcSxNTCLISJm7LA0uGBARdR/aPsKeUW0UA1jk407fu7u1ROb\n\tjTTZq5DpFEDRCShIGTlNkYF2oeE0e9hUUHVoL8y8=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260323102724.1385487-3-barnabas.pocze@ideasonboard.com>","References":"<20260323102724.1385487-1-barnabas.pocze@ideasonboard.com>\n\t<20260323102724.1385487-3-barnabas.pocze@ideasonboard.com>","Subject":"Re: [RFC PATCH v2 2/7] meson: Ignore `Wredundant-move` with GCC 11\n\tand above","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 23 Mar 2026 17:03:16 +0000","Message-ID":"<177428539623.4036272.15189324486421435726@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]