atomicobject / heatshrink

data compression library for embedded/real-time systems
ISC License
1.31k stars 176 forks source link

Fixed fallthrough compiler warning #46

Closed tobhe closed 6 years ago

tobhe commented 7 years ago

Fixed fallthrough warnings thrown in GCC 7.1.1:

heatshrink_encoder.c: In function ‘heatshrink_encoder_poll’:
heatshrink_encoder.c:237:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
             hse->state = st_flush_bit_buffer(hse, &oi);
             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
heatshrink_encoder.c:238:9: note: here
         case HSES_DONE:

heatshrink.c: In function ‘proc_args’:
heatshrink.c:411:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             usage();
             ^~~~~~~
heatshrink.c:412:9: note: here
         case 'e':               /* encode */
chmorgan commented 7 years ago

I ran into the same issue, good thing I looked here and saw that it was already an open pull request!

Any plans to review and include this into master @silentbicycle?

silentbicycle commented 7 years ago

I'll cherry-pick this onto develop and include it in the next release. Thanks.

Aside from warnings, it shouldn't be a functional change -- the fallthrough there is intentional (but not explicitly noted), and GCC isn't detecting that usage() calls exit(1).

chmorgan commented 7 years ago

@silentbicycle thanks!

tobhe commented 6 years ago

@silentbicycle: If the fallthrough is planned I recommend using a comment to prevent gcc throwing a warning here

silentbicycle commented 6 years ago

Thanks!