1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Fix -Wimplicit-fallthrough warnings from GCC 8

Adds `FALLTHROUGH` macro to specify when a fallthrough is intentional.
Can be replaced by `[[fallthrough]]` if/when we switch to C++17.

The warning is now enabled by default for GCC on `extra` warnings level
(part of GCC's `-Wextra`). It's not enabled in Clang's `-Wextra` yet,
but we could enable it manually once we switch to C++11. There's no
equivalent feature in MSVC for now.

Fixes #26135.

(cherry picked from commit fc370b3feb)
This commit is contained in:
Rémi Verschelde
2019-04-05 14:06:16 +02:00
parent 3b703d6707
commit fc18d637a8
18 changed files with 82 additions and 67 deletions

View File

@@ -1901,7 +1901,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
break;
}
} // fallthrough
FALLTHROUGH;
}
case SCENE_TAB_CLOSE:
case FILE_SAVE_SCENE: {
@@ -1920,8 +1921,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
break;
}
// fallthrough to save_as
};
FALLTHROUGH;
}
case FILE_SAVE_AS_SCENE: {
int scene_idx = (p_option == FILE_SAVE_SCENE || p_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;