[{"id":35066,"web_url":"https://patchwork.libcamera.org/comment/35066/","msgid":"<2gaphtsnvdyy5xderypp6fmmg4hisj4l75ydipm7fyd2mj4765@g5wxsccxgpeq>","date":"2025-07-24T03:26:12","subject":"Re: [PATCH] qcam: Silence false positive warnings with Qt 6.9.0 and\n\tnewer","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"On Thu, Jul 24, 2025 at 01:39:14AM +0300, Laurent Pinchart wrote:\n> In Qt 6.9.0 the qtmochelpers.h header introduced a construct that gcc 12\n> and gcc 13 incorrectly flag as variable shadowing:\n> \n> In file included from src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:12:\n> /usr/include/qt6/QtCore/qtmochelpers.h: In instantiation of ‘constexpr void QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, Idx ...>, T ...>::forEach(F&&) const [with F = QtMocHelpers::UintData<QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(QtMocHelpers::MetaObjectContents<24, 10, 60, 3>&, size_t, uint&) const::<lambda(const auto:39&)>; int ...Idx = {0}; T = {QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)>}]’:\n> /usr/include/qt6/QtCore/qtmochelpers.h:255:21:   required from ‘constexpr const QtMocHelpers::MetaObjectContents<24, 10, 60, 3> ViewFinderGL::qt_staticMetaObjectContent<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>’\n> src/apps/qcam/qcam.p/../../../../../../src/apps/qcam/viewfinder_gl.h:32:2:   required from ‘constexpr const auto ViewFinderGL::qt_staticMetaObjectStaticContent<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>’\n> src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:63:5:   required from here\n> src/apps/qcam/qcam.p/../../../../../../src/apps/qcam/viewfinder_gl.h:32:2:   in ‘constexpr’ expansion of ‘ViewFinderGL::qt_create_metaobjectdata<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>()’\n> src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:58:87:   in ‘constexpr’ expansion of ‘QtMocHelpers::metaObjectData<ViewFinderGL, {anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, StringRefStorage<char [13], char [15], char [1], char [24], char [7]>, UintData<SignalData<void(libcamera::FrameBuffer*)> >, UintData<>, UintData<> >(0, qt_stringData, qt_methods, qt_properties, qt_enums, QtMocHelpers::UintData<>(), const QtMocHelpers::detail::UintDataBlock<0, 0>{uint [1](), uint [1]()})’\n> /usr/include/qt6/QtCore/qtmochelpers.h:563:36:   in ‘constexpr’ expansion of ‘(& methods)->QtMocHelpers::UintData<QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(result, ((size_t)dataoffset), metatypeoffset)’\n> /usr/include/qt6/QtCore/qtmochelpers.h:201:57: error: declaration of ‘entry’ shadows a member of ‘QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, 0>, QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >’ [-Werror=shadow]\n>   201 |         [[maybe_unused]] auto invoke = [&f](const auto &entry) { f(entry.entry); return 0; };\n>       |                                             ~~~~~~~~~~~~^~~~~\n> /usr/include/qt6/QtCore/qtmochelpers.h:180:7: note: shadowed declaration is here\n>   180 |     T entry;\n>       |       ^~~~~\n> \n\nYes, this seems really awkward. :-(\n\n> There is little we can do but silence the warning. Do so selectively\n> based on the Qt and gcc versions, to still detect variable shadowing\n> with compilers unaffected by the issue.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Umang Jain <uajain@igalia.com>\n\n> ---\n>  src/apps/qcam/meson.build | 7 +++++++\n>  1 file changed, 7 insertions(+)\n> \n> diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build\n> index f7c140643373..9ca047b0f927 100644\n> --- a/src/apps/qcam/meson.build\n> +++ b/src/apps/qcam/meson.build\n> @@ -42,6 +42,13 @@ qt6_cpp_args = [\n>      '-Wno-extra-semi',\n>  ]\n>  \n> +# gcc 12 and 13 output a false positive variable shadowing warning with Qt\n> +# 6.9.0 and newer. Silence it.\n> +if qt6_dep.version().version_compare('>=6.9.0') and \\\n> +   cxx.version().version_compare('>=12') and cxx.version().version_compare('<14')\n> +    qt6_cpp_args += ['-Wno-shadow']\n> +endif\n> +\n>  resources = qt6.preprocess(moc_headers : qcam_moc_headers,\n>                             qresources : qcam_resources,\n>                             dependencies : qt6_dep)\n> \n> base-commit: b65df7e7554b45e2d3d7fdb5b37c2ab7df3db4fe\n> -- \n> Regards,\n> \n> Laurent Pinchart\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 EDFACBDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Jul 2025 03:26:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 95C3D69079;\n\tThu, 24 Jul 2025 05:26:11 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B23566903A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Jul 2025 05:26:08 +0200 (CEST)","from [49.36.71.87] (helo=uajain) by fanzine2.igalia.com with\n\tesmtpsa \n\t(Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1uemat-002xBw-7r; Thu, 24 Jul 2025 05:26:07 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"lKVGBYvn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version\n\t:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=Dc3ACkqoyt+phKhJJ+3OE4sZ53ywTXjnd4ZYhWsI6Qg=;\n\tb=lKVGBYvnmwK3RWOcClDVV7h93p\n\t0yH1dDM1GLYYeKTeiX9XJSbozR83lOH7eXVUW+SjK+Bh1xCls8xsi+RUCXTHb7uzgwC85frv19VSc\n\taxlgaFYK3o+x6+aWnO+OLL1EGr3JWiWj1sViWr5ZfShwyfAptzJgiqE/p6XqChBH6DjjkXBEhHNlz\n\tyoCa+PF+q20Xz29u9+S0eDIUFLGF+G9f//boEb0C1f1J383Vr0Uxx2CixSJ21ULVMvdf9k3sLQvtH\n\tetNQgvna+J43kRLBQBZfcNhup7HzwVP40ra7FKRd/uiBs/A4vlCTMgZFBl35SvzxTXSuCdqN5KKh1\n\tozKhkTFQ==;","Date":"Thu, 24 Jul 2025 08:56:12 +0530","From":"Umang Jain <uajain@igalia.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] qcam: Silence false positive warnings with Qt 6.9.0 and\n\tnewer","Message-ID":"<2gaphtsnvdyy5xderypp6fmmg4hisj4l75ydipm7fyd2mj4765@g5wxsccxgpeq>","References":"<20250723223914.23733-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250723223914.23733-1-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20250510-dirty","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":35071,"web_url":"https://patchwork.libcamera.org/comment/35071/","msgid":"<175334061614.774292.13794711917263210187@neptunite.rasen.tech>","date":"2025-07-24T07:03:36","subject":"Re: [PATCH] qcam: Silence false positive warnings with Qt 6.9.0 and\n\tnewer","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2025-07-24 07:39:14)\n> In Qt 6.9.0 the qtmochelpers.h header introduced a construct that gcc 12\n> and gcc 13 incorrectly flag as variable shadowing:\n> \n> In file included from src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:12:\n> /usr/include/qt6/QtCore/qtmochelpers.h: In instantiation of ‘constexpr void QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, Idx ...>, T ...>::forEach(F&&) const [with F = QtMocHelpers::UintData<QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(QtMocHelpers::MetaObjectContents<24, 10, 60, 3>&, size_t, uint&) const::<lambda(const auto:39&)>; int ...Idx = {0}; T = {QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)>}]’:\n> /usr/include/qt6/QtCore/qtmochelpers.h:255:21:   required from ‘constexpr const QtMocHelpers::MetaObjectContents<24, 10, 60, 3> ViewFinderGL::qt_staticMetaObjectContent<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>’\n> src/apps/qcam/qcam.p/../../../../../../src/apps/qcam/viewfinder_gl.h:32:2:   required from ‘constexpr const auto ViewFinderGL::qt_staticMetaObjectStaticContent<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>’\n> src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:63:5:   required from here\n> src/apps/qcam/qcam.p/../../../../../../src/apps/qcam/viewfinder_gl.h:32:2:   in ‘constexpr’ expansion of ‘ViewFinderGL::qt_create_metaobjectdata<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>()’\n> src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:58:87:   in ‘constexpr’ expansion of ‘QtMocHelpers::metaObjectData<ViewFinderGL, {anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, StringRefStorage<char [13], char [15], char [1], char [24], char [7]>, UintData<SignalData<void(libcamera::FrameBuffer*)> >, UintData<>, UintData<> >(0, qt_stringData, qt_methods, qt_properties, qt_enums, QtMocHelpers::UintData<>(), const QtMocHelpers::detail::UintDataBlock<0, 0>{uint [1](), uint [1]()})’\n> /usr/include/qt6/QtCore/qtmochelpers.h:563:36:   in ‘constexpr’ expansion of ‘(& methods)->QtMocHelpers::UintData<QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(result, ((size_t)dataoffset), metatypeoffset)’\n> /usr/include/qt6/QtCore/qtmochelpers.h:201:57: error: declaration of ‘entry’ shadows a member of ‘QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, 0>, QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >’ [-Werror=shadow]\n>   201 |         [[maybe_unused]] auto invoke = [&f](const auto &entry) { f(entry.entry); return 0; };\n>       |                                             ~~~~~~~~~~~~^~~~~\n> /usr/include/qt6/QtCore/qtmochelpers.h:180:7: note: shadowed declaration is here\n>   180 |     T entry;\n>       |       ^~~~~\n> \n> There is little we can do but silence the warning. Do so selectively\n> based on the Qt and gcc versions, to still detect variable shadowing\n> with compilers unaffected by the issue.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/apps/qcam/meson.build | 7 +++++++\n>  1 file changed, 7 insertions(+)\n> \n> diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build\n> index f7c140643373..9ca047b0f927 100644\n> --- a/src/apps/qcam/meson.build\n> +++ b/src/apps/qcam/meson.build\n> @@ -42,6 +42,13 @@ qt6_cpp_args = [\n>      '-Wno-extra-semi',\n>  ]\n>  \n> +# gcc 12 and 13 output a false positive variable shadowing warning with Qt\n> +# 6.9.0 and newer. Silence it.\n> +if qt6_dep.version().version_compare('>=6.9.0') and \\\n> +   cxx.version().version_compare('>=12') and cxx.version().version_compare('<14')\n> +    qt6_cpp_args += ['-Wno-shadow']\n> +endif\n> +\n>  resources = qt6.preprocess(moc_headers : qcam_moc_headers,\n>                             qresources : qcam_resources,\n>                             dependencies : qt6_dep)\n> \n> base-commit: b65df7e7554b45e2d3d7fdb5b37c2ab7df3db4fe\n> -- \n> Regards,\n> \n> Laurent Pinchart\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 BFA52BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Jul 2025 07:03:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 64EAE69094;\n\tThu, 24 Jul 2025 09:03:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 700F361508\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Jul 2025 09:03:42 +0200 (CEST)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:be7f:7fca:78b4:1343])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 29E0DC74;\n\tThu, 24 Jul 2025 09:03:02 +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=\"HI0Cm/gN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1753340583;\n\tbh=HwxNE927JsolKEhdRN9ApDDfFKZV7/coCBCQ3u5/eKE=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=HI0Cm/gNrEA6ggpUeRO2yFQxprBBTbBiKK1Ra1AVJQpWuksS+3fNC6AS7RKBJ5F//\n\tel4HJFJbNLoRVHMkVizs2ujxrj1FQrSjyi4r5hH7QVZtbw/HjgEel1w5VHVr+VsgKm\n\taVRV0AMOXtHVimfn9e/E7yBtNAoezFKDdbZIhh6Y=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250723223914.23733-1-laurent.pinchart@ideasonboard.com>","References":"<20250723223914.23733-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH] qcam: Silence false positive warnings with Qt 6.9.0 and\n\tnewer","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 24 Jul 2025 16:03:36 +0900","Message-ID":"<175334061614.774292.13794711917263210187@neptunite.rasen.tech>","User-Agent":"alot/0.0.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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]