Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Even more gcc warning options #38222

Merged
merged 10 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,18 @@ IF(MSVC)
ELSE()
SET(CATA_WARNINGS
"-Werror -Wall -Wextra \
-Wformat-signedness \
-Wlogical-op \
-Wmissing-declarations \
-Wmissing-noreturn \
-Wnon-virtual-dtor \
-Wold-style-cast \
-Woverloaded-virtual \
-Wsuggest-override \
-Wpedantic \
-Wredundant-decls \
-Wsuggest-override \
-Wunused-macros \
-Wzero-as-null-pointer-constant \
-Wno-unknown-warning-option")
# Compact the whitespace in the warning string
string(REGEX REPLACE "[\t ]+" " " CATA_WARNINGS "${CATA_WARNINGS}")
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,18 @@
RELEASE_FLAGS =
WARNINGS = \
-Werror -Wall -Wextra \
-Wformat-signedness \
-Wlogical-op \
-Wmissing-declarations \
-Wmissing-noreturn \
-Wnon-virtual-dtor \
-Wold-style-cast \
-Woverloaded-virtual \
-Wpedantic \
-Wredundant-decls \
-Wsuggest-override \
-Wunused-macros \
-Wzero-as-null-pointer-constant \
-Wno-unknown-warning-option
# Uncomment below to disable warnings
#WARNINGS = -w
Expand Down
1 change: 1 addition & 0 deletions src/behavior_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct behavior_return;
class strategy_t
{
public:
virtual ~strategy_t() = default;
virtual behavior_return evaluate( const oracle_t *subject,
std::vector<const node_t *> children ) const = 0;
};
Expand Down
1 change: 1 addition & 0 deletions src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "bionics.h"
#include "calendar.h"
#include "craft_command.h"
#include "crafting_gui.h"
#include "debug.h"
#include "flag.h"
#include "game.h"
Expand Down
2 changes: 0 additions & 2 deletions src/crafting.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ void remove_ammo( item &dis_item, player &p );
// same as above but for each item in the list
void remove_ammo( std::list<item> &dis_items, player &p );

const recipe *select_crafting_recipe( int &batch_size );

#endif
2 changes: 2 additions & 0 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6838,7 +6838,9 @@ static void centerlistview( const tripoint &active_item_position, int ui_width )

}

#if defined(TILES)
#define MAXIMUM_ZOOM_LEVEL 4
#endif
void game::zoom_out()
{
#if defined(TILES)
Expand Down
2 changes: 0 additions & 2 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2512,8 +2512,6 @@ void iexamine::arcfurnace_full( player &, const tripoint &examp )
}
//arc furnace end

void iexamine::fireplace( player &p, const tripoint &examp );

void iexamine::autoclave_empty( player &p, const tripoint &examp )
{
furn_id cur_autoclave_type = g->m.furn( examp );
Expand Down
3 changes: 2 additions & 1 deletion src/inventory_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class inventory_selector_preset
{
public:
inventory_selector_preset();
virtual ~inventory_selector_preset() = default;

/** Does this entry satisfy the basic preset conditions? */
virtual bool is_shown( const item_location & ) const {
Expand Down Expand Up @@ -424,7 +425,7 @@ class inventory_selector
{
public:
inventory_selector( player &u, const inventory_selector_preset &preset = default_preset );
~inventory_selector();
virtual ~inventory_selector();
/** These functions add items from map / vehicles. */
void add_character_items( Character &character );
void add_map_items( const tripoint &target );
Expand Down
1 change: 1 addition & 0 deletions src/item_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class item_stack
using const_reverse_iterator = cata::colony<item>::const_reverse_iterator;

item_stack( cata::colony<item> *items ) : items( items ) { }
virtual ~item_stack() = default;

size_t size() const;
bool empty() const;
Expand Down
2 changes: 0 additions & 2 deletions src/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ extern bool test_mode;
// JSON parsing and serialization tools for Cataclysm-DDA.
// For documentation, see the included header, json.h.

#define dbg(x) DebugLog((x), D_MAIN) << __FILE__ << ":" << __LINE__ << ": "

static bool is_whitespace( char ch )
{
// These are all the valid whitespace characters allowed by RFC 4627.
Expand Down
2 changes: 0 additions & 2 deletions src/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
#include "pldata.h"
#include "string_formatter.h"

#define dbg(x) DebugLog((DebugLevel)(x),D_GAME) << __FILE__ << ":" << __LINE__ << ": "

static const holiday current_holiday = holiday::none;

void main_menu::on_move() const
Expand Down
3 changes: 0 additions & 3 deletions src/mapgen_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ void mapgen_rotate( map *m, oter_id terrain_type, bool north_is_down )
m->rotate( static_cast<int>( north_is_down ? om_direction::opposite( dir ) : dir ) );
}

#define autorotate(x) mapgen_rotate(m, terrain_type, x)
#define autorotate_down() mapgen_rotate(m, terrain_type, true)

/////////////////////////////////////////////////////////////////////////////////////////////////
///// builtin terrain-specific mapgen functions. big multi-overmap-tile terrains are located in
///// mapgen_functions_big.cpp
Expand Down
1 change: 0 additions & 1 deletion src/mission_companion.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ namespace talk_function

//Identifies which mission set the NPC draws from
void companion_mission( npc &p );
void basecamp_mission( npc &p );

// Display the available missions and let the player choose one
bool display_and_choose_opts( mission_data &mission_key, const tripoint &omt_pos,
Expand Down
2 changes: 1 addition & 1 deletion src/ncurses_def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void catacurses::init_interface()
}
#if !defined(__CYGWIN__)
// ncurses mouse registration
mousemask( BUTTON1_CLICKED | BUTTON3_CLICKED | REPORT_MOUSE_POSITION, NULL );
mousemask( BUTTON1_CLICKED | BUTTON3_CLICKED | REPORT_MOUSE_POSITION, nullptr );
#endif
// our curses wrapper does not support changing this behavior, ncurses must
// behave exactly like the wrapper, therefor:
Expand Down
2 changes: 0 additions & 2 deletions src/npctalk_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@

struct itype;

#define dbg(x) DebugLog((DebugLevel)(x), D_NPC) << __FILE__ << ":" << __LINE__ << ": "

void spawn_animal( npc &p, const mtype_id &mon );

void talk_function::nothing( npc & )
Expand Down
2 changes: 0 additions & 2 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
#include <string>
#include <exception>

#define dbg(x) DebugLog((x), D_MAIN) << __FILE__ << ":" << __LINE__ << ": "

bool trigdist;
bool use_tiles;
bool log_from_top;
Expand Down
2 changes: 0 additions & 2 deletions src/overmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ class map_extra;
#define MAX_ANT_SIZE 20
#define MIN_GOO_SIZE 1
#define MAX_GOO_SIZE 2
#define MIN_RIFT_SIZE 6
#define MAX_RIFT_SIZE 16

using oter_type_id = int_id<oter_type_t>;
using oter_type_str_id = string_id<oter_type_t>;
Expand Down
2 changes: 0 additions & 2 deletions src/savegame_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
struct oter_type_t;
struct mutation_branch;

#define dbg(x) DebugLog((DebugLevel)(x),D_GAME) << __FILE__ << ":" << __LINE__ << ": "

static const std::array<std::string, NUM_OBJECTS> obj_type_name = { { "OBJECT_NONE", "OBJECT_ITEM", "OBJECT_ACTOR", "OBJECT_PLAYER",
"OBJECT_NPC", "OBJECT_MONSTER", "OBJECT_VEHICLE", "OBJECT_TRAP", "OBJECT_FIELD",
"OBJECT_TERRAIN", "OBJECT_FURNITURE"
Expand Down
4 changes: 2 additions & 2 deletions src/sounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
# if defined(_WIN32) && !defined(_MSC_VER)
# include "mingw.thread.h"
# endif
#endif

#define dbg(x) DebugLog((x),D_SDL) << __FILE__ << ":" << __LINE__ << ": "
# define dbg(x) DebugLog((x),D_SDL) << __FILE__ << ":" << __LINE__ << ": "
#endif

weather_type previous_weather;
int prev_hostiles = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/worldfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

using namespace std::placeholders;

#define dbg(x) DebugLog((x), D_MAIN) << __FILE__ << ":" << __LINE__ << ": "

// single instance of world generator
std::unique_ptr<worldfactory> world_generator;

Expand Down
4 changes: 2 additions & 2 deletions tests/stomach_contents_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ TEST_CASE( "starve_test_hunger3" )
unsigned int day = 0;
do {
if( print_tests ) {
printf( "day %d: %d\n", day, dummy.get_stored_kcal() );
printf( "day %u: %d\n", day, dummy.get_stored_kcal() );
}
pass_time( dummy, 1_days );
dummy.set_thirst( 0 );
Expand Down Expand Up @@ -163,7 +163,7 @@ TEST_CASE( "all_nutrition_starve_test" )

for( unsigned int day = 0; day <= 20; day++ ) {
if( print_tests ) {
printf( "day %d: %d\n", day, dummy.get_stored_kcal() );
printf( "day %u: %d\n", day, dummy.get_stored_kcal() );
}
pass_time( dummy, 1_days );
dummy.set_thirst( 0 );
Expand Down
8 changes: 4 additions & 4 deletions tools/format/getpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ inline std::string urlDecode( std::string str )
tmp[2] = str[i + 1];
tmp[3] = str[i + 2];
tmp[4] = '\0';
tmpchar = static_cast<char>( strtol( tmp, NULL, 0 ) );
tmpchar = static_cast<char>( strtol( tmp, nullptr, 0 ) );
temp += tmpchar;
i += 2;
continue;
Expand All @@ -65,7 +65,7 @@ inline void initializeGet( std::map <std::string, std::string> &Get )
std::string tmpkey, tmpvalue;
std::string *tmpstr = &tmpkey;
char *raw_get = getenv( "QUERY_STRING" );
if( raw_get == NULL ) {
if( raw_get == nullptr ) {
Get.clear();
return;
}
Expand Down Expand Up @@ -98,9 +98,9 @@ inline void initializePost( std::map <std::string, std::string> &Post )
std::string *tmpstr = &tmpkey;
int content_length;
char *ibuffer;
char *buffer = NULL;
char *buffer = nullptr;
char *strlength = getenv( "CONTENT_LENGTH" );
if( strlength == NULL ) {
if( strlength == nullptr ) {
Post.clear();
return;
}
Expand Down