From: Bruno Haible Date: Mon, 20 Jan 2020 17:40:59 +0000 (+0100) Subject: unistr/u8-uctomb: Fix warning. X-Git-Tag: v1.0~4333 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=dbb301ad31ad703030a483cd3d0ca8de5e817fb9;p=gnulib.git unistr/u8-uctomb: Fix warning. Reported by Andreas Schwab in . * lib/unistr/u8-uctomb.c (FALLTHROUGH): New macro. (u8_uctomb): Add FALLTHROUGH markers. --- diff --git a/ChangeLog b/ChangeLog index 8b6168164a..29ee66869a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-01-20 Bruno Haible + + unistr/u8-uctomb: Fix warning. + Reported by Andreas Schwab in + . + * lib/unistr/u8-uctomb.c (FALLTHROUGH): New macro. + (u8_uctomb): Add FALLTHROUGH markers. + 2020-01-20 Bruno Haible lock: Fix test-once1 failure on FreeBSD 11 (regression from 2020-01-19). diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c index f093822134..d9980022c2 100644 --- a/lib/unistr/u8-uctomb.c +++ b/lib/unistr/u8-uctomb.c @@ -25,6 +25,14 @@ /* Specification. */ #include "unistr.h" +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + #if !HAVE_INLINE int @@ -62,7 +70,9 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n) switch (count) /* note: code falls through cases! */ { case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; + FALLTHROUGH; case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; + FALLTHROUGH; case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; /*case 1:*/ s[0] = uc; }