Merge lp:~widelands-dev/widelands/compiler_warnings_062017 into lp:widelands

Proposed by GunChleoc
Status: Rejected
Rejected by: GunChleoc
Proposed branch: lp:~widelands-dev/widelands/compiler_warnings_062017
Merge into: lp:widelands
Diff against target: 583 lines (+106/-43)
20 files modified
CMakeLists.txt (+8/-0)
src/base/wexception.h (+5/-5)
src/economy/economy.cc (+2/-0)
src/economy/ware_instance.cc (+2/-0)
src/graphic/animation.cc (+1/-1)
src/graphic/text/bidi.cc (+4/-0)
src/io/filesystem/filesystem_exceptions.h (+10/-6)
src/io/streamread.h (+2/-1)
src/logic/map_objects/bob.cc (+8/-1)
src/logic/map_objects/immovable.cc (+4/-0)
src/logic/map_objects/tribes/building.cc (+4/-0)
src/logic/map_objects/tribes/worker.cc (+10/-0)
src/network/gamehost.cc (+1/-2)
src/network/netclient.cc (+5/-0)
src/network/nethost.cc (+6/-0)
src/scripting/lua_errors.cc (+1/-0)
src/scripting/lua_map.cc (+6/-6)
src/scripting/test/test_luna.cc (+25/-19)
src/ui_basic/progressbar.cc (+1/-1)
src/ui_fsmenu/launch_spg.h (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/compiler_warnings_062017
Reviewer Review Type Date Requested Status
Klaus Halfmann compile, play Approve
Review via email: mp+325717@code.launchpad.net

Description of the change

Trying to get rid of all compiler warnings.

This isn't ready yet, but I need the Travis builds for the compilers that I don't have.

To post a comment you must log in.
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Ahh, thanks for starting this branch.

I will start with these two:

compiler_warnings_062017/src/scripting/lua_errors.h:27:7: warning: 'LuaError' has no out-of-line virtual method
      definitions; its vtable will be emitted in every translation unit [-Wweak-vtables]
class LuaError : public WException {
      ^
compiler_warnings_062017/src/scripting/lua_errors.h:32:7: warning: 'LuaScriptNotExistingError' has no out-of-line virtual
      method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables]
class LuaScriptNotExistingError : public LuaError {

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Ahh, Ohh, well, mmh. These _can_ result in a lot of duplicate code.
So I will stop checkeing these ... :-)

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Ok next candidate is this one:

src/wui/interactive_base.cc:168:34: warning: instantiation of function
      'Widelands::MapTriangleRegion<Widelands::TCoords<Widelands::Coords>, unsigned short>::MapTriangleRegion' required here, but no definition is available
      [-Wundefined-func-template]
                Widelands::MapTriangleRegion<> mr(map, Area<TCoords<>>(center.triangle, sel_.radius));

No idea how to fix this right now.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 2297. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/243125962.
Appveyor build 2132. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_compiler_warnings_062017-2132.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

I must give up on this template warning.
I do have some ideas but the statemet is to complex for me.

SireVer: please enlighten me.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Sgrìobh Klaus Halfmann na leanas 15/06/2017 aig 15:01:
> I must give up on this template warning.
> I do have some ideas but the statemet is to complex for me.

At least I'm not the only one - makes me feel less dumb *lol*

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

I think we got rid of:
 * all problems with missing overrides / vitual
 * all unneed double promototions

We (well I) still see:
 * -Wformat-pedantic with printf and not void* pointers -> we should not use that flag
 * Problems with recursive macros, No idea about those, yet.
 * multiple instantiation of template functions/classes
    -> to much code is generated that must be eliminated when linking.
    Need SirVer or some other C++Guru to untangle that Template magic?
 * -Wcovered-switch-default problmes with covered switch default
    -> we should ignore these, If we fix it for llvm older gccs will start to complain :-(

Still this could go in, as we fixed auite a lot of warnings that have acuumulated
upto the boost.asi migration.

I will compile this again, and then play a bit if something is seriously broken.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

run the regressions tests, all fine.
Did not do a manual code review.

I think we should get this in and tackle these rest of the warnings
in some other branch.

review: Approve (compile, play)
Revision history for this message
GunChleoc (gunchleoc) wrote :

Are sou still seeing the warning below? If so, I will remove the extra includes, because added code that serves no purpose is not good.

src/wui/interactive_base.cc:168:34: warning: instantiation of function
      'Widelands::MapTriangleRegion<Widelands::TCoords<Widelands::Coords>, unsigned short>::MapTriangleRegion' required here, but no definition is available
      [-Wundefined-func-template]
                Widelands::MapTriangleRegion<> mr(map, Area<TCoords<>>(center.triangle, sel_.radius));

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 2304. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/243539525.
Appveyor build 2132. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_compiler_warnings_062017-2132.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

* Mmmh, looks like the bzr -> git thingy failed,
because .travis.sh definitly is _in_ that branch.

* the gcc fixes did no fix the all fallthrogh / default: warnings for LLVM, sigh

* and yes I still see these:
      src/scripting/lua_map.cc:6053:26: warning: instantiation of function
      'Widelands::MapHollowRegion<Widelands::Area<Widelands::Coords, unsigned short> >::MapHollowRegion' required here, but no definition is available
      [-Wundefined-func-template]
        MapHollowRegion<Area<>> mr(map, har);

What now?

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

The internet dod not help to understand that disabled-macro-expansion warning,
but I have seen it for a year now and it did not harm.

And format-pedantic only complains when using a non void* in a printf like statement.

Gun: we will need a resubmit for travis to compile this again?

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

plyed this again for quite some time, no problems seen

Revision history for this message
GunChleoc (gunchleoc) wrote :

Travis was having problems. I have commented out your last change, because I want to see the logs first. I also switched off some macro expansion warnings locally and need to see whether it worked - we might go for that one rather than blanket disabling.

Revision history for this message
SirVer (sirver) wrote :

I am investigating the weirdness with travis right now. Looking at GitHub [1], the branch only contains partial data and claims to have deleted 37.000 files. Looking at the bzr diff between trunk and this branch shows a smaller diff - so my guess is that bunnybot did not do a good job importing all of this branch. I am nuking bunnybots knowledge of this pull request and let it retry. Sorry for the inconvenience.

[1] https://github.com/widelands/widelands/tree/_widelands_dev_widelands_compiler_warnings_062017

Revision history for this message
SirVer (sirver) wrote :

Redoing the import yielded the exact same state in git as before. According to the git history, the "merged GUNs weak vtables change" deleted most files in the repository, though of course it did not according to bzr.

I think this branch somehow triggered a bug in the git-bzr import script that we use for bunnybot. I cannot fathom how we got into this state. I am unsure what happens if we merge this branch into trunk - maybe this breaks bunnybot for everything going forward or maybe it fixes it.

My suggestion is the following: apply the diff of this branch onto trunk in a new branch, close the current one as abandoned and continue on the other one. Of course this looses the history of this branch, but content trumps IMHO.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Gun: I can eventually setup that new Branch as sirver suggested at tuesday,
I would just call it compiler_warnings_20170618 or such.
OK?

Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes please do :)

Leave this merge request up for now so we can still refer to this discussion while we are working on the other branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2017-06-15 15:45:01 +0000
3+++ CMakeLists.txt 2017-06-18 08:24:03 +0000
4@@ -127,9 +127,17 @@
5 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")
6 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")
7 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")
8+ # NOCOM wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-disabled-macro-expansion")
9+ # NOCOM wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-format-pedantic")
10+
11+ # It is impossible to write code that both GCC and Clang will like,
12+ # so we have to switch off the warning for one of them.
13+ # http://clang-developers.42468.n3.nabble.com/Question-on-Wswitch-enum-td4025927.html
14+ wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-switch-enum")
15
16 # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.
17 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")
18+
19 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-unreachable-code")
20 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-documentation")
21
22
23=== modified file 'src/base/wexception.h'
24--- src/base/wexception.h 2017-01-25 18:55:59 +0000
25+++ src/base/wexception.h 2017-06-18 08:24:03 +0000
26@@ -36,12 +36,12 @@
27 #endif
28 #endif
29
30-/** class wexception
31+/** Stupid, simple exception class.
32 *
33- * Stupid, simple exception class. It has the nice bonus that you can give it
34- * sprintf()-style format strings
35+ * It has the nice bonus that you can give it sprintf()-style format strings.
36 */
37-struct WException : public std::exception {
38+class WException : public std::exception {
39+ public:
40 explicit WException(char const* const file, uint32_t const line, char const* const fmt, ...)
41 PRINTF_FORMAT(4, 5);
42
43@@ -51,7 +51,7 @@
44 */
45 const char* what() const noexcept override;
46
47-protected:
48+ protected:
49 WException() {
50 }
51 std::string what_;
52
53=== modified file 'src/economy/economy.cc'
54--- src/economy/economy.cc 2017-02-12 09:10:57 +0000
55+++ src/economy/economy.cc 2017-06-18 08:24:03 +0000
56@@ -431,7 +431,9 @@
57 RequestList::iterator const it = std::find(requests_.begin(), requests_.end(), &req);
58
59 if (it == requests_.end()) {
60+ DIAG_OFF("-Wformat");
61 log("WARNING: remove_request(%p) not in list\n", &req);
62+ DIAG_ON("-Wformat");
63 return;
64 }
65
66
67=== modified file 'src/economy/ware_instance.cc'
68--- src/economy/ware_instance.cc 2017-04-23 12:11:19 +0000
69+++ src/economy/ware_instance.cc 2017-06-18 08:24:03 +0000
70@@ -187,7 +187,9 @@
71
72 WareInstance::~WareInstance() {
73 if (supply_) {
74+ DIAG_OFF("-Wformat");
75 molog("Ware %u still has supply %p\n", descr_index_, supply_);
76+ DIAG_ON("-Wformat");
77 delete supply_;
78 }
79 }
80
81=== modified file 'src/graphic/animation.cc'
82--- src/graphic/animation.cc 2017-05-31 21:27:07 +0000
83+++ src/graphic/animation.cc 2017-06-18 08:24:03 +0000
84@@ -150,7 +150,7 @@
85 if (table.has_key("scale")) {
86 scale_ = table.get_double("scale");
87 if (scale_ <= 0.0f) {
88- throw wexception("Animation scale needs to be > 0.0f, but it is %f. The first image of "
89+ throw wexception("Animation scale needs to be > 0.0f, but it is %2.2f. The first image of "
90 "this animation is %s",
91 scale_, image_files_[0].c_str());
92 }
93
94=== modified file 'src/graphic/text/bidi.cc'
95--- src/graphic/text/bidi.cc 2017-02-18 14:03:02 +0000
96+++ src/graphic/text/bidi.cc 2017-06-18 08:24:03 +0000
97@@ -492,7 +492,9 @@
98
99 // True if the character is in one of the script's code blocks
100 bool is_script_character(UChar32 c, UI::FontSets::Selector script) {
101+ CLANG_DIAG_OFF("-Wdisabled-macro-expansion")
102 UBlockCode code = ublock_getCode(c);
103+ CLANG_DIAG_ON("-Wdisabled-macro-expansion")
104 if (kRTLCodeBlocks.count(script) == 1 && kRTLCodeBlocks.at(script).count(code) == 1) {
105 return true;
106 }
107@@ -503,7 +505,9 @@
108 }
109
110 bool is_rtl_character(UChar32 c) {
111+ CLANG_DIAG_OFF("-Wdisabled-macro-expansion")
112 UBlockCode code = ublock_getCode(c);
113+ CLANG_DIAG_ON("-Wdisabled-macro-expansion")
114 for (UI::FontSets::Selector script : kRTLScripts) {
115 assert(kRTLCodeBlocks.count(script) == 1);
116 if ((kRTLCodeBlocks.at(script).count(code) == 1)) {
117
118=== modified file 'src/io/filesystem/filesystem_exceptions.h'
119--- src/io/filesystem/filesystem_exceptions.h 2017-01-25 18:55:59 +0000
120+++ src/io/filesystem/filesystem_exceptions.h 2017-06-18 08:24:03 +0000
121@@ -26,7 +26,8 @@
122 /**
123 * Generic problem when dealing with a file or directory
124 */
125-struct FileError : public std::runtime_error {
126+class FileError : public std::runtime_error {
127+ public:
128 explicit FileError(const std::string& thrower,
129 const std::string& filename,
130 const std::string& message = "problem with file/directory")
131@@ -39,7 +40,8 @@
132 * A file/directory could not be found. Either it really does not exist or there
133 * are problems with the path, e.g. loops or nonexistent path components
134 */
135-struct FileNotFoundError : public FileError {
136+class FileNotFoundError : public FileError {
137+ public:
138 explicit FileNotFoundError(const std::string& thrower,
139 const std::string& filename,
140 const std::string& message = "could not find file or directory")
141@@ -51,7 +53,8 @@
142 /**
143 * The file/directory is of an unexpected type. Reasons can be given via message
144 */
145-struct FileTypeError : public FileError {
146+class FileTypeError : public FileError {
147+ public:
148 explicit FileTypeError(const std::string& thrower,
149 const std::string& filename,
150 const std::string& message = "file or directory has wrong type")
151@@ -63,7 +66,8 @@
152 /**
153 * The operating system denied access to the file/directory in question
154 */
155-struct FileAccessDeniedError : public FileError {
156+class FileAccessDeniedError : public FileError {
157+ public:
158 explicit FileAccessDeniedError(const std::string& thrower,
159 const std::string& filename,
160 const std::string& message = "access denied on file or directory")
161@@ -75,8 +79,8 @@
162 /**
163 * The directory cannot be created
164 */
165-
166-struct DirectoryCannotCreateError : public FileError {
167+class DirectoryCannotCreateError : public FileError {
168+ public:
169 explicit DirectoryCannotCreateError(const std::string& thrower,
170 const std::string& dirname,
171 const std::string& message = "cannot create directory")
172
173=== modified file 'src/io/streamread.h'
174--- src/io/streamread.h 2017-01-25 18:55:59 +0000
175+++ src/io/streamread.h 2017-06-18 08:24:03 +0000
176@@ -75,7 +75,8 @@
177
178 /// Base of all exceptions that are caused by errors in the data that is
179 /// read.
180- struct DataError : public WException {
181+ class DataError : public WException {
182+ public:
183 DataError(char const* const fmt, ...) PRINTF_FORMAT(2, 3);
184 };
185 #define data_error(...) DataError(__VA_ARGS__)
186
187=== modified file 'src/logic/map_objects/bob.cc'
188--- src/logic/map_objects/bob.cc 2017-04-23 12:11:19 +0000
189+++ src/logic/map_objects/bob.cc 2017-06-18 08:24:03 +0000
190@@ -901,7 +901,9 @@
191
192 /// Give debug information.
193 void Bob::log_general_info(const EditorGameBase& egbase) {
194+ DIAG_OFF("-Wformat"); // GCC warnings can't handle polymorphy with void*
195 molog("Owner: %p\n", owner_);
196+ DIAG_ON("-Wformat");
197 molog("Postition: (%i, %i)\n", position_.x, position_.y);
198 molog("ActID: %i\n", actid_);
199 molog("ActScheduled: %s\n", actscheduled_ ? "true" : "false");
200@@ -926,7 +928,9 @@
201 molog("* ivar2: %i\n", stack_[i].ivar2);
202 molog("* ivar3: %i\n", stack_[i].ivar3);
203
204+ DIAG_OFF("-Wformat");
205 molog("* object pointer: %p\n", stack_[i].objvar1.get(egbase));
206+ DIAG_ON("-Wformat");
207 molog("* svar1: %s\n", stack_[i].svar1.c_str());
208
209 molog("* coords: (%i, %i)\n", stack_[i].coords.x, stack_[i].coords.y);
210@@ -934,7 +938,9 @@
211 for (Direction dir = FIRST_DIRECTION; dir <= LAST_DIRECTION; ++dir) {
212 molog(" %d", stack_[i].diranims.get_animation(dir));
213 }
214+ DIAG_OFF("-Wformat");
215 molog("\n* path: %p\n", stack_[i].path);
216+ DIAG_ON("-Wformat");
217 if (stack_[i].path) {
218 const Path& path = *stack_[i].path;
219 Path::StepVector::size_type nr_steps = path.get_nsteps();
220@@ -947,9 +953,10 @@
221 molog("* (%i, %i)\n", coords.x, coords.y);
222 }
223 }
224+ DIAG_OFF("-Wformat");
225 molog("* route: %p\n", stack_[i].route);
226-
227 molog("* program: %p\n", stack_[i].route);
228+ DIAG_ON("-Wformat");
229 }
230 }
231
232
233=== modified file 'src/logic/map_objects/immovable.cc'
234--- src/logic/map_objects/immovable.cc 2017-06-15 22:00:08 +0000
235+++ src/logic/map_objects/immovable.cc 2017-06-18 08:24:03 +0000
236@@ -1329,10 +1329,14 @@
237 void PlayerImmovable::log_general_info(const EditorGameBase& egbase) {
238 BaseImmovable::log_general_info(egbase);
239
240+ DIAG_OFF("-Wformat");
241 molog("this: %p\n", this);
242 molog("owner_: %p\n", owner_);
243+ DIAG_ON("-Wformat");
244 molog("player_number: %i\n", owner_->player_number());
245+ DIAG_OFF("-Wformat");
246 molog("economy_: %p\n", economy_);
247+ DIAG_ON("-Wformat");
248 }
249
250 constexpr uint8_t kCurrentPacketVersionPlayerImmovable = 1;
251
252=== modified file 'src/logic/map_objects/tribes/building.cc'
253--- src/logic/map_objects/tribes/building.cc 2017-05-25 13:00:12 +0000
254+++ src/logic/map_objects/tribes/building.cc 2017-06-18 08:24:03 +0000
255@@ -672,7 +672,9 @@
256 PlayerImmovable::log_general_info(egbase);
257
258 molog("position: (%i, %i)\n", position_.x, position_.y);
259+ DIAG_OFF("-Wformat");
260 molog("flag: %p\n", flag_);
261+ DIAG_ON("-Wformat");
262 molog("* position: (%i, %i)\n", flag_->get_position().x, flag_->get_position().y);
263
264 molog("anim: %s\n", descr().get_animation_name(anim_).c_str());
265@@ -681,7 +683,9 @@
266 molog("leave_time: %i\n", leave_time_);
267
268 molog("leave_queue.size(): %lu\n", static_cast<long unsigned int>(leave_queue_.size()));
269+ DIAG_OFF("-Wformat");
270 molog("leave_allow.get(): %p\n", leave_allow_.get(egbase));
271+ DIAG_ON("-Wformat");
272 }
273
274 void Building::add_worker(Worker& worker) {
275
276=== modified file 'src/logic/map_objects/tribes/worker.cc'
277--- src/logic/map_objects/tribes/worker.cc 2017-05-03 07:24:06 +0000
278+++ src/logic/map_objects/tribes/worker.cc 2017-06-18 08:24:03 +0000
279@@ -977,24 +977,34 @@
280 Bob::log_general_info(egbase);
281
282 if (upcast(PlayerImmovable, loc, location_.get(egbase))) {
283+ DIAG_OFF("-Wformat");
284 molog("* Owner: (%p)\n", &loc->owner());
285+ DIAG_ON("-Wformat");
286 molog("** Owner (plrnr): %i\n", loc->owner().player_number());
287+ DIAG_OFF("-Wformat");
288 molog("* Economy: %p\n", loc->get_economy());
289+ DIAG_ON("-Wformat");
290 }
291
292 PlayerImmovable* imm = location_.get(egbase);
293 molog("location: %u\n", imm ? imm->serial() : 0);
294+ DIAG_OFF("-Wformat");
295 molog("Economy: %p\n", economy_);
296 molog("transfer: %p\n", transfer_);
297+ DIAG_ON("-Wformat");
298
299 if (upcast(WareInstance, ware, carried_ware_.get(egbase))) {
300 molog("* carried_ware->get_ware() (id): %i\n", ware->descr_index());
301+ DIAG_OFF("-Wformat");
302 molog("* carried_ware->get_economy() (): %p\n", ware->get_economy());
303+ DIAG_ON("-Wformat");
304 }
305
306 molog("current_exp: %i / %i\n", current_exp_, descr().get_needed_experience());
307
308+ DIAG_OFF("-Wformat");
309 molog("supply: %p\n", supply_);
310+ DIAG_ON("-Wformat");
311 }
312
313 /**
314
315=== modified file 'src/network/gamehost.cc'
316--- src/network/gamehost.cc 2017-06-15 22:00:08 +0000
317+++ src/network/gamehost.cc 2017-06-18 08:24:03 +0000
318@@ -65,7 +65,7 @@
319
320 struct HostGameSettingsProvider : public GameSettingsProvider {
321 HostGameSettingsProvider(GameHost* const init_host)
322- : host_(init_host), current_wincondition_(0) {
323+ : host_(init_host) {
324 }
325 ~HostGameSettingsProvider() {
326 }
327@@ -275,7 +275,6 @@
328
329 private:
330 GameHost* host_;
331- int16_t current_wincondition_;
332 std::vector<std::string> wincondition_scripts_;
333 };
334
335
336=== modified file 'src/network/netclient.cc'
337--- src/network/netclient.cc 2017-06-10 16:36:29 +0000
338+++ src/network/netclient.cc 2017-06-18 08:24:03 +0000
339@@ -68,8 +68,13 @@
340 return;
341
342 boost::system::error_code ec;
343+#ifdef NDEBUG
344+ boost::asio::write(socket_, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
345+#else
346 size_t written =
347 boost::asio::write(socket_, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
348+#endif
349+
350 // TODO(Notabilis): This one is an assertion of mine, I am not sure if it will hold
351 // If it doesn't, set the socket to blocking before writing
352 // If it does, remove this comment after build 20
353
354=== modified file 'src/network/nethost.cc'
355--- src/network/nethost.cc 2017-06-10 16:36:29 +0000
356+++ src/network/nethost.cc 2017-06-18 08:24:03 +0000
357@@ -170,8 +170,14 @@
358 void NetHost::send(const ConnectionId id, const SendPacket& packet) {
359 boost::system::error_code ec;
360 if (is_connected(id)) {
361+#ifdef NDEBUG
362+ boost::asio::write(
363+ clients_.at(id).socket, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
364+#else
365 size_t written = boost::asio::write(
366 clients_.at(id).socket, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
367+#endif
368+
369 // TODO(Notabilis): This one is an assertion of mine, I am not sure if it will hold
370 // If it doesn't, set the socket to blocking before writing
371 // If it does, remove this comment after build 20
372
373=== modified file 'src/scripting/lua_errors.cc'
374--- src/scripting/lua_errors.cc 2017-01-25 18:55:59 +0000
375+++ src/scripting/lua_errors.cc 2017-06-18 08:24:03 +0000
376@@ -25,3 +25,4 @@
377 LuaScriptNotExistingError::LuaScriptNotExistingError(const std::string& name)
378 : LuaError("The script '" + name + "' was not found!") {
379 }
380+
381
382=== modified file 'src/scripting/lua_map.cc'
383--- src/scripting/lua_map.cc 2017-04-05 14:19:14 +0000
384+++ src/scripting/lua_map.cc 2017-06-18 08:24:03 +0000
385@@ -4458,7 +4458,7 @@
386 report_error(L, "<%s> is no valid warehouse policy!", str.c_str());
387 }
388
389-bool do_set_ware_policy(Warehouse* wh, const DescriptionIndex idx, const Warehouse::StockPolicy p) {
390+inline bool do_set_ware_policy(Warehouse* wh, const DescriptionIndex idx, const Warehouse::StockPolicy p) {
391 wh->set_ware_policy(idx, p);
392 return true;
393 }
394@@ -4467,7 +4467,7 @@
395 * Sets the given policy for the given ware in the given warehouse and return true.
396 * If the no ware with the given name exists for the tribe of the warehouse, return false.
397 */
398-bool do_set_ware_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {
399+inline bool do_set_ware_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {
400 const TribeDescr& tribe = wh->owner().tribe();
401 DescriptionIndex idx = tribe.ware_index(name);
402 if (!tribe.has_ware(idx)) {
403@@ -4476,7 +4476,7 @@
404 return do_set_ware_policy(wh, idx, p);
405 }
406
407-bool do_set_worker_policy(Warehouse* wh,
408+inline bool do_set_worker_policy(Warehouse* wh,
409 const DescriptionIndex idx,
410 const Warehouse::StockPolicy p) {
411 const TribeDescr& tribe = wh->owner().tribe();
412@@ -4496,7 +4496,7 @@
413 * policy.
414 * If no worker with the given name exists for the tribe of the warehouse, return false.
415 */
416-bool do_set_worker_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {
417+inline bool do_set_worker_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {
418 const TribeDescr& tribe = wh->owner().tribe();
419 DescriptionIndex idx = tribe.worker_index(name);
420 if (!tribe.has_worker(idx)) {
421@@ -4566,11 +4566,11 @@
422
423 // Gets the warehouse policy by ware/worker-name or id
424 #define WH_GET_POLICY(type) \
425- void do_get_##type##_policy(lua_State* L, Warehouse* wh, const DescriptionIndex idx) { \
426+ inline void do_get_##type##_policy(lua_State* L, Warehouse* wh, const DescriptionIndex idx) { \
427 wh_policy_to_string(L, wh->get_##type##_policy(idx)); \
428 } \
429 \
430- bool do_get_##type##_policy(lua_State* L, Warehouse* wh, const std::string& name) { \
431+ inline bool do_get_##type##_policy(lua_State* L, Warehouse* wh, const std::string& name) { \
432 const TribeDescr& tribe = wh->owner().tribe(); \
433 DescriptionIndex idx = tribe.type##_index(name); \
434 if (!tribe.has_##type(idx)) { \
435
436=== modified file 'src/scripting/test/test_luna.cc'
437--- src/scripting/test/test_luna.cc 2017-01-25 18:55:59 +0000
438+++ src/scripting/test/test_luna.cc 2017-06-18 08:24:03 +0000
439@@ -53,8 +53,7 @@
440 }
441 LuaClass() : x(123), prop(246) {
442 }
443- virtual ~LuaClass() {
444- }
445+ virtual ~LuaClass();
446 LuaClass(lua_State* /* L */) : x(124), prop(248) {
447 }
448 virtual int test(lua_State* L) {
449@@ -78,6 +77,7 @@
450 void __unpersist(lua_State* /* L */) override {
451 }
452 };
453+LuaClass::~LuaClass() { }
454 const char LuaClass::className[] = "Class";
455 const MethodType<LuaClass> LuaClass::Methods[] = {
456 METHOD(LuaClass, test), {nullptr, nullptr},
457@@ -86,7 +86,7 @@
458 PROP_RO(LuaClass, propr)
459 , PROP_RW(LuaClass, prop1), END_LUNA_PROPERTIES()
460
461- class LuaSubClass : public LuaClass {
462+class LuaSubClass : public LuaClass {
463 int y;
464
465 public:
466@@ -95,10 +95,7 @@
467 }
468 LuaSubClass(lua_State* L) : LuaClass(L), y(1240) {
469 }
470- virtual int subtest(lua_State* L) {
471- lua_pushuint32(L, y);
472- return 1;
473- }
474+ virtual int subtest(lua_State* L);
475 void __persist(lua_State* /* L */) override {
476 }
477 void __unpersist(lua_State* /* L */) override {
478@@ -111,6 +108,11 @@
479 BEGIN_LUNA_PROPERTIES(LuaSubClass)
480 END_LUNA_PROPERTIES()
481
482+int LuaSubClass::subtest(lua_State* L) {
483+ lua_pushuint32(L, y);
484+ return 1;
485+}
486+
487 class LuaVirtualClass : public LuaClass {
488 int z;
489
490@@ -120,10 +122,7 @@
491 }
492 LuaVirtualClass(lua_State* L) : LuaClass(L), z(12400) {
493 }
494- virtual int virtualtest(lua_State* L) {
495- lua_pushuint32(L, z);
496- return 1;
497- }
498+ virtual int virtualtest(lua_State* L);
499 void __persist(lua_State* /* L */) override {
500 }
501 void __unpersist(lua_State* /* L */) override {
502@@ -136,21 +135,26 @@
503 BEGIN_LUNA_PROPERTIES(LuaVirtualClass)
504 END_LUNA_PROPERTIES()
505
506+int LuaVirtualClass::virtualtest(lua_State* L) {
507+ lua_pushuint32(L, z);
508+ return 1;
509+}
510+
511 class LuaSecond {
512 public:
513 int get_second(lua_State* L) {
514 lua_pushint32(L, 2001);
515 return 1;
516 }
517- virtual ~LuaSecond() {
518- }
519-
520+ virtual ~LuaSecond();
521 virtual int multitest(lua_State* L) {
522 lua_pushint32(L, 2002);
523 return 1;
524 }
525 };
526
527+LuaSecond::~LuaSecond() { }
528+
529 class LuaMultiClass : public LuaClass, public LuaSecond {
530 int z;
531
532@@ -160,10 +164,7 @@
533 }
534 LuaMultiClass(lua_State* L) : LuaClass(L), z(12400) {
535 }
536- virtual int virtualtest(lua_State* L) {
537- lua_pushuint32(L, z);
538- return 1;
539- }
540+ virtual int virtualtest(lua_State* L);
541 void __persist(lua_State* /* L */) override {
542 }
543 void __unpersist(lua_State* /* L */) override {
544@@ -177,7 +178,12 @@
545 PROP_RO(LuaMultiClass, second)
546 , END_LUNA_PROPERTIES()
547
548- const static struct luaL_Reg wltest[] = {{nullptr, nullptr}};
549+int LuaMultiClass::virtualtest(lua_State* L) {
550+ lua_pushuint32(L, z);
551+ return 1;
552+}
553+
554+const static struct luaL_Reg wltest[] = {{nullptr, nullptr}};
555 const static struct luaL_Reg wl[] = {{nullptr, nullptr}};
556
557 static int test_check_int(lua_State* L) {
558
559=== modified file 'src/ui_basic/progressbar.cc'
560--- src/ui_basic/progressbar.cc 2017-05-25 12:30:40 +0000
561+++ src/ui_basic/progressbar.cc 2017-06-18 08:24:03 +0000
562@@ -86,7 +86,7 @@
563
564 // Print the state in percent without decimal points.
565 const std::string progress_text = (boost::format("<font color=%s>%u%%</font>") %
566- UI_FONT_CLR_BRIGHT.hex_value() % floor(fraction * 100.f))
567+ UI_FONT_CLR_BRIGHT.hex_value() % floorf(fraction * 100.f))
568 .str();
569 std::shared_ptr<const UI::RenderedText> rendered_text =
570 UI::g_fh1->render(as_uifont(progress_text));
571
572=== modified file 'src/ui_fsmenu/launch_spg.h'
573--- src/ui_fsmenu/launch_spg.h 2017-02-10 14:12:36 +0000
574+++ src/ui_fsmenu/launch_spg.h 2017-06-18 08:24:03 +0000
575@@ -52,7 +52,7 @@
576 FullscreenMenuLaunchSPG(GameSettingsProvider*, GameController* = nullptr);
577 ~FullscreenMenuLaunchSPG();
578
579- void start();
580+ void start() override;
581 void refresh() override;
582
583 protected:

Subscribers

People subscribed via source and target branches

to status/vote changes: