summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-03-14 22:33:32 +0100
committerAndras Timar <andras.timar@collabora.com>2023-05-21 13:28:39 +0200
commit682d0cead56448f6b0332a1271611efa2266c079 (patch)
treebfd8df2748b60a2bf2c975773232d4677b26cfb5 /vcl
parentc6cd03cadd3c92c6277c01ebe6a84b3df19908fb (diff)
Silence some false -Werror=dangling-reference
...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<T, NumDims>::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<VclGrid::Value>&, std::__debug::vector<VclGrid::Value>&)’: > 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<T, NumDims>::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<T, NumDims>::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 <sbergman@redhat.com> (cherry picked from commit 5377a98c2cb78b0768d469ff379f9add9aaa7b68) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151765 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/layout.cxx28
1 files changed, 28 insertions, 0 deletions
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<VclGrid::Value> &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<VclGrid::Value> &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)
{