stb icon indicating copy to clipboard operation
stb copied to clipboard

Make fallthroughs explicit in stb_image.h

Open r-barnes opened this issue 1 year ago • 2 comments
trafficstars

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.

r-barnes avatar Feb 20 '24 19:02 r-barnes

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.

nothings avatar Feb 20 '24 20:02 nothings

@nothings - Of course, my apologies. I've updated the PR.

r-barnes avatar Jul 15 '24 19:07 r-barnes