aappleby / smhasher

Automatically exported from code.google.com/p/smhasher
2.66k stars 469 forks source link

switch fallthrough #71

Open leomrtns opened 5 years ago

leomrtns commented 5 years ago

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