1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

Fix -Wimplicit-fallthrough warnings

Add "falls through" comments to quench implicit-fallthrough warnings
which are enabled by -Wextra under GCC 7.
This commit is contained in:
J. Peter Mugaas
2017-10-21 13:49:31 +02:00
committed by Nick Wellnhofer
parent bec3c17fae
commit d2c329a9a4
11 changed files with 49 additions and 7 deletions

View File

@ -2396,6 +2396,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
case SGML_CATA_ENTITY: case SGML_CATA_ENTITY:
if (*cur == '%') if (*cur == '%')
type = SGML_CATA_PENTITY; type = SGML_CATA_PENTITY;
/* Falls through. */
case SGML_CATA_PENTITY: case SGML_CATA_PENTITY:
case SGML_CATA_DOCTYPE: case SGML_CATA_DOCTYPE:
case SGML_CATA_LINKTYPE: case SGML_CATA_LINKTYPE:

29
dict.c
View File

@ -453,14 +453,23 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
} }
switch (namelen) { switch (namelen) {
case 10: value += name[9]; case 10: value += name[9];
/* Falls through. */
case 9: value += name[8]; case 9: value += name[8];
/* Falls through. */
case 8: value += name[7]; case 8: value += name[7];
/* Falls through. */
case 7: value += name[6]; case 7: value += name[6];
/* Falls through. */
case 6: value += name[5]; case 6: value += name[5];
/* Falls through. */
case 5: value += name[4]; case 5: value += name[4];
/* Falls through. */
case 4: value += name[3]; case 4: value += name[3];
/* Falls through. */
case 3: value += name[2]; case 3: value += name[2];
/* Falls through. */
case 2: value += name[1]; case 2: value += name[1];
/* Falls through. */
default: break; default: break;
} }
return(value); return(value);
@ -496,15 +505,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
} }
switch (plen) { switch (plen) {
case 10: value += prefix[9]; case 10: value += prefix[9];
/* Falls through. */
case 9: value += prefix[8]; case 9: value += prefix[8];
/* Falls through. */
case 8: value += prefix[7]; case 8: value += prefix[7];
/* Falls through. */
case 7: value += prefix[6]; case 7: value += prefix[6];
/* Falls through. */
case 6: value += prefix[5]; case 6: value += prefix[5];
/* Falls through. */
case 5: value += prefix[4]; case 5: value += prefix[4];
/* Falls through. */
case 4: value += prefix[3]; case 4: value += prefix[3];
/* Falls through. */
case 3: value += prefix[2]; case 3: value += prefix[2];
/* Falls through. */
case 2: value += prefix[1]; case 2: value += prefix[1];
/* Falls through. */
case 1: value += prefix[0]; case 1: value += prefix[0];
/* Falls through. */
default: break; default: break;
} }
len -= plen; len -= plen;
@ -514,15 +533,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
} }
switch (len) { switch (len) {
case 10: value += name[9]; case 10: value += name[9];
/* Falls through. */
case 9: value += name[8]; case 9: value += name[8];
/* Falls through. */
case 8: value += name[7]; case 8: value += name[7];
/* Falls through. */
case 7: value += name[6]; case 7: value += name[6];
/* Falls through. */
case 6: value += name[5]; case 6: value += name[5];
/* Falls through. */
case 5: value += name[4]; case 5: value += name[4];
/* Falls through. */
case 4: value += name[3]; case 4: value += name[3];
/* Falls through. */
case 3: value += name[2]; case 3: value += name[2];
/* Falls through. */
case 2: value += name[1]; case 2: value += name[1];
/* Falls through. */
case 1: value += name[0]; case 1: value += name[0];
/* Falls through. */
default: break; default: break;
} }
return(value); return(value);

View File

@ -1036,6 +1036,7 @@ xmlNanoFTPConnect(void *ctx) {
case 2: case 2:
if (proxyPasswd == NULL) if (proxyPasswd == NULL)
break; break;
/* Falls through. */
case 3: case 3:
if (proxyPasswd != NULL) if (proxyPasswd != NULL)
snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd); snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
@ -1105,6 +1106,7 @@ xmlNanoFTPConnect(void *ctx) {
ctxt->controlFd = INVALID_SOCKET; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
/* Falls through. */
case 2: case 2:
/* USER user@host command */ /* USER user@host command */
if (ctxt->user == NULL) if (ctxt->user == NULL)
@ -1158,6 +1160,7 @@ xmlNanoFTPConnect(void *ctx) {
ctxt->controlFd = INVALID_SOCKET; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
/* Falls through. */
case 3: case 3:
/* /*
* If you need support for other Proxy authentication scheme * If you need support for other Proxy authentication scheme
@ -1206,6 +1209,7 @@ xmlNanoFTPConnect(void *ctx) {
case 3: case 3:
__xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT, __xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT,
"FTP server asking for ACCNT on anonymous\n"); "FTP server asking for ACCNT on anonymous\n");
/* Falls through. */
case 1: case 1:
case 4: case 4:
case 5: case 5:

View File

@ -8891,7 +8891,7 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt,
if (ret != 0) { if (ret != 0) {
break; break;
} }
/* no break on purpose */ /* Falls through. */
case XML_RELAXNG_ZEROORMORE:{ case XML_RELAXNG_ZEROORMORE:{
xmlChar *cur, *temp; xmlChar *cur, *temp;
@ -10168,7 +10168,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
} }
if (ctxt->errNr > errNr) if (ctxt->errNr > errNr)
xmlRelaxNGPopErrors(ctxt, errNr); xmlRelaxNGPopErrors(ctxt, errNr);
/* no break on purpose */ /* Falls through. */
case XML_RELAXNG_ZEROORMORE:{ case XML_RELAXNG_ZEROORMORE:{
int progress; int progress;
xmlRelaxNGStatesPtr states = NULL, res = NULL; xmlRelaxNGStatesPtr states = NULL, res = NULL;

6
tree.c
View File

@ -8259,7 +8259,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc,
ns = ns->next; ns = ns->next;
} while (ns != NULL); } while (ns != NULL);
} }
/* No break on purpose. */ /* Falls through. */
case XML_ATTRIBUTE_NODE: case XML_ATTRIBUTE_NODE:
if (node->ns != NULL) { if (node->ns != NULL) {
/* /*
@ -8850,7 +8850,7 @@ next_ns_decl:
} }
if (! adoptns) if (! adoptns)
goto ns_end; goto ns_end;
/* No break on purpose. */ /* Falls through. */
case XML_ATTRIBUTE_NODE: case XML_ATTRIBUTE_NODE:
/* No ns, no fun. */ /* No ns, no fun. */
if (cur->ns == NULL) if (cur->ns == NULL)
@ -9131,7 +9131,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt,
goto internal_error; goto internal_error;
} }
} }
/* No break on purpose. */ /* Falls through. */
case XML_ATTRIBUTE_NODE: case XML_ATTRIBUTE_NODE:
/* No namespace, no fun. */ /* No namespace, no fun. */
if (cur->ns == NULL) if (cur->ns == NULL)

View File

@ -5190,6 +5190,7 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
case XML_TEXT_NODE: case XML_TEXT_NODE:
if (xmlIsBlankNode(cur)) if (xmlIsBlankNode(cur))
break; break;
/* Falls through. */
case XML_CDATA_SECTION_NODE: case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE: case XML_ENTITY_REF_NODE:
strcat(buf, "CDATA"); strcat(buf, "CDATA");

View File

@ -2810,18 +2810,21 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg,
break; break;
case XML_REGEXP_NOTSPACE: case XML_REGEXP_NOTSPACE:
neg = !neg; neg = !neg;
/* Falls through. */
case XML_REGEXP_ANYSPACE: case XML_REGEXP_ANYSPACE:
ret = ((codepoint == '\n') || (codepoint == '\r') || ret = ((codepoint == '\n') || (codepoint == '\r') ||
(codepoint == '\t') || (codepoint == ' ')); (codepoint == '\t') || (codepoint == ' '));
break; break;
case XML_REGEXP_NOTINITNAME: case XML_REGEXP_NOTINITNAME:
neg = !neg; neg = !neg;
/* Falls through. */
case XML_REGEXP_INITNAME: case XML_REGEXP_INITNAME:
ret = (IS_LETTER(codepoint) || ret = (IS_LETTER(codepoint) ||
(codepoint == '_') || (codepoint == ':')); (codepoint == '_') || (codepoint == ':'));
break; break;
case XML_REGEXP_NOTNAMECHAR: case XML_REGEXP_NOTNAMECHAR:
neg = !neg; neg = !neg;
/* Falls through. */
case XML_REGEXP_NAMECHAR: case XML_REGEXP_NAMECHAR:
ret = (IS_LETTER(codepoint) || IS_DIGIT(codepoint) || ret = (IS_LETTER(codepoint) || IS_DIGIT(codepoint) ||
(codepoint == '.') || (codepoint == '-') || (codepoint == '.') || (codepoint == '-') ||
@ -2830,11 +2833,13 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg,
break; break;
case XML_REGEXP_NOTDECIMAL: case XML_REGEXP_NOTDECIMAL:
neg = !neg; neg = !neg;
/* Falls through. */
case XML_REGEXP_DECIMAL: case XML_REGEXP_DECIMAL:
ret = xmlUCSIsCatNd(codepoint); ret = xmlUCSIsCatNd(codepoint);
break; break;
case XML_REGEXP_REALCHAR: case XML_REGEXP_REALCHAR:
neg = !neg; neg = !neg;
/* Falls through. */
case XML_REGEXP_NOTREALCHAR: case XML_REGEXP_NOTREALCHAR:
ret = xmlUCSIsCatP(codepoint); ret = xmlUCSIsCatP(codepoint);
if (ret == 0) if (ret == 0)

View File

@ -1742,6 +1742,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf,
*buf = xmlStrcat(*buf, BAD_CAST "'"); *buf = xmlStrcat(*buf, BAD_CAST "'");
FREE_AND_NULL(str); FREE_AND_NULL(str);
} }
/* Falls through. */
default: default:
named = 0; named = 0;
} }

View File

@ -5403,7 +5403,7 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
if ((valType == XML_SCHEMAS_QNAME) || if ((valType == XML_SCHEMAS_QNAME) ||
(valType == XML_SCHEMAS_NOTATION)) (valType == XML_SCHEMAS_NOTATION))
return (0); return (0);
/* No break on purpose. */ /* Falls through. */
case XML_SCHEMA_FACET_MAXLENGTH: case XML_SCHEMA_FACET_MAXLENGTH:
case XML_SCHEMA_FACET_MINLENGTH: { case XML_SCHEMA_FACET_MINLENGTH: {
unsigned int len = 0; unsigned int len = 0;

View File

@ -3754,6 +3754,7 @@ xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
if (count < 0) if (count < 0)
return -1; return -1;
sum += count; sum += count;
/* Falls through. */
case XML_TEXTWRITER_DTD_ENTY: case XML_TEXTWRITER_DTD_ENTY:
case XML_TEXTWRITER_DTD_PENT: case XML_TEXTWRITER_DTD_PENT:
count = xmlOutputBufferWriteString(writer->out, ">"); count = xmlOutputBufferWriteString(writer->out, ">");

View File

@ -7042,7 +7042,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
valuePush(ctxt, arg2); valuePush(ctxt, arg2);
xmlXPathNumberFunction(ctxt, 1); xmlXPathNumberFunction(ctxt, 1);
arg2 = valuePop(ctxt); arg2 = valuePop(ctxt);
/* no break on purpose */ /* Falls through. */
case XPATH_NUMBER: case XPATH_NUMBER:
/* Hand check NaN and Infinity equalities */ /* Hand check NaN and Infinity equalities */
if (xmlXPathIsNaN(arg1->floatval) || if (xmlXPathIsNaN(arg1->floatval) ||