Removed unused variables (first pass)

Fixes various gcc 5.4.0 warnings for -Wunused-variable and -Wunused-but-set-variable
This commit is contained in:
Rémi Verschelde 2016-07-03 23:19:22 +02:00
parent 1b9433594e
commit b6ac91c0e6
13 changed files with 20 additions and 100 deletions

View file

@ -125,10 +125,7 @@ MainLoop* test() {
for (List<StringName>::Element *E=tl.front();E;E=E->next()) {
Vector<uint8_t> m5b = E->get().operator String().md5_buffer();
uint32_t *ub = (uint32_t*)m5b.ptr();
//hashes.push_back(ihash(ihash2(ihash3(*ub))));
hashes.push_back(hashes.size());
//hashes.push_back(E->get().hash());
}

View file

@ -2205,8 +2205,6 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui
AABB aabb;
float scale=1;
float max=0;
if (p_surface->array[VS::ARRAY_VERTEX].datatype==_GL_HALF_FLOAT_OES) {
@ -5913,8 +5911,7 @@ Error RasterizerGLES2::_setup_geometry(const Geometry *p_geometry, const Materia
base = skinned_buffer;
//copy stuff and get it ready for the skeleton
int src_stride = surf->stride;
int dst_stride = surf->stride - ( surf->array[VS::ARRAY_BONES].size + surf->array[VS::ARRAY_WEIGHTS].size );
int dst_stride = surf->stride - ( surf->array[VS::ARRAY_BONES].size + surf->array[VS::ARRAY_WEIGHTS].size );
const uint8_t *src_weights=&surf->array_local[surf->array[VS::ARRAY_WEIGHTS].ofs];
const uint8_t *src_bones=&surf->array_local[surf->array[VS::ARRAY_BONES].ofs];
const Skeleton::Bone *skeleton = &p_skeleton->bones[0];
@ -6316,9 +6313,9 @@ void RasterizerGLES2::_render(const Geometry *p_geometry,const Material *p_mater
void RasterizerGLES2::_setup_shader_params(const Material *p_material) {
#if 0
int idx=0;
int tex_idx=0;
#if 0
for(Map<StringName,Variant>::Element *E=p_material->shader_cache->params.front();E;E=E->next(),idx++) {
Variant v; //
@ -6384,7 +6381,6 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans
uint16_t prev_light=0x777E;
const Geometry *prev_geometry_cmp=NULL;
uint8_t prev_light_type=0xEF;
const ParamOverrideMap* prev_overrides=NULL; // make it diferent than NULL
const Skeleton *prev_skeleton =NULL;
uint8_t prev_sort_flags=0xFF;
const BakedLightData *prev_baked_light=NULL;
@ -6392,8 +6388,6 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans
const float *prev_morph_values=NULL;
int prev_receive_shadows_state=-1;
Geometry::Type prev_geometry_type=Geometry::GEOMETRY_INVALID;
material_shader.set_conditional(MaterialShaderGLES2::USE_VERTEX_LIGHTING,!shadow && !p_fragment_light);
material_shader.set_conditional(MaterialShaderGLES2::USE_FRAGMENT_LIGHTING,!shadow && p_fragment_light);
material_shader.set_conditional(MaterialShaderGLES2::USE_SKELETON,false);
@ -6450,12 +6444,10 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans
prev_light=0x777E;
prev_geometry_cmp=NULL;
prev_light_type=0xEF;
prev_overrides=NULL; // make it diferent than NULL
prev_skeleton =NULL;
prev_sort_flags=0xFF;
prev_morph_values=NULL;
prev_receive_shadows_state=-1;
prev_geometry_type=Geometry::GEOMETRY_INVALID;
glEnable(GL_BLEND);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
@ -6838,7 +6830,6 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans
prev_sort_flags=sort_flags;
prev_baked_light=baked_light;
prev_morph_values=morph_values;
// prev_geometry_type=geometry->type;
prev_receive_shadows_state=receive_shadows_state;
}
@ -8877,8 +8868,6 @@ void RasterizerGLES2::canvas_light_shadow_buffer_update(RID p_buffer, const Matr
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
canvas_shadow_shader.bind();
const int vp_height = 10;
glViewport(0, 0, cls->size,cls->height);
_glClearDepth(1.0f);
glClearColor(1,1,1,1);
@ -8920,12 +8909,6 @@ void RasterizerGLES2::canvas_light_shadow_buffer_update(RID p_buffer, const Matr
Vector3 cam_target=Matrix3(Vector3(0,0,Math_PI*2*(i/4.0))).xform(Vector3(0,1,0));
projection = projection * CameraMatrix(Transform().looking_at(cam_target,Vector3(0,0,-1)).affine_inverse());
//print_line("near: "+rtos(p_near));
//print_line("far: "+rtos(p_far));
//projection.set_perspective(60,size/float(vp_height),p_near,p_far);
// CameraMatrix light_mat = projection * CameraMatrix(camera);
canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES2::PROJECTION_MATRIX,projection);
canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES2::LIGHT_MATRIX,light);
@ -9501,19 +9484,15 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
if (ci->copy_back_buffer && framebuffer.active && framebuffer.scale==1) {
Rect2 rect;
int x,y,w,h;
int x,y;
if (ci->copy_back_buffer->full) {
x = viewport.x;
y = window_size.height-(viewport.height+viewport.y);
w = viewport.width;
h = viewport.height;
} else {
x = viewport.x+ci->copy_back_buffer->screen_rect.pos.x;
y = window_size.height-(viewport.y+ci->copy_back_buffer->screen_rect.pos.y+ci->copy_back_buffer->screen_rect.size.y);
w = ci->copy_back_buffer->screen_rect.size.x;
h = ci->copy_back_buffer->screen_rect.size.y;
}
glActiveTexture(GL_TEXTURE0+max_texture_units-1);
glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color);
@ -9531,9 +9510,6 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
} else {
glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
}
// if (current_clip) {
// // print_line(" a clip ");
// }
canvas_texscreen_used=true;
glActiveTexture(GL_TEXTURE0);
@ -10496,7 +10472,6 @@ void RasterizerGLES2::_update_framebuffer() {
// GLuint format_rgba = use_fp16_fb?_GL_RGBA16F_EXT:GL_RGBA;
GLuint format_rgba = GL_RGBA;
GLuint format_rgb = use_fp16_fb?_GL_RGB16F_EXT:GL_RGB;
GLuint format_type = use_fp16_fb?_GL_HALF_FLOAT_OES:GL_UNSIGNED_BYTE;
GLuint format_internal=GL_RGBA;
@ -10998,10 +10973,9 @@ void RasterizerGLES2::init() {
{
//shadowmaps
OS::VideoMode vm=OS::get_singleton()->get_video_mode();
//don't use a shadowbuffer too big in GLES, this should be the maximum
int max_shadow_size = GLOBAL_DEF("rasterizer/max_shadow_buffer_size",1024);//nearest_power_of_2(MIN(vm.width,vm.height))/2;
int max_shadow_size = GLOBAL_DEF("rasterizer/max_shadow_buffer_size",1024);
int smsize=max_shadow_size;
while(smsize>=16) {

View file

@ -129,6 +129,8 @@ static Image _jpegd_mem_loader_func(const uint8_t* p_png,int p_size) {
Image img;
Error err = jpeg_load_image_from_buffer(&img,p_png,p_size);
if (err)
ERR_PRINT("Couldn't initialize ImageLoaderJPG with the given resource.");
return img;
}

View file

@ -133,7 +133,6 @@ Error ResourceSaverPNG::save_image(const String &p_path, Image &p_img) {
}
int pngf=0;
int pngb=8;
int cs=0;

View file

@ -101,7 +101,6 @@ static bool init_fullscreen=false;
static bool init_use_custom_pos=false;
static bool debug_collisions=false;
static bool debug_navigation=false;
static bool allow_hidpi=true;
static Vector2 init_custom_pos;
static int video_driver_idx=-1;
static int audio_driver_idx=-1;
@ -262,7 +261,6 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
Vector<String> breakpoints;
bool use_custom_res=true;
bool force_res=false;
bool profile=false;
I=args.front();
@ -916,6 +914,8 @@ Error Main::setup2() {
if (boot_logo_path!=String() /*&& FileAccess::exists(boot_logo_path)*/) {
print_line("Boot splash path: "+boot_logo_path);
Error err = boot_logo.load(boot_logo_path);
if (err)
ERR_PRINTS("Non-existing or invalid boot splash at: " + boot_logo_path + ". Loading default splash.");
}
if (!boot_logo.empty()) {
@ -1040,7 +1040,6 @@ bool Main::start() {
String _import_script;
String dumpstrings;
bool noquit=false;
bool convert_old=false;
bool export_debug=false;
bool project_manager_request = false;
List<String> args = OS::get_singleton()->get_cmdline_args();
@ -1050,8 +1049,6 @@ bool Main::start() {
doc_base=false;
} else if (args[i]=="-noquit") {
noquit=true;
} else if (args[i]=="-convert_old") {
convert_old=true;
} else if (args[i]=="-editor" || args[i]=="-e") {
editor=true;
} else if (args[i] == "-pm" || args[i] == "-project_manager") {

View file

@ -460,7 +460,6 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
const GDParser::Node *instance = on->arguments[0];
bool in_static=false;
if (instance->type==GDParser::Node::TYPE_SELF) {
//room for optimization
@ -771,8 +770,6 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
Vector<int> setchain;
int prev_key_idx=-1;
for(List<GDParser::OperatorNode*>::Element *E=chain.back();E;E=E->prev()) {
@ -822,7 +819,6 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
setchain.push_back(named ? GDFunction::OPCODE_SET_NAMED : GDFunction::OPCODE_SET);
prev_pos=dst_pos;
prev_key_idx=key_idx;
}
@ -1211,7 +1207,6 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
if (p_func) {
for(int i=0;i<p_func->arguments.size();i++) {
int idx = i;
codegen.add_stack_identifier(p_func->arguments[i],i);
#ifdef TOOLS_ENABLED
argnames.push_back(p_func->arguments[i]);
@ -1449,7 +1444,6 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
p_script->name=p_class->name;
int index_from=0;
Ref<GDNativeClass> native;
if (p_class->extends_used) {

View file

@ -449,57 +449,21 @@ static Ref<Reference> _get_parent_class(GDCompletionContext& context) {
}
String base=context._class->extends_class[0];
const GDParser::ClassNode *p = context._class->owner;
Ref<GDScript> base_class;
#if 0
while(p) {
if (p->subclasses.has(base)) {
if (context._class->extends_class.size()>1) {
return REF();
base_class=p->subclasses[base];
break;
}
p=p->_owner;
}
#endif
if (base_class.is_valid()) {
#if 0
for(int i=1;i<context._class->extends_class.size();i++) {
//if not found, try engine classes
if (!GDScriptLanguage::get_singleton()->get_global_map().has(base)) {
String subclass=context._class->extends_class[i];
if (base_class->subclasses.has(subclass)) {
base_class=base_class->subclasses[subclass];
} else {
//print_line("Could not find subclass: "+subclass);
return _get_type_from_class(context); //fail please
}
}
script=base_class;
#endif
} else {
if (context._class->extends_class.size()>1) {
return REF();
}
//if not found, try engine classes
if (!GDScriptLanguage::get_singleton()->get_global_map().has(base)) {
return REF();
}
int base_idx = GDScriptLanguage::get_singleton()->get_global_map()[base];
native = GDScriptLanguage::get_singleton()->get_global_array()[base_idx];
return native;
return REF();
}
int base_idx = GDScriptLanguage::get_singleton()->get_global_map()[base];
native = GDScriptLanguage::get_singleton()->get_global_array()[base_idx];
return native;
}
@ -2100,10 +2064,8 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
}
Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base_path, Object*p_owner, List<String>* r_options, String &r_call_hint) {
//print_line( p_code.replace(String::chr(0xFFFF),"<cursor>"));
GDParser p;
//Error parse(const String& p_code, const String& p_base_path="", bool p_just_validate=false,const String& p_self_path="",bool p_for_completion=false);
Error err = p.parse(p_code,p_base_path,false,"",true);
bool isfunction=false;
@ -2204,7 +2166,6 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (code!="") {
//if there is code, parse it. This way is slower but updates in real-time
GDParser p;
//Error parse(const String& p_code, const String& p_base_path="", bool p_just_validate=false,const String& p_self_path="",bool p_for_completion=false);
Error err = p.parse(scr->get_source_code(),scr->get_path().get_base_dir(),true,"",false);

View file

@ -502,7 +502,6 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
Ref<FuncRef> fr = memnew( FuncRef);
Object *obj = *p_args[0];
fr->set_instance(*p_args[0]);
fr->set_function(*p_args[1]);

View file

@ -514,8 +514,6 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
} else if (/*tokenizer->get_token()==GDTokenizer::TK_OP_ADD ||*/ tokenizer->get_token()==GDTokenizer::TK_OP_SUB || tokenizer->get_token()==GDTokenizer::TK_OP_NOT || tokenizer->get_token()==GDTokenizer::TK_OP_BIT_INVERT) {
//single prefix operators like !expr -expr ++expr --expr
OperatorNode *op = alloc_node<OperatorNode>();
Expression e;
e.is_op=true;

View file

@ -1156,7 +1156,6 @@ Vector<uint8_t> GDTokenizerBuffer::parse_code_string(const String& p_code) {
GDTokenizerText tt;
tt.set_code(p_code);
int line=-1;
int col=0;
while(true) {

View file

@ -912,7 +912,6 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
int lc = p_lights.size();
const BakeLight* bl = p_lights.ptr();
float ofs = cell_size*0.02;
float att = 0.2;
for(;V;V=V->next()) {

View file

@ -241,7 +241,7 @@ void InverseKinematics::_notification(int p_what)
}
} break;
case NOTIFICATION_PROCESS: {
float delta = get_process_delta_time();
Spatial *sksp = skel->cast_to<Spatial>();
if (!bound)
break;

View file

@ -45,7 +45,9 @@
#define test_bit(nr, addr) (((1UL << ((nr) % LONG_BITS)) & ((addr)[(nr) / LONG_BITS])) != 0)
#define NBITS(x) ((((x)-1)/LONG_BITS)+1)
#ifdef UDEV_ENABLED
static const char* ignore_str = "/dev/input/js";
#endif
joystick_linux::Joystick::Joystick() {
fd = -1;
@ -198,7 +200,6 @@ void joystick_linux::monitor_joysticks(udev *p_udev) {
}
usleep(50000);
}
//printf("exit udev\n");
udev_monitor_unref(mon);
}
#endif