diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-03-08 23:06:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-03-09 10:11:19 +0000 |
commit | b48371ba614d300ab5906bbc723c87095cfcd8f2 (patch) | |
tree | 7b62e7ef04e48434e84431f33308f84556f16de4 /sw/inc/calbck.hxx | |
parent | 4322248194c2b019c20f593ad9971a1014a7e7bc (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'sw/inc/calbck.hxx')
-rw-r--r-- | sw/inc/calbck.hxx | 7 |
1 files changed, 7 insertions, 0 deletions
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; } |