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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2017-06-15 15:45:01 +0000
+++ CMakeLists.txt 2017-06-18 08:24:03 +0000
@@ -127,9 +127,17 @@
127 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")127 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")
128 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")128 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")
129 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")129 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")
130 # NOCOM wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-disabled-macro-expansion")
131 # NOCOM wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-format-pedantic")
132
133 # It is impossible to write code that both GCC and Clang will like,
134 # so we have to switch off the warning for one of them.
135 # http://clang-developers.42468.n3.nabble.com/Question-on-Wswitch-enum-td4025927.html
136 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-switch-enum")
130137
131 # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.138 # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.
132 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")139 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")
140
133 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-unreachable-code")141 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-unreachable-code")
134 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-documentation")142 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-documentation")
135143
136144
=== modified file 'src/base/wexception.h'
--- src/base/wexception.h 2017-01-25 18:55:59 +0000
+++ src/base/wexception.h 2017-06-18 08:24:03 +0000
@@ -36,12 +36,12 @@
36#endif36#endif
37#endif37#endif
3838
39/** class wexception39/** Stupid, simple exception class.
40 *40 *
41 * Stupid, simple exception class. It has the nice bonus that you can give it41 * It has the nice bonus that you can give it sprintf()-style format strings.
42 * sprintf()-style format strings
43 */42 */
44struct WException : public std::exception {43class WException : public std::exception {
44 public:
45 explicit WException(char const* const file, uint32_t const line, char const* const fmt, ...)45 explicit WException(char const* const file, uint32_t const line, char const* const fmt, ...)
46 PRINTF_FORMAT(4, 5);46 PRINTF_FORMAT(4, 5);
4747
@@ -51,7 +51,7 @@
51 */51 */
52 const char* what() const noexcept override;52 const char* what() const noexcept override;
5353
54protected:54 protected:
55 WException() {55 WException() {
56 }56 }
57 std::string what_;57 std::string what_;
5858
=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc 2017-02-12 09:10:57 +0000
+++ src/economy/economy.cc 2017-06-18 08:24:03 +0000
@@ -431,7 +431,9 @@
431 RequestList::iterator const it = std::find(requests_.begin(), requests_.end(), &req);431 RequestList::iterator const it = std::find(requests_.begin(), requests_.end(), &req);
432432
433 if (it == requests_.end()) {433 if (it == requests_.end()) {
434 DIAG_OFF("-Wformat");
434 log("WARNING: remove_request(%p) not in list\n", &req);435 log("WARNING: remove_request(%p) not in list\n", &req);
436 DIAG_ON("-Wformat");
435 return;437 return;
436 }438 }
437439
438440
=== modified file 'src/economy/ware_instance.cc'
--- src/economy/ware_instance.cc 2017-04-23 12:11:19 +0000
+++ src/economy/ware_instance.cc 2017-06-18 08:24:03 +0000
@@ -187,7 +187,9 @@
187187
188WareInstance::~WareInstance() {188WareInstance::~WareInstance() {
189 if (supply_) {189 if (supply_) {
190 DIAG_OFF("-Wformat");
190 molog("Ware %u still has supply %p\n", descr_index_, supply_);191 molog("Ware %u still has supply %p\n", descr_index_, supply_);
192 DIAG_ON("-Wformat");
191 delete supply_;193 delete supply_;
192 }194 }
193}195}
194196
=== modified file 'src/graphic/animation.cc'
--- src/graphic/animation.cc 2017-05-31 21:27:07 +0000
+++ src/graphic/animation.cc 2017-06-18 08:24:03 +0000
@@ -150,7 +150,7 @@
150 if (table.has_key("scale")) {150 if (table.has_key("scale")) {
151 scale_ = table.get_double("scale");151 scale_ = table.get_double("scale");
152 if (scale_ <= 0.0f) {152 if (scale_ <= 0.0f) {
153 throw wexception("Animation scale needs to be > 0.0f, but it is %f. The first image of "153 throw wexception("Animation scale needs to be > 0.0f, but it is %2.2f. The first image of "
154 "this animation is %s",154 "this animation is %s",
155 scale_, image_files_[0].c_str());155 scale_, image_files_[0].c_str());
156 }156 }
157157
=== modified file 'src/graphic/text/bidi.cc'
--- src/graphic/text/bidi.cc 2017-02-18 14:03:02 +0000
+++ src/graphic/text/bidi.cc 2017-06-18 08:24:03 +0000
@@ -492,7 +492,9 @@
492492
493// True if the character is in one of the script's code blocks493// True if the character is in one of the script's code blocks
494bool is_script_character(UChar32 c, UI::FontSets::Selector script) {494bool is_script_character(UChar32 c, UI::FontSets::Selector script) {
495 CLANG_DIAG_OFF("-Wdisabled-macro-expansion")
495 UBlockCode code = ublock_getCode(c);496 UBlockCode code = ublock_getCode(c);
497 CLANG_DIAG_ON("-Wdisabled-macro-expansion")
496 if (kRTLCodeBlocks.count(script) == 1 && kRTLCodeBlocks.at(script).count(code) == 1) {498 if (kRTLCodeBlocks.count(script) == 1 && kRTLCodeBlocks.at(script).count(code) == 1) {
497 return true;499 return true;
498 }500 }
@@ -503,7 +505,9 @@
503}505}
504506
505bool is_rtl_character(UChar32 c) {507bool is_rtl_character(UChar32 c) {
508 CLANG_DIAG_OFF("-Wdisabled-macro-expansion")
506 UBlockCode code = ublock_getCode(c);509 UBlockCode code = ublock_getCode(c);
510 CLANG_DIAG_ON("-Wdisabled-macro-expansion")
507 for (UI::FontSets::Selector script : kRTLScripts) {511 for (UI::FontSets::Selector script : kRTLScripts) {
508 assert(kRTLCodeBlocks.count(script) == 1);512 assert(kRTLCodeBlocks.count(script) == 1);
509 if ((kRTLCodeBlocks.at(script).count(code) == 1)) {513 if ((kRTLCodeBlocks.at(script).count(code) == 1)) {
510514
=== modified file 'src/io/filesystem/filesystem_exceptions.h'
--- src/io/filesystem/filesystem_exceptions.h 2017-01-25 18:55:59 +0000
+++ src/io/filesystem/filesystem_exceptions.h 2017-06-18 08:24:03 +0000
@@ -26,7 +26,8 @@
26/**26/**
27 * Generic problem when dealing with a file or directory27 * Generic problem when dealing with a file or directory
28 */28 */
29struct FileError : public std::runtime_error {29class FileError : public std::runtime_error {
30 public:
30 explicit FileError(const std::string& thrower,31 explicit FileError(const std::string& thrower,
31 const std::string& filename,32 const std::string& filename,
32 const std::string& message = "problem with file/directory")33 const std::string& message = "problem with file/directory")
@@ -39,7 +40,8 @@
39 * A file/directory could not be found. Either it really does not exist or there40 * A file/directory could not be found. Either it really does not exist or there
40 * are problems with the path, e.g. loops or nonexistent path components41 * are problems with the path, e.g. loops or nonexistent path components
41 */42 */
42struct FileNotFoundError : public FileError {43class FileNotFoundError : public FileError {
44 public:
43 explicit FileNotFoundError(const std::string& thrower,45 explicit FileNotFoundError(const std::string& thrower,
44 const std::string& filename,46 const std::string& filename,
45 const std::string& message = "could not find file or directory")47 const std::string& message = "could not find file or directory")
@@ -51,7 +53,8 @@
51/**53/**
52 * The file/directory is of an unexpected type. Reasons can be given via message54 * The file/directory is of an unexpected type. Reasons can be given via message
53 */55 */
54struct FileTypeError : public FileError {56class FileTypeError : public FileError {
57 public:
55 explicit FileTypeError(const std::string& thrower,58 explicit FileTypeError(const std::string& thrower,
56 const std::string& filename,59 const std::string& filename,
57 const std::string& message = "file or directory has wrong type")60 const std::string& message = "file or directory has wrong type")
@@ -63,7 +66,8 @@
63/**66/**
64 * The operating system denied access to the file/directory in question67 * The operating system denied access to the file/directory in question
65 */68 */
66struct FileAccessDeniedError : public FileError {69class FileAccessDeniedError : public FileError {
70 public:
67 explicit FileAccessDeniedError(const std::string& thrower,71 explicit FileAccessDeniedError(const std::string& thrower,
68 const std::string& filename,72 const std::string& filename,
69 const std::string& message = "access denied on file or directory")73 const std::string& message = "access denied on file or directory")
@@ -75,8 +79,8 @@
75/**79/**
76 * The directory cannot be created80 * The directory cannot be created
77 */81 */
7882class DirectoryCannotCreateError : public FileError {
79struct DirectoryCannotCreateError : public FileError {83 public:
80 explicit DirectoryCannotCreateError(const std::string& thrower,84 explicit DirectoryCannotCreateError(const std::string& thrower,
81 const std::string& dirname,85 const std::string& dirname,
82 const std::string& message = "cannot create directory")86 const std::string& message = "cannot create directory")
8387
=== modified file 'src/io/streamread.h'
--- src/io/streamread.h 2017-01-25 18:55:59 +0000
+++ src/io/streamread.h 2017-06-18 08:24:03 +0000
@@ -75,7 +75,8 @@
7575
76 /// Base of all exceptions that are caused by errors in the data that is76 /// Base of all exceptions that are caused by errors in the data that is
77 /// read.77 /// read.
78 struct DataError : public WException {78 class DataError : public WException {
79 public:
79 DataError(char const* const fmt, ...) PRINTF_FORMAT(2, 3);80 DataError(char const* const fmt, ...) PRINTF_FORMAT(2, 3);
80 };81 };
81#define data_error(...) DataError(__VA_ARGS__)82#define data_error(...) DataError(__VA_ARGS__)
8283
=== modified file 'src/logic/map_objects/bob.cc'
--- src/logic/map_objects/bob.cc 2017-04-23 12:11:19 +0000
+++ src/logic/map_objects/bob.cc 2017-06-18 08:24:03 +0000
@@ -901,7 +901,9 @@
901901
902/// Give debug information.902/// Give debug information.
903void Bob::log_general_info(const EditorGameBase& egbase) {903void Bob::log_general_info(const EditorGameBase& egbase) {
904 DIAG_OFF("-Wformat"); // GCC warnings can't handle polymorphy with void*
904 molog("Owner: %p\n", owner_);905 molog("Owner: %p\n", owner_);
906 DIAG_ON("-Wformat");
905 molog("Postition: (%i, %i)\n", position_.x, position_.y);907 molog("Postition: (%i, %i)\n", position_.x, position_.y);
906 molog("ActID: %i\n", actid_);908 molog("ActID: %i\n", actid_);
907 molog("ActScheduled: %s\n", actscheduled_ ? "true" : "false");909 molog("ActScheduled: %s\n", actscheduled_ ? "true" : "false");
@@ -926,7 +928,9 @@
926 molog("* ivar2: %i\n", stack_[i].ivar2);928 molog("* ivar2: %i\n", stack_[i].ivar2);
927 molog("* ivar3: %i\n", stack_[i].ivar3);929 molog("* ivar3: %i\n", stack_[i].ivar3);
928930
931 DIAG_OFF("-Wformat");
929 molog("* object pointer: %p\n", stack_[i].objvar1.get(egbase));932 molog("* object pointer: %p\n", stack_[i].objvar1.get(egbase));
933 DIAG_ON("-Wformat");
930 molog("* svar1: %s\n", stack_[i].svar1.c_str());934 molog("* svar1: %s\n", stack_[i].svar1.c_str());
931935
932 molog("* coords: (%i, %i)\n", stack_[i].coords.x, stack_[i].coords.y);936 molog("* coords: (%i, %i)\n", stack_[i].coords.x, stack_[i].coords.y);
@@ -934,7 +938,9 @@
934 for (Direction dir = FIRST_DIRECTION; dir <= LAST_DIRECTION; ++dir) {938 for (Direction dir = FIRST_DIRECTION; dir <= LAST_DIRECTION; ++dir) {
935 molog(" %d", stack_[i].diranims.get_animation(dir));939 molog(" %d", stack_[i].diranims.get_animation(dir));
936 }940 }
941 DIAG_OFF("-Wformat");
937 molog("\n* path: %p\n", stack_[i].path);942 molog("\n* path: %p\n", stack_[i].path);
943 DIAG_ON("-Wformat");
938 if (stack_[i].path) {944 if (stack_[i].path) {
939 const Path& path = *stack_[i].path;945 const Path& path = *stack_[i].path;
940 Path::StepVector::size_type nr_steps = path.get_nsteps();946 Path::StepVector::size_type nr_steps = path.get_nsteps();
@@ -947,9 +953,10 @@
947 molog("* (%i, %i)\n", coords.x, coords.y);953 molog("* (%i, %i)\n", coords.x, coords.y);
948 }954 }
949 }955 }
956 DIAG_OFF("-Wformat");
950 molog("* route: %p\n", stack_[i].route);957 molog("* route: %p\n", stack_[i].route);
951
952 molog("* program: %p\n", stack_[i].route);958 molog("* program: %p\n", stack_[i].route);
959 DIAG_ON("-Wformat");
953 }960 }
954}961}
955962
956963
=== modified file 'src/logic/map_objects/immovable.cc'
--- src/logic/map_objects/immovable.cc 2017-06-15 22:00:08 +0000
+++ src/logic/map_objects/immovable.cc 2017-06-18 08:24:03 +0000
@@ -1329,10 +1329,14 @@
1329void PlayerImmovable::log_general_info(const EditorGameBase& egbase) {1329void PlayerImmovable::log_general_info(const EditorGameBase& egbase) {
1330 BaseImmovable::log_general_info(egbase);1330 BaseImmovable::log_general_info(egbase);
13311331
1332 DIAG_OFF("-Wformat");
1332 molog("this: %p\n", this);1333 molog("this: %p\n", this);
1333 molog("owner_: %p\n", owner_);1334 molog("owner_: %p\n", owner_);
1335 DIAG_ON("-Wformat");
1334 molog("player_number: %i\n", owner_->player_number());1336 molog("player_number: %i\n", owner_->player_number());
1337 DIAG_OFF("-Wformat");
1335 molog("economy_: %p\n", economy_);1338 molog("economy_: %p\n", economy_);
1339 DIAG_ON("-Wformat");
1336}1340}
13371341
1338constexpr uint8_t kCurrentPacketVersionPlayerImmovable = 1;1342constexpr uint8_t kCurrentPacketVersionPlayerImmovable = 1;
13391343
=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc 2017-05-25 13:00:12 +0000
+++ src/logic/map_objects/tribes/building.cc 2017-06-18 08:24:03 +0000
@@ -672,7 +672,9 @@
672 PlayerImmovable::log_general_info(egbase);672 PlayerImmovable::log_general_info(egbase);
673673
674 molog("position: (%i, %i)\n", position_.x, position_.y);674 molog("position: (%i, %i)\n", position_.x, position_.y);
675 DIAG_OFF("-Wformat");
675 molog("flag: %p\n", flag_);676 molog("flag: %p\n", flag_);
677 DIAG_ON("-Wformat");
676 molog("* position: (%i, %i)\n", flag_->get_position().x, flag_->get_position().y);678 molog("* position: (%i, %i)\n", flag_->get_position().x, flag_->get_position().y);
677679
678 molog("anim: %s\n", descr().get_animation_name(anim_).c_str());680 molog("anim: %s\n", descr().get_animation_name(anim_).c_str());
@@ -681,7 +683,9 @@
681 molog("leave_time: %i\n", leave_time_);683 molog("leave_time: %i\n", leave_time_);
682684
683 molog("leave_queue.size(): %lu\n", static_cast<long unsigned int>(leave_queue_.size()));685 molog("leave_queue.size(): %lu\n", static_cast<long unsigned int>(leave_queue_.size()));
686 DIAG_OFF("-Wformat");
684 molog("leave_allow.get(): %p\n", leave_allow_.get(egbase));687 molog("leave_allow.get(): %p\n", leave_allow_.get(egbase));
688 DIAG_ON("-Wformat");
685}689}
686690
687void Building::add_worker(Worker& worker) {691void Building::add_worker(Worker& worker) {
688692
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc 2017-05-03 07:24:06 +0000
+++ src/logic/map_objects/tribes/worker.cc 2017-06-18 08:24:03 +0000
@@ -977,24 +977,34 @@
977 Bob::log_general_info(egbase);977 Bob::log_general_info(egbase);
978978
979 if (upcast(PlayerImmovable, loc, location_.get(egbase))) {979 if (upcast(PlayerImmovable, loc, location_.get(egbase))) {
980 DIAG_OFF("-Wformat");
980 molog("* Owner: (%p)\n", &loc->owner());981 molog("* Owner: (%p)\n", &loc->owner());
982 DIAG_ON("-Wformat");
981 molog("** Owner (plrnr): %i\n", loc->owner().player_number());983 molog("** Owner (plrnr): %i\n", loc->owner().player_number());
984 DIAG_OFF("-Wformat");
982 molog("* Economy: %p\n", loc->get_economy());985 molog("* Economy: %p\n", loc->get_economy());
986 DIAG_ON("-Wformat");
983 }987 }
984988
985 PlayerImmovable* imm = location_.get(egbase);989 PlayerImmovable* imm = location_.get(egbase);
986 molog("location: %u\n", imm ? imm->serial() : 0);990 molog("location: %u\n", imm ? imm->serial() : 0);
991 DIAG_OFF("-Wformat");
987 molog("Economy: %p\n", economy_);992 molog("Economy: %p\n", economy_);
988 molog("transfer: %p\n", transfer_);993 molog("transfer: %p\n", transfer_);
994 DIAG_ON("-Wformat");
989995
990 if (upcast(WareInstance, ware, carried_ware_.get(egbase))) {996 if (upcast(WareInstance, ware, carried_ware_.get(egbase))) {
991 molog("* carried_ware->get_ware() (id): %i\n", ware->descr_index());997 molog("* carried_ware->get_ware() (id): %i\n", ware->descr_index());
998 DIAG_OFF("-Wformat");
992 molog("* carried_ware->get_economy() (): %p\n", ware->get_economy());999 molog("* carried_ware->get_economy() (): %p\n", ware->get_economy());
1000 DIAG_ON("-Wformat");
993 }1001 }
9941002
995 molog("current_exp: %i / %i\n", current_exp_, descr().get_needed_experience());1003 molog("current_exp: %i / %i\n", current_exp_, descr().get_needed_experience());
9961004
1005 DIAG_OFF("-Wformat");
997 molog("supply: %p\n", supply_);1006 molog("supply: %p\n", supply_);
1007 DIAG_ON("-Wformat");
998}1008}
9991009
1000/**1010/**
10011011
=== modified file 'src/network/gamehost.cc'
--- src/network/gamehost.cc 2017-06-15 22:00:08 +0000
+++ src/network/gamehost.cc 2017-06-18 08:24:03 +0000
@@ -65,7 +65,7 @@
6565
66struct HostGameSettingsProvider : public GameSettingsProvider {66struct HostGameSettingsProvider : public GameSettingsProvider {
67 HostGameSettingsProvider(GameHost* const init_host)67 HostGameSettingsProvider(GameHost* const init_host)
68 : host_(init_host), current_wincondition_(0) {68 : host_(init_host) {
69 }69 }
70 ~HostGameSettingsProvider() {70 ~HostGameSettingsProvider() {
71 }71 }
@@ -275,7 +275,6 @@
275275
276private:276private:
277 GameHost* host_;277 GameHost* host_;
278 int16_t current_wincondition_;
279 std::vector<std::string> wincondition_scripts_;278 std::vector<std::string> wincondition_scripts_;
280};279};
281280
282281
=== modified file 'src/network/netclient.cc'
--- src/network/netclient.cc 2017-06-10 16:36:29 +0000
+++ src/network/netclient.cc 2017-06-18 08:24:03 +0000
@@ -68,8 +68,13 @@
68 return;68 return;
6969
70 boost::system::error_code ec;70 boost::system::error_code ec;
71#ifdef NDEBUG
72 boost::asio::write(socket_, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
73#else
71 size_t written =74 size_t written =
72 boost::asio::write(socket_, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);75 boost::asio::write(socket_, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
76#endif
77
73 // TODO(Notabilis): This one is an assertion of mine, I am not sure if it will hold78 // TODO(Notabilis): This one is an assertion of mine, I am not sure if it will hold
74 // If it doesn't, set the socket to blocking before writing79 // If it doesn't, set the socket to blocking before writing
75 // If it does, remove this comment after build 2080 // If it does, remove this comment after build 20
7681
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2017-06-10 16:36:29 +0000
+++ src/network/nethost.cc 2017-06-18 08:24:03 +0000
@@ -170,8 +170,14 @@
170void NetHost::send(const ConnectionId id, const SendPacket& packet) {170void NetHost::send(const ConnectionId id, const SendPacket& packet) {
171 boost::system::error_code ec;171 boost::system::error_code ec;
172 if (is_connected(id)) {172 if (is_connected(id)) {
173#ifdef NDEBUG
174 boost::asio::write(
175 clients_.at(id).socket, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
176#else
173 size_t written = boost::asio::write(177 size_t written = boost::asio::write(
174 clients_.at(id).socket, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);178 clients_.at(id).socket, boost::asio::buffer(packet.get_data(), packet.get_size()), ec);
179#endif
180
175 // TODO(Notabilis): This one is an assertion of mine, I am not sure if it will hold181 // TODO(Notabilis): This one is an assertion of mine, I am not sure if it will hold
176 // If it doesn't, set the socket to blocking before writing182 // If it doesn't, set the socket to blocking before writing
177 // If it does, remove this comment after build 20183 // If it does, remove this comment after build 20
178184
=== modified file 'src/scripting/lua_errors.cc'
--- src/scripting/lua_errors.cc 2017-01-25 18:55:59 +0000
+++ src/scripting/lua_errors.cc 2017-06-18 08:24:03 +0000
@@ -25,3 +25,4 @@
25LuaScriptNotExistingError::LuaScriptNotExistingError(const std::string& name)25LuaScriptNotExistingError::LuaScriptNotExistingError(const std::string& name)
26 : LuaError("The script '" + name + "' was not found!") {26 : LuaError("The script '" + name + "' was not found!") {
27}27}
28
2829
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2017-04-05 14:19:14 +0000
+++ src/scripting/lua_map.cc 2017-06-18 08:24:03 +0000
@@ -4458,7 +4458,7 @@
4458 report_error(L, "<%s> is no valid warehouse policy!", str.c_str());4458 report_error(L, "<%s> is no valid warehouse policy!", str.c_str());
4459}4459}
44604460
4461bool do_set_ware_policy(Warehouse* wh, const DescriptionIndex idx, const Warehouse::StockPolicy p) {4461inline bool do_set_ware_policy(Warehouse* wh, const DescriptionIndex idx, const Warehouse::StockPolicy p) {
4462 wh->set_ware_policy(idx, p);4462 wh->set_ware_policy(idx, p);
4463 return true;4463 return true;
4464}4464}
@@ -4467,7 +4467,7 @@
4467 * Sets the given policy for the given ware in the given warehouse and return true.4467 * Sets the given policy for the given ware in the given warehouse and return true.
4468 * If the no ware with the given name exists for the tribe of the warehouse, return false.4468 * If the no ware with the given name exists for the tribe of the warehouse, return false.
4469 */4469 */
4470bool do_set_ware_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {4470inline bool do_set_ware_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {
4471 const TribeDescr& tribe = wh->owner().tribe();4471 const TribeDescr& tribe = wh->owner().tribe();
4472 DescriptionIndex idx = tribe.ware_index(name);4472 DescriptionIndex idx = tribe.ware_index(name);
4473 if (!tribe.has_ware(idx)) {4473 if (!tribe.has_ware(idx)) {
@@ -4476,7 +4476,7 @@
4476 return do_set_ware_policy(wh, idx, p);4476 return do_set_ware_policy(wh, idx, p);
4477}4477}
44784478
4479bool do_set_worker_policy(Warehouse* wh,4479inline bool do_set_worker_policy(Warehouse* wh,
4480 const DescriptionIndex idx,4480 const DescriptionIndex idx,
4481 const Warehouse::StockPolicy p) {4481 const Warehouse::StockPolicy p) {
4482 const TribeDescr& tribe = wh->owner().tribe();4482 const TribeDescr& tribe = wh->owner().tribe();
@@ -4496,7 +4496,7 @@
4496 * policy.4496 * policy.
4497 * If no worker with the given name exists for the tribe of the warehouse, return false.4497 * If no worker with the given name exists for the tribe of the warehouse, return false.
4498 */4498 */
4499bool do_set_worker_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {4499inline bool do_set_worker_policy(Warehouse* wh, const std::string& name, const Warehouse::StockPolicy p) {
4500 const TribeDescr& tribe = wh->owner().tribe();4500 const TribeDescr& tribe = wh->owner().tribe();
4501 DescriptionIndex idx = tribe.worker_index(name);4501 DescriptionIndex idx = tribe.worker_index(name);
4502 if (!tribe.has_worker(idx)) {4502 if (!tribe.has_worker(idx)) {
@@ -4566,11 +4566,11 @@
45664566
4567// Gets the warehouse policy by ware/worker-name or id4567// Gets the warehouse policy by ware/worker-name or id
4568#define WH_GET_POLICY(type) \4568#define WH_GET_POLICY(type) \
4569 void do_get_##type##_policy(lua_State* L, Warehouse* wh, const DescriptionIndex idx) { \4569 inline void do_get_##type##_policy(lua_State* L, Warehouse* wh, const DescriptionIndex idx) { \
4570 wh_policy_to_string(L, wh->get_##type##_policy(idx)); \4570 wh_policy_to_string(L, wh->get_##type##_policy(idx)); \
4571 } \4571 } \
4572 \4572 \
4573 bool do_get_##type##_policy(lua_State* L, Warehouse* wh, const std::string& name) { \4573 inline bool do_get_##type##_policy(lua_State* L, Warehouse* wh, const std::string& name) { \
4574 const TribeDescr& tribe = wh->owner().tribe(); \4574 const TribeDescr& tribe = wh->owner().tribe(); \
4575 DescriptionIndex idx = tribe.type##_index(name); \4575 DescriptionIndex idx = tribe.type##_index(name); \
4576 if (!tribe.has_##type(idx)) { \4576 if (!tribe.has_##type(idx)) { \
45774577
=== modified file 'src/scripting/test/test_luna.cc'
--- src/scripting/test/test_luna.cc 2017-01-25 18:55:59 +0000
+++ src/scripting/test/test_luna.cc 2017-06-18 08:24:03 +0000
@@ -53,8 +53,7 @@
53 }53 }
54 LuaClass() : x(123), prop(246) {54 LuaClass() : x(123), prop(246) {
55 }55 }
56 virtual ~LuaClass() {56 virtual ~LuaClass();
57 }
58 LuaClass(lua_State* /* L */) : x(124), prop(248) {57 LuaClass(lua_State* /* L */) : x(124), prop(248) {
59 }58 }
60 virtual int test(lua_State* L) {59 virtual int test(lua_State* L) {
@@ -78,6 +77,7 @@
78 void __unpersist(lua_State* /* L */) override {77 void __unpersist(lua_State* /* L */) override {
79 }78 }
80};79};
80LuaClass::~LuaClass() { }
81const char LuaClass::className[] = "Class";81const char LuaClass::className[] = "Class";
82const MethodType<LuaClass> LuaClass::Methods[] = {82const MethodType<LuaClass> LuaClass::Methods[] = {
83 METHOD(LuaClass, test), {nullptr, nullptr},83 METHOD(LuaClass, test), {nullptr, nullptr},
@@ -86,7 +86,7 @@
86PROP_RO(LuaClass, propr)86PROP_RO(LuaClass, propr)
87, PROP_RW(LuaClass, prop1), END_LUNA_PROPERTIES()87, PROP_RW(LuaClass, prop1), END_LUNA_PROPERTIES()
8888
89 class LuaSubClass : public LuaClass {89class LuaSubClass : public LuaClass {
90 int y;90 int y;
9191
92public:92public:
@@ -95,10 +95,7 @@
95 }95 }
96 LuaSubClass(lua_State* L) : LuaClass(L), y(1240) {96 LuaSubClass(lua_State* L) : LuaClass(L), y(1240) {
97 }97 }
98 virtual int subtest(lua_State* L) {98 virtual int subtest(lua_State* L);
99 lua_pushuint32(L, y);
100 return 1;
101 }
102 void __persist(lua_State* /* L */) override {99 void __persist(lua_State* /* L */) override {
103 }100 }
104 void __unpersist(lua_State* /* L */) override {101 void __unpersist(lua_State* /* L */) override {
@@ -111,6 +108,11 @@
111BEGIN_LUNA_PROPERTIES(LuaSubClass)108BEGIN_LUNA_PROPERTIES(LuaSubClass)
112END_LUNA_PROPERTIES()109END_LUNA_PROPERTIES()
113110
111int LuaSubClass::subtest(lua_State* L) {
112 lua_pushuint32(L, y);
113 return 1;
114}
115
114class LuaVirtualClass : public LuaClass {116class LuaVirtualClass : public LuaClass {
115 int z;117 int z;
116118
@@ -120,10 +122,7 @@
120 }122 }
121 LuaVirtualClass(lua_State* L) : LuaClass(L), z(12400) {123 LuaVirtualClass(lua_State* L) : LuaClass(L), z(12400) {
122 }124 }
123 virtual int virtualtest(lua_State* L) {125 virtual int virtualtest(lua_State* L);
124 lua_pushuint32(L, z);
125 return 1;
126 }
127 void __persist(lua_State* /* L */) override {126 void __persist(lua_State* /* L */) override {
128 }127 }
129 void __unpersist(lua_State* /* L */) override {128 void __unpersist(lua_State* /* L */) override {
@@ -136,21 +135,26 @@
136BEGIN_LUNA_PROPERTIES(LuaVirtualClass)135BEGIN_LUNA_PROPERTIES(LuaVirtualClass)
137END_LUNA_PROPERTIES()136END_LUNA_PROPERTIES()
138137
138int LuaVirtualClass::virtualtest(lua_State* L) {
139 lua_pushuint32(L, z);
140 return 1;
141}
142
139class LuaSecond {143class LuaSecond {
140public:144public:
141 int get_second(lua_State* L) {145 int get_second(lua_State* L) {
142 lua_pushint32(L, 2001);146 lua_pushint32(L, 2001);
143 return 1;147 return 1;
144 }148 }
145 virtual ~LuaSecond() {149 virtual ~LuaSecond();
146 }
147
148 virtual int multitest(lua_State* L) {150 virtual int multitest(lua_State* L) {
149 lua_pushint32(L, 2002);151 lua_pushint32(L, 2002);
150 return 1;152 return 1;
151 }153 }
152};154};
153155
156LuaSecond::~LuaSecond() { }
157
154class LuaMultiClass : public LuaClass, public LuaSecond {158class LuaMultiClass : public LuaClass, public LuaSecond {
155 int z;159 int z;
156160
@@ -160,10 +164,7 @@
160 }164 }
161 LuaMultiClass(lua_State* L) : LuaClass(L), z(12400) {165 LuaMultiClass(lua_State* L) : LuaClass(L), z(12400) {
162 }166 }
163 virtual int virtualtest(lua_State* L) {167 virtual int virtualtest(lua_State* L);
164 lua_pushuint32(L, z);
165 return 1;
166 }
167 void __persist(lua_State* /* L */) override {168 void __persist(lua_State* /* L */) override {
168 }169 }
169 void __unpersist(lua_State* /* L */) override {170 void __unpersist(lua_State* /* L */) override {
@@ -177,7 +178,12 @@
177PROP_RO(LuaMultiClass, second)178PROP_RO(LuaMultiClass, second)
178, END_LUNA_PROPERTIES()179, END_LUNA_PROPERTIES()
179180
180 const static struct luaL_Reg wltest[] = {{nullptr, nullptr}};181int LuaMultiClass::virtualtest(lua_State* L) {
182 lua_pushuint32(L, z);
183 return 1;
184}
185
186const static struct luaL_Reg wltest[] = {{nullptr, nullptr}};
181const static struct luaL_Reg wl[] = {{nullptr, nullptr}};187const static struct luaL_Reg wl[] = {{nullptr, nullptr}};
182188
183static int test_check_int(lua_State* L) {189static int test_check_int(lua_State* L) {
184190
=== modified file 'src/ui_basic/progressbar.cc'
--- src/ui_basic/progressbar.cc 2017-05-25 12:30:40 +0000
+++ src/ui_basic/progressbar.cc 2017-06-18 08:24:03 +0000
@@ -86,7 +86,7 @@
8686
87 // Print the state in percent without decimal points.87 // Print the state in percent without decimal points.
88 const std::string progress_text = (boost::format("<font color=%s>%u%%</font>") %88 const std::string progress_text = (boost::format("<font color=%s>%u%%</font>") %
89 UI_FONT_CLR_BRIGHT.hex_value() % floor(fraction * 100.f))89 UI_FONT_CLR_BRIGHT.hex_value() % floorf(fraction * 100.f))
90 .str();90 .str();
91 std::shared_ptr<const UI::RenderedText> rendered_text =91 std::shared_ptr<const UI::RenderedText> rendered_text =
92 UI::g_fh1->render(as_uifont(progress_text));92 UI::g_fh1->render(as_uifont(progress_text));
9393
=== modified file 'src/ui_fsmenu/launch_spg.h'
--- src/ui_fsmenu/launch_spg.h 2017-02-10 14:12:36 +0000
+++ src/ui_fsmenu/launch_spg.h 2017-06-18 08:24:03 +0000
@@ -52,7 +52,7 @@
52 FullscreenMenuLaunchSPG(GameSettingsProvider*, GameController* = nullptr);52 FullscreenMenuLaunchSPG(GameSettingsProvider*, GameController* = nullptr);
53 ~FullscreenMenuLaunchSPG();53 ~FullscreenMenuLaunchSPG();
5454
55 void start();55 void start() override;
56 void refresh() override;56 void refresh() override;
5757
58protected:58protected:

Subscribers

People subscribed via source and target branches

to status/vote changes: