nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
25.77k stars 7.66k forks source link

Make fallthroughs explicit in stb_image.h #1615

Open r-barnes opened 4 months ago

r-barnes commented 4 months ago

The -Wimplicit-fallthrough flag can be used to check for implicit fallthroughs, which are a common source of errors.

I've added and used STBI_FALLTHROUGH which maps to __attribute__((fallthrough)), which the compiler uses to determine whether a fallthrough is explicit or not.

nothings commented 4 months ago

This needs to work on all compilers, so the define needs to be an ifdef which tests for suitable compilers, with an else that defines it to nothing.