You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +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.
This commit is contained in:
@@ -2261,6 +2261,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
|
||||
break;
|
||||
case DRAG_PAN:
|
||||
c = CURSOR_DRAG;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2597,6 +2598,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
|
||||
case DRAG_TOP_LEFT:
|
||||
case DRAG_BOTTOM_LEFT:
|
||||
_draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
|
||||
FALLTHROUGH;
|
||||
case DRAG_MOVE:
|
||||
start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
|
||||
end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
|
||||
@@ -2611,6 +2613,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
|
||||
case DRAG_TOP_RIGHT:
|
||||
case DRAG_BOTTOM_RIGHT:
|
||||
_draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
|
||||
FALLTHROUGH;
|
||||
case DRAG_MOVE:
|
||||
start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
|
||||
end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
|
||||
@@ -2625,6 +2628,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
|
||||
case DRAG_TOP_LEFT:
|
||||
case DRAG_TOP_RIGHT:
|
||||
_draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
|
||||
FALLTHROUGH;
|
||||
case DRAG_MOVE:
|
||||
start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
|
||||
end = start - Vector2(0, control->get_margin(MARGIN_TOP));
|
||||
@@ -2639,6 +2643,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
|
||||
case DRAG_BOTTOM_LEFT:
|
||||
case DRAG_BOTTOM_RIGHT:
|
||||
_draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
|
||||
FALLTHROUGH;
|
||||
case DRAG_MOVE:
|
||||
start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
|
||||
end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));
|
||||
|
||||
Reference in New Issue
Block a user