From 0a74ae4d66c051b19af09e9e8dd4ecce985f1da4 Mon Sep 17 00:00:00 2001 From: John Bytheway Date: Sun, 5 Apr 2020 00:22:54 +0100 Subject: [PATCH] clang-tidy readability_redundant_preprocessor (#39254) * Remove redundant preprocessor check * Enable readability-redundant-preprocessor * Assorted other clang-tidy fixes --- .clang-tidy | 1 - src/cata_tiles.cpp | 5 ----- src/character.h | 2 +- src/game_inventory.cpp | 4 ++-- src/veh_type.h | 2 +- src/vehicle.cpp | 4 ++-- tests/npc_test.cpp | 2 +- 7 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 129b27cf8f1a9..d7607ac2c776e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -53,7 +53,6 @@ readability-*,\ -readability-named-parameter,\ -readability-redundant-control-flow,\ -readability-redundant-declaration,\ --readability-redundant-preprocessor,\ " WarningsAsErrors: '*' HeaderFilterRegex: '(src|test).*' diff --git a/src/cata_tiles.cpp b/src/cata_tiles.cpp index c28c3e42ac22b..296f0d90634c5 100644 --- a/src/cata_tiles.cpp +++ b/src/cata_tiles.cpp @@ -3586,17 +3586,12 @@ std::vector cata_tiles::build_renderer_list() { std::vector renderer_names; std::vector default_renderer_names = { -#if defined(TILES) # if defined(_WIN32) { "direct3d", translate_marker( "direct3d" ) }, # endif { "software", translate_marker( "software" ) }, { "opengl", translate_marker( "opengl" ) }, { "opengles2", translate_marker( "opengles2" ) }, -#else - { "software", translate_marker( "software" ) } -#endif - }; int numRenderDrivers = SDL_GetNumRenderDrivers(); DebugLog( D_INFO, DC_ALL ) << "Number of render drivers on your system: " << numRenderDrivers; diff --git a/src/character.h b/src/character.h index 23bc272b90e24..c20f390390499 100644 --- a/src/character.h +++ b/src/character.h @@ -567,7 +567,7 @@ class Character : public Creature, public visitable int intensity = 0, bool force = false, bool deferred = false ) override; /**Determine if character is susceptible to dis_type and if so apply the symptoms*/ - void expose_to_disease( const diseasetype_id dis_type ); + void expose_to_disease( diseasetype_id dis_type ); /** * Handles end-of-turn processing. */ diff --git a/src/game_inventory.cpp b/src/game_inventory.cpp index 02457983a5e8e..c906909dd4a62 100644 --- a/src/game_inventory.cpp +++ b/src/game_inventory.cpp @@ -1459,9 +1459,9 @@ void game_menus::inv::compare( player &p, const cata::optional &offset ui.on_screen_resize( [&]( ui_adaptor & ui ) { const int half_width = ( TERMX - VIEW_OFFSET_X * 2 ) / 2; const int height = TERMY - VIEW_OFFSET_Y * 2; - w_last_item_info = catacurses::newwin( height, half_width, point( 0, 0 ) ); + w_last_item_info = catacurses::newwin( height, half_width, point_zero ); w_cur_item_info = catacurses::newwin( height, half_width, point( half_width, 0 ) ); - ui.position( point( 0, 0 ), point( half_width * 2, height ) ); + ui.position( point_zero, point( half_width * 2, height ) ); } ); ui.mark_resize(); diff --git a/src/veh_type.h b/src/veh_type.h index 50944457926e1..ede5f3ba77e3b 100644 --- a/src/veh_type.h +++ b/src/veh_type.h @@ -354,7 +354,7 @@ class vpart_info const itype_id &fuel_type ); static void load_wheel( cata::optional &whptr, const JsonObject &jo ); static void load_workbench( cata::optional &wbptr, const JsonObject &jo ); - static void load_rotor( cata::optional &whptr, const JsonObject &jo ); + static void load_rotor( cata::optional &roptr, const JsonObject &jo ); static void load( const JsonObject &jo, const std::string &src ); static void finalize(); static void check(); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 29710e5432a55..88825a996cc17 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -752,13 +752,13 @@ static int get_turn_from_angle( const double angle, const tripoint &vehpos, cons if( angle > 10.0 && angle <= 45.0 ) { return reverse ? 4 : 1; } else if( angle > 45.0 && angle <= 90.0 ) { - return reverse ? 3 : 3; + return 3; } else if( angle > 90.0 && angle < 180.0 ) { return reverse ? 1 : 4; } else if( angle < -10.0 && angle >= -45.0 ) { return reverse ? -4 : -1; } else if( angle < -45.0 && angle >= -90.0 ) { - return reverse ? -3 : -3; + return -3; } else if( angle < -90.0 && angle > -180.0 ) { return reverse ? -1 : -4; // edge case of being exactly on the button for the target. diff --git a/tests/npc_test.cpp b/tests/npc_test.cpp index 62dd5f1fac846..6ee10862cc9f0 100644 --- a/tests/npc_test.cpp +++ b/tests/npc_test.cpp @@ -431,7 +431,7 @@ TEST_CASE( "npc_can_target_player" ) g->faction_manager_ptr->create_if_needed(); - g->place_player( tripoint( 0, 0, 0 ) ); + g->place_player( tripoint_zero ); clear_npcs(); clear_creatures();