From patchwork Fri Jul 7 09:02:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 18797 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 8B673BDC71 for ; Fri, 7 Jul 2023 09:02:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CF776628C0; Fri, 7 Jul 2023 11:02:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1688720575; bh=UzphMmFmP1Lt6areJFxxmArnqo0l2uVPqTrN94kMb/c=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ImV0YiJLdQx4zEuu6qAu+aAbpGRrYFD9prmBIxjnPvkOq/GBFuN2q3zYkqp7Jw60s aQR7uZlhxV6r5kfEXvjEFz5n7fa/phBtS1Rq+9+pu3wwOaerUmPbOOvVgfM7pdejIo zC7JulKz4SPF0Yd0GQUJ9O1yOXoDxe+kKFd8tyljVLuhdmBZ55AWH/5gr9n5h+ohIZ 6XrwmMe7fCcQ153z2YR+AC2/l0dyoJpMcrzcZtvDa9j/RpnX79ct5IMeqrMk5BP+TT urUp+k6HFXFabuzFMxBiRPzvWMzp+wbRjahsI4kpyYKCrkMbcLq3oqlG8KiCTHmrW/ tDjMChI5ePUmA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8EB0561E32 for ; Fri, 7 Jul 2023 11:02:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FcuDBwUZ"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (85-76-32-136-nat.elisa-mobile.fi [85.76.32.136]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C407B558; Fri, 7 Jul 2023 11:02:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1688720527; bh=UzphMmFmP1Lt6areJFxxmArnqo0l2uVPqTrN94kMb/c=; h=From:To:Cc:Subject:Date:From; b=FcuDBwUZ1RlNbNxTmaW+p2uAHmAarHiLW+lDMi49rhEVjuJvJAsruZCgyZYFSxHvd WunIF/41kAVi/D72chnk4L5UzwwiofvdKfwO71bABOk2NZAfvsZSzlq6TS+H2WCY9R AWTdPHV9UMLscmnhYYRTHSMs8KuJcN4oMDBvf7Po= 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 Subject: [libcamera-devel] [PATCH] tests: gstreamer: Fix compiler error with gcc 8.4.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: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The provider g_autoptr variable introduced by commit adb1bbb748a1 ("tests: gstreamer: Test cameras' enumeration from GstDeviceProvider") is left uninitialized when declared. The cleanup function could thus get called on an unitialized variable if the scope was exited before the variable gets initialized. This can't occur here, but gcc 8.4.0 still complains about it: /usr/include/glib-2.0/glib/gmacros.h: In member function ‘virtual int GstreamerDeviceProviderTest::run()’: /usr/include/glib-2.0/glib/gmacros.h:1049:27: error: ‘provider’ may be used uninitialized in this function [-Werror=maybe-uninitialized] { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ ^ ../test/gstreamer/gstreamer_device_provider_test.cpp:37:32: note: ‘provider’ was declared here g_autoptr(GstDeviceProvider) provider; Silence the error by initializing the variable to NULL at declaration time. This is a good practice in any case, as later refactoring could otherwise introduce a scope exit before initialization. Fixes: adb1bbb748a1 ("tests: gstreamer: Test cameras' enumeration from GstDeviceProvider") Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham --- test/gstreamer/gstreamer_device_provider_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: adb1bbb748a12eb2427f2d19a46fae55d99b623a diff --git a/test/gstreamer/gstreamer_device_provider_test.cpp b/test/gstreamer/gstreamer_device_provider_test.cpp index c8606b90559b..237af8cd934e 100644 --- a/test/gstreamer/gstreamer_device_provider_test.cpp +++ b/test/gstreamer/gstreamer_device_provider_test.cpp @@ -34,7 +34,7 @@ protected: int run() override { - g_autoptr(GstDeviceProvider) provider; + g_autoptr(GstDeviceProvider) provider = NULL; GList *devices, *l; std::vector cameraNames; std::unique_ptr cm;