From 7b3c36c7c6152598b8f7d03a456e83aca43fe261 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 16:50:03 +0200 Subject: [PATCH] reduce scope of warning silencing --- rtengine/cJSON.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rtengine/cJSON.c b/rtengine/cJSON.c index cf5ebef56..bf46c98c4 100644 --- a/rtengine/cJSON.c +++ b/rtengine/cJSON.c @@ -31,7 +31,6 @@ #include #include #include "cJSON.h" -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" static const char *ep; @@ -192,12 +191,21 @@ static const char *parse_string(cJSON *item,const char *str) len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len; +#ifdef __GNUC__ // silence warning +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + switch (len) { case 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; case 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; case 1: *--ptr2 =(uc | firstByteMark[len]); } + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif ptr2+=len; break; default: *ptr2++=*ptr; break;