include/tools/stream.hxx       |    2 +-
 tools/source/stream/stream.cxx |    2 ++
 unoxml/source/dom/document.cxx |    7 +++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit e95ffe9a7359cca85ce3ff065baa75c8431004f9
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 14:20:21 2026 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Mon Mar 9 09:52:35 2026 +0100

    Silence spurious -Werror=maybe-uninitialized
    
    seen at least with recent GCC 16 trunk,
    
    > In file included from unoxml/source/dom/document.hxx:29,
    >                  from unoxml/source/dom/document.cxx:22:
    > In constructor ‘cppu::ImplInheritanceHelper<BaseClass, 
Ifc>::ImplInheritanceHelper(Arg&& ...) [with Arg = {DOM::CDocument&, 
osl::Mutex&, const com::sun::star::xml::dom::NodeType&, _xmlNode*}; BaseClass = 
DOM::CNode; Ifc = {com::sun::star::xml::dom::XDocument, 
com::sun::star::xml::dom::events::XDocumentEvent, 
com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSource, 
com::sun::star::xml::sax::XSAXSerializable, 
com::sun::star::xml::sax::XFastSAXSerializable}]’,
    >     inlined from ‘DOM::CDocument::CDocument(xmlDocPtr)’ at 
unoxml/source/dom/document.cxx:92:58:
    > include/cppuhelper/implbase.hxx:152:44: error: ‘<unknown>’ may be used 
uninitialized [-Werror=maybe-uninitialized]
    >   152 |         BaseClass(std::forward<Arg>(arg)...)
    >       |                                            ^
    > In file included from unoxml/source/dom/document.hxx:50:
    > unoxml/inc/node.hxx: In constructor 
‘DOM::CDocument::CDocument(xmlDocPtr)’:
    > unoxml/inc/node.hxx:110:9: note: by argument 2 of type ‘const 
DOM::CDocument&’ to ‘DOM::CNode::CNode(const DOM::CDocument&, const 
osl::Mutex&, const com::sun::star::xml::dom::NodeType&, xmlNode* const&)’ 
declared here
    >   110 |         CNode(CDocument const& rDocument, ::osl::Mutex const& 
rMutex,
    >       |         ^~~~~
    > In constructor ‘cppu::ImplInheritanceHelper<BaseClass, 
Ifc>::ImplInheritanceHelper(Arg&& ...) [with Arg = {DOM::CDocument&, 
osl::Mutex&, const com::sun::star::xml::dom::NodeType&, _xmlNode*}; BaseClass = 
DOM::CNode; Ifc = {com::sun::star::xml::dom::XDocument, 
com::sun::star::xml::dom::events::XDocumentEvent, 
com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSource, 
com::sun::star::xml::sax::XSAXSerializable, 
com::sun::star::xml::sax::XFastSAXSerializable}]’,
    >     inlined from ‘DOM::CDocument::CDocument(xmlDocPtr)’ at 
unoxml/source/dom/document.cxx:92:58:
    > include/cppuhelper/implbase.hxx:152:44: error: ‘<unknown>’ may be used 
uninitialized [-Werror=maybe-uninitialized]
    >   152 |         BaseClass(std::forward<Arg>(arg)...)
    >       |                                            ^
    > unoxml/inc/node.hxx: In constructor 
‘DOM::CDocument::CDocument(xmlDocPtr)’:
    > unoxml/inc/node.hxx:110:9: note: by argument 3 of type ‘const 
osl::Mutex&’ to ‘DOM::CNode::CNode(const DOM::CDocument&, const osl::Mutex&, 
const com::sun::star::xml::dom::NodeType&, xmlNode* const&)’ declared here
    >   110 |         CNode(CDocument const& rDocument, ::osl::Mutex const& 
rMutex,
    >       |         ^~~~~
    
    Change-Id: I9b422727d47b148faf9e7a62ce8220116e32479c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197843
    Reviewed-by: Stephan Bergmann <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit aa228e60a52bed433d52e29adea2b15aa04de12c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200979
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index ab57e51b869a..f7058a3fa3d6 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -85,6 +85,10 @@ namespace DOM
         return cur;
     }
 
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
     CDocument::CDocument(xmlDocPtr const pDoc)
         : CDocument_Base(*this, m_Mutex,
                 NodeType_DOCUMENT_NODE, reinterpret_cast<xmlNodePtr>(pDoc))
@@ -92,6 +96,9 @@ namespace DOM
         , m_pEventDispatcher(new events::CEventDispatcher)
     {
     }
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic pop
+#endif
 
     ::rtl::Reference<CDocument> CDocument::CreateCDocument(xmlDocPtr const 
pDoc)
     {
commit 910f23c3d90961d00131a9f6cad6eebdf7e2d2f3
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 14:09:56 2026 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Mon Mar 9 09:52:20 2026 +0100

    Make a virtual function non-inline
    
    ...which helps avoid some supposedly spurious -Werror=free-nonheap-object 
seen
    at least with recent GCC 16 trunk,
    
    > In destructor ‘virtual SvLockBytes::~SvLockBytes()’,
    >     inlined from ‘void SvRefBase::ReleaseRef()’ at 
include/tools/ref.hxx:160:36,
    >     inlined from ‘tools::SvRef<T>::~SvRef() [with T = 
writerfilter::rtftok::RTFTokenizer]’ at include/tools/ref.hxx:56:46,
    >     inlined from ‘writerfilter::rtftok::RTFLookahead::~RTFLookahead()’ at 
sw/source/writerfilter/rtftok/rtflookahead.cxx:37:1:
    > include/tools/stream.hxx:115:48: error: ‘void operator delete(void*, 
std::size_t)’ called on pointer 
‘((tools::SvRef<writerfilter::rtftok::RTFTokenizer>*)this)[1].tools::SvRef<writerfilter::rtftok::RTFTokenizer>::pObj’
 with nonzero offset 56 [-Werror=free-nonheap-object]
    >   115 |     virtual ~SvLockBytes() override { close(); }
    >       |                                                ^
    
    etc.
    
    Change-Id: I26a599f0e3258e6bf6a4d6e63e559b41029862db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197842
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>
    (cherry picked from commit e3ea377f2daa2756a412dd974eb39fd9f5db1366)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200978
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 38c072fe038a..43c2b028d36c 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -112,7 +112,7 @@ public:
 
     SvLockBytes() : m_bSync(false) {}
 
-    virtual ~SvLockBytes() override { close(); }
+    virtual ~SvLockBytes() override;
 
     void            SetSynchronMode(bool bTheSync = true) { m_bSync = 
bTheSync; }
     bool            IsSynchronMode() const { return m_bSync; }
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 16e5e0fbb703..2cb511e9896d 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -155,6 +155,8 @@ void SvStream::writeNumberWithoutSwap_(const void * 
pDataSrc, int nDataSize)
 }
 
 
+SvLockBytes::~SvLockBytes() { close(); }
+
 void SvLockBytes::close()
 {
     (void)this;

Reply via email to