Fix -Wimplicit-fallthrough warnings
Add "falls through" comments to quench implicit-fallthrough warnings
which are enabled by -Wextra under GCC 7.
diff --git a/catalog.c b/catalog.c
index 6dfdfbb..f6186a1 100644
--- a/catalog.c
+++ b/catalog.c
@@ -2396,6 +2396,7 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
ctxt->controlFd = INVALID_SOCKET;
return(-1);
}
+ /* Falls through. */
case 2:
/* USER user@host command */
if (ctxt->user == NULL)
@@ -1158,6 +1160,7 @@
ctxt->controlFd = INVALID_SOCKET;
return(-1);
}
+ /* Falls through. */
case 3:
/*
* If you need support for other Proxy authentication scheme
@@ -1206,6 +1209,7 @@
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 @@
if (ret != 0) {
break;
}
- /* no break on purpose */
+ /* Falls through. */
case XML_RELAXNG_ZEROORMORE:{
xmlChar *cur, *temp;
@@ -10168,7 +10168,7 @@
}
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 @@
ns = ns->next;
} while (ns != NULL);
}
- /* No break on purpose. */
+ /* Falls through. */
case XML_ATTRIBUTE_NODE:
if (node->ns != NULL) {
/*
@@ -8850,7 +8850,7 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
*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 @@
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 @@
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 @@
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) ||