[widelands] 01/05: Add gcc7.patch and fix FTBFS with GCC 7.

Markus Koschany apo at moszumanska.debian.org
Wed Aug 23 22:15:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

apo pushed a commit to branch master
in repository widelands.

commit 2104a15f5898136cc20c929236ec1a8fdb67244f
Author: Markus Koschany <apo at debian.org>
Date:   Wed Aug 23 23:07:32 2017 +0200

    Add gcc7.patch and fix FTBFS with GCC 7.
    
    Closes: #871114
---
 debian/changelog          |   1 +
 debian/patches/gcc7.patch | 859 ++++++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series     |   1 +
 3 files changed, 861 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 92a419e..ed681f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ widelands (1:19+repack-4) UNRELEASED; urgency=medium
   * Vcs-Browser: Use canonical Vcs-URI.
   * Do not convert png files to xpm anymore. Drop imagemagick from B-D.
   * Move font dependencies from widelands to widelands-data. (Closes: #861043)
+  * Add gcc7.patch and fix FTBFS with GCC 7. (Closes: #871114)
 
  -- Markus Koschany <apo at debian.org>  Wed, 23 Aug 2017 22:14:58 +0200
 
diff --git a/debian/patches/gcc7.patch b/debian/patches/gcc7.patch
new file mode 100644
index 0000000..10091e6
--- /dev/null
+++ b/debian/patches/gcc7.patch
@@ -0,0 +1,859 @@
+From: Markus Koschany <apo at debian.org>
+Date: Wed, 23 Aug 2017 23:07:01 +0200
+Subject: gcc7
+
+---
+ .travis.yml                                        | 24 +++++++------------
+ CMakeLists.txt                                     |  5 ++--
+ src/CMakeLists.txt                                 |  1 +
+ src/base/macros.h                                  | 10 ++++++++
+ src/graphic/gl/fill_rect_program.cc                |  6 ++---
+ src/logic/CMakeLists.txt                           | 20 ++++++++++++----
+ src/logic/game_controller.h                        |  2 +-
+ src/logic/game_settings.cc                         |  1 +
+ src/logic/game_settings.h                          | 11 +++++----
+ src/logic/map_objects/immovable.cc                 |  2 +-
+ src/logic/map_objects/tribes/production_program.cc |  3 +--
+ src/logic/map_objects/tribes/ship.cc               |  5 ++--
+ src/logic/mapfringeregion.cc                       | 14 +++++++----
+ src/logic/player_end_result.h                      | 27 ++++++++++++++++++++++
+ src/logic/playersmanager.h                         |  8 +------
+ src/logic/single_player_game_controller.h          |  1 +
+ src/network/netclient.cc                           |  3 +--
+ src/network/netclient.h                            |  1 +
+ src/network/nethost.cc                             |  8 +++----
+ src/network/nethost.h                              |  1 +
+ src/scripting/CMakeLists.txt                       |  1 +
+ src/scripting/lua_game.cc                          |  1 +
+ src/ui_basic/editbox.cc                            | 21 +++++++++--------
+ src/ui_basic/listselect.cc                         | 10 ++++----
+ src/ui_basic/multilineeditbox.cc                   | 17 +++++++-------
+ src/ui_fsmenu/loadgame.cc                          |  5 ++--
+ src/wui/game_summary.cc                            | 11 +++++----
+ src/wui/interactive_base.cc                        | 10 ++++----
+ src/wui/interactive_player.cc                      |  2 +-
+ 29 files changed, 143 insertions(+), 88 deletions(-)
+ create mode 100644 src/logic/game_settings.cc
+ create mode 100644 src/logic/player_end_result.h
+
+diff --git a/.travis.yml b/.travis.yml
+index b894510..f762f8a 100644
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -19,43 +19,35 @@ matrix:
+        env: CLANG_VERSION="3.4" BUILD_TYPE="Debug"
+      - compiler: clang
+        env: CLANG_VERSION="3.5" BUILD_TYPE="Debug"
+-     - compiler: clang
+-       env: CLANG_VERSION="3.6" BUILD_TYPE="Debug"
+-     - compiler: clang
+-       env: CLANG_VERSION="3.7" BUILD_TYPE="Debug"
+-     - compiler: clang
+-       env: CLANG_VERSION="3.8" BUILD_TYPE="Debug"
+      - compiler: clang
+        env: CLANG_VERSION="3.9" BUILD_TYPE="Debug"
++     - compiler: clang
++       env: CLANG_VERSION="4.0" BUILD_TYPE="Debug"
+      - compiler: clang
+        env: CLANG_VERSION="3.4" BUILD_TYPE="Release"
+      - compiler: clang
+        env: CLANG_VERSION="3.5" BUILD_TYPE="Release"
+-     - compiler: clang
+-       env: CLANG_VERSION="3.6" BUILD_TYPE="Release"
+-     - compiler: clang
+-       env: CLANG_VERSION="3.7" BUILD_TYPE="Release"
+-     - compiler: clang
+-       env: CLANG_VERSION="3.8" BUILD_TYPE="Release"
+      - compiler: clang
+        env: CLANG_VERSION="3.9" BUILD_TYPE="Release"
++     - compiler: clang
++       env: CLANG_VERSION="4.0" BUILD_TYPE="Release"
+      - compiler: gcc
+        env: GCC_VERSION="4.7" BUILD_TYPE="Debug"
+      - compiler: gcc
+        env: GCC_VERSION="4.8" BUILD_TYPE="Debug"
+      - compiler: gcc
+        env: GCC_VERSION="4.9" BUILD_TYPE="Debug"
+-     - compiler: gcc
+-       env: GCC_VERSION="5" BUILD_TYPE="Debug"
+      - compiler: gcc
+        env: GCC_VERSION="6" BUILD_TYPE="Debug"
++     - compiler: gcc
++       env: GCC_VERSION="7" BUILD_TYPE="Debug"
+      - compiler: gcc
+        env: GCC_VERSION="4.7" BUILD_TYPE="Release"
+      - compiler: gcc
+        env: GCC_VERSION="4.8" BUILD_TYPE="Release"
+      - compiler: gcc
+        env: GCC_VERSION="4.9" BUILD_TYPE="Release"
+-     - compiler: gcc
+-       env: GCC_VERSION="5" BUILD_TYPE="Release"
+      - compiler: gcc
+        env: GCC_VERSION="6" BUILD_TYPE="Release"
++     - compiler: gcc
++       env: GCC_VERSION="7" BUILD_TYPE="Release"
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f6f1bff..d08355f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -119,7 +119,6 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")
+-  wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-implicit-fallthrough")
+ 
+   # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")
+@@ -135,6 +134,9 @@ else()
+   if(WIN32)
+     # This is needed for getenv().
+     wl_add_flag(WL_GENERIC_CXX_FLAGS "-std=gnu++11")
++  else()
++    # SDL and MinGW both declare 'unsigned int __builtin_ia32_crc32qi(unsigned int, unsigned char)', resulting in lots of warnings. So, we can't have this flag in Windows.
++    wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls")
+   endif()
+ 
+   if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8))
+@@ -170,7 +172,6 @@ else()
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Woverlength-strings")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpacked")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpointer-arith")
+-  wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsign-promo")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsync-nand")
+   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wtrampolines")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index ff21685..6512646 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -113,6 +113,7 @@ wl_library(widelands_ball_of_mud
+     logic
+     logic_game_controller
+     logic_game_settings
++    logic_single_player_game_settings
+     map_io_map_loader
+     network
+     profile
+diff --git a/src/base/macros.h b/src/base/macros.h
+index 29ec81c..c9b2169 100644
+--- a/src/base/macros.h
++++ b/src/base/macros.h
+@@ -67,6 +67,16 @@
+ #define DIAG_OFF(x) GCC_DIAG_OFF(x) CLANG_DIAG_OFF(x)
+ #define DIAG_ON(x) GCC_DIAG_ON(x) CLANG_DIAG_ON(x)
+ 
++// For switch statements: Tell gcc7 and clang that a fallthrough is intended
++// https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
++#ifdef __clang__
++#define FALLS_THROUGH /* Falls through */ [[clang::fallthrough]]
++#elif __GNUC__ >= 7
++#define FALLS_THROUGH /* Falls through */ [[gnu::fallthrough]]
++#else
++#define FALLS_THROUGH /* Falls through */
++#endif
++
+ // disallow copying or assigning a class
+ #define DISALLOW_COPY_AND_ASSIGN(TypeName)                                                         \
+ 	TypeName(const TypeName&) = delete;                                                             \
+diff --git a/src/graphic/gl/fill_rect_program.cc b/src/graphic/gl/fill_rect_program.cc
+index bbc36ef..568a360 100644
+--- a/src/graphic/gl/fill_rect_program.cc
++++ b/src/graphic/gl/fill_rect_program.cc
+@@ -21,7 +21,7 @@
+ 
+ #include <vector>
+ 
+-#include "base/log.h"
++#include "base/macros.h"
+ #include "base/wexception.h"
+ 
+ // static
+@@ -66,7 +66,7 @@ void FillRectProgram::draw(const std::vector<Arguments>& arguments) {
+ 		switch (template_args.blend_mode) {
+ 		case BlendMode::Subtract:
+ 			glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
+-		/* fallthrough intended */
++			FALLS_THROUGH;
+ 		case BlendMode::UseAlpha:
+ 			glBlendFunc(GL_ONE, GL_ONE);
+ 			break;
+@@ -132,7 +132,7 @@ void FillRectProgram::draw(const std::vector<Arguments>& arguments) {
+ 		switch (template_args.blend_mode) {
+ 		case BlendMode::Subtract:
+ 			glBlendEquation(GL_FUNC_ADD);
+-		/* fallthrough intended */
++			FALLS_THROUGH;
+ 		case BlendMode::UseAlpha:
+ 			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ 			break;
+diff --git a/src/logic/CMakeLists.txt b/src/logic/CMakeLists.txt
+index 120dd82..f3f2470 100644
+--- a/src/logic/CMakeLists.txt
++++ b/src/logic/CMakeLists.txt
+@@ -4,20 +4,29 @@ wl_library(logic_widelands_geometry
+     widelands_geometry.h
+ )
+ 
+-wl_library(logic_game_settings
++ wl_library(logic_game_settings
+   SRCS
++    game_settings.cc
+     game_settings.h
+-    single_player_game_settings_provider.cc
+-    single_player_game_settings_provider.h
++    player_end_result.h
+   DEPENDS
+-    ai
+-    base_exceptions
+     io_filesystem
+     logic
+     scripting_lua_interface
+     scripting_lua_table
+ )
+ 
++wl_library(logic_single_player_game_settings
++  SRCS
++    single_player_game_settings_provider.cc
++    single_player_game_settings_provider.h
++  DEPENDS
++    ai
++    base_exceptions
++    logic
++    logic_game_settings
++ )
++
+ wl_library(logic_game_controller
+   SRCS
+     game_controller.h
+@@ -28,6 +37,7 @@ wl_library(logic_game_controller
+   DEPENDS
+     ai
+     logic
++    logic_game_settings
+     profile
+     ui_basic
+     widelands_ball_of_mud
+diff --git a/src/logic/game_controller.h b/src/logic/game_controller.h
+index 06d12c8..bddbc84 100644
+--- a/src/logic/game_controller.h
++++ b/src/logic/game_controller.h
+@@ -22,12 +22,12 @@
+ 
+ #include <string>
+ 
++#include "logic/player_end_result.h"
+ #include "logic/widelands.h"
+ 
+ namespace Widelands {
+ class Game;
+ class PlayerCommand;
+-enum class PlayerEndResult : uint8_t;
+ }
+ 
+ /**
+diff --git a/src/logic/game_settings.cc b/src/logic/game_settings.cc
+new file mode 100644
+index 0000000..e4501e1
+--- /dev/null
++++ b/src/logic/game_settings.cc
+@@ -0,0 +1 @@
++// Dummy to make CMake happy
+diff --git a/src/logic/game_settings.h b/src/logic/game_settings.h
+index 0c56aad..bd57801 100644
+--- a/src/logic/game_settings.h
++++ b/src/logic/game_settings.h
+@@ -26,14 +26,11 @@
+ 
+ #include "io/filesystem/layered_filesystem.h"
+ #include "logic/map_objects/tribes/tribe_basic_info.h"
++#include "logic/player_end_result.h"
+ #include "logic/widelands.h"
+ #include "scripting/lua_interface.h"
+ #include "scripting/lua_table.h"
+ 
+-namespace Widelands {
+-enum class PlayerEndResult : uint8_t;
+-}
+-
+ struct PlayerSettings {
+ 	enum State { stateOpen, stateHuman, stateComputer, stateClosed, stateShared };
+ 
+@@ -60,6 +57,12 @@ struct UserSettings {
+ 		return not_connected() - 1;
+ 	}
+ 
++	UserSettings(Widelands::PlayerEndResult init_result, bool init_ready)
++	   : position(0), name(""), result(init_result), win_condition_string(""), ready(init_ready) {
++	}
++	UserSettings() : UserSettings(Widelands::PlayerEndResult::kUndefined, false) {
++	}
++
+ 	uint8_t position;
+ 	std::string name;
+ 	Widelands::PlayerEndResult result;
+diff --git a/src/logic/map_objects/immovable.cc b/src/logic/map_objects/immovable.cc
+index 3e1ab2e..8886396 100644
+--- a/src/logic/map_objects/immovable.cc
++++ b/src/logic/map_objects/immovable.cc
+@@ -947,7 +947,7 @@ ImmovableProgram::ActSeed::ActSeed(char* parameters, ImmovableDescr& descr) {
+ 				probability = value;
+ 				//  fallthrough
+ 			}
+-			/* no break */
++				FALLS_THROUGH;
+ 			case '\0':
+ 				goto end;
+ 			default:
+diff --git a/src/logic/map_objects/tribes/production_program.cc b/src/logic/map_objects/tribes/production_program.cc
+index c06cc04..95a2aa3 100644
+--- a/src/logic/map_objects/tribes/production_program.cc
++++ b/src/logic/map_objects/tribes/production_program.cc
+@@ -245,9 +245,8 @@ void ProductionProgram::parse_ware_type_group(char*& parameters,
+ 				                    "the specified ware type(s) is only %u, so the group can "
+ 				                    "never be fulfilled by the site",
+ 				                    count, count_max);
+-			//  fallthrough
+ 		}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case '\0':
+ 		case ' ':
+ 			group.second = count;
+diff --git a/src/logic/map_objects/tribes/ship.cc b/src/logic/map_objects/tribes/ship.cc
+index fd2ebcf..b2a7032 100644
+--- a/src/logic/map_objects/tribes/ship.cc
++++ b/src/logic/map_objects/tribes/ship.cc
+@@ -274,14 +274,13 @@ void Ship::ship_update(Game& game, Bob::State& state) {
+ 			return;
+ 		}
+ 		log("Oh no... this ship has no sinking animation :(!\n");
+-	// fall trough
++		FALLS_THROUGH;
+ 	case ShipStates::kSinkAnimation:
+ 		// The sink animation has been played, so finally remove the ship from the map
+ 		pop_task(game);
+ 		remove(game);
+ 		return;
+ 	}
+-
+ 	// if the real update function failed (e.g. nothing to transport), the ship goes idle
+ 	ship_update_idle(game, state);
+ }
+@@ -685,7 +684,7 @@ void Ship::ship_update_idle(Game& game, Bob::State& state) {
+ 			return start_task_idle(game, descr().main_animation(), 1500);
+ 		}
+ 	}
+-
++		FALLS_THROUGH;
+ 	case ShipStates::kExpeditionWaiting:
+ 	case ShipStates::kExpeditionPortspaceFound:
+ 	case ShipStates::kSinkRequest:
+diff --git a/src/logic/mapfringeregion.cc b/src/logic/mapfringeregion.cc
+index 4039e87..52403c1 100644
+--- a/src/logic/mapfringeregion.cc
++++ b/src/logic/mapfringeregion.cc
+@@ -29,9 +29,11 @@ template <> bool MapFringeRegion<Area<FCoords>>::advance(const Map& map) {
+ 		if (area_.radius) {
+ 			remaining_in_phase_ = area_.radius;
+ 			phase_ = 6;
+-		} else
++			// Fallthrough
++		} else {
+ 			return false;
+-	/* no break */
++		}
++		FALLS_THROUGH;
+ 	case 1:
+ 		map.get_trn(area_, &area_);
+ 		break;
+@@ -53,6 +55,7 @@ template <> bool MapFringeRegion<Area<FCoords>>::advance(const Map& map) {
+ 	default:
+ 		NEVER_HERE();
+ 	}
++
+ 	if (--remaining_in_phase_ == 0) {
+ 		remaining_in_phase_ = area_.radius;
+ 		--phase_;
+@@ -66,9 +69,11 @@ template <> bool MapFringeRegion<Area<>>::advance(const Map& map) {
+ 		if (area_.radius) {
+ 			remaining_in_phase_ = area_.radius;
+ 			phase_ = 6;
+-		} else
++			// Fallthrough
++		} else {
+ 			return false;
+-	/* no break */
++		}
++		FALLS_THROUGH;
+ 	case 1:
+ 		map.get_trn(area_, &area_);
+ 		break;
+@@ -90,6 +95,7 @@ template <> bool MapFringeRegion<Area<>>::advance(const Map& map) {
+ 	default:
+ 		NEVER_HERE();
+ 	}
++
+ 	if (--remaining_in_phase_ == 0) {
+ 		remaining_in_phase_ = area_.radius;
+ 		--phase_;
+diff --git a/src/logic/player_end_result.h b/src/logic/player_end_result.h
+new file mode 100644
+index 0000000..1f794d2
+--- /dev/null
++++ b/src/logic/player_end_result.h
+@@ -0,0 +1,27 @@
++/*
++ * Copyright (C) 2008-2017 by the Widelands Development Team
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
++ *
++ */
++
++#ifndef WL_LOGIC_PLAYER_END_RESULT_H
++#define WL_LOGIC_PLAYER_END_RESULT_H
++
++namespace Widelands {
++enum class PlayerEndResult : uint8_t { kLost = 0, kWon = 1, kResigned = 2, kUndefined = 255 };
++}
++
++#endif  // end of include guard: WL_LOGIC_PLAYER_END_RESULT_H
+diff --git a/src/logic/playersmanager.h b/src/logic/playersmanager.h
+index 19303f4..585e691 100644
+--- a/src/logic/playersmanager.h
++++ b/src/logic/playersmanager.h
+@@ -24,6 +24,7 @@
+ #include <vector>
+ 
+ #include "logic/constants.h"
++#include "logic/player_end_result.h"
+ #include "logic/widelands.h"
+ 
+ namespace Widelands {
+@@ -32,13 +33,6 @@ class EditorGameBase;
+ class Player;
+ class Player;
+ 
+-enum class PlayerEndResult : uint8_t {
+-	PLAYER_LOST = 0,
+-	PLAYER_WON = 1,
+-	PLAYER_RESIGNED = 2,
+-	UNDEFINED = 255
+-};
+-
+ /**
+  * Hold data once a player left the game, or on game ends.
+  * Allowed values for the info string, as key=value pairs separated
+diff --git a/src/logic/single_player_game_controller.h b/src/logic/single_player_game_controller.h
+index 926748b..5279af9 100644
+--- a/src/logic/single_player_game_controller.h
++++ b/src/logic/single_player_game_controller.h
+@@ -22,6 +22,7 @@
+ 
+ #include "ai/computer_player.h"
+ #include "logic/game_controller.h"
++#include "logic/player_end_result.h"
+ 
+ class SinglePlayerGameController : public GameController {
+ public:
+diff --git a/src/network/netclient.cc b/src/network/netclient.cc
+index dba73fc..c476ae3 100644
+--- a/src/network/netclient.cc
++++ b/src/network/netclient.cc
+@@ -476,8 +476,7 @@ void NetClient::receive_one_user(uint32_t const number, StreamRead& packet) {
+ 
+ 	// This might happen, if a users connects after the game starts.
+ 	if (number == d->settings.users.size()) {
+-		UserSettings newuser;
+-		d->settings.users.push_back(newuser);
++		d->settings.users.push_back(*new UserSettings());
+ 	}
+ 
+ 	d->settings.users.at(number).name = packet.string();
+diff --git a/src/network/netclient.h b/src/network/netclient.h
+index 324b643..6320be6 100644
+--- a/src/network/netclient.h
++++ b/src/network/netclient.h
+@@ -23,6 +23,7 @@
+ #include "chat/chat.h"
+ #include "logic/game_controller.h"
+ #include "logic/game_settings.h"
++#include "logic/player_end_result.h"
+ #include "network/network.h"
+ 
+ struct NetClientImpl;
+diff --git a/src/network/nethost.cc b/src/network/nethost.cc
+index a6a159c..131041b 100644
+--- a/src/network/nethost.cc
++++ b/src/network/nethost.cc
+@@ -143,7 +143,7 @@ struct HostGameSettingsProvider : public GameSettingsProvider {
+ 				newstate = PlayerSettings::stateClosed;
+ 				break;
+ 			}  // else fall through
+-		      /* no break */
++			FALLS_THROUGH;
+ 		case PlayerSettings::stateComputer: {
+ 			const ComputerPlayer::ImplementationVector& impls = ComputerPlayer::get_implementations();
+ 			ComputerPlayer::ImplementationVector::const_iterator it = impls.begin();
+@@ -1605,14 +1605,14 @@ void NetHost::welcome_client(uint32_t const number, std::string& playername) {
+ 		for (uint32_t i = 0; i < d->settings.users.size(); ++i)
+ 			if (d->settings.users[i].position == UserSettings::not_connected()) {
+ 				client.usernum = i;
+-				d->settings.users[i].result = Widelands::PlayerEndResult::UNDEFINED;
++				d->settings.users[i].result = Widelands::PlayerEndResult::kUndefined;
+ 				d->settings.users[i].ready = true;
+ 				break;
+ 			}
+ 	if (client.usernum == -1) {
+ 		client.usernum = d->settings.users.size();
+ 		UserSettings newuser;
+-		newuser.result = Widelands::PlayerEndResult::UNDEFINED;
++		newuser.result = Widelands::PlayerEndResult::kUndefined;
+ 		newuser.ready = true;
+ 		d->settings.users.push_back(newuser);
+ 	}
+@@ -2404,7 +2404,7 @@ void NetHost::report_result(uint8_t p_nr,
+ 		if (user.position == p_nr - 1) {
+ 			user.result = result;
+ 			user.win_condition_string = info;
+-			if (result == Widelands::PlayerEndResult::PLAYER_LOST) {
++			if (result == Widelands::PlayerEndResult::kLost) {
+ 				send_system_message_code("PLAYER_DEFEATED", user.name);
+ 			}
+ 		}
+diff --git a/src/network/nethost.h b/src/network/nethost.h
+index 04fe9e4..543d7bb 100644
+--- a/src/network/nethost.h
++++ b/src/network/nethost.h
+@@ -22,6 +22,7 @@
+ 
+ #include "logic/game_controller.h"
+ #include "logic/game_settings.h"
++#include "logic/player_end_result.h"
+ #include "logic/widelands.h"
+ #include "network/network.h"
+ 
+diff --git a/src/scripting/CMakeLists.txt b/src/scripting/CMakeLists.txt
+index 493631d..13aac75 100644
+--- a/src/scripting/CMakeLists.txt
++++ b/src/scripting/CMakeLists.txt
+@@ -110,6 +110,7 @@ wl_library(scripting_logic
+     logic
+     logic_campaign_visibility
+     logic_game_controller
++    logic_game_settings
+     logic_widelands_geometry
+     map_io
+     scripting_base
+diff --git a/src/scripting/lua_game.cc b/src/scripting/lua_game.cc
+index f78c386..bedc4cd 100644
+--- a/src/scripting/lua_game.cc
++++ b/src/scripting/lua_game.cc
+@@ -33,6 +33,7 @@
+ #include "logic/objective.h"
+ #include "logic/path.h"
+ #include "logic/player.h"
++#include "logic/player_end_result.h"
+ #include "logic/playersmanager.h"
+ #include "scripting/globals.h"
+ #include "scripting/lua_interface.h"
+diff --git a/src/ui_basic/editbox.cc b/src/ui_basic/editbox.cc
+index ca6aceb..18b6cff 100644
+--- a/src/ui_basic/editbox.cc
++++ b/src/ui_basic/editbox.cc
+@@ -219,15 +219,16 @@ bool EditBox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_DELETE:
+ 			if (m_->caret < m_->text.size()) {
+ 				while ((m_->text[++m_->caret] & 0xc0) == 0x80) {
+ 				};
+-				// now handle it like Backspace
+-			} else
++				// Now fallthrough to handle it like Backspace
++			} else {
+ 				return true;
+-		/* no break */
++			}
++			FALLS_THROUGH;
+ 		case SDLK_BACKSPACE:
+ 			if (m_->caret > 0) {
+ 				while ((m_->text[--m_->caret] & 0xc0) == 0x80)
+@@ -242,7 +243,7 @@ bool EditBox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_LEFT:
+ 			if (m_->caret > 0) {
+ 				while ((m_->text[--m_->caret] & 0xc0) == 0x80) {
+@@ -260,7 +261,7 @@ bool EditBox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_RIGHT:
+ 			if (m_->caret < m_->text.size()) {
+ 				while ((m_->text[++m_->caret] & 0xc0) == 0x80) {
+@@ -280,7 +281,7 @@ bool EditBox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_HOME:
+ 			if (m_->caret != 0) {
+ 				m_->caret = 0;
+@@ -293,7 +294,7 @@ bool EditBox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_END:
+ 			if (m_->caret != m_->text.size()) {
+ 				m_->caret = m_->text.size();
+@@ -305,7 +306,7 @@ bool EditBox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_UP:
+ 			// Load entry from history if active and text is not empty
+ 			if (history_active_) {
+@@ -323,7 +324,7 @@ bool EditBox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_DOWN:
+ 			// Load entry from history if active and text is not equivalent to the current one
+ 			if (history_active_) {
+diff --git a/src/ui_basic/listselect.cc b/src/ui_basic/listselect.cc
+index 696d4e5..1636f5b 100644
+--- a/src/ui_basic/listselect.cc
++++ b/src/ui_basic/listselect.cc
+@@ -454,9 +454,10 @@ bool BaseListselect::handle_key(bool const down, SDL_Keysym const code) {
+ 		uint32_t selected_idx;
+ 		switch (code.sym) {
+ 		case SDLK_KP_2:
+-			if (code.mod & KMOD_NUM)
++			if (code.mod & KMOD_NUM) {
+ 				break;
+-		/* no break */
++			}
++			FALLS_THROUGH;
+ 		case SDLK_DOWN:
+ 			selected_idx = selection_index() + 1;
+ 			if (selected_idx < size())
+@@ -468,9 +469,10 @@ bool BaseListselect::handle_key(bool const down, SDL_Keysym const code) {
+ 			}
+ 			return true;
+ 		case SDLK_KP_8:
+-			if (code.mod & KMOD_NUM)
++			if (code.mod & KMOD_NUM) {
+ 				break;
+-		/* no break */
++			}
++			FALLS_THROUGH;
+ 		case SDLK_UP:
+ 			selected_idx = selection_index();
+ 			if (selected_idx > 0)
+diff --git a/src/ui_basic/multilineeditbox.cc b/src/ui_basic/multilineeditbox.cc
+index 83830bc..e62ba03 100644
+--- a/src/ui_basic/multilineeditbox.cc
++++ b/src/ui_basic/multilineeditbox.cc
+@@ -235,9 +235,10 @@ bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
+ 			// Let the panel handle the tab key
+ 			return get_parent()->handle_key(true, code);
+ 		case SDLK_KP_PERIOD:
+-			if (code.mod & KMOD_NUM)
++			if (code.mod & KMOD_NUM) {
+ 				break;
+-		/* no break */
++			}
++			FALLS_THROUGH;
+ 		case SDLK_DELETE:
+ 			if (d_->cursor_pos < d_->text.size()) {
+ 				d_->erase_bytes(d_->cursor_pos, d_->next_char(d_->cursor_pos));
+@@ -256,7 +257,7 @@ bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_LEFT: {
+ 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
+ 				uint32_t newpos = d_->prev_char(d_->cursor_pos);
+@@ -279,7 +280,7 @@ bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_RIGHT:
+ 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
+ 				uint32_t newpos = d_->next_char(d_->cursor_pos);
+@@ -297,7 +298,7 @@ bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_DOWN:
+ 			if (d_->cursor_pos < d_->text.size()) {
+ 				d_->refresh_ww();
+@@ -326,7 +327,7 @@ bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_UP:
+ 			if (d_->cursor_pos > 0) {
+ 				d_->refresh_ww();
+@@ -353,7 +354,7 @@ bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_HOME:
+ 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
+ 				d_->set_cursor_pos(0);
+@@ -371,7 +372,7 @@ bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
+ 			if (code.mod & KMOD_NUM) {
+ 				break;
+ 			}
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_END:
+ 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
+ 				d_->set_cursor_pos(d_->text.size());
+diff --git a/src/ui_fsmenu/loadgame.cc b/src/ui_fsmenu/loadgame.cc
+index 5e5fd46..9f5f03e 100644
+--- a/src/ui_fsmenu/loadgame.cc
++++ b/src/ui_fsmenu/loadgame.cc
+@@ -631,9 +631,10 @@ bool FullscreenMenuLoadGame::handle_key(bool down, SDL_Keysym code) {
+ 
+ 	switch (code.sym) {
+ 	case SDLK_KP_PERIOD:
+-		if (code.mod & KMOD_NUM)
++		if (code.mod & KMOD_NUM) {
+ 			break;
+-	/* no break */
++		}
++		FALLS_THROUGH;
+ 	case SDLK_DELETE:
+ 		clicked_delete();
+ 		return true;
+diff --git a/src/wui/game_summary.cc b/src/wui/game_summary.cc
+index c0864cc..496b1c4 100644
+--- a/src/wui/game_summary.cc
++++ b/src/wui/game_summary.cc
+@@ -26,6 +26,7 @@
+ #include "graphic/graphic.h"
+ #include "logic/game.h"
+ #include "logic/player.h"
++#include "logic/player_end_result.h"
+ #include "logic/playersmanager.h"
+ #include "ui_basic/box.h"
+ #include "ui_basic/button.h"
+@@ -147,7 +148,7 @@ void GameSummaryScreen::fill_data() {
+ 		Widelands::PlayerEndStatus pes = players_status.at(i);
+ 		if (ipl && pes.player == ipl->player_number()) {
+ 			local_in_game = true;
+-			local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON;
++			local_won = pes.result == Widelands::PlayerEndResult::kWon;
+ 			current_player_position = i;
+ 		}
+ 		Widelands::Player* p = game_.get_player(pes.player);
+@@ -163,11 +164,11 @@ void GameSummaryScreen::fill_data() {
+ 		// Status
+ 		std::string stat_str;
+ 		switch (pes.result) {
+-		case Widelands::PlayerEndResult::PLAYER_LOST:
++		case Widelands::PlayerEndResult::kLost:
+ 			/** TRANSLATORS: This is shown in the game summary for the players who have lost. */
+ 			stat_str = _("Lost");
+ 			break;
+-		case Widelands::PlayerEndResult::PLAYER_WON:
++		case Widelands::PlayerEndResult::kWon:
+ 			/** TRANSLATORS: This is shown in the game summary for the players who have won. */
+ 			stat_str = _("Won");
+ 			if (!single_won) {
+@@ -176,11 +177,11 @@ void GameSummaryScreen::fill_data() {
+ 				teawon_ = p->team_number();
+ 			}
+ 			break;
+-		case Widelands::PlayerEndResult::PLAYER_RESIGNED:
++		case Widelands::PlayerEndResult::kResigned:
+ 			/** TRANSLATORS: This is shown in the game summary for the players who have resigned. */
+ 			stat_str = _("Resigned");
+ 			break;
+-		case Widelands::PlayerEndResult::UNDEFINED:
++		case Widelands::PlayerEndResult::kUndefined:
+ 			/** TRANSLATORS: This is shown in the game summary when we don't know */
+ 			/** TRANSLATORS: if the player has lost or won. */
+ 			stat_str = pgettext("player_won", "Unknown");
+diff --git a/src/wui/interactive_base.cc b/src/wui/interactive_base.cc
+index 0595cf8..e9c5a24 100644
+--- a/src/wui/interactive_base.cc
++++ b/src/wui/interactive_base.cc
+@@ -774,9 +774,10 @@ bool InteractiveBase::handle_key(bool const down, SDL_Keysym const code) {
+ 	if (down) {
+ 		switch (code.sym) {
+ 		case SDLK_KP_9:
+-			if (code.mod & KMOD_NUM)
++			if (code.mod & KMOD_NUM) {
+ 				break;
+-		/* no break */
++			}
++			FALLS_THROUGH;
+ 		case SDLK_PAGEUP:
+ 			if (upcast(Game, game, &egbase_)) {
+ 				if (GameController* const ctrl = game->game_controller()) {
+@@ -794,9 +795,10 @@ bool InteractiveBase::handle_key(bool const down, SDL_Keysym const code) {
+ 			return true;
+ 
+ 		case SDLK_KP_3:
+-			if (code.mod & KMOD_NUM)
++			if (code.mod & KMOD_NUM) {
+ 				break;
+-		/* no break */
++			}
++			FALLS_THROUGH;
+ 		case SDLK_PAGEDOWN:
+ 			if (upcast(Widelands::Game, game, &egbase_)) {
+ 				if (GameController* const ctrl = game->game_controller()) {
+diff --git a/src/wui/interactive_player.cc b/src/wui/interactive_player.cc
+index 90264a2..79ee1bc 100644
+--- a/src/wui/interactive_player.cc
++++ b/src/wui/interactive_player.cc
+@@ -320,7 +320,7 @@ bool InteractivePlayer::handle_key(bool const down, SDL_Keysym const code) {
+ 		case SDLK_KP_7:
+ 			if (code.mod & KMOD_NUM)
+ 				break;
+-		/* no break */
++			FALLS_THROUGH;
+ 		case SDLK_HOME:
+ 			move_view_to(game().map().get_starting_pos(player_number_));
+ 			return true;
diff --git a/debian/patches/series b/debian/patches/series
index 70c0f36..aaa0a0f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 system-wide_minizip
 hurd_PATH_MAX_missing
 dbg_symbols
+gcc7.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/widelands.git



More information about the Pkg-games-commits mailing list