tinyprintf icon indicating copy to clipboard operation
tinyprintf copied to clipboard

Warning: implicit fallthrough

Open boyska opened this issue 6 years ago • 0 comments

When compiling with make I receive warnings about implicit fallthrough in the printf switch case.

Here is the exact line

And that's the build log

cc -Wall -W -Wextra -O3 -g -I.  -c -o tinyprintf.o tinyprintf.c
tinyprintf.c: In function ‘tfp_format’:
tinyprintf.c:378:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
                 lng = 1;
                 ~~~~^~~
tinyprintf.c:383:13: note: here
             case 'x':
             ^~~~

I think that if that's unwanted, a break should be added. If that's wanted, it should be either:

  • avoided with __attribute__ ((fallthrough)) (but I understand this might be compiler-dependent; a pragma might be easier to do, then)
  • documented that it is not an issue

boyska avatar Aug 20 '18 10:08 boyska