[{"id":27507,"web_url":"https://patchwork.libcamera.org/comment/27507/","msgid":"<457aa6d9-eb34-314b-6a58-336a8d09a8ff@ideasonboard.com>","date":"2023-07-07T09:03:45","subject":"Re: [libcamera-devel] [PATCH] tests: gstreamer: Fix compiler error\n\twith gcc 8.4.0","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 7/7/23 11:02 AM, Laurent Pinchart wrote:\n> The provider g_autoptr variable introduced by commit adb1bbb748a1\n> (\"tests: gstreamer: Test cameras' enumeration from GstDeviceProvider\")\n> is left uninitialized when declared. The cleanup function could thus get\n> called on an unitialized variable if the scope was exited before the\n> variable gets initialized. This can't occur here, but gcc 8.4.0 still\n> complains about it:\n>\n> /usr/include/glib-2.0/glib/gmacros.h: In member function ‘virtual int GstreamerDeviceProviderTest::run()’:\n> /usr/include/glib-2.0/glib/gmacros.h:1049:27: error: ‘provider’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n>       { if (_ptr) (cleanup) ((ParentName *) _ptr); }                                                              \\\n>                             ^\n> ../test/gstreamer/gstreamer_device_provider_test.cpp:37:32: note: ‘provider’ was declared here\n>     g_autoptr(GstDeviceProvider) provider;\n>\n> Silence the error by initializing the variable to NULL at declaration\n> time. This is a good practice in any case, as later refactoring could\n> otherwise introduce a scope exit before initialization.\n>\n> Fixes: adb1bbb748a1 (\"tests: gstreamer: Test cameras' enumeration from GstDeviceProvider\")\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nLGTM, ship it!\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n\n> ---\n>   test/gstreamer/gstreamer_device_provider_test.cpp | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/test/gstreamer/gstreamer_device_provider_test.cpp b/test/gstreamer/gstreamer_device_provider_test.cpp\n> index c8606b90559b..237af8cd934e 100644\n> --- a/test/gstreamer/gstreamer_device_provider_test.cpp\n> +++ b/test/gstreamer/gstreamer_device_provider_test.cpp\n> @@ -34,7 +34,7 @@ protected:\n>   \n>   \tint run() override\n>   \t{\n> -\t\tg_autoptr(GstDeviceProvider) provider;\n> +\t\tg_autoptr(GstDeviceProvider) provider = NULL;\n>   \t\tGList *devices, *l;\n>   \t\tstd::vector<std::string> cameraNames;\n>   \t\tstd::unique_ptr<libcamera::CameraManager> cm;\n>\n> base-commit: adb1bbb748a12eb2427f2d19a46fae55d99b623a","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 B8AD7BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  7 Jul 2023 09:03:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6D57C628BC;\n\tFri,  7 Jul 2023 11:03: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 CFB7161E32\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  7 Jul 2023 11:03:48 +0200 (CEST)","from [192.168.247.180] (89-24-50-82.nat.epc.tmcz.cz [89.24.50.82])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CC64F56D;\n\tFri,  7 Jul 2023 11:03:02 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1688720630;\n\tbh=jNqZTJ+Aw4O7KieOko5QYJbQUq7iwDClsp3jbS1cdl8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=RPf143VVc2XHNBRBJVnEKAnbXRsa4WI7a19RFgd4mrogqt/FjViwzgG0tfD2XllUe\n\tFSyShjRIyi+jW2JWm2kOl2xIPR6iB8wVUrS4+4zQmC7LU/ZWNf4+gl6mv3GbipEvW3\n\tMOcE0Wq/7L9oModaw0F/U6p/jBnL6tFY3GD0oqEPT/gEOCnSZRZdffsFvgwqaHDgU5\n\tzsN3Eiz1mrBm3JePico0N8U3YdSo9Q2JbHNFINJPOwd0nWd5+l2y5AvLP44PTo64Gt\n\t6zHEY1k/l7ET7szE3eFPLABGOO7ox0X4XK+GX6ycHgL4frpEo+pXaX/T+mEw25VR5x\n\tx0lecgHU1MVgQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1688720582;\n\tbh=jNqZTJ+Aw4O7KieOko5QYJbQUq7iwDClsp3jbS1cdl8=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=Kk7vLV09Pn2mm8ZO4PbuKR70YQRzvj0xBBrNnFIilWL0Ukiqbynpwqheb9/y6ntQG\n\t+5njIAzk9XdPrmLq/82MpR6s+Rz7XML9IcPURL5gX4iwPa8aeqsWJBWDqPkxtbEBj0\n\tVC6v8Bmv3Ss08uISMhhmMjbUKDEzalMNdtoGacFU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Kk7vLV09\"; dkim-atps=neutral","Message-ID":"<457aa6d9-eb34-314b-6a58-336a8d09a8ff@ideasonboard.com>","Date":"Fri, 7 Jul 2023 11:03:45 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.7.1","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20230707090249.21635-1-laurent.pinchart@ideasonboard.com>","Content-Language":"en-US","In-Reply-To":"<20230707090249.21635-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH] tests: gstreamer: Fix compiler error\n\twith gcc 8.4.0","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":27540,"web_url":"https://patchwork.libcamera.org/comment/27540/","msgid":"<168908741795.3585053.17241920361625507875@Monstersaurus>","date":"2023-07-11T14:56:57","subject":"Re: [libcamera-devel] [PATCH] tests: gstreamer: Fix compiler error\n\twith gcc 8.4.0","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Umang Jain via libcamera-devel (2023-07-07 10:03:45)\n> Hi Laurent,\n> \n> On 7/7/23 11:02 AM, Laurent Pinchart wrote:\n> > The provider g_autoptr variable introduced by commit adb1bbb748a1\n> > (\"tests: gstreamer: Test cameras' enumeration from GstDeviceProvider\")\n> > is left uninitialized when declared. The cleanup function could thus get\n> > called on an unitialized variable if the scope was exited before the\n> > variable gets initialized. This can't occur here, but gcc 8.4.0 still\n> > complains about it:\n> >\n> > /usr/include/glib-2.0/glib/gmacros.h: In member function ‘virtual int GstreamerDeviceProviderTest::run()’:\n> > /usr/include/glib-2.0/glib/gmacros.h:1049:27: error: ‘provider’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n> >       { if (_ptr) (cleanup) ((ParentName *) _ptr); }                                                              \\\n> >                             ^\n> > ../test/gstreamer/gstreamer_device_provider_test.cpp:37:32: note: ‘provider’ was declared here\n> >     g_autoptr(GstDeviceProvider) provider;\n> >\n> > Silence the error by initializing the variable to NULL at declaration\n> > time. This is a good practice in any case, as later refactoring could\n> > otherwise introduce a scope exit before initialization.\n> >\n> > Fixes: adb1bbb748a1 (\"tests: gstreamer: Test cameras' enumeration from GstDeviceProvider\")\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> LGTM, ship it!\n> \n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nWill pick for merge.\n\n> \n> \n> > ---\n> >   test/gstreamer/gstreamer_device_provider_test.cpp | 2 +-\n> >   1 file changed, 1 insertion(+), 1 deletion(-)\n> >\n> > diff --git a/test/gstreamer/gstreamer_device_provider_test.cpp b/test/gstreamer/gstreamer_device_provider_test.cpp\n> > index c8606b90559b..237af8cd934e 100644\n> > --- a/test/gstreamer/gstreamer_device_provider_test.cpp\n> > +++ b/test/gstreamer/gstreamer_device_provider_test.cpp\n> > @@ -34,7 +34,7 @@ protected:\n> >   \n> >       int run() override\n> >       {\n> > -             g_autoptr(GstDeviceProvider) provider;\n> > +             g_autoptr(GstDeviceProvider) provider = NULL;\n> >               GList *devices, *l;\n> >               std::vector<std::string> cameraNames;\n> >               std::unique_ptr<libcamera::CameraManager> cm;\n> >\n> > base-commit: adb1bbb748a12eb2427f2d19a46fae55d99b623a\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 C7069BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Jul 2023 14:57:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3844461E32;\n\tTue, 11 Jul 2023 16:57: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 301B960570\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jul 2023 16:57:01 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 31842DFB;\n\tTue, 11 Jul 2023 16:56:12 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689087423;\n\tbh=mH04pU4TXgiQ2pw6/K51bgGA9hs8D6sU2BV4a0iFQd8=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=sVrA7zqNKvD4Xj0oHG1CFWdPNQrqWp2d8Erp9VtN1tz5mPSzNdhtW+T79vq5/4S5h\n\tyHjsoiobwzj0gpDR3CfXf0NG8c0g3Q9B31trtCYzRJQ4UWQw1/zha0muvarENPc0ZO\n\tNDOVKNsKKSGZLGOnFyaTxEL8pDWYeAf2shL6WJHFNDjMju8uIEoU2wd+qEG5o80D76\n\t1ZjHTNEq7cZFd9etvzJYVksRAB+UtgfxDRZYOsEZS0fNgwSwIG44vEUJSRbKajXPH4\n\tuxxnoEBhoA6/VbpWyGuqY6wwxxaon//tZxfeUDVChoYde6zTW9LLx7/gcqc0NXYz+u\n\t9MBd5vSaGn+tA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1689087372;\n\tbh=mH04pU4TXgiQ2pw6/K51bgGA9hs8D6sU2BV4a0iFQd8=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=amONPLOFatBfU3E8LXOV5KFniJMKvbZ4X4QzvfKlcRRteGKrXifu7bkYOmwYxTLu6\n\tAuoQoeAFpYTk2RtZKWgcZtpEhSZjMEhafP3ul5RCUwsOtHuxdpoQfBpgfYaMVU6J46\n\tuyIxeonrhy6Vf+vpwdQgHGajDlXWlMZZLYb4Ry80="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"amONPLOF\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<457aa6d9-eb34-314b-6a58-336a8d09a8ff@ideasonboard.com>","References":"<20230707090249.21635-1-laurent.pinchart@ideasonboard.com>\n\t<457aa6d9-eb34-314b-6a58-336a8d09a8ff@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 11 Jul 2023 15:56:57 +0100","Message-ID":"<168908741795.3585053.17241920361625507875@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH] tests: gstreamer: Fix compiler error\n\twith gcc 8.4.0","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]