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:
@ -29,6 +29,7 @@
|
||||
/*************************************************************************/
|
||||
|
||||
#include "line_edit.h"
|
||||
|
||||
#include "core/message_queue.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/os/os.h"
|
||||
@ -320,7 +321,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
// numlock disabled. fallthrough to key_left
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case KEY_LEFT: {
|
||||
|
||||
@ -367,7 +368,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
// numlock disabled. fallthrough to key_right
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case KEY_RIGHT: {
|
||||
|
||||
@ -474,7 +475,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
// numlock disabled. fallthrough to key_home
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case KEY_HOME: {
|
||||
|
||||
@ -487,7 +488,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
// numlock disabled. fallthrough to key_end
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case KEY_END: {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user