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

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

View File

@ -656,13 +656,6 @@ else()
set(RELEASE_WARNING_FLAGS "")
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")
# clang does not understand __extern_always_inline but libc headers use it
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")

View File

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

View File

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

View File

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

View File

@ -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 packets_successfull = 0;
unsigned int packet_too_late = 0;
//unsigned int packet_too_late = 0;
bool reasonable_amount_of_data_transmitted = false;
{
JMutexAutoLock internal(m_internal_mutex);
packet_loss = current_packet_loss;
packet_too_late = current_packet_too_late;
//packet_too_late = current_packet_too_late;
packets_successfull = current_packet_successfull;
if (current_bytes_transfered > (unsigned int) (window_size*512/2))

View File

@ -223,7 +223,6 @@ public:
if(m_speed_f.getLength()*dtime > pos_max_d)
m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
v3f pos_f = getBasePosition();
v3f pos_f_old = pos_f;
v3f accel_f = v3f(0,0,0);
f32 stepheight = 0;
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
@ -1488,15 +1487,12 @@ bool PlayerSAO::checkMovementCheat()
*/
float player_max_speed = 0;
float player_max_speed_up = 0;
if(m_privs.count("fast") != 0){
// Fast speed
player_max_speed = m_player->movement_speed_fast;
player_max_speed_up = m_player->movement_speed_fast;
} else {
// Normal speed
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.
//player_max_speed *= 2.5;

View File

@ -421,79 +421,74 @@ void draw_scene(video::IVideoDriver* driver, scene::ISceneManager* smgr,
gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes,
const v2u32& screensize, video::SColor skycolor, bool show_hud)
{
//TODO check if usefull
u32 scenetime = 0;
{
TimeTaker timer("smgr");
TimeTaker timer("smgr");
bool draw_wield_tool = (show_hud &&
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
camera.getCameraMode() < CAMERA_MODE_THIRD );
bool draw_wield_tool = (show_hud &&
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
camera.getCameraMode() < CAMERA_MODE_THIRD );
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
#ifdef HAVE_TOUCHSCREENGUI
try {
draw_crosshair = !g_settings->getBool("touchtarget");
}
catch(SettingNotFoundException) {}
try {
draw_crosshair = !g_settings->getBool("touchtarget");
}
catch(SettingNotFoundException) {}
#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")
{
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, draw_wield_tool, client, guienv);
draw_crosshair = false;
}
else if (draw_mode == "interlaced")
{
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
draw_crosshair = false;
}
else if (draw_mode == "sidebyside")
{
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
show_hud = false;
}
else if (draw_mode == "topbottom")
{
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
show_hud = false;
}
else {
draw_plain(camera, show_hud, hud, hilightboxes, driver,
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);
if (draw_mode == "anaglyph")
{
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, draw_wield_tool, client, guienv);
draw_crosshair = false;
}
else if (draw_mode == "interlaced")
{
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
draw_crosshair = false;
}
else if (draw_mode == "sidebyside")
{
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
show_hud = false;
}
else if (draw_mode == "topbottom")
{
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
show_hud = false;
}
else {
draw_plain(camera, show_hud, hud, hilightboxes, driver,
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();
timer.stop(true);
}
/*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -438,7 +438,6 @@ void MapgenV6::makeChunk(BlockMakeData *data)
this->ndef = data->nodedef;
// 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_max = data->blockpos_max;

View File

@ -1025,10 +1025,6 @@ int ModApiMainMenu::l_download_file(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
= porting::getSupportedVideoDrivers();

View File

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