Malvineous/libgamegraphics

Unintended switch statement fall-through in tls-bash.cpp

Opened this issue · 0 comments

I am compiling this with GCC 8.3.0 which has some nice warnings, especially this one:

tls-bash.cpp:61:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
 #define FILETYPE_BASH_TILE_SOLID   "tile/bash-solid"
                                    ^~~~~~~~~~~~~~~~~
tls-bash.cpp:245:40: note: in expansion of macro 'FILETYPE_BASH_TILE_SOLID'
    case PlaneCount::Solid: fat->type = FILETYPE_BASH_TILE_SOLID;
                                        ^~~~~~~~~~~~~~~~~~~~~~~~
tls-bash.cpp:246:4: note: here
    case PlaneCount::Masked: fat->type = FILETYPE_BASH_TILE_MASKED;
    ^~~~

Code in question:

		switch (this->numPlanes) {
			case PlaneCount::Solid: fat->type = FILETYPE_BASH_TILE_SOLID;
			case PlaneCount::Masked: fat->type = FILETYPE_BASH_TILE_MASKED;
		}

The result of this code is that all solid-type graphics are erroneously treated as masked-type.