From 682d0cead56448f6b0332a1271611efa2266c079 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 14 Mar 2023 22:33:32 +0100 Subject: Silence some false -Werror=dangling-reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...seen at least with gcc-c++-13.0.1-0.7.fc38.x86_64, > connectivity/source/manager/mdrivermanager.cxx: In lambda function: > connectivity/source/manager/mdrivermanager.cxx:621:41: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 621 | const DriverAccess& ensuredAccess = EnsureDriver(m_xContext)(driverAccess); > | ^~~~~~~~~~~~~ > connectivity/source/manager/mdrivermanager.cxx:621:81: note: the temporary was destroyed at the end of the full expression ‘drivermanager::{anonymous}::EnsureDriver(this->drivermanager::OSDBCDriverManager::m_xContext).drivermanager::{anonymous}::EnsureDriver::operator()((* & driverAccess))’ > 621 | const DriverAccess& ensuredAccess = EnsureDriver(m_xContext)(driverAccess); > | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ and > vcl/source/window/layout.cxx: In function ‘array_type assembleGrid(const VclGrid&)’: > vcl/source/window/layout.cxx:952:30: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 952 | const GridEntry &rEntry = A[x][y]; > | ^~~~~~ > vcl/source/window/layout.cxx:952:45: note: the temporary was destroyed at the end of the full expression ‘boost::multi_array_ref::operator[](index) [with T = {anonymous}::GridEntry; long unsigned int NumDims = 2; reference = boost::detail::multi_array::sub_array<{anonymous}::GridEntry, 1>; index = long int](((boost::multi_array_ref<{anonymous}::GridEntry, 2>::index)x)).boost::detail::multi_array::sub_array<{anonymous}::GridEntry, 1>::operator[](((boost::detail::multi_array::sub_array<{anonymous}::GridEntry, 1>::index)y))’ > 952 | const GridEntry &rEntry = A[x][y]; > | ^ > vcl/source/window/layout.cxx: In function ‘void calcMaxs(const array_type&, std::__debug::vector&, std::__debug::vector&)’: > vcl/source/window/layout.cxx:1075:30: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 1075 | const GridEntry &rEntry = A[x][y]; > | ^~~~~~ > vcl/source/window/layout.cxx:1075:45: note: the temporary was destroyed at the end of the full expression ‘boost::multi_array_ref::operator[](index) const [with T = {anonymous}::GridEntry; long unsigned int NumDims = 2; const_reference = boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>; index = long int](((boost::multi_array_ref<{anonymous}::GridEntry, 2>::index)x)).boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::operator[](((boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::index)y))’ > 1075 | const GridEntry &rEntry = A[x][y]; > | ^ > vcl/source/window/layout.cxx:1106:30: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 1106 | const GridEntry &rEntry = A[x][y]; > | ^~~~~~ > vcl/source/window/layout.cxx:1106:45: note: the temporary was destroyed at the end of the full expression ‘boost::multi_array_ref::operator[](index) const [with T = {anonymous}::GridEntry; long unsigned int NumDims = 2; const_reference = boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>; index = long int](((boost::multi_array_ref<{anonymous}::GridEntry, 2>::index)x)).boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::operator[](((boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::index)y))’ > 1106 | const GridEntry &rEntry = A[x][y]; > | ^ Change-Id: I498bb468ade52f83117c8cf57f8d64697978d9ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148921 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit 5377a98c2cb78b0768d469ff379f9add9aaa7b68) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151765 Reviewed-by: Michael Stahl --- vcl/source/window/layout.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'vcl') diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 1cdad21f6c66..46f816b29edd 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -949,7 +949,14 @@ array_type assembleGrid(const VclGrid &rGrid) { for (sal_Int32 y = 0; y < nMaxY; ++y) { +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif const GridEntry &rEntry = A[x][y]; +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic pop +#endif const vcl::Window *pChild = rEntry.pChild; if (pChild && pChild->IsVisible()) { @@ -1072,7 +1079,14 @@ static void calcMaxs(const array_type &A, std::vector &rWidths, { for (sal_Int32 y = 0; y < nMaxY; ++y) { +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif const GridEntry &rEntry = A[x][y]; +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic pop +#endif const vcl::Window *pChild = rEntry.pChild; if (!pChild || !pChild->IsVisible()) continue; @@ -1103,7 +1117,14 @@ static void calcMaxs(const array_type &A, std::vector &rWidths, { for (sal_Int32 y = 0; y < nMaxY; ++y) { +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif const GridEntry &rEntry = A[x][y]; +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic pop +#endif const vcl::Window *pChild = rEntry.pChild; if (!pChild || !pChild->IsVisible()) continue; @@ -1348,7 +1369,14 @@ void VclGrid::setAllocation(const Size& rAllocation) { for (sal_Int32 y = 0; y < nMaxY; ++y) { +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif GridEntry &rEntry = A[x][y]; +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic pop +#endif vcl::Window *pChild = rEntry.pChild; if (pChild) { -- cgit