diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index b6c95bb6b..e84b08a2c 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -65,7 +65,7 @@ function(set_file_warnings) -Wsign-conversion # warn on sign conversions -Wdouble-promotion # warn if float is implicit promoted to double -Wformat=2 # warn on security issues around functions that format output (ie printf) - # -Wimplicit-fallthrough # warn when a missing break causes control flow to continue at the next case in a switch statement (disabled until better compiler support for explicit fallthrough is available) + -Wimplicit-fallthrough # warn when a missing break causes control flow to continue at the next case in a switch statement ${NON_ANDROID_CLANG_AND_GCC_WARNINGS} ) diff --git a/include/SFML/System/Utf.inl b/include/SFML/System/Utf.inl index ee7d3fa16..adf5c3ccd 100644 --- a/include/SFML/System/Utf.inl +++ b/include/SFML/System/Utf.inl @@ -62,11 +62,11 @@ In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement) output = 0; switch (trailingBytes) { - case 5: output += static_cast(*begin++); output <<= 6; // fallthrough - case 4: output += static_cast(*begin++); output <<= 6; // fallthrough - case 3: output += static_cast(*begin++); output <<= 6; // fallthrough - case 2: output += static_cast(*begin++); output <<= 6; // fallthrough - case 1: output += static_cast(*begin++); output <<= 6; // fallthrough + case 5: output += static_cast(*begin++); output <<= 6; [[fallthrough]]; + case 4: output += static_cast(*begin++); output <<= 6; [[fallthrough]]; + case 3: output += static_cast(*begin++); output <<= 6; [[fallthrough]]; + case 2: output += static_cast(*begin++); output <<= 6; [[fallthrough]]; + case 1: output += static_cast(*begin++); output <<= 6; [[fallthrough]]; case 0: output += static_cast(*begin++); } output -= offsets[trailingBytes]; @@ -114,9 +114,9 @@ Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement) Uint8 bytes[4]; switch (bytestoWrite) { - case 4: bytes[3] = static_cast((input | 0x80) & 0xBF); input >>= 6; // fallthrough - case 3: bytes[2] = static_cast((input | 0x80) & 0xBF); input >>= 6; // fallthrough - case 2: bytes[1] = static_cast((input | 0x80) & 0xBF); input >>= 6; // fallthrough + case 4: bytes[3] = static_cast((input | 0x80) & 0xBF); input >>= 6; [[fallthrough]]; + case 3: bytes[2] = static_cast((input | 0x80) & 0xBF); input >>= 6; [[fallthrough]]; + case 2: bytes[1] = static_cast((input | 0x80) & 0xBF); input >>= 6; [[fallthrough]]; case 1: bytes[0] = static_cast (input | firstBytes[bytestoWrite]); }