libxml2: Ignore deprecations for system libxml2 as well for now

commit e3b5e3aebc
    Date:   Wed Apr 23 13:38:50 2025 +0200

        libxml2: upgrade to 2.14.3

        * In https://gitlab.gnome.org/GNOME/libxml2/-/commit/712a31abe458eed75f0e2a442b35af58cf7091ca
        some members used by Libreoffice were marked as deprecated.
        Add deprecated.patch.0 to undeprecate them for now.
        Meanwhile
        https://gitlab.gnome.org/GNOME/libxml2/-/issues/936#note_2461334 has been
        opened to discuss it. The necessary code changes
        will be addressed in a follow-up commit
        [...]

added a patch to ignore deprecated symbols in
the internal libxml2, by undeprecating the symbols for
that version.

Drop that patch again and instead let compilers ignore
the deprecation warnings for now, to also make the --enable-werror
build pass for the (default) system libxml2 used e.g. on
Debian testing (which currently provides 2.14.5+dfsg-0.2).

Build failure seen there otherwise:

    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:162:24: error: 'recovery' is deprecated [-Werror,-Wdeprecated-declarations]
      162 |         m_pParserCtxt->recovery = 1 ;
          |                        ^
    /usr/include/libxml2/libxml/parser.h:377:18: note: 'recovery' has been explicitly marked deprecated here
      377 |     int recovery XML_DEPRECATED_MEMBER;
          |                  ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:209:20: error: 'nodeTab' is deprecated [-Werror,-Wdeprecated-declarations]
      209 |     m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
          |                    ^
    /usr/include/libxml2/libxml/parser.h:284:25: note: 'nodeTab' has been explicitly marked deprecated here
      284 |     xmlNodePtr *nodeTab XML_DEPRECATED_MEMBER;
          |                         ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:209:43: error: 'nodeNr' is deprecated [-Werror,-Wdeprecated-declarations]
      209 |     m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
          |                                           ^
    /usr/include/libxml2/libxml/parser.h:280:16: note: 'nodeNr' has been explicitly marked deprecated here
      280 |     int nodeNr XML_DEPRECATED_MEMBER;
          |                ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:229:62: error: 'inputMax' is deprecated [-Werror,-Wdeprecated-declarations]
      229 |     if( m_pParserCtxt->inputTab != nullptr && m_pParserCtxt->inputMax != 0 )
          |                                                              ^
    /usr/include/libxml2/libxml/parser.h:271:18: note: 'inputMax' has been explicitly marked deprecated here
      271 |     int inputMax XML_DEPRECATED_MEMBER;
          |                  ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    4 errors generated.
    make[1]: *** [/home/michi/development/git/libreoffice/solenv/gbuild/LinkTarget.mk:338: /home/michi/development/git/libreoffice/workdir/CxxObject/xmlsecurity/source/xmlsec/saxhelper.o] Error 1
    make[1]: *** Waiting for unfinished jobs....
    make: *** [Makefile:301: build] Error 2

Change-Id: I1124859c0ef766b73f506dd997d89543ccf6eb12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190668
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn
2025-09-08 15:32:08 +02:00
parent b732868bd6
commit c368f94db2
3 changed files with 6 additions and 35 deletions
-1
View File
@@ -23,7 +23,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
external/libxml2/libxml2-vc10.patch \
external/libxml2/libxml2-XMLCALL-redefine.patch.0 \
external/libxml2/makefile.msvc-entry-point.patch.0 \
external/libxml2/deprecated.patch.0 \
external/libxml2/0001-const-up-allowPCData.patch.1 \
$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
$(if $(gb_Module_CURRENTMODULE_SYMBOLS_ENABLED), \
-34
View File
@@ -1,34 +0,0 @@
--- include/libxml/parser.h 2025-05-13 16:42:31.000000000 +0200
+++ include/libxml/parser.h 2025-06-03 14:00:37.833979131 +0200
@@ -268,7 +268,7 @@
/* Number of current input streams */
int inputNr;
/* Max number of input streams */
- int inputMax XML_DEPRECATED_MEMBER;
+ int inputMax;
/* stack of inputs */
xmlParserInputPtr *inputTab;
@@ -277,11 +277,11 @@
/* Current parsed Node */
xmlNodePtr node;
/* Depth of the parsing stack */
- int nodeNr XML_DEPRECATED_MEMBER;
+ int nodeNr;
/* Max depth of the parsing stack */
int nodeMax XML_DEPRECATED_MEMBER;
/* array of nodes */
- xmlNodePtr *nodeTab XML_DEPRECATED_MEMBER;
+ xmlNodePtr *nodeTab;
/* Whether node info should be kept */
int record_info;
@@ -374,7 +374,7 @@
/* document's own catalog */
void *catalogs XML_DEPRECATED_MEMBER;
/* run in recovery mode */
- int recovery XML_DEPRECATED_MEMBER;
+ int recovery;
/* unused */
int progressive XML_DEPRECATED_MEMBER;
/* dictionary for the parser */
+6
View File
@@ -159,7 +159,9 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
m_pSaxHandler = m_pParserCtxt->sax ;
//Adjust the context
SAL_WNODEPRECATED_DECLARATIONS_PUSH
m_pParserCtxt->recovery = 1 ;
SAL_WNODEPRECATED_DECLARATIONS_POP
}
}
@@ -206,9 +208,11 @@ void SAXHelper::setCurrentNode(const xmlNodePtr pNode)
* stack's top has to been replaced with the same
* node, in order to make compatibility.
*/
SAL_WNODEPRECATED_DECLARATIONS_PUSH
m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
= m_pParserCtxt->node
= pNode;
SAL_WNODEPRECATED_DECLARATIONS_POP
}
@@ -226,7 +230,9 @@ void SAXHelper::startDocument()
*/
xmlParserInputPtr pInput = xmlNewInputStream( m_pParserCtxt ) ;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
if( m_pParserCtxt->inputTab != nullptr && m_pParserCtxt->inputMax != 0 )
SAL_WNODEPRECATED_DECLARATIONS_POP
{
m_pParserCtxt->inputTab[0] = pInput ;
m_pParserCtxt->input = pInput ;