diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-05-22 13:50:11 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-06-07 17:35:30 +0200 |
commit | 21e0122310dedf3b33144cc77f880ec51446186b (patch) | |
tree | 8030f2f98fb316dfa38647386b52f11776d86620 /sw | |
parent | 13bbabd0a7d52b8a823f9fce704c32818b44ceb3 (diff) |
sw: SwNodeIndex GCC12 spurious -Werror=dangling-pointer=
It doesn't understand that ~SwNodeIndex() will remove the pointer,
which is obfuscated by over-boostified code.
In member function ‘void SwNodeIndex::RegisterIndex(SwNodes&)’,
inlined from ‘SwNodeIndex::SwNodeIndex(SwNodes&, SwNodeOffset)’ at sw/inc/ndindex.hxx:54:22,
inlined from ‘bool SwNodes::InsBoxen(SwTableNode*, SwTableLine*, SwTableBoxFormat*, SwTextFormatColl*, const SfxItemSet*, sal_uInt16, sal_uInt16)’ at sw/source/core/docnode/ndtbl.cxx:301:41:
sw/inc/ndindex.hxx:37:31: error: storing the address of local variable ‘aEndIdx’ in ‘*this.SwNodes::m_vIndices’ [-Werror=dangling-pointer=]
37 | rNodes.m_vIndices = this;
| ~~~~~~~~~~~~~~~~~~^~~~~~
sw/source/core/docnode/ndtbl.cxx: In member function ‘bool SwNodes::InsBoxen(SwTableNode*, SwTableLine*, SwTableBoxFormat*, SwTextFormatColl*, const SfxItemSet*, sal_uInt16, sal_uInt16)’:
sw/source/core/docnode/ndtbl.cxx:301:17: note: ‘aEndIdx’ declared here
301 | SwNodeIndex aEndIdx( *this, nIdxPos );
| ^~~~~~~
sw/source/core/docnode/ndtbl.cxx:301:17: note: ‘<unknown>’ declared here
Change-Id: I3f24cd8e3e0b1fd0a0943150d3d83d09f2c984fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134741
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 486991b8ec2b63324c8cf5a26e9091942c24b3d9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134774
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ndindex.hxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx index 7d03b0bcadaf..64201ac3e1b3 100644 --- a/sw/inc/ndindex.hxx +++ b/sw/inc/ndindex.hxx @@ -36,7 +36,16 @@ class SW_DLLPUBLIC SwNodeIndex final : public sw::Ring<SwNodeIndex> void RegisterIndex( SwNodes& rNodes ) { if(!rNodes.m_vIndices) + { +#if defined(__GNUC__) && __GNUC__ == 12 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-pointer" +#endif rNodes.m_vIndices = this; +#if defined(__GNUC__) && __GNUC__ == 12 +#pragma GCC diagnostic pop +#endif + } MoveTo(rNodes.m_vIndices); } void DeRegisterIndex( SwNodes& rNodes ) |