From a420a3b8eff4e272785e8bee36cd3c7f8da792d7 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Mon, 15 May 2017 18:18:29 +0100 Subject: [PATCH] Comment why tidy-up parse cannot be suspended Also add tags so that lcov can ignore the unreachable code. --- expat/lib/xmlparse.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index d26ebd3c..111474e5 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -1870,9 +1870,22 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) if (errorCode == XML_ERROR_NONE) { switch (ps_parsing) { case XML_SUSPENDED: + /* It is hard to be certain, but it seems that this case + * cannot occur. This code is cleaning up a previous parse + * with no new data (since len == 0). Changing the parsing + * state requires getting to execute a handler function, and + * there doesn't seem to be an opportunity for that while in + * this circumstance. + * + * Given the uncertainty, we retain the code but exclude it + * from coverage tests. + * + * LCOV_EXCL_START + */ XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); positionPtr = bufferPtr; return XML_STATUS_SUSPENDED; + /* LCOV_EXCL_END */ case XML_INITIALIZED: case XML_PARSING: ps_parsing = XML_FINISHED; -- 2.40.0