[SLOF] [PATCH] libc: Add missing fallthrough annotation

Philippe Mathieu-Daudé f4bug at amsat.org
Sat Jan 23 04:21:33 AEDT 2021


Silence warning when cross-compiling with GCC on Debian 10:

  $ s390x-linux-gnu-gcc --version
  s390x-linux-gnu-gcc (Debian 8.3.0-2) 8.3.0

  lib/libc/stdio/vsnprintf.c: In function 'print_format':
  lib/libc/stdio/vsnprintf.c:165:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
       upper = true;
       ~~~~~~^~~~~~
  lib/libc/stdio/vsnprintf.c:166:4: note: here
      case 'x':
      ^~~~

Signed-off-by: Philippe Mathieu-Daudé <f4bug at amsat.org>
---
 lib/libc/stdio/vsnprintf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c
index 21dd04d..f292dd8 100644
--- a/lib/libc/stdio/vsnprintf.c
+++ b/lib/libc/stdio/vsnprintf.c
@@ -163,6 +163,7 @@ print_format(char **buffer, size_t bufsize, const char *format, void *var)
 				break;
 			case 'X':
 				upper = true;
+				/* fall through */
 			case 'x':
 				sizec[i] = '\0';
 				value = (unsigned long) var & convert[length_mod];
-- 
2.26.2



More information about the SLOF mailing list