Skip to content

Commit

Permalink
Merge pull request #22447 from akien-mga/fix-warnings-Wswitch
Browse files Browse the repository at this point in the history
Fix warnings about unhandled enum value in switch [-Wswitch]
  • Loading branch information
akien-mga authored Sep 28, 2018
2 parents 1c60465 + 7b081a7 commit c7e646c
Show file tree
Hide file tree
Showing 49 changed files with 246 additions and 85 deletions.
4 changes: 3 additions & 1 deletion core/io/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ Error HTTPClient::poll() {
} break;
}
} break;
case STATUS_BODY:
case STATUS_CONNECTED: {
// Check if we are still connected
if (ssl) {
Expand Down Expand Up @@ -480,7 +481,8 @@ Error HTTPClient::poll() {
case STATUS_DISCONNECTED: {
return ERR_UNCONFIGURED;
} break;
case STATUS_CONNECTION_ERROR: {
case STATUS_CONNECTION_ERROR:
case STATUS_SSL_HANDSHAKE_ERROR: {
return ERR_CONNECTION_ERROR;
} break;
case STATUS_CANT_CONNECT: {
Expand Down
1 change: 1 addition & 0 deletions core/io/marshalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
flags |= ENCODE_FLAG_OBJECT_AS_ID;
}
} break;
default: {} // nothing to do at this stage
}

if (buf) {
Expand Down
1 change: 1 addition & 0 deletions core/os/dir_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ String DirAccess::fix_path(String p_path) const {

return p_path;
} break;
case ACCESS_MAX: break; // Can't happen, but silences warning
}

return p_path;
Expand Down
1 change: 1 addition & 0 deletions core/os/file_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ String FileAccess::fix_path(const String &p_path) const {

return r_path;
} break;
case ACCESS_MAX: break; // Can't happen, but silences warning
}

return r_path;
Expand Down
4 changes: 1 addition & 3 deletions doc/classes/PhysicsServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1518,9 +1518,7 @@
<constant name="BODY_MODE_RIGID" value="2" enum="BodyMode">
Constant for rigid bodies.
</constant>
<constant name="BODY_MODE_SOFT" value="3" enum="BodyMode">
</constant>
<constant name="BODY_MODE_CHARACTER" value="4" enum="BodyMode">
<constant name="BODY_MODE_CHARACTER" value="3" enum="BodyMode">
Constant for rigid bodies in character mode. In this mode, a body can not rotate, and only its linear velocity is affected by physics.
</constant>
<constant name="BODY_PARAM_BOUNCE" value="0" enum="BodyParameter">
Expand Down
12 changes: 4 additions & 8 deletions drivers/gles2/rasterizer_scene_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p

} break;

default: {

} break;
default: {}
}
}
}
Expand Down Expand Up @@ -1240,9 +1238,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
case VS::INSTANCE_IMMEDIATE: {
} break;

default: {

} break;
default: {}
}
}

Expand Down Expand Up @@ -1465,6 +1461,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
}

} break;
default: {}
}
}

Expand Down Expand Up @@ -1767,8 +1764,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
}

} break;

default: break;
default: {}
}
}

Expand Down
10 changes: 8 additions & 2 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,13 @@ void RasterizerStorageGLES2::shader_get_param_list(RID p_shader, List<PropertyIn
pi.hint_string = "CubeMap";
} break;

default: {

case ShaderLanguage::TYPE_SAMPLER2DARRAY:
case ShaderLanguage::TYPE_ISAMPLER2DARRAY:
case ShaderLanguage::TYPE_USAMPLER2DARRAY:
case ShaderLanguage::TYPE_SAMPLER3D:
case ShaderLanguage::TYPE_ISAMPLER3D:
case ShaderLanguage::TYPE_USAMPLER3D: {
// Not implemented in GLES2
} break;
}

Expand Down Expand Up @@ -3110,6 +3115,7 @@ void RasterizerStorageGLES2::light_set_param(RID p_light, VS::LightParam p_param
light->version++;
light->instance_change_notify();
} break;
default: {}
}

light->param[p_param] = p_value;
Expand Down
13 changes: 13 additions & 0 deletions drivers/gles2/shader_gles2.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,19 @@ class ShaderGLES2 {
case ShaderLanguage::TYPE_SAMPLERCUBE: {

} break;

case ShaderLanguage::TYPE_SAMPLER2DARRAY:
case ShaderLanguage::TYPE_ISAMPLER2DARRAY:
case ShaderLanguage::TYPE_USAMPLER2DARRAY:
case ShaderLanguage::TYPE_SAMPLER3D:
case ShaderLanguage::TYPE_ISAMPLER3D:
case ShaderLanguage::TYPE_USAMPLER3D: {
// Not implemented in GLES2
} break;

case ShaderLanguage::TYPE_VOID: {
// Nothing to do?
} break;
}
}

Expand Down
7 changes: 6 additions & 1 deletion drivers/gles3/rasterizer_scene_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,8 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
case ShaderLanguage::TYPE_SAMPLER2DARRAY: {
// TODO
} break;

default: {}
}
}

Expand Down Expand Up @@ -1509,6 +1511,7 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo
}

} break;
default: {}
}
}

Expand Down Expand Up @@ -1830,6 +1833,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) {
}

} break;
default: {}
}
}

Expand Down Expand Up @@ -3210,6 +3214,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
}

} break;
default: {}
}
}
}
Expand Down Expand Up @@ -4296,7 +4301,6 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
if (env) {
switch (env->bg_mode) {
case VS::ENV_BG_COLOR_SKY:

case VS::ENV_BG_SKY:

sky = storage->sky_owner.getornull(env->sky);
Expand Down Expand Up @@ -4334,6 +4338,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
break;
default: {}
}
}

Expand Down
10 changes: 10 additions & 0 deletions drivers/gles3/rasterizer_storage_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
actions = &shaders.actions_particles;
actions->uniforms = &p_shader->uniforms;
} break;
case VS::SHADER_MAX: break; // Can't happen, but silences warning
}

Error err = shaders.compiler.compile(p_shader->mode, p_shader->code, actions, p_shader->path, gen_code);
Expand Down Expand Up @@ -2028,6 +2029,14 @@ void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List<PropertyIn
pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
pi.hint_string = "Texture";
} break;
case ShaderLanguage::TYPE_SAMPLER2DARRAY:
case ShaderLanguage::TYPE_ISAMPLER2DARRAY:
case ShaderLanguage::TYPE_USAMPLER2DARRAY: {

pi.type = Variant::OBJECT;
pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
pi.hint_string = "TextureArray";
} break;
case ShaderLanguage::TYPE_SAMPLER3D:
case ShaderLanguage::TYPE_ISAMPLER3D:
case ShaderLanguage::TYPE_USAMPLER3D: {
Expand Down Expand Up @@ -4961,6 +4970,7 @@ void RasterizerStorageGLES3::light_set_param(RID p_light, VS::LightParam p_param
light->version++;
light->instance_change_notify();
} break;
default: {}
}

light->param[p_param] = p_value;
Expand Down
12 changes: 12 additions & 0 deletions drivers/gles3/shader_compiler_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ static int _get_datatype_size(SL::DataType p_type) {
case SL::TYPE_SAMPLER2D: return 16;
case SL::TYPE_ISAMPLER2D: return 16;
case SL::TYPE_USAMPLER2D: return 16;
case SL::TYPE_SAMPLER2DARRAY: return 16;
case SL::TYPE_ISAMPLER2DARRAY: return 16;
case SL::TYPE_USAMPLER2DARRAY: return 16;
case SL::TYPE_SAMPLER3D: return 16;
case SL::TYPE_ISAMPLER3D: return 16;
case SL::TYPE_USAMPLER3D: return 16;
case SL::TYPE_SAMPLERCUBE: return 16;
}

Expand Down Expand Up @@ -112,6 +118,12 @@ static int _get_datatype_alignment(SL::DataType p_type) {
case SL::TYPE_SAMPLER2D: return 16;
case SL::TYPE_ISAMPLER2D: return 16;
case SL::TYPE_USAMPLER2D: return 16;
case SL::TYPE_SAMPLER2DARRAY: return 16;
case SL::TYPE_ISAMPLER2DARRAY: return 16;
case SL::TYPE_USAMPLER2DARRAY: return 16;
case SL::TYPE_SAMPLER3D: return 16;
case SL::TYPE_ISAMPLER3D: return 16;
case SL::TYPE_USAMPLER3D: return 16;
case SL::TYPE_SAMPLERCUBE: return 16;
}

Expand Down
5 changes: 4 additions & 1 deletion drivers/pulseaudio/audio_driver_pulseaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) {
case PA_CONTEXT_FAILED:
ad->pa_ready = -1;
break;

case PA_CONTEXT_READY:
ad->pa_ready = 1;
break;
default:
// TODO: Check if we want to handle some of the other
// PA context states like PA_CONTEXT_UNCONNECTED.
break;
}
}

Expand Down
9 changes: 9 additions & 0 deletions editor/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ void EditorFileDialog::update_dir() {
case MODE_OPEN_DIR:
get_ok()->set_text(TTR("Select Current Folder"));
break;
case MODE_OPEN_ANY:
case MODE_SAVE_FILE:
// FIXME: Implement, or refactor to avoid duplication with set_mode
break;
}
}

Expand Down Expand Up @@ -504,6 +508,11 @@ void EditorFileDialog::_items_clear_selection() {
get_ok()->set_disabled(false);
get_ok()->set_text(TTR("Select Current Folder"));
break;

case MODE_OPEN_ANY:
case MODE_SAVE_FILE:
// FIXME: Implement, or refactor to avoid duplication with set_mode
break;
}
}

Expand Down
36 changes: 2 additions & 34 deletions editor/editor_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
err_str = String(p_file) + ":" + itos(p_line) + " - " + String(p_error);
}

/*
if (!self->is_visible_in_tree())
self->emit_signal("show_request");
*/

if (p_type == ERR_HANDLER_WARNING) {
self->add_message(err_str, MSG_TYPE_WARNING);
} else {
Expand All @@ -76,17 +71,6 @@ void EditorLog::_notification(int p_what) {
}
}
}

/*if (p_what==NOTIFICATION_DRAW) {

RID ci = get_canvas_item();
get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
int top_ofs = 20;
int border_ofs=4;
Ref<StyleBox> style = get_stylebox("normal","TextEdit");

style->draw(ci,Rect2( Point2(border_ofs,top_ofs),get_size()-Size2(border_ofs*2,top_ofs+border_ofs)));
}*/
}

void EditorLog::_clear_request() {
Expand All @@ -105,6 +89,8 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) {

bool restore = p_type != MSG_TYPE_STD;
switch (p_type) {
case MSG_TYPE_STD: {
} break;
case MSG_TYPE_ERROR: {
log->push_color(get_color("error_color", "Editor"));
Ref<Texture> icon = get_icon("Error", "EditorIcons");
Expand All @@ -122,7 +108,6 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) {
}

log->add_text(p_msg);
//button->set_text(p_msg);

if (restore)
log->pop();
Expand All @@ -132,21 +117,6 @@ void EditorLog::set_tool_button(ToolButton *p_tool_button) {
tool_button = p_tool_button;
}

/*
void EditorLog::_dragged(const Point2& p_ofs) {

int ofs = ec->get_minsize().height;
ofs = ofs-p_ofs.y;
if (ofs<50)
ofs=50;
if (ofs>300)
ofs=300;
ec->set_minsize(Size2(ec->get_minsize().width,ofs));
minimum_size_changed();

}
*/

void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) {

EditorLog *self = (EditorLog *)p_self;
Expand All @@ -156,7 +126,6 @@ void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) {
void EditorLog::_bind_methods() {

ClassDB::bind_method(D_METHOD("_clear_request"), &EditorLog::_clear_request);
//ClassDB::bind_method(D_METHOD("_dragged"),&EditorLog::_dragged );
ADD_SIGNAL(MethodInfo("clear_request"));
}

Expand Down Expand Up @@ -187,7 +156,6 @@ EditorLog::EditorLog() {
log->set_h_size_flags(SIZE_EXPAND_FILL);
vb->add_child(log);
add_message(VERSION_FULL_NAME " (c) 2007-2018 Juan Linietsky, Ariel Manzur & Godot Contributors.");
//log->add_text("Initialization Complete.\n"); //because it looks cool.

eh.errfunc = _error_handler;
eh.userdata = this;
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/baked_lightmap_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void BakedLightmapEditorPlugin::_bake() {
case BakedLightmap::BAKE_ERROR_CANT_CREATE_IMAGE:
EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images, make sure path is writable."));
break;
default: {}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/polygon_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
node->set_polygon(uv_new);
}
} break;
default: {}
}

if (bone_painting) {
Expand Down
Loading

0 comments on commit c7e646c

Please sign in to comment.