From 9f0c6a60095025cb7f67a36ffa81e8709d645a66 Mon Sep 17 00:00:00 2001 From: hbina085 Date: Fri, 28 Jun 2019 23:09:59 -0400 Subject: [PATCH] Many fallthrough switch cases now have the FALLTHROUGH macro to tell the compiler that this is intended. --- core/packed_data_container.cpp | 3 ++- editor/plugins/sprite_frames_editor_plugin.cpp | 3 ++- editor/plugins/tile_map_editor_plugin.cpp | 4 ++-- modules/gdscript/gdscript_editor.cpp | 12 ++++++++---- modules/gridmap/grid_map_editor_plugin.cpp | 2 +- platform/windows/os_windows.cpp | 4 ++-- scene/resources/particles_material.cpp | 3 ++- 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index fa60be64a76..54bf12b314d 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -224,7 +224,8 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector &tmpd string_cache[s] = tmpdata.size(); - }; //fallthrough + FALLTHROUGH; + }; case Variant::NIL: case Variant::BOOL: case Variant::INT: diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index c509202a886..d91de6cbf63 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -232,7 +232,8 @@ void SpriteFramesEditor::_notification(int p_what) { _delete->set_icon(get_icon("Remove", "EditorIcons")); new_anim->set_icon(get_icon("New", "EditorIcons")); remove_anim->set_icon(get_icon("Remove", "EditorIcons")); - } // Fallthrough. + FALLTHROUGH; + } case NOTIFICATION_THEME_CHANGED: { splite_sheet_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); } break; diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 82e82482169..6e47d828474 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -61,8 +61,8 @@ void TileMapEditor::_notification(int p_what) { if (is_visible_in_tree()) { _update_palette(); } - - } // fallthrough + FALLTHROUGH; + } case NOTIFICATION_ENTER_TREE: { diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 6c77968f44f..26b14a61488 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2498,7 +2498,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path } break; case GDScriptParser::COMPLETION_FUNCTION: { is_function = true; - } // fallthrough + FALLTHROUGH; + } case GDScriptParser::COMPLETION_IDENTIFIER: { _find_identifiers(context, is_function, options); } break; @@ -2537,7 +2538,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path } break; case GDScriptParser::COMPLETION_METHOD: { is_function = true; - } // fallthrough + FALLTHROUGH; + } case GDScriptParser::COMPLETION_INDEX: { const GDScriptParser::Node *node = parser.get_completion_node(); if (node->type != GDScriptParser::Node::TYPE_OPERATOR) { @@ -3234,7 +3236,8 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol case GDScriptParser::COMPLETION_PARENT_FUNCTION: case GDScriptParser::COMPLETION_FUNCTION: { is_function = true; - } // fallthrough + FALLTHROUGH; + } case GDScriptParser::COMPLETION_IDENTIFIER: { if (!is_function) { @@ -3365,7 +3368,8 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } break; case GDScriptParser::COMPLETION_METHOD: { is_function = true; - } // fallthrough + FALLTHROUGH; + } case GDScriptParser::COMPLETION_INDEX: { const GDScriptParser::Node *node = parser.get_completion_node(); if (node->type != GDScriptParser::Node::TYPE_OPERATOR) { diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 03619aa0bdc..20e454c2180 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -235,7 +235,7 @@ void GridMapEditor::_menu_option(int p_option) { options->get_popup()->set_item_checked(idx, !options->get_popup()->is_item_checked(idx)); } break; - case MENU_OPTION_SELECTION_DUPLICATE: // fallthrough + case MENU_OPTION_SELECTION_DUPLICATE: case MENU_OPTION_SELECTION_CUT: { if (!(selection.active && input_action == INPUT_NONE)) break; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 5876a385c64..e535f6a148a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -843,8 +843,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (wParam==VK_WIN) TODO wtf is this? meta_mem=uMsg==WM_KEYDOWN; */ - - } //fallthrough + FALLTHROUGH; + } case WM_CHAR: { ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE); diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index a80a57a09ce..691d73c181d 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -184,7 +184,8 @@ void ParticlesMaterial::_update_shader() { } break; case EMISSION_SHAPE_DIRECTED_POINTS: { code += "uniform sampler2D emission_texture_normal : hint_black;\n"; - } //fallthrough + FALLTHROUGH; + } case EMISSION_SHAPE_POINTS: { code += "uniform sampler2D emission_texture_points : hint_black;\n"; code += "uniform int emission_texture_point_count;\n";