Eliminate all but three compiler warnings.
Most are banished by use of a new UNUSED macro that expnds to the right GNU C++ attribute but an empty string elsewhere. I have the definition being generated into config.h, which therefore has to be included a few places it wasn't before. There might be a better place to put it.
This commit is contained in:
parent
d574cbec15
commit
8fb016cbe9
12 changed files with 30 additions and 12 deletions
11
configure.ac
11
configure.ac
|
@ -807,7 +807,18 @@ if test "x$lite" = "xno"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
#######################################################################
|
||||
# Make UNUSED available for suppressing warnings of unused parameters #
|
||||
#######################################################################
|
||||
|
||||
AH_VERBATIM([_GNU_SOURCE],
|
||||
[/* Macro for declaring function arguments unused. */
|
||||
#if defined(__GNUC__)
|
||||
# define UNUSED __attribute__((unused)) /* Flag variable as unused */
|
||||
#else /* not __GNUC__ */
|
||||
# define UNUSED
|
||||
#endif
|
||||
])
|
||||
|
||||
#######################################################################
|
||||
# Tune gettext stuff for our needs #
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "ai_interface.hpp"
|
||||
#include "menu_events.hpp"
|
||||
#undef _POSIX_C_SOURCE // avoids a spurious compiler warning
|
||||
#include <Python.h>
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "widgets/progressbar.hpp"
|
||||
#include "widgets/textbox.hpp"
|
||||
#include "wassert.hpp"
|
||||
#include "config.h" // For UNUSED
|
||||
|
||||
#include "sdl_ttf/SDL_ttf.h"
|
||||
|
||||
|
@ -88,7 +89,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
bool can_execute_command(hotkey::HOTKEY_COMMAND cmd, int index=-1) const
|
||||
bool can_execute_command(hotkey::HOTKEY_COMMAND cmd, int index UNUSED) const
|
||||
{
|
||||
return (topic_.empty() == false && cmd == hotkey::HOTKEY_HELP) || cmd == hotkey::HOTKEY_SCREENSHOT;
|
||||
}
|
||||
|
|
|
@ -243,8 +243,8 @@ bool has_focus(const handler* ptr, const SDL_Event* event)
|
|||
} else if(!event_contexts.back().handlers[index]->requires_event_focus(event)) {
|
||||
//if the currently focused handler doesn't need focus for this event
|
||||
//allow the first-in interested handler to take care of it
|
||||
for(int i=0; i<event_contexts.back().handlers.size(); i++) {
|
||||
if(i != index && event_contexts.back().handlers[i]->requires_event_focus(event)) {
|
||||
for(unsigned int i=0; i<event_contexts.back().handlers.size(); i++) {
|
||||
if(i != (unsigned)index && event_contexts.back().handlers[i]->requires_event_focus(event)) {
|
||||
//focus_handler(event_contexts.back().handlers[i]); //steal focus?
|
||||
return event_contexts.back().handlers[i] == ptr;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "font.hpp"
|
||||
#include "preferences.hpp"
|
||||
#include "config.h" // For UNUSED
|
||||
|
||||
namespace gui{
|
||||
floating_textbox::floating_textbox() : box_(NULL), check_(NULL), mode_(TEXTBOX_NONE), label_(0)
|
||||
|
@ -100,7 +101,7 @@ namespace gui{
|
|||
update_location(gui);
|
||||
}
|
||||
|
||||
void floating_textbox::tab(std::vector<team>& teams, const unit_map& units, display& gui)
|
||||
void floating_textbox::tab(std::vector<team>& teams, const unit_map& units UNUSED, display& gui)
|
||||
{
|
||||
if(active() == false) {
|
||||
return;
|
||||
|
|
|
@ -506,7 +506,7 @@ void key_event_execute(display& disp, const SDL_KeyboardEvent& event, command_ex
|
|||
execute_command(disp,hk->get_id(),executor);
|
||||
}
|
||||
|
||||
bool command_executor::execute_command(HOTKEY_COMMAND command, int index)
|
||||
bool command_executor::execute_command(HOTKEY_COMMAND command, int index UNUSED)
|
||||
{
|
||||
switch(command) {
|
||||
case HOTKEY_CYCLE_UNITS:
|
||||
|
|
|
@ -448,7 +448,7 @@ void set_colour_adjustment(int r, int g, int b)
|
|||
}
|
||||
}
|
||||
|
||||
void set_image_mask(const std::string& image)
|
||||
void set_image_mask(const std::string& image UNUSED)
|
||||
{
|
||||
|
||||
//image_mask are blitted in display.cpp
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "video.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "wml_separators.hpp"
|
||||
#include "config.h" // for UNUSED
|
||||
|
||||
#define LOG_NG lg::info(lg::engine)
|
||||
#define LOG_NW LOG_STREAM(info, network)
|
||||
|
@ -41,7 +42,7 @@ namespace {
|
|||
item_size_(empty_rect)
|
||||
{}
|
||||
virtual void init();
|
||||
virtual SDL_Rect item_size(const std::string& item) { return item_size_; }
|
||||
virtual SDL_Rect item_size(const std::string& item UNUSED) { return item_size_; }
|
||||
void set_width(const int width) { item_size_.w = width; }
|
||||
private:
|
||||
SDL_Rect item_size_;
|
||||
|
|
|
@ -20,6 +20,7 @@ See the COPYING file for more details.
|
|||
#include "pathfind.hpp"
|
||||
#include "util.hpp"
|
||||
#include "wassert.hpp"
|
||||
#include "config.h" // For UNUSED
|
||||
|
||||
class gamestatus;
|
||||
|
||||
|
@ -516,7 +517,7 @@ shortest_path_calculator::shortest_path_calculator(unit const &u, team const &t,
|
|||
{
|
||||
}
|
||||
|
||||
double shortest_path_calculator::cost(const gamemap::location& src,const gamemap::location& loc, const double so_far, const bool isDst) const
|
||||
double shortest_path_calculator::cost(const gamemap::location& src UNUSED,const gamemap::location& loc, const double so_far, const bool isDst) const
|
||||
{
|
||||
wassert(map_.on_board(loc));
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "sound.hpp"
|
||||
#include "variable.hpp"
|
||||
#include "wassert.hpp"
|
||||
#include "config.h" // For UNUSED
|
||||
|
||||
#define LOG_NG LOG_STREAM(info, engine)
|
||||
|
||||
|
@ -297,7 +298,7 @@ void play_controller::init_gui(){
|
|||
}
|
||||
}
|
||||
|
||||
void play_controller::init_side(const unsigned int team_index, bool is_replay){
|
||||
void play_controller::init_side(const unsigned int team_index, bool is_replay UNUSED){
|
||||
log_scope("player turn");
|
||||
team& current_team = teams_[team_index];
|
||||
|
||||
|
@ -875,7 +876,7 @@ bool play_controller::in_context_menu(hotkey::HOTKEY_COMMAND command) const
|
|||
|
||||
std::string play_controller::get_action_image(hotkey::HOTKEY_COMMAND command, int index) const
|
||||
{
|
||||
if(index >= 0 && index < wml_commands_.size()) {
|
||||
if(index >= 0 && (unsigned)index < wml_commands_.size()) {
|
||||
wml_menu_item* const& wmi = wml_commands_[index];
|
||||
if(wmi != NULL) {
|
||||
return wmi->image.empty() ? game_config::wml_menu_image : wmi->image;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "widgets/progressbar.hpp"
|
||||
#include "widgets/textbox.hpp"
|
||||
#include "wassert.hpp"
|
||||
#include "config.h" // For UNUSED
|
||||
|
||||
#include "sdl_ttf/SDL_ttf.h"
|
||||
|
||||
|
@ -322,7 +323,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
bool can_execute_command(hotkey::HOTKEY_COMMAND cmd, int index=-1) const
|
||||
bool can_execute_command(hotkey::HOTKEY_COMMAND cmd, int index UNUSED) const
|
||||
{
|
||||
return (topic_.empty() == false && cmd == hotkey::HOTKEY_HELP) || cmd == hotkey::HOTKEY_SCREENSHOT;
|
||||
}
|
||||
|
|
|
@ -618,7 +618,7 @@ void write_music_play_list(config& snapshot)
|
|||
void reposition_sound(int id, unsigned int distance)
|
||||
{
|
||||
audio_lock lock();
|
||||
for(int ch = 0; ch < channel_ids.size(); ++ch) {
|
||||
for(unsigned int ch = 0; ch < channel_ids.size(); ++ch) {
|
||||
int& ch_id = channel_ids[ch];
|
||||
if(ch_id == id) {
|
||||
if(distance >= DISTANCE_SILENT) {
|
||||
|
|
Loading…
Add table
Reference in a new issue