Skip to content

Commit e7754ea

Browse files
committed
Enable -Wunused-variable and fix most errors
1 parent 8d551c7 commit e7754ea

47 files changed

Lines changed: 40 additions & 113 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ if(UNIX)
244244
# enable C++11 features
245245
add_definitions(-DLINUX_BUILD)
246246
add_definitions(-D_GLIBCXX_USE_C99)
247-
set(GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror -Wno-unused-variable")
247+
set(GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror")
248248
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g")
249249
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMMON_FLAGS}")
250250
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMMON_FLAGS}")

library/Console-posix.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ namespace DFHack
534534
while(1)
535535
{
536536
unsigned char c;
537-
int isok;
538537
unsigned char seq[2], seq2;
539538
lock->unlock();
540539
if(!read_char(c))

library/Process-linux.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ using namespace DFHack;
4848

4949
Process::Process(const VersionInfoFactory& known_versions) : identified(false), my_pe(0)
5050
{
51-
const char * dir_name = "/proc/self/";
5251
const char * exe_link_name = "/proc/self/exe";
53-
const char * cwd_name = "/proc/self/cwd";
54-
const char * cmdline_name = "/proc/self/cmdline";
55-
int target_result;
5652

5753
// valgrind replaces readlink for /proc/self/exe, but not open.
5854
char self_exe[1024];

library/RemoteClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ bool sendRemoteMessage(CSimpleSocket *socket, int16_t id, const MessageLite *msg
358358

359359
uint8_t *pstart = data + sizeof(RPCMessageHeader);
360360
uint8_t *pend = msg->SerializeWithCachedSizesToArray(pstart);
361-
assert((pend - pstart) == size);
361+
assert((pend - pstart) == size); (void)pend;
362362

363363
int got = socket->Send(data, fullsz);
364364
delete[] data;

library/modules/Buildings.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ uint32_t Buildings::getNumBuildings()
173173

174174
bool Buildings::Read (const uint32_t index, t_building & building)
175175
{
176-
Core & c = Core::getInstance();
177176
df::building *bld = world->buildings.all[index];
178177

179178
building.x1 = bld->x1;
@@ -193,12 +192,10 @@ bool Buildings::Read (const uint32_t index, t_building & building)
193192
bool Buildings::ReadCustomWorkshopTypes(map <uint32_t, string> & btypes)
194193
{
195194
vector <building_def *> & bld_def = world->raws.buildings.all;
196-
uint32_t size = bld_def.size();
197195
btypes.clear();
198196

199-
for (auto iter = bld_def.begin(); iter != bld_def.end();iter++)
197+
for (building_def *temp : bld_def)
200198
{
201-
building_def * temp = *iter;
202199
btypes[temp->id] = temp->code;
203200
}
204201
return true;

library/modules/Gui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
261261
case ViewUnits:
262262
if (ui_selected_unit)
263263
{
264-
if (auto unit = vector_get(world->units.active, *ui_selected_unit))
264+
if (vector_get(world->units.active, *ui_selected_unit))
265265
{
266266
focus += "/Some";
267267

library/modules/Job.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ bool DFHack::Job::removeJob(df::job *job) {
383383
//a great way of recovering since we can't properly destroy the job & we can't leave it
384384
//around. Better to know the moment that becomes a problem.
385385
bool success = disconnectJobGeneralRef(job, ref);
386-
assert(success);
386+
assert(success); (void)success;
387387

388388
vector_erase_at(job->general_refs, 0);
389389
if (ref != NULL) delete ref;

plugins/autochop.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ class ViewscreenAutochop : public dfhack_viewscreen
470470
{
471471
selected_column = 0;
472472

473-
auto last_selected_index = burrows_column.highlighted_index;
474473
burrows_column.clear();
475474

476475
for (df::burrow *burrow : ui->burrows.list)
@@ -825,7 +824,6 @@ struct autochop_hook : public df::viewscreen_dwarfmodest
825824
if (dims.menu_x1 <= 0)
826825
return;
827826

828-
df::ui_sidebar_mode d = ui->main.mode;
829827
if (!isInDesignationMenu())
830828
return;
831829

plugins/autodump.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
350350
size_t numItems = world->items.all.size();
351351

352352
MapCache MC;
353-
int i = 0;
354353
int dumped_total = 0;
355354

356355
int cx, cy, cz;

plugins/autohauler.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,10 +809,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
809809
// Reset step count since at this point it has reached 60
810810
step_count = 0;
811811

812-
// xxx I don't know what this does
813-
uint32_t race = ui->race_id;
814-
uint32_t civ = ui->civ_id;
815-
816812
// Create a vector of units. This will be populated in the following for loop.
817813
std::vector<df::unit *> dwarfs;
818814

0 commit comments

Comments
 (0)