Skip to content

Warning: implicit fallthrough #14

Description

@boyska

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions