{"id":18797,"url":"https://patchwork.libcamera.org/api/patches/18797/?format=json","web_url":"https://patchwork.libcamera.org/patch/18797/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230707090249.21635-1-laurent.pinchart@ideasonboard.com>","date":"2023-07-07T09:02:49","name":"[libcamera-devel] tests: gstreamer: Fix compiler error with gcc 8.4.0","commit_ref":"03526e58d1fc58012374ad83b43c93a9d3ea289f","pull_url":null,"state":"accepted","archived":false,"hash":"94b258eb3042c586fd4de575f157c47a376b0a09","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18797/mbox/","series":[{"id":3961,"url":"https://patchwork.libcamera.org/api/series/3961/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3961","date":"2023-07-07T09:02:49","name":"[libcamera-devel] tests: gstreamer: Fix compiler error with gcc 8.4.0","version":1,"mbox":"https://patchwork.libcamera.org/series/3961/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18797/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18797/checks/","tags":{},"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 8B673BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  7 Jul 2023 09:02:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF776628C0;\n\tFri,  7 Jul 2023 11:02:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8EB0561E32\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  7 Jul 2023 11:02:53 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-32-136-nat.elisa-mobile.fi\n\t[85.76.32.136])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C407B558;\n\tFri,  7 Jul 2023 11:02:06 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1688720575;\n\tbh=UzphMmFmP1Lt6areJFxxmArnqo0l2uVPqTrN94kMb/c=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=ImV0YiJLdQx4zEuu6qAu+aAbpGRrYFD9prmBIxjnPvkOq/GBFuN2q3zYkqp7Jw60s\n\taQR7uZlhxV6r5kfEXvjEFz5n7fa/phBtS1Rq+9+pu3wwOaerUmPbOOvVgfM7pdejIo\n\tzC7JulKz4SPF0Yd0GQUJ9O1yOXoDxe+kKFd8tyljVLuhdmBZ55AWH/5gr9n5h+ohIZ\n\t6XrwmMe7fCcQ153z2YR+AC2/l0dyoJpMcrzcZtvDa9j/RpnX79ct5IMeqrMk5BP+TT\n\turUp+k6HFXFabuzFMxBiRPzvWMzp+wbRjahsI4kpyYKCrkMbcLq3oqlG8KiCTHmrW/\n\ttDjMChI5ePUmA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1688720527;\n\tbh=UzphMmFmP1Lt6areJFxxmArnqo0l2uVPqTrN94kMb/c=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=FcuDBwUZ1RlNbNxTmaW+p2uAHmAarHiLW+lDMi49rhEVjuJvJAsruZCgyZYFSxHvd\n\tWunIF/41kAVi/D72chnk4L5UzwwiofvdKfwO71bABOk2NZAfvsZSzlq6TS+H2WCY9R\n\tAWTdPHV9UMLscmnhYYRTHSMs8KuJcN4oMDBvf7Po="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FcuDBwUZ\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  7 Jul 2023 12:02:49 +0300","Message-Id":"<20230707090249.21635-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.39.3","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] tests: gstreamer: Fix compiler error with\n\tgcc 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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The provider g_autoptr variable introduced by commit adb1bbb748a1\n(\"tests: gstreamer: Test cameras' enumeration from GstDeviceProvider\")\nis left uninitialized when declared. The cleanup function could thus get\ncalled on an unitialized variable if the scope was exited before the\nvariable gets initialized. This can't occur here, but gcc 8.4.0 still\ncomplains 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\nSilence the error by initializing the variable to NULL at declaration\ntime. This is a good practice in any case, as later refactoring could\notherwise introduce a scope exit before initialization.\n\nFixes: adb1bbb748a1 (\"tests: gstreamer: Test cameras' enumeration from GstDeviceProvider\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/gstreamer/gstreamer_device_provider_test.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n\nbase-commit: adb1bbb748a12eb2427f2d19a46fae55d99b623a","diff":"diff --git a/test/gstreamer/gstreamer_device_provider_test.cpp b/test/gstreamer/gstreamer_device_provider_test.cpp\nindex 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","prefixes":["libcamera-devel"]}