From patchwork Wed Jul 23 22:39:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 23916 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 657CFBDCC1 for ; Wed, 23 Jul 2025 22:39:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 079D069076; Thu, 24 Jul 2025 00:39:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="T4qvrHxK"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D4BB469068 for ; Thu, 24 Jul 2025 00:39:17 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 23F79B0B for ; Thu, 24 Jul 2025 00:38:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1753310319; bh=7+38HEgMp3dG2pU0DcJ3oeCCt8lT2HshM9QSqjZEPBg=; h=From:To:Subject:Date:From; b=T4qvrHxKgp3YZchxEVodMqFKxHfl+yRZv0iiIGNSWwSJo8sEbVVZOBwJpTJWP81X1 Zs2XytpAsB9oQ/mvqFFwmctMPDpJXHNHNR+8moDkd8FmctQhgtLTzJoOgT7AW53fp1 sw9xSCxTGjQdU5TfkQ9l8pqgl52su3S1dhGPNcYY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH] qcam: Silence false positive warnings with Qt 6.9.0 and newer Date: Thu, 24 Jul 2025 01:39:14 +0300 Message-ID: <20250723223914.23733-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.49.1 MIME-Version: 1.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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In Qt 6.9.0 the qtmochelpers.h header introduced a construct that gcc 12 and gcc 13 incorrectly flag as variable shadowing: In file included from src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:12: /usr/include/qt6/QtCore/qtmochelpers.h: In instantiation of ‘constexpr void QtMocHelpers::detail::UintDataStorage, T ...>::forEach(F&&) const [with F = QtMocHelpers::UintData >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(QtMocHelpers::MetaObjectContents<24, 10, 60, 3>&, size_t, uint&) const::; int ...Idx = {0}; T = {QtMocHelpers::SignalData}]’: /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>’ 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>’ src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:63:5: required from here 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>()’ src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:58:87: in ‘constexpr’ expansion of ‘QtMocHelpers::metaObjectData, UintData >, UintData<>, UintData<> >(0, qt_stringData, qt_methods, qt_properties, qt_enums, QtMocHelpers::UintData<>(), const QtMocHelpers::detail::UintDataBlock<0, 0>{uint [1](), uint [1]()})’ /usr/include/qt6/QtCore/qtmochelpers.h:563:36: in ‘constexpr’ expansion of ‘(& methods)->QtMocHelpers::UintData >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(result, ((size_t)dataoffset), metatypeoffset)’ /usr/include/qt6/QtCore/qtmochelpers.h:201:57: error: declaration of ‘entry’ shadows a member of ‘QtMocHelpers::detail::UintDataStorage, QtMocHelpers::SignalData >’ [-Werror=shadow] 201 | [[maybe_unused]] auto invoke = [&f](const auto &entry) { f(entry.entry); return 0; }; | ~~~~~~~~~~~~^~~~~ /usr/include/qt6/QtCore/qtmochelpers.h:180:7: note: shadowed declaration is here 180 | T entry; | ^~~~~ There is little we can do but silence the warning. Do so selectively based on the Qt and gcc versions, to still detect variable shadowing with compilers unaffected by the issue. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Paul Elder --- src/apps/qcam/meson.build | 7 +++++++ 1 file changed, 7 insertions(+) base-commit: b65df7e7554b45e2d3d7fdb5b37c2ab7df3db4fe diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build index f7c140643373..9ca047b0f927 100644 --- a/src/apps/qcam/meson.build +++ b/src/apps/qcam/meson.build @@ -42,6 +42,13 @@ qt6_cpp_args = [ '-Wno-extra-semi', ] +# gcc 12 and 13 output a false positive variable shadowing warning with Qt +# 6.9.0 and newer. Silence it. +if qt6_dep.version().version_compare('>=6.9.0') and \ + cxx.version().version_compare('>=12') and cxx.version().version_compare('<14') + qt6_cpp_args += ['-Wno-shadow'] +endif + resources = qt6.preprocess(moc_headers : qcam_moc_headers, qresources : qcam_resources, dependencies : qt6_dep)