Browse Source

Many fallthrough switch cases now have the FALLTHROUGH macro to tell the compiler that this is intended.

hbina085 6 years ago
parent
commit
9f0c6a6009

+ 2 - 1
core/packed_data_container.cpp

@@ -224,7 +224,8 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
 
 			string_cache[s] = tmpdata.size();
 
-		}; //fallthrough
+			FALLTHROUGH;
+		};
 		case Variant::NIL:
 		case Variant::BOOL:
 		case Variant::INT:

+ 2 - 1
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;

+ 2 - 2
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: {
 

+ 8 - 4
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) {

+ 1 - 1
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;

+ 2 - 2
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);

+ 2 - 1
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";