[libxml2] Fix -Wimplicit-fallthrough warnings



commit d2c329a9a4b630de1f32d359fcc983a6cc285649
Author: J. Peter Mugaas <jpmugaas suddenlink net>
Date:   Sat Oct 21 13:49:31 2017 +0200

    Fix -Wimplicit-fallthrough warnings
    
    Add "falls through" comments to quench implicit-fallthrough warnings
    which are enabled by -Wextra under GCC 7.

 catalog.c         |    1 +
 dict.c            |   29 +++++++++++++++++++++++++++++
 nanoftp.c         |    4 ++++
 relaxng.c         |    4 ++--
 tree.c            |    6 +++---
 valid.c           |    1 +
 xmlregexp.c       |    5 +++++
 xmlschemas.c      |    1 +
 xmlschemastypes.c |    2 +-
 xmlwriter.c       |    1 +
 xpath.c           |    2 +-
 11 files changed, 49 insertions(+), 7 deletions(-)
---
diff --git a/catalog.c b/catalog.c
index 6dfdfbb..f6186a1 100644
--- a/catalog.c
+++ b/catalog.c
@@ -2396,6 +2396,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
                case SGML_CATA_ENTITY:
                    if (*cur == '%')
                        type = SGML_CATA_PENTITY;
+                    /* Falls through. */
                case SGML_CATA_PENTITY:
                case SGML_CATA_DOCTYPE:
                case SGML_CATA_LINKTYPE:
diff --git a/dict.c b/dict.c
index 5590217..0ef3718 100644
--- a/dict.c
+++ b/dict.c
@@ -453,14 +453,23 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
     }
     switch (namelen) {
         case 10: value += name[9];
+        /* Falls through. */
         case 9: value += name[8];
+        /* Falls through. */
         case 8: value += name[7];
+        /* Falls through. */
         case 7: value += name[6];
+        /* Falls through. */
         case 6: value += name[5];
+        /* Falls through. */
         case 5: value += name[4];
+        /* Falls through. */
         case 4: value += name[3];
+        /* Falls through. */
         case 3: value += name[2];
+        /* Falls through. */
         case 2: value += name[1];
+        /* Falls through. */
         default: break;
     }
     return(value);
@@ -496,15 +505,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
     }
     switch (plen) {
         case 10: value += prefix[9];
+        /* Falls through. */
         case 9: value += prefix[8];
+        /* Falls through. */
         case 8: value += prefix[7];
+        /* Falls through. */
         case 7: value += prefix[6];
+        /* Falls through. */
         case 6: value += prefix[5];
+        /* Falls through. */
         case 5: value += prefix[4];
+        /* Falls through. */
         case 4: value += prefix[3];
+        /* Falls through. */
         case 3: value += prefix[2];
+        /* Falls through. */
         case 2: value += prefix[1];
+        /* Falls through. */
         case 1: value += prefix[0];
+        /* Falls through. */
         default: break;
     }
     len -= plen;
@@ -514,15 +533,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
     }
     switch (len) {
         case 10: value += name[9];
+        /* Falls through. */
         case 9: value += name[8];
+        /* Falls through. */
         case 8: value += name[7];
+        /* Falls through. */
         case 7: value += name[6];
+        /* Falls through. */
         case 6: value += name[5];
+        /* Falls through. */
         case 5: value += name[4];
+        /* Falls through. */
         case 4: value += name[3];
+        /* Falls through. */
         case 3: value += name[2];
+        /* Falls through. */
         case 2: value += name[1];
+        /* Falls through. */
         case 1: value += name[0];
+        /* Falls through. */
         default: break;
     }
     return(value);
diff --git a/nanoftp.c b/nanoftp.c
index 1624881..4458497 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -1036,6 +1036,7 @@ xmlNanoFTPConnect(void *ctx) {
                case 2:
                    if (proxyPasswd == NULL)
                        break;
+                    /* Falls through. */
                case 3:
                    if (proxyPasswd != NULL)
                        snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
@@ -1105,6 +1106,7 @@ xmlNanoFTPConnect(void *ctx) {
                    ctxt->controlFd = INVALID_SOCKET;
                    return(-1);
                }
+                /* Falls through. */
            case 2:
                /* USER user@host command */
                if (ctxt->user == NULL)
@@ -1158,6 +1160,7 @@ xmlNanoFTPConnect(void *ctx) {
                    ctxt->controlFd = INVALID_SOCKET;
                    return(-1);
                }
+                /* Falls through. */
            case 3:
                /*
                 * If you need support for other Proxy authentication scheme
@@ -1206,6 +1209,7 @@ xmlNanoFTPConnect(void *ctx) {
        case 3:
            __xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT,
                       "FTP server asking for ACCNT on anonymous\n");
+           /* Falls through. */
        case 1:
        case 4:
        case 5:
diff --git a/relaxng.c b/relaxng.c
index be73194..b12e1ae 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -8891,7 +8891,7 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt,
             if (ret != 0) {
                 break;
             }
-            /* no break on purpose */
+            /* Falls through. */
         case XML_RELAXNG_ZEROORMORE:{
                 xmlChar *cur, *temp;
 
@@ -10168,7 +10168,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
             }
             if (ctxt->errNr > errNr)
                 xmlRelaxNGPopErrors(ctxt, errNr);
-            /* no break on purpose */
+            /* Falls through. */
         case XML_RELAXNG_ZEROORMORE:{
                 int progress;
                 xmlRelaxNGStatesPtr states = NULL, res = NULL;
diff --git a/tree.c b/tree.c
index 911aa10..86a8da7 100644
--- a/tree.c
+++ b/tree.c
@@ -8259,7 +8259,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc,
                        ns = ns->next;
                    } while (ns != NULL);
                }
-               /* No break on purpose. */
+                /* Falls through. */
            case XML_ATTRIBUTE_NODE:
                if (node->ns != NULL) {
                    /*
@@ -8850,7 +8850,7 @@ next_ns_decl:
                }
                if (! adoptns)
                    goto ns_end;
-               /* No break on purpose. */
+                /* Falls through. */
            case XML_ATTRIBUTE_NODE:
                /* No ns, no fun. */
                if (cur->ns == NULL)
@@ -9131,7 +9131,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt,
                            goto internal_error;
                    }
                }
-               /* No break on purpose. */
+                /* Falls through. */
            case XML_ATTRIBUTE_NODE:
                /* No namespace, no fun. */
                if (cur->ns == NULL)
diff --git a/valid.c b/valid.c
index 59a17c6..a64b96b 100644
--- a/valid.c
+++ b/valid.c
@@ -5190,6 +5190,7 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
             case XML_TEXT_NODE:
                if (xmlIsBlankNode(cur))
                    break;
+                /* Falls through. */
             case XML_CDATA_SECTION_NODE:
             case XML_ENTITY_REF_NODE:
                strcat(buf, "CDATA");
diff --git a/xmlregexp.c b/xmlregexp.c
index b640264..d255fbf 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -2810,18 +2810,21 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg,
            break;
         case XML_REGEXP_NOTSPACE:
            neg = !neg;
+            /* Falls through. */
         case XML_REGEXP_ANYSPACE:
            ret = ((codepoint == '\n') || (codepoint == '\r') ||
                   (codepoint == '\t') || (codepoint == ' '));
            break;
         case XML_REGEXP_NOTINITNAME:
            neg = !neg;
+            /* Falls through. */
         case XML_REGEXP_INITNAME:
            ret = (IS_LETTER(codepoint) ||
                   (codepoint == '_') || (codepoint == ':'));
            break;
         case XML_REGEXP_NOTNAMECHAR:
            neg = !neg;
+            /* Falls through. */
         case XML_REGEXP_NAMECHAR:
            ret = (IS_LETTER(codepoint) || IS_DIGIT(codepoint) ||
                   (codepoint == '.') || (codepoint == '-') ||
@@ -2830,11 +2833,13 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg,
            break;
         case XML_REGEXP_NOTDECIMAL:
            neg = !neg;
+            /* Falls through. */
         case XML_REGEXP_DECIMAL:
            ret = xmlUCSIsCatNd(codepoint);
            break;
         case XML_REGEXP_REALCHAR:
            neg = !neg;
+            /* Falls through. */
         case XML_REGEXP_NOTREALCHAR:
            ret = xmlUCSIsCatP(codepoint);
            if (ret == 0)
diff --git a/xmlschemas.c b/xmlschemas.c
index 1938d7e..05a12e0 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -1742,6 +1742,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf,
                *buf = xmlStrcat(*buf, BAD_CAST "'");
                FREE_AND_NULL(str);
            }
+            /* Falls through. */
        default:
            named = 0;
        }
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index c9674ba..c6c9365 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -5403,7 +5403,7 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
            if ((valType == XML_SCHEMAS_QNAME) ||
                (valType == XML_SCHEMAS_NOTATION))
                return (0);
-           /* No break on purpose. */
+            /* Falls through. */
        case XML_SCHEMA_FACET_MAXLENGTH:
        case XML_SCHEMA_FACET_MINLENGTH: {
            unsigned int len = 0;
diff --git a/xmlwriter.c b/xmlwriter.c
index 69541b8..eb94e6e 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -3754,6 +3754,7 @@ xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
             if (count < 0)
                 return -1;
             sum += count;
+            /* Falls through. */
         case XML_TEXTWRITER_DTD_ENTY:
         case XML_TEXTWRITER_DTD_PENT:
             count = xmlOutputBufferWriteString(writer->out, ">");
diff --git a/xpath.c b/xpath.c
index 6fdb7df..3527473 100644
--- a/xpath.c
+++ b/xpath.c
@@ -7042,7 +7042,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
                    valuePush(ctxt, arg2);
                    xmlXPathNumberFunction(ctxt, 1);
                    arg2 = valuePop(ctxt);
-                   /* no break on purpose */
+                    /* Falls through. */
                case XPATH_NUMBER:
                    /* Hand check NaN and Infinity equalities */
                    if (xmlXPathIsNaN(arg1->floatval) ||


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]