]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libxml: Silence several gcc warnings.
authorBruno Haible <bruno@clisp.org>
Fri, 26 May 2023 15:07:04 +0000 (17:07 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 26 May 2023 22:26:13 +0000 (00:26 +0200)
* gnulib-local/lib/libxml/SAX2.c (xmlNsErrMsg): Mark as possibly unused.
(xmlSAX2AttributeDecl, xmlSAX2ElementDecl, xmlSAX2NotationDecl): Mark a local
variable as possibly unused.
* gnulib-local/lib/libxml/encoding.c (xmlCharEncCloseFunc): Likewise.
* gnulib-local/lib/libxml/trionan.c (compute_minus_zerod, minus_zerod): Mark as
possibly unused.
* gnulib-local/lib/libxml/tree.c (xmlDOMWrapCloneNode): Use a differently typed
variable cloneAttr.

gnulib-local/lib/libxml/SAX2.c
gnulib-local/lib/libxml/encoding.c
gnulib-local/lib/libxml/tree.c
gnulib-local/lib/libxml/trionan.c

index e52467ec7ed7246a60a0b8e1bb16099880ff11d8..c9f241b89711673532dad973175b693fc5857060 100644 (file)
@@ -1,5 +1,5 @@
 /* libxml2 - Library for parsing XML documents
- * Copyright (C) 2006-2019 Free Software Foundation, Inc.
+ * Copyright (C) 2006-2023 Free Software Foundation, Inc.
  *
  * This file is not part of the GNU gettext program, but is used with
  * GNU gettext.
@@ -218,6 +218,7 @@ xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
  *
  * Handle a namespace error
  */
+_GL_ATTRIBUTE_MAYBE_UNUSED
 static void LIBXML_ATTR_FORMAT(3,0)
 xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
             const char *msg, const xmlChar *str1, const xmlChar *str2)
@@ -764,7 +765,7 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
              xmlEnumerationPtr tree)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-    xmlAttributePtr attr;
+    _GL_ATTRIBUTE_MAYBE_UNUSED xmlAttributePtr attr;
     xmlChar *name = NULL, *prefix = NULL;
 
     if ((ctxt == NULL) || (ctxt->myDoc == NULL))
@@ -831,7 +832,7 @@ xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
             xmlElementContentPtr content)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-    xmlElementPtr elem = NULL;
+    _GL_ATTRIBUTE_MAYBE_UNUSED xmlElementPtr elem = NULL;
 
     if ((ctxt == NULL) || (ctxt->myDoc == NULL))
         return;
@@ -877,7 +878,7 @@ xmlSAX2NotationDecl(void *ctx, const xmlChar *name,
             const xmlChar *publicId, const xmlChar *systemId)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-    xmlNotationPtr nota = NULL;
+    _GL_ATTRIBUTE_MAYBE_UNUSED xmlNotationPtr nota = NULL;
 
     if ((ctxt == NULL) || (ctxt->myDoc == NULL))
         return;
index af31ae444147d6d76d822cedea3841aaef12727f..d7f2310b5ecc2a59dbdbd532261199cdcb6d9145 100644 (file)
@@ -1,5 +1,5 @@
 /* libxml2 - Library for parsing XML documents
- * Copyright (C) 2006-2019 Free Software Foundation, Inc.
+ * Copyright (C) 2006-2023 Free Software Foundation, Inc.
  *
  * This file is not part of the GNU gettext program, but is used with
  * GNU gettext.
@@ -2749,7 +2749,8 @@ int
 xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
     int ret = 0;
     int tofree = 0;
-    int i, handler_in_list = 0;
+    int i;
+    _GL_ATTRIBUTE_MAYBE_UNUSED int handler_in_list = 0;
 
     if (handler == NULL) return(-1);
     if (handler->name == NULL) return(-1);
index 56527623f7474e254c95bac9c2ccc21caf8ada3d..0c3f792b0b8717026386999f0bc8d4628eb6bf61 100644 (file)
@@ -1,5 +1,5 @@
 /* libxml2 - Library for parsing XML documents
- * Copyright (C) 2006-2019 Free Software Foundation, Inc.
+ * Copyright (C) 2006-2023 Free Software Foundation, Inc.
  *
  * This file is not part of the GNU gettext program, but is used with
  * GNU gettext.
@@ -9514,25 +9514,25 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
                /*
                * Attributes (xmlAttr).
                */
-               clone = (xmlNodePtr) xmlMalloc(sizeof(xmlAttr));
-               if (clone == NULL) {
+               xmlAttrPtr cloneAttr = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr));
+               if (cloneAttr == NULL) {
                    xmlTreeErrMemory("xmlDOMWrapCloneNode(): allocating an attr-node");
                    goto internal_error;
                }
-               memset(clone, 0, sizeof(xmlAttr));
+               memset(cloneAttr, 0, sizeof(xmlAttr));
                /*
                * Set hierachical links.
                * TODO: Change this to add to the end of attributes.
                */
                if (resultClone != NULL) {
-                   clone->parent = parentClone;
+                   cloneAttr->parent = parentClone;
                    if (prevClone) {
-                       prevClone->next = clone;
-                       clone->prev = prevClone;
+                       prevClone->next = (xmlNodePtr) cloneAttr;
+                       cloneAttr->prev = (xmlAttrPtr) prevClone;
                    } else
-                       parentClone->properties = (xmlAttrPtr) clone;
+                       parentClone->properties = (xmlAttrPtr) cloneAttr;
                } else
-                   resultClone = clone;
+                   resultClone = (xmlNodePtr) cloneAttr;
                break;
            default:
                /*
index dcd277049530da1ad826d2a67e7487f27e0054f4..55182ffe77118a6155adb7ebfecf96a918fd1284 100644 (file)
@@ -1,5 +1,5 @@
 /* NaNs and Infinity in floating-point numbers.
-   Copyright (C) 2015-2019 Free Software Foundation, Inc.
+   Copyright (C) 2015-2023 Free Software Foundation, Inc.
 
    This file was written by Daiki Ueno <ueno@gnu.org>, 2015.
 
@@ -64,6 +64,7 @@ NaNd ()
    The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
    to PowerPC on Mac OS X 10.5.  */
 #if defined __hpux || defined __sgi || defined __ICC
+_GL_ATTRIBUTE_MAYBE_UNUSED
 static double
 compute_minus_zerod (void)
 {
@@ -71,6 +72,7 @@ compute_minus_zerod (void)
 }
 # define minus_zerod compute_minus_zerod ()
 #else
+_GL_ATTRIBUTE_MAYBE_UNUSED
 static double minus_zerod = -0.0;
 #endif