NagyD / SDLPoP

An open-source port of Prince of Persia, based on the disassembly of the DOS version.
GNU General Public License v3.0
1.1k stars 140 forks source link

Fix compiler warning on intentional fallthrough #276

Closed bonki closed 2 years ago

bonki commented 2 years ago

Indeed, and gcc already has a non-standard attribute for this as well (not sure if this is true for clang in C-mode). I just picked what's already in use as a marker to be consistent with the rest of the current code base.

NagyD commented 2 years ago

I have merged this for now.

@mooskagh, I tried your code.

In Dev-C++ I need one more check:

#ifdef __has_c_attribute
#if __has_c_attribute(fallthrough)
[[fallthrough]];
#endif
#endif

Instead of checking this every time, I think it would be better to define a macro which expands to [[fallthrough]] if it's supported, or to nothing otherwise.

NagyD commented 2 years ago

Instead of checking this every time, I think it would be better to define a macro which expands to [[fallthrough]] if it's supported, or to nothing otherwise.

Here is it on a new branch: 96dfb3d2e3970b7495efd81ba7fde1ad8a16149d