diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-03-14 22:33:32 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-03-15 19:57:23 +0000 |
commit | 5377a98c2cb78b0768d469ff379f9add9aaa7b68 (patch) | |
tree | 0d8aeaefc0b08f835a05d69b7105390567723bc5 | |
parent | 2fd915b7d2d2a9e25600a07587ab01d23bffbc58 (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>
-rw-r--r-- | connectivity/source/manager/mdrivermanager.cxx | 7 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 28 |
2 files changed, 35 insertions, 0 deletions
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index dbc35c2c4072..c4b884cc973b 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -607,7 +607,14 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU m_aDriversBS.end(), // end of search range [&_rURL, this] (const DriverAccessArray::value_type& driverAccess) { // extract the driver from the access, then ask the resulting driver for acceptance +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif const DriverAccess& ensuredAccess = EnsureDriver(m_xContext)(driverAccess); +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#pragma GCC diagnostic pop +#endif const Reference<XDriver> driver = ExtractDriverFromAccess()(ensuredAccess); return AcceptsURL(_rURL, driver); }); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 881d3e6ed465..039cb2690a9d 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) { |