Fix all warnings and remove -Wno-unused-but-set cflag

This commit is contained in:
kwolekr 2015-01-18 23:29:19 -05:00
parent e36681101e
commit 38bd9e93a2
17 changed files with 175 additions and 205 deletions

@ -656,13 +656,6 @@ else()
set(RELEASE_WARNING_FLAGS "") set(RELEASE_WARNING_FLAGS "")
endif() endif()
if(NOT APPLE AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
CHECK_CXX_COMPILER_FLAG("-Wno-unused-but-set-variable" HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
if(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable")
endif(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# clang does not understand __extern_always_inline but libc headers use it # clang does not understand __extern_always_inline but libc headers use it
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"") set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")

@ -152,8 +152,8 @@ struct ClientEvent
{ {
ClientEventType type; ClientEventType type;
union{ union{
struct{ //struct{
} none; //} none;
struct{ struct{
u8 amount; u8 amount;
} player_damage; } player_damage;
@ -171,8 +171,8 @@ struct ClientEvent
std::string *formspec; std::string *formspec;
std::string *formname; std::string *formname;
} show_formspec; } show_formspec;
struct{ //struct{
} textures_updated; //} textures_updated;
struct{ struct{
v3f *pos; v3f *pos;
v3f *vel; v3f *vel;

@ -179,7 +179,7 @@ void RemoteClient::GetNextBlocks(
s32 nearest_emerged_d = -1; s32 nearest_emerged_d = -1;
s32 nearest_emergefull_d = -1; s32 nearest_emergefull_d = -1;
s32 nearest_sent_d = -1; s32 nearest_sent_d = -1;
bool queue_is_full = false; //bool queue_is_full = false;
s16 d; s16 d;
for(d = d_start; d <= d_max; d++) for(d = d_start; d <= d_max; d++)
@ -214,7 +214,7 @@ void RemoteClient::GetNextBlocks(
// Don't select too many blocks for sending // Don't select too many blocks for sending
if(num_blocks_selected >= max_simul_dynamic) if(num_blocks_selected >= max_simul_dynamic)
{ {
queue_is_full = true; //queue_is_full = true;
goto queue_full_break; goto queue_full_break;
} }

@ -190,7 +190,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
v3f camera_position = m_camera_position; v3f camera_position = m_camera_position;
v3f camera_direction = m_camera_direction; v3f camera_direction = m_camera_direction;
f32 camera_fov = m_camera_fov; f32 camera_fov = m_camera_fov;
v3s16 camera_offset = m_camera_offset; //v3s16 camera_offset = m_camera_offset;
m_camera_mutex.Unlock(); m_camera_mutex.Unlock();
// Use a higher fov to accomodate faster camera movements. // Use a higher fov to accomodate faster camera movements.

@ -707,14 +707,14 @@ void Channel::UpdateTimers(float dtime,bool legacy_peer)
unsigned int packet_loss = 11; /* use a neutral value for initialization */ unsigned int packet_loss = 11; /* use a neutral value for initialization */
unsigned int packets_successfull = 0; unsigned int packets_successfull = 0;
unsigned int packet_too_late = 0; //unsigned int packet_too_late = 0;
bool reasonable_amount_of_data_transmitted = false; bool reasonable_amount_of_data_transmitted = false;
{ {
JMutexAutoLock internal(m_internal_mutex); JMutexAutoLock internal(m_internal_mutex);
packet_loss = current_packet_loss; packet_loss = current_packet_loss;
packet_too_late = current_packet_too_late; //packet_too_late = current_packet_too_late;
packets_successfull = current_packet_successfull; packets_successfull = current_packet_successfull;
if (current_bytes_transfered > (unsigned int) (window_size*512/2)) if (current_bytes_transfered > (unsigned int) (window_size*512/2))

@ -223,7 +223,6 @@ public:
if(m_speed_f.getLength()*dtime > pos_max_d) if(m_speed_f.getLength()*dtime > pos_max_d)
m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime); m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
v3f pos_f = getBasePosition(); v3f pos_f = getBasePosition();
v3f pos_f_old = pos_f;
v3f accel_f = v3f(0,0,0); v3f accel_f = v3f(0,0,0);
f32 stepheight = 0; f32 stepheight = 0;
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(), moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
@ -1488,15 +1487,12 @@ bool PlayerSAO::checkMovementCheat()
*/ */
float player_max_speed = 0; float player_max_speed = 0;
float player_max_speed_up = 0;
if(m_privs.count("fast") != 0){ if(m_privs.count("fast") != 0){
// Fast speed // Fast speed
player_max_speed = m_player->movement_speed_fast; player_max_speed = m_player->movement_speed_fast;
player_max_speed_up = m_player->movement_speed_fast;
} else { } else {
// Normal speed // Normal speed
player_max_speed = m_player->movement_speed_walk; player_max_speed = m_player->movement_speed_walk;
player_max_speed_up = m_player->movement_speed_walk;
} }
// Tolerance. With the lag pool we shouldn't need it. // Tolerance. With the lag pool we shouldn't need it.
//player_max_speed *= 2.5; //player_max_speed *= 2.5;

@ -421,79 +421,74 @@ void draw_scene(video::IVideoDriver* driver, scene::ISceneManager* smgr,
gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes, gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes,
const v2u32& screensize, video::SColor skycolor, bool show_hud) const v2u32& screensize, video::SColor skycolor, bool show_hud)
{ {
//TODO check if usefull TimeTaker timer("smgr");
u32 scenetime = 0;
{
TimeTaker timer("smgr");
bool draw_wield_tool = (show_hud && bool draw_wield_tool = (show_hud &&
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) && (player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
camera.getCameraMode() < CAMERA_MODE_THIRD ); camera.getCameraMode() < CAMERA_MODE_THIRD );
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) && bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT)); (camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
#ifdef HAVE_TOUCHSCREENGUI #ifdef HAVE_TOUCHSCREENGUI
try { try {
draw_crosshair = !g_settings->getBool("touchtarget"); draw_crosshair = !g_settings->getBool("touchtarget");
} }
catch(SettingNotFoundException) {} catch(SettingNotFoundException) {}
#endif #endif
std::string draw_mode = g_settings->get("3d_mode"); std::string draw_mode = g_settings->get("3d_mode");
smgr->drawAll(); smgr->drawAll();
if (draw_mode == "anaglyph") if (draw_mode == "anaglyph")
{ {
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver, draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, draw_wield_tool, client, guienv); smgr, draw_wield_tool, client, guienv);
draw_crosshair = false; draw_crosshair = false;
} }
else if (draw_mode == "interlaced") else if (draw_mode == "interlaced")
{ {
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver, draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor); smgr, screensize, draw_wield_tool, client, guienv, skycolor);
draw_crosshair = false; draw_crosshair = false;
} }
else if (draw_mode == "sidebyside") else if (draw_mode == "sidebyside")
{ {
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver, draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor); smgr, screensize, draw_wield_tool, client, guienv, skycolor);
show_hud = false; show_hud = false;
} }
else if (draw_mode == "topbottom") else if (draw_mode == "topbottom")
{ {
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver, draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor); smgr, screensize, draw_wield_tool, client, guienv, skycolor);
show_hud = false; show_hud = false;
} }
else { else {
draw_plain(camera, show_hud, hud, hilightboxes, driver, draw_plain(camera, show_hud, hud, hilightboxes, driver,
draw_wield_tool, client, guienv); draw_wield_tool, client, guienv);
}
/*
Post effects
*/
{
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
}
//TODO how to make those 3d too
if (show_hud)
{
if (draw_crosshair)
hud.drawCrosshair();
hud.drawHotbar(client.getPlayerItem());
hud.drawLuaElements(camera.getOffset());
}
guienv->drawAll();
scenetime = timer.stop(true);
} }
/*
Post effects
*/
{
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
}
//TODO how to make those 3d too
if (show_hud)
{
if (draw_crosshair)
hud.drawCrosshair();
hud.drawHotbar(client.getPlayerItem());
hud.drawLuaElements(camera.getOffset());
}
guienv->drawAll();
timer.stop(true);
} }
/* /*

@ -433,8 +433,8 @@ struct ClientEnvEvent
{ {
ClientEnvEventType type; ClientEnvEventType type;
union { union {
struct{ //struct{
} none; //} none;
struct{ struct{
u8 amount; u8 amount;
bool send_to_server; bool send_to_server;

@ -364,15 +364,14 @@ void GUIEngine::cloudPostProcess()
{ {
float fps_max = g_settings->getFloat("fps_max"); float fps_max = g_settings->getFloat("fps_max");
// Time of frame without fps limit // Time of frame without fps limit
float busytime;
u32 busytime_u32; u32 busytime_u32;
// not using getRealTime is necessary for wine // not using getRealTime is necessary for wine
u32 time = m_device->getTimer()->getTime(); u32 time = m_device->getTimer()->getTime();
if(time > m_cloud.lasttime) if(time > m_cloud.lasttime)
busytime_u32 = time - m_cloud.lasttime; busytime_u32 = time - m_cloud.lasttime;
else else
busytime_u32 = 0; busytime_u32 = 0;
busytime = busytime_u32 / 1000.0;
// FPS limiter // FPS limiter
u32 frametime_min = 1000./fps_max; u32 frametime_min = 1000./fps_max;

@ -146,10 +146,7 @@ bool JThread::IsSameThread()
void *JThread::TheThread(void *param) void *JThread::TheThread(void *param)
{ {
JThread *jthread; JThread *jthread = (JThread *)param;
void *ret;
jthread = (JThread *)param;
jthread->continuemutex2.Lock(); jthread->continuemutex2.Lock();
jthread->running = true; jthread->running = true;
@ -157,7 +154,7 @@ void *JThread::TheThread(void *param)
jthread->continuemutex.Lock(); jthread->continuemutex.Lock();
jthread->continuemutex.Unlock(); jthread->continuemutex.Unlock();
ret = jthread->Thread(); jthread->Thread();
jthread->running = false; jthread->running = false;

@ -74,8 +74,6 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
v3f position = getPosition(); v3f position = getPosition();
v3f old_speed = m_speed;
// Copy parent position if local player is attached // Copy parent position if local player is attached
if(isAttached) if(isAttached)
{ {

@ -3220,8 +3220,6 @@ bool ServerMap::loadSectorMeta(v2s16 p2d)
{ {
DSTACK(__FUNCTION_NAME); DSTACK(__FUNCTION_NAME);
MapSector *sector = NULL;
// The directory layout we're going to load from. // The directory layout we're going to load from.
// 1 - original sectors/xxxxzzzz/ // 1 - original sectors/xxxxzzzz/
// 2 - new sectors2/xxx/zzz/ // 2 - new sectors2/xxx/zzz/
@ -3241,7 +3239,7 @@ bool ServerMap::loadSectorMeta(v2s16 p2d)
} }
try{ try{
sector = loadSectorMeta(sectordir, loadlayout != 2); loadSectorMeta(sectordir, loadlayout != 2);
} }
catch(InvalidFilenameException &e) catch(InvalidFilenameException &e)
{ {

@ -147,7 +147,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
{ {
#if 1 #if 1
bool no_sunlight = false; bool no_sunlight = false;
bool no_top_block = false; //bool no_top_block = false;
// Check if node above block has sunlight // Check if node above block has sunlight
@ -168,7 +168,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
} }
else else
{ {
no_top_block = true; //no_top_block = true;
// NOTE: This makes over-ground roofed places sunlighted // NOTE: This makes over-ground roofed places sunlighted
// Assume sunlight, unless is_underground==true // Assume sunlight, unless is_underground==true

@ -310,7 +310,6 @@ void Mapgen::spreadLight(v3s16 nmin, v3s16 nmax)
{ {
//TimeTaker t("spreadLight"); //TimeTaker t("spreadLight");
VoxelArea a(nmin, nmax); VoxelArea a(nmin, nmax);
v3s16 em = vm->m_area.getExtent();
for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) { for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) {
for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) { for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) {

@ -438,7 +438,6 @@ void MapgenV6::makeChunk(BlockMakeData *data)
this->ndef = data->nodedef; this->ndef = data->nodedef;
// Hack: use minimum block coords for old code that assumes a single block // Hack: use minimum block coords for old code that assumes a single block
v3s16 blockpos = data->blockpos_requested;
v3s16 blockpos_min = data->blockpos_min; v3s16 blockpos_min = data->blockpos_min;
v3s16 blockpos_max = data->blockpos_max; v3s16 blockpos_max = data->blockpos_max;

@ -1025,10 +1025,6 @@ int ModApiMainMenu::l_download_file(lua_State *L)
/******************************************************************************/ /******************************************************************************/
int ModApiMainMenu::l_get_video_drivers(lua_State *L) int ModApiMainMenu::l_get_video_drivers(lua_State *L)
{ {
unsigned int index = 1;
lua_newtable(L);
int top = lua_gettop(L);
std::vector<irr::video::E_DRIVER_TYPE> drivers std::vector<irr::video::E_DRIVER_TYPE> drivers
= porting::getSupportedVideoDrivers(); = porting::getSupportedVideoDrivers();

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "lua_api/l_base.h" #include "lua_api/l_base.h"
class INodeDefManager; class INodeDefManager;
class NodeResolveInfo; struct NodeResolveInfo;
class DecoSimple; class DecoSimple;
class DecoSchematic; class DecoSchematic;