Replace FALLTHROUGH macro by C++17 [[fallthrough]]
This attribute is now part of the standard we target so we no longer need compiler-specific hacks. Also enables -Wimplicit-fallthrough for Clang now that we can properly support it. It's already on by default for GCC's -Wextra. Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
This commit is contained in:
@@ -98,11 +98,18 @@ static const Vector3 speaker_directions[7] = {
|
||||
void AudioStreamPlayer3D::_calc_output_vol(const Vector3 &source_dir, real_t tightness, AudioStreamPlayer3D::Output &output) {
|
||||
unsigned int speaker_count; // only main speakers (no LFE)
|
||||
switch (AudioServer::get_singleton()->get_speaker_mode()) {
|
||||
default: //fallthrough
|
||||
case AudioServer::SPEAKER_MODE_STEREO: speaker_count = 2; break;
|
||||
case AudioServer::SPEAKER_SURROUND_31: speaker_count = 3; break;
|
||||
case AudioServer::SPEAKER_SURROUND_51: speaker_count = 5; break;
|
||||
case AudioServer::SPEAKER_SURROUND_71: speaker_count = 7; break;
|
||||
case AudioServer::SPEAKER_MODE_STEREO:
|
||||
speaker_count = 2;
|
||||
break;
|
||||
case AudioServer::SPEAKER_SURROUND_31:
|
||||
speaker_count = 3;
|
||||
break;
|
||||
case AudioServer::SPEAKER_SURROUND_51:
|
||||
speaker_count = 5;
|
||||
break;
|
||||
case AudioServer::SPEAKER_SURROUND_71:
|
||||
speaker_count = 7;
|
||||
break;
|
||||
}
|
||||
|
||||
Spcap spcap(speaker_count, speaker_directions); //TODO: should only be created/recreated once the speaker mode / speaker positions changes
|
||||
@@ -113,18 +120,19 @@ void AudioStreamPlayer3D::_calc_output_vol(const Vector3 &source_dir, real_t tig
|
||||
case AudioServer::SPEAKER_SURROUND_71:
|
||||
output.vol[3].l = volumes[5]; // side-left
|
||||
output.vol[3].r = volumes[6]; // side-right
|
||||
//fallthrough
|
||||
[[fallthrough]];
|
||||
case AudioServer::SPEAKER_SURROUND_51:
|
||||
output.vol[2].l = volumes[3]; // rear-left
|
||||
output.vol[2].r = volumes[4]; // rear-right
|
||||
//fallthrough
|
||||
[[fallthrough]];
|
||||
case AudioServer::SPEAKER_SURROUND_31:
|
||||
output.vol[1].r = 1.0; // LFE - always full power
|
||||
output.vol[1].l = volumes[2]; // center
|
||||
//fallthrough
|
||||
[[fallthrough]];
|
||||
case AudioServer::SPEAKER_MODE_STEREO:
|
||||
output.vol[0].r = volumes[1]; // front-right
|
||||
output.vol[0].l = volumes[0]; // front-left
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ void Button::_notification(int p_what) {
|
||||
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case DRAW_PRESSED: {
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_LEFT: {
|
||||
|
||||
@@ -402,7 +402,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_RIGHT: {
|
||||
|
||||
@@ -509,7 +509,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_HOME: {
|
||||
|
||||
@@ -522,7 +522,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_END: {
|
||||
|
||||
|
||||
@@ -3068,7 +3068,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_LEFT: {
|
||||
|
||||
@@ -3144,7 +3144,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_RIGHT: {
|
||||
|
||||
@@ -3205,7 +3205,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_UP: {
|
||||
|
||||
@@ -3258,7 +3258,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_DOWN: {
|
||||
|
||||
@@ -3381,7 +3381,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_HOME: {
|
||||
#ifdef APPLE_STYLE_KEYS
|
||||
@@ -3442,7 +3442,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_END: {
|
||||
#ifdef APPLE_STYLE_KEYS
|
||||
@@ -3489,7 +3489,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_PAGEUP: {
|
||||
|
||||
@@ -3512,7 +3512,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
scancode_handled = false;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case KEY_PAGEDOWN: {
|
||||
|
||||
|
||||
+1
-1
@@ -1020,7 +1020,7 @@ int Tree::compute_item_height(TreeItem *p_item) const {
|
||||
int check_icon_h = cache.checked->get_height();
|
||||
if (height < check_icon_h)
|
||||
height = check_icon_h;
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case TreeItem::CELL_MODE_STRING:
|
||||
case TreeItem::CELL_MODE_CUSTOM:
|
||||
|
||||
@@ -189,7 +189,7 @@ 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";
|
||||
|
||||
Reference in New Issue
Block a user