connectivity/source/manager/mdrivermanager.cxx | 7 +++ editeng/source/accessibility/AccessibleEditableTextPara.cxx | 3 - sc/source/ui/drawfunc/drtxtob.cxx | 3 - sc/source/ui/view/editsh.cxx | 3 - sd/qa/unit/tiledrendering/tiledrendering.cxx | 8 +-- sfx2/source/view/viewfrm.cxx | 3 - slideshow/source/engine/eventqueue.cxx | 4 - starmath/source/unomodel.cxx | 27 +---------- vcl/source/window/layout.cxx | 28 ++++++++++++ 9 files changed, 49 insertions(+), 37 deletions(-)
New commits: commit 230e3fc3bd9197f93b11136e27949e8a7bb6f51d Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Nov 3 17:11:01 2022 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Sep 25 14:07:23 2023 +0200 Reinstate removal of lcl_GuessPaperSize ...originally done with 1d7964c5ff579ff93067dc1c3e45b522e3cb2b4e "CWS-TOOLING: integrate CWS unifypaper01" on 2009-06-12. However, the removed lcl_GuessPaperSize then reappeared, apparently with the merge commit 4563270cfd37f1a08e0315a5624affa3a7680771 "CWS-TOOLING: integrate CWS printerpullpages" on 2010-01-15, presumably due to a mis-merge somewhere along the way. SmModel::getRenderer and SmModel::render are e.g. called when doing "Export as PDF..." of a Math Formula, but it seems a bit hard to get into the "no real printer" branches there that would actually have called lcl_GuessPaperSize. But anyway, it looks reasonable to replace that function with the more elaborate SvxPaperInfo::GetDefaultPaperSize. (I stumbled over this when the code in lcl_GuessPaperSize caused a newly introduced -Werror=dangling-reference with GCC 13 trunk, similar to e0121b2478526d803681d57d59af0cbf9cf602b4 "-Werror=dangling-reference". So I figured I'd remove that code as apparently intended back in 2009 rather than try to fix it now.) Change-Id: Ia73d9ece8429bbeccd4f65a9efc156c0dee52c01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142246 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 20926c0a7559ea9c4f82c662f11a395fa1eb79a3) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 42f377f27ce9..0f15abf2e24c 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -40,6 +40,7 @@ #include <comphelper/servicehelper.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/supportsservice.hxx> +#include <editeng/paperinf.hxx> #include <unotools/moduleoptions.hxx> #include <tools/mapunit.hxx> #include <tools/stream.hxx> @@ -898,28 +899,6 @@ sal_Int32 SAL_CALL SmModel::getRendererCount( return 1; } - -static Size lcl_GuessPaperSize() -{ - Size aRes; - const LocaleDataWrapper& rLocWrp( AllSettings().GetLocaleDataWrapper() ); - if( MeasurementSystem::Metric == rLocWrp.getMeasurementSystemEnum() ) - { - // in 100th mm - PaperInfo aInfo( PAPER_A4 ); - aRes.setWidth( aInfo.getWidth() ); - aRes.setHeight( aInfo.getHeight() ); - } - else - { - // in 100th mm - PaperInfo aInfo( PAPER_LETTER ); - aRes.setWidth( aInfo.getWidth() ); - aRes.setHeight( aInfo.getHeight() ); - } - return aRes; -} - uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( sal_Int32 nRenderer, const uno::Any& /*rSelection*/, @@ -941,7 +920,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( // if paper size is 0 (usually if no 'real' printer is found), // guess the paper size if (aPrtPaperSize.IsEmpty()) - aPrtPaperSize = lcl_GuessPaperSize(); + aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MapUnit::Map100thMM); awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() ); uno::Sequence< beans::PropertyValue > aRenderer(1); @@ -1015,7 +994,7 @@ void SAL_CALL SmModel::render( // no real printer ?? if (aPrtPaperSize.IsEmpty()) { - aPrtPaperSize = lcl_GuessPaperSize(); + aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MapUnit::Map100thMM); // factors from Windows DIN A4 aOutputSize = Size( static_cast<tools::Long>(aPrtPaperSize.Width() * 0.941), static_cast<tools::Long>(aPrtPaperSize.Height() * 0.961)); commit 24f31d62b15d162632198cbe9e689d871f11194b Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Aug 23 15:37:06 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Sep 25 13:55:47 2023 +0200 -Werror=redundant-move ...with recent GCC 16 trunk. Introduced with 1a2926a995fdbdcdae0ca6407877084f3520e539 "use std::move when popping stuff off stacks" but which doesn't make sense here where std::priority_queue's top() unconditionally returns a const reference (unlike std::stack's top()). Change-Id: I408920220e3b7ffe775fa87f9edbfdc7721058db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138732 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 4c27aaa787a67e05a592adcf6cf42e49b7a02eaf) diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index b63db471d5ef..e434b75d8993 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -171,7 +171,7 @@ namespace slideshow::internal && !bFireAllEvents && (maEvents.empty() || maEvents.top().nTime > nCurrTime)) { - const EventEntry aEvent (std::move(maNextNextEvents.top())); + const EventEntry aEvent (maNextNextEvents.top()); maNextNextEvents.pop(); maEvents.push(aEvent); } @@ -183,7 +183,7 @@ namespace slideshow::internal while( !maEvents.empty() && (bFireAllEvents || maEvents.top().nTime <= nCurrTime) ) { - EventEntry event( std::move(maEvents.top()) ); + EventEntry event( maEvents.top() ); maEvents.pop(); // only process event, if it is still 'charged', commit 89694bccbebca282589e91e59740706f6da2e14b Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Sep 25 13:17:02 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Sep 25 13:17:02 2023 +0200 sfx2: -Werror=unused-function Change-Id: Id31e58cae1267c35efaf49fb2f0d79e1be6177e4 diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 86dbcf954ef8..a64bb1b22c79 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -49,9 +49,6 @@ #include <vcl/stdtext.hxx> #include <vcl/weld.hxx> #include <vcl/weldutils.hxx> -#if !ENABLE_WASM_STRIP_PINGUSER -#include <unotools/VersionConfig.hxx> -#endif #include <svtools/miscopt.hxx> #include <tools/diagnose_ex.h> #include <com/sun/star/container/XIndexAccess.hpp> commit 6231cbaf9dfc558cf7238b976970c86955e27f35 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Nov 3 09:14:18 2022 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Sep 25 13:11:53 2023 +0200 -Werror=dangling-reference In <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2249cd9adf5ae638577139177a50f7e62d8abd9> "c++: Implement -Wdangling-reference [PR106393]" grew a new warning, included in -Wall, and based on some more-or-less shaky heuristics, that warns about "possibly dangling reference to a temporary". It produces quite a number of false positives, but for these uses of SfxItemSet::Get it does look plausible that the returned item references could, at least in theory, point at data that is destroyed along with the temporary SfxItemSet. Change-Id: I11afc4512db488f73170c6cfa706e9e094209550 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142217 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit e0121b2478526d803681d57d59af0cbf9cf602b4) diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index c6c6520cc545..7d0d00cd55c4 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1517,8 +1517,7 @@ namespace accessibility // NumberingLevel if (rRes.Name == "NumberingLevel") { - const SvxNumBulletItem& rNumBullet = rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET); - if(rNumBullet.GetNumRule().GetLevelCount()==0) + if(rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET).GetNumRule().GetLevelCount()==0) { rRes.Value <<= sal_Int16(-1); rRes.Handle = -1; diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 12968c9d27d1..37a493178e39 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -205,7 +205,8 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) case SID_CHARMAP: { - const SvxFontItem& rItem = pOutView->GetAttribs().Get(EE_CHAR_FONTINFO); + auto const attribs = pOutView->GetAttribs(); + const SvxFontItem& rItem = attribs.Get(EE_CHAR_FONTINFO); OUString aString; std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO)); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 796000efe88d..2b36efa11ec8 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -383,8 +383,9 @@ void ScEditShell::Execute( SfxRequest& rReq ) sal_uInt16 nFontWhich = ( nScript == SvtScriptType::ASIAN ) ? EE_CHAR_FONTINFO_CJK : ( ( nScript == SvtScriptType::COMPLEX ) ? EE_CHAR_FONTINFO_CTL : EE_CHAR_FONTINFO ); + auto const attribs = pTableView->GetAttribs(); const SvxFontItem& rItem = static_cast<const SvxFontItem&>( - pTableView->GetAttribs().Get(nFontWhich)); + attribs.Get(nFontWhich)); OUString aString; std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO)); diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index e9f3f012bc6c..b9d1f5576c83 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -1499,8 +1499,8 @@ void SdTiledRenderingTest::testTdf102223() EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); rEditView.SetSelection(ESelection(0, 0, 0, 3)); // start para, start char, end para, end char. CPPUNIT_ASSERT_EQUAL(OUString("Red"), rEditView.GetSelected()); - const SvxFontHeightItem& rItem = rEditView.GetAttribs().Get(EE_CHAR_FONTHEIGHT); - CPPUNIT_ASSERT_EQUAL(int(1411), static_cast<int>(rItem.GetHeight())); + CPPUNIT_ASSERT_EQUAL( + int(1411), static_cast<int>(rEditView.GetAttribs().Get(EE_CHAR_FONTHEIGHT).GetHeight())); // cut contents of cell uno::Sequence<beans::PropertyValue> aArgs; @@ -1511,8 +1511,8 @@ void SdTiledRenderingTest::testTdf102223() CPPUNIT_ASSERT(pView->GetTextEditObject()); EditView& rEditView2 = pView->GetTextEditOutlinerView()->GetEditView(); rEditView2.SetSelection(ESelection(0, 0, 0, 1)); // start para, start char, end para, end char. - const SvxFontHeightItem& rItem2 = rEditView2.GetAttribs().Get(EE_CHAR_FONTHEIGHT); - CPPUNIT_ASSERT_EQUAL(int(1411), static_cast<int>(rItem2.GetHeight())); + CPPUNIT_ASSERT_EQUAL( + int(1411), static_cast<int>(rEditView2.GetAttribs().Get(EE_CHAR_FONTHEIGHT).GetHeight())); } void SdTiledRenderingTest::testTdf118354() commit c5d2dc2747dc46c48eb7600d8a2ec510b20114e7 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Mar 14 22:33:32 2023 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Sep 25 13:01:26 2023 +0200 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 <sberg...@redhat.com> (cherry picked from commit 5377a98c2cb78b0768d469ff379f9add9aaa7b68) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151765 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 960b4ada3d765ca8d05d7512863ea6d4e4718a0d) diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index e7e0adf5e4fb..db34f8dc2623 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -617,7 +617,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 946e2cce2732..84e113f00ffa 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -943,7 +943,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()) { @@ -1066,7 +1073,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; @@ -1097,7 +1111,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; @@ -1342,7 +1363,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) {