[{"id":29619,"web_url":"https://patchwork.libcamera.org/comment/29619/","msgid":"<171680579759.2626842.7605128708792699250@ping.linuxembedded.co.uk>","date":"2024-05-27T10:29:57","subject":"Re: [PATCH v1] android: camera_capabilities: Fix GCC 14 warning","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 (2024-05-25 17:50:55)\n> GCC 14 thinks `rects` is a \"possibly dangling reference to a temporary\",\n> which causes the compilation to fail due to the use of `-Werror`.\n\nThe error message from GCC might be more useful. The fact it fails due\nto the use of -Werror is just a side effect of the warning, and that we\naim to be warning free.\n\n> \n> Fix this by not using a reference.\n> \n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> ---\n>  src/android/camera_capabilities.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> index 6f4d48de..71043e12 100644\n> --- a/src/android/camera_capabilities.cpp\n> +++ b/src/android/camera_capabilities.cpp\n> @@ -1081,7 +1081,7 @@ int CameraCapabilities::initializeStaticMetadata()\n>         }\n>  \n>         {\n> -               const Span<const Rectangle> &rects =\n> +               const Span<const Rectangle> rects =\n>                         properties.get(properties::PixelArrayActiveAreas).value_or(Span<const Rectangle>{});\n\nPresumably this means it will make a copy of the Span. But that's\nincredible cheap so not an issue?\n\nI don't object to it - and with the compiler warning clarified (which is\nthe underlying justification for the change):\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>                 std::vector<int32_t> data{\n>                         static_cast<int32_t>(rects[0].x),\n> -- \n> 2.45.1\n> \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 DC9F2BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 May 2024 10:30:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F0E47634B2;\n\tMon, 27 May 2024 12:30:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A3931634AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 May 2024 12:30:00 +0200 (CEST)","from pendragon.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 8D085471;\n\tMon, 27 May 2024 12:29:58 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"j+gUsc6c\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1716805798;\n\tbh=W2CicGuvdGfdiDJGv107rrSLtPbb6QZR7Wyy9JbZAmE=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=j+gUsc6ce0BXuTj6aShQlZlXwAK6c62MIPgCPpKsvWFLK6AVb+MpwPv8riHYijF8Q\n\t84uDFk/tX2FZ3ahlHZ4xrxnpnjRSXq9tv9EYsuB1UkOZs8P28lWAw8xjF2nKXkp2dz\n\tfzI3AxxHWAwXvZ6el4XOxV3QRP9XrEDTpx3zXcmE=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240525165053.46330-1-pobrn@protonmail.com>","References":"<20240525165053.46330-1-pobrn@protonmail.com>","Subject":"Re: [PATCH v1] android: camera_capabilities: Fix GCC 14 warning","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 27 May 2024 11:29:57 +0100","Message-ID":"<171680579759.2626842.7605128708792699250@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}},{"id":29620,"web_url":"https://patchwork.libcamera.org/comment/29620/","msgid":"<20240527110135.GA1490@pendragon.ideasonboard.com>","date":"2024-05-27T11:01:35","subject":"Re: [PATCH v1] android: camera_capabilities: Fix GCC 14 warning","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, May 27, 2024 at 11:29:57AM +0100, Kieran Bingham wrote:\n> Quoting Barnabás Pőcze (2024-05-25 17:50:55)\n> > GCC 14 thinks `rects` is a \"possibly dangling reference to a temporary\",\n> > which causes the compilation to fail due to the use of `-Werror`.\n> \n> The error message from GCC might be more useful. The fact it fails due\n> to the use of -Werror is just a side effect of the warning, and that we\n> aim to be warning free.\n> \n> > \n> > Fix this by not using a reference.\n> > \n> > Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> > ---\n> >  src/android/camera_capabilities.cpp | 2 +-\n> >  1 file changed, 1 insertion(+), 1 deletion(-)\n> > \n> > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> > index 6f4d48de..71043e12 100644\n> > --- a/src/android/camera_capabilities.cpp\n> > +++ b/src/android/camera_capabilities.cpp\n> > @@ -1081,7 +1081,7 @@ int CameraCapabilities::initializeStaticMetadata()\n> >         }\n> >  \n> >         {\n> > -               const Span<const Rectangle> &rects =\n> > +               const Span<const Rectangle> rects =\n> >                         properties.get(properties::PixelArrayActiveAreas).value_or(Span<const Rectangle>{});\n> \n> Presumably this means it will make a copy of the Span. But that's\n> incredible cheap so not an issue?\n\nCorrect, it's cheap. It seems to be a false positive from gcc though.\nI'm curious to see the exact error message.\n\n> I don't object to it - and with the compiler warning clarified (which is\n> the underlying justification for the change):\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n> >                 std::vector<int32_t> data{\n> >                         static_cast<int32_t>(rects[0].x),","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 063B6BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 May 2024 11:01:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DD560634B1;\n\tMon, 27 May 2024 13:01:50 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B1342634AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 May 2024 13:01:48 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3DEBC710;\n\tMon, 27 May 2024 13:01:46 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nJv7SnrG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1716807706;\n\tbh=ec6GF92uxqNNLOXgO2lhyII8avZondw0yMUa1SdPi5w=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nJv7SnrGmx5nUHvpDWi0u3v4P9SpcVDMOQWutPDZe5tZVGOC6cgmt9D2rfqKPDKTi\n\tiTla9SYZDIBzyPZHkCi74v3FHT6CfQLQoeTxyTcOo3M0QL/w0jUf2VchUIlH6dFheU\n\tIstQ+q/7+vn1b/wn2BO/S4lZzwgByOPIFNyIt3w8=","Date":"Mon, 27 May 2024 14:01:35 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>,\n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1] android: camera_capabilities: Fix GCC 14 warning","Message-ID":"<20240527110135.GA1490@pendragon.ideasonboard.com>","References":"<20240525165053.46330-1-pobrn@protonmail.com>\n\t<171680579759.2626842.7605128708792699250@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<171680579759.2626842.7605128708792699250@ping.linuxembedded.co.uk>","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>"}}]