sw/inc/calbck.hxx | 7 +++++++
1 file changed, 7 insertions(+)
New commits:
commit b48371ba614d300ab5906bbc723c87095cfcd8f2
Author: Stephan Bergmann <[email protected]>
AuthorDate: Wed Mar 8 23:06:30 2023 +0100
Commit: Stephan Bergmann <[email protected]>
CommitDate: Thu Mar 9 10:11:19 2023 +0000
Silence false -Werror=dangling-pointer=
...that hit at least with GCC 13 trunk and --enable-optimized,
> In file included from sw/inc/tox.hxx:35,
> from sw/inc/doc.hxx:35,
> from sw/source/core/inc/AccessibilityCheck.hxx:14,
> from sw/source/core/access/AccessibilityCheck.cxx:11:
> In constructor ‘sw::ClientIteratorBase::ClientIteratorBase(const
SwModify&)’,
> inlined from ‘SwIterator<E, S, <anonymous> >::SwIterator(const
TSource&) [with TElementType = SwTextFrame; TSource = SwTextNode;
sw::IteratorMode eMode = sw::IteratorMode::UnwrapMulti]’ at
sw/inc/calbck.hxx:364:68,
> inlined from ‘virtual void
sw::{anonymous}::FakeCaptionCheck::check(SwNode*)’ at
sw/source/core/access/AccessibilityCheck.cxx:937:99:
> sw/inc/calbck.hxx:295:32: error: storing the address of local variable
‘aIter’ in ‘sw::ClientIteratorBase::s_pClientIters’ [-Werror=dangling-pointer=]
> 295 | s_pClientIters = this;
> | ~~~~~~~~~~~~~~~^~~~~~
> sw/source/core/access/AccessibilityCheck.cxx: In member function ‘virtual
void sw::{anonymous}::FakeCaptionCheck::check(SwNode*)’:
> sw/source/core/access/AccessibilityCheck.cxx:937:14: note: ‘aIter’
declared here
> 937 | auto aIter = SwIterator<SwTextFrame, SwTextNode,
sw::IteratorMode::UnwrapMulti>(*pTextNode);
> | ^~~~~
> sw/inc/calbck.hxx:289:53: note: ‘sw::ClientIteratorBase::s_pClientIters’
declared here
> 289 | static SW_DLLPUBLIC ClientIteratorBase*
s_pClientIters;
> | ^~~~~~~~~~~~~~
(And -Wdangling-pointer is unknown to older GCC versions, so would cause
-Werror=pragmas there.)
Change-Id: I64e53b52e04ab34da42c7adc54b8d8cb46123dfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148515
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index abe556ef6757..523557f7dc68 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -292,7 +292,14 @@ namespace sw
: m_rRoot(rModify)
{
MoveTo(s_pClientIters);
+#if defined __GNUC__ && __GNUC__ >= 12 && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
s_pClientIters = this;
+#if defined __GNUC__ && __GNUC__ >= 12 && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
m_pCurrent = m_pPosition = m_rRoot.m_pWriterListeners;
}
WriterListener* GetLeftOfPos() { return m_pPosition->m_pLeft; }