From 3cc6f5c6f2184ed56fb13353ef5d03d38f00dac6 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 3 Aug 2017 18:42:20 +0300 Subject: [PATCH] Annotate fall throughs with comments --- tinyxml2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 3043ab3..8a3f857 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -424,20 +424,24 @@ void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length output += *length; - // Scary scary fall throughs. + // Scary scary fall throughs are annotated with carefully designed comments + // to suppress compiler warnings such as -Wimplicit-fallthrough in gcc switch (*length) { case 4: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; + //fall through case 3: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; + //fall through case 2: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; + //fall through case 1: --output; *output = (char)(input | FIRST_BYTE_MARK[*length]);