Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch fallthrough #71

Open
leomrtns opened this issue Jul 1, 2019 · 0 comments
Open

switch fallthrough #71

leomrtns opened this issue Jul 1, 2019 · 0 comments

Comments

@leomrtns
Copy link

leomrtns commented Jul 1, 2019

Hello, I noticed that when you compile with "-Wextra", "-Wall", etc., gcc complains that "this statement may fall through" in the switch cases. The idea is to warn the programmer that the "standard" is to use a break statement. Assuming you do want to go through all cases, maybe you can add a __attribute__ ((fallthrough)); in the cases? ( https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/ ) Something like

switch(len & 15) {
    case 15: k2 ^= (uint64_t)(tail[14]) << 48;  __attribute__ ((fallthrough));
    case 14: k2 ^= (uint64_t)(tail[13]) << 40;  __attribute__ ((fallthrough));
//etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant