Page MenuHomeWildfire Games

Adds containers serialization tests, std::set serialization and movement semantics
ClosedPublic

Authored by vladislavbelov on Oct 3 2019, 6:39 PM.

Details

Reviewers
elexis
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23044: Adds containers serialization tests, std::set serialization and movement…
Summary

Subj.

Test Plan
  1. Apply the patch and compile the game
  2. Run the game and make sure that serialization works
  3. Run tests and make sure that all tests are passed as before the patch.

Diff Detail

Event Timeline

vladislavbelov created this revision.
Vulcan added a comment.Oct 3 2019, 6:42 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/390/display/redirect

Vulcan added a comment.Oct 3 2019, 6:44 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/391/display/redirect

Vulcan added a comment.Oct 3 2019, 6:48 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|   1| /*·Copyright·(C)·2016·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2016"

source/simulation2/serialization/SerializeTemplates.h
|  28| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/905/display/redirect

Vulcan added a comment.Oct 3 2019, 6:53 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  28| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/906/display/redirect

elexis awarded a token.Oct 3 2019, 7:12 PM
Stan awarded a token.Oct 3 2019, 7:17 PM
elexis added a subscriber: elexis.Oct 3 2019, 7:30 PM

Looks very appealing and useful, and I don't see any mistake in the added lines.

(I havent compared with the surrounding code and callstack nor tested it though.)

Empty summary is a bit dull, it helps even onself if one can phrase the motivation behind each diff.

See IRClogs today and D1958, this is one motivation, the other motivation is that support for all std containers is useful for future simulation component code.
So thanks for the patch on behalf of the simulation component coders.

source/simulation2/serialization/SerializeTemplates.h
112

can be inlined

source/simulation2/tests/test_SerializeTemplates.h
23

Xero needed?

29

(Simulation2 needed?)

64

tabs for indentation

elexis added inline comments.Oct 3 2019, 7:36 PM
source/simulation2/serialization/SerializeTemplates.h
52–54

I always wonder about this pattern whether one shouldn't push_back() and then operate on that reference instead of copy/move assigning after processing the constructed value.

Like

value.emplace_back();
ELEM()(deserialize, name, value.back());

That's faster than moving and shared_ptr and stricter than raw ptr.

If there was a hypothetical error during the process, one can still erase the value (which should never happen, and if it happens, its probably unrecoverable)

vladislavbelov marked 4 inline comments as done.

Fixes @elexis`s notes.

source/simulation2/serialization/SerializeTemplates.h
52–54

Yes, it'd be good, but it's not possible yet. Because we have std::vector<bool>, that's a "special" vector. I'll refactor it later.

Vulcan added a comment.Oct 3 2019, 9:26 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/392/display/redirect

Vulcan added a comment.Oct 3 2019, 9:29 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  28| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/907/display/redirect

elexis added inline comments.Oct 3 2019, 9:55 PM
source/simulation2/serialization/SerializeTemplates.h
122

reserve
(I guess shrinking wont be needed)

value.clear + reserve after obtaining size, for grouping

elexis added inline comments.Oct 3 2019, 10:33 PM
source/simulation2/serialization/SerializeTemplates.h
52–54

I suppose > 90% of the serialized vector instances are not bool, so we shouldnt make > 90% of the calls slower for no reason when we can have it faster by specializing bool.

If Im not mistaken this code is also called for the hash serializer, which means it's called every N turns during an MP game or replay thereof. (And perhaps we enable hashing for SP replays too)

I was trying to load a saved game with this patch enabled, but all I get when the game has loaded is a white screen where I can select units (whilst not seeing them). When I move an entity I get the following error: CCmpObstructionManager.cpp(877): Assertion failed: "it != m_UnitShapes.end()".
If you need more information, please let me know :)

Removes resize.

I was trying to load a saved game with this patch enabled, but all I get when the game has loaded is a white screen where I can select units (whilst not seeing them). When I move an entity I get the following error: CCmpObstructionManager.cpp(877): Assertion failed: "it != m_UnitShapes.end()".
If you need more information, please let me know :)

I suppose because of extra resize. Could you try the last version of the patch?

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/394/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  28| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/909/display/redirect

(Two requested changes: one reserve function for set deserialization and a specialization of bool vector (since I suppose the serialization code shouldn't forbid using the type), where the vector<bool> code is the current code without move semantics and the specialization is the one with resize to avoid the std::move too (std::move often is only a 50% improvement if one can change the code to avoid the transfer altogether). Should be 5 more lines of code. (See also http://irclogs.wildfiregames.com/2019-10/2019-10-03-QuakeNet-%230ad-dev.log ))

Works fine now! It was a black screen by the way. I usually have my screen's colours inverted ;)

Vulcan added a comment.Oct 4 2019, 6:39 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/911/display/redirect

Vulcan added a comment.Oct 4 2019, 6:40 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/396/display/redirect

elexis added a comment.Oct 4 2019, 7:10 PM
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:45:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU32_Unbounded("length", len);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:56:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU32_Unbounded("length", len);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:100:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU32_Unbounded("length", len);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:105:15: error: member access into incomplete type 'IDeserializer'
                        deserialize.NumberU32_Unbounded("#", count);
                                   ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:130:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU32_Unbounded("size", size);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:174:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU32_Unbounded("length", len);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:192:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU32_Unbounded("length", len);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:209:67: error: no template named 'unordered_map' in namespace 'boost'
        void operator()(ISerializer& serialize, const char* name, boost::unordered_map<K, V>& value)
                                                                  ~~~~~~~^
../../../source/simulation2/serialization/SerializeTemplates.h:216:71: error: no template named 'unordered_map' in namespace 'boost'
        void operator()(IDeserializer& deserialize, const char* name, boost::unordered_map<K, V>& value)
                                                                      ~~~~~~~^
../../../source/simulation2/serialization/SerializeTemplates.h:233:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU8(name, val, 0, max);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:230:58: warning: unused parameter 'name' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, T& value)
                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:247:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU8_Unbounded(name, value);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:245:58: warning: unused parameter 'name' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, u8& value)
                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:245:68: warning: unused parameter 'value' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, u8& value)
                                                                          ^
../../../source/simulation2/serialization/SerializeTemplates.h:260:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU16_Unbounded(name, value);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:258:58: warning: unused parameter 'name' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, u16& value)
                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:258:69: warning: unused parameter 'value' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, u16& value)
                                                                           ^
../../../source/simulation2/serialization/SerializeTemplates.h:273:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberU32_Unbounded(name, value);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:271:58: warning: unused parameter 'name' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, u32& value)
                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:271:69: warning: unused parameter 'value' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, u32& value)
                                                                           ^
../../../source/simulation2/serialization/SerializeTemplates.h:286:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberI32_Unbounded(name, value);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:284:58: warning: unused parameter 'name' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, i32& value)
                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:284:69: warning: unused parameter 'value' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, i32& value)
                                                                           ^
../../../source/simulation2/serialization/SerializeTemplates.h:299:14: error: member access into incomplete type 'IDeserializer'
                deserialize.Bool(name, value);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:297:58: warning: unused parameter 'name' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, bool& value)
                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:297:70: warning: unused parameter 'value' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, bool& value)
                                                                            ^
../../../source/simulation2/serialization/SerializeTemplates.h:312:14: error: member access into incomplete type 'IDeserializer'
                deserialize.StringASCII(name, value, 0, UINT32_MAX);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:310:58: warning: unused parameter 'name' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, std::string& value)
                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:310:77: warning: unused parameter 'value' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* name, std::string& value)
                                                                                   ^
../../../source/simulation2/serialization/SerializeTemplates.h:326:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberFixed_Unbounded("waypoint x", value.x);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:327:14: error: member access into incomplete type 'IDeserializer'
                deserialize.NumberFixed_Unbounded("waypoint z", value.z);
                           ^
../../../source/simulation2/system/IComponent.h:31:7: note: forward declaration of 'IDeserializer'
class IDeserializer;
      ^
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:23:
../../../source/simulation2/serialization/SerializeTemplates.h:324:82: warning: unused parameter 'value' [-Wunused-parameter]
        void operator()(IDeserializer& deserialize, const char* UNUSED(name), Waypoint& value)
                                                                                        ^
14 warnings and 18 errors generated.
make[1]: *** [test.make:1307: obj/test_Release/test_SerializeTemplates.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:187: test] Error 2
make: *** Waiting for unfinished jobs....

The remaining std::move calls are unoptimizable, so they are the best improvement available.

I didnt check whether further containers could be implemented.

Thank for the good patch Vladislav!

(Perhaps you even want to commit the new set code separately after doing the performance improvement.)

source/simulation2/serialization/SerializeTemplates.h
47

group value.clear + value.resize
perhaps add a comment that resize was faster in a benchmark

58

(same)

120

(if you want consistency you can move the clear below the size getter here too; or whatever)

source/simulation2/tests/test_SerializeTemplates.h
26

I didnt check whether further includes could be removed

elexis added a comment.Oct 4 2019, 7:16 PM

I think I forgot to run update-workspaces.sh for the error above, but now I get this:

In file included from ../../../source/simulation2/components/CCmpObstruction.cpp:29:
../../../source/simulation2/serialization/SerializeTemplates.h:51:11: error: explicit specialization in non-namespace scope ‘struct SerializeVector<ELEM>’
   51 |  template<>
      |           ^
make[1]: *** [simulation2.make:257: obj/simulation2_Release/CCmpObstruction.o] Error 1
make[1]: *** Waiting for unfinished jobs....
==== Building AtlasObject (release) ====
==== Building cxxtestroot (release) ====
Generating test root file
/home/elexis/code/0ad-svn/trunk/libraries/source/cxxtest-4.4/bin/cxxtestgen --root  --include=precompiled.h --include=lib/external_libraries/libsdl.h --runner=ErrorPrinter -o /home/elexis/code/0ad-svn/trunk/source/test_root.cpp
==== Building AtlasUI (release) ====
==== Building ActorEditor (release) ====
In file included from ../../../source/simulation2/components/CCmpAIManager.cpp:46:
../../../source/simulation2/serialization/SerializeTemplates.h:51:11: error: explicit specialization in non-namespace scope ‘struct SerializeVector<ELEM>’
   51 |  template<>
      |           ^
make[1]: *** [simulation2.make:236: obj/simulation2_Release/CCmpAIManager.o] Error 1
make: *** [Makefile:97: simulation2] Error 2
vladislavbelov marked 2 inline comments as done.
Vulcan added a comment.Oct 4 2019, 7:50 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/912/display/redirect

Vulcan added a comment.Oct 4 2019, 7:51 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/397/display/redirect

Vulcan added a comment.Oct 4 2019, 8:38 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/398/display/redirect

Vulcan added a comment.Oct 4 2019, 8:42 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  30| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/913/display/redirect

Reverts vector changes.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/399/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  30| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/914/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/400/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  30| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/915/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/401/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  32| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/916/display/redirect

Better:

In file included from /home/elexis/code/0ad-svn/trunk/source/simulation2/tests/test_SerializeTemplates.h:22,
                 from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
../../../source/simulation2/serialization/SerializeTemplates.h:202:67: error: ‘boost::unordered_map’ has not been declared
  202 |  void operator()(ISerializer& serialize, const char* name, boost::unordered_map<K, V>& value)
      |                                                                   ^~~~~~~~~~~~~
../../../source/simulation2/serialization/SerializeTemplates.h:202:80: error: expected ‘,’ or ‘...’ before ‘<’ token
  202 |  void operator()(ISerializer& serialize, const char* name, boost::unordered_map<K, V>& value)
      |                                                                                ^
../../../source/simulation2/serialization/SerializeTemplates.h:209:71: error: ‘boost::unordered_map’ has not been declared
  209 |  void operator()(IDeserializer& deserialize, const char* name, boost::unordered_map<K, V>& value)
      |                                                                       ^~~~~~~~~~~~~
../../../source/simulation2/serialization/SerializeTemplates.h:209:84: error: expected ‘,’ or ‘...’ before ‘<’ token
  209 |  void operator()(IDeserializer& deserialize, const char* name, boost::unordered_map<K, V>& value)
      |                                                                                    ^
../../../source/simulation2/serialization/SerializeTemplates.h: In member function ‘void SerializeUnorderedMap<KS, VS>::operator()(ISerializer&, const char*, int)’:
../../../source/simulation2/serialization/SerializeTemplates.h:204:32: error: ‘value’ was not declared in this scope
  204 |   std::map<K, V> ordered_value(value.begin(), value.end());
      |                                ^~~~~
../../../source/simulation2/serialization/SerializeTemplates.h: In member function ‘void SerializeUnorderedMap<KS, VS>::operator()(IDeserializer&, const char*, int)’:
../../../source/simulation2/serialization/SerializeTemplates.h:211:45: error: ‘value’ was not declared in this scope
  211 |   SerializeMap<KS, VS>()(deserialize, name, value);
      |                                             ^~~~~
make[1]: *** [test.make:1307: obj/test_Release/test_SerializeTemplates.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:187: test] Error 2
make: *** Waiting for unfinished jobs....

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/402/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/serialization/SerializeTemplates.h
|  33| template<typename·ELEM>
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/917/display/redirect

elexis accepted this revision.Oct 4 2019, 11:17 PM

Performed ./test, savegame loading test, rejoin with 2 clients.
Code reads correct, we went through it many times on 2 days with different findings.
Optimizing vector is something that would be good and probably be forgotton unless we work more with the code.

Thanks for the patch!

source/simulation2/serialization/SerializeTemplates.h
52–54

// Cant use references nor move semantics due to std::vector<bool>

This revision is now accepted and ready to land.Oct 4 2019, 11:17 PM
Owners added a subscriber: Restricted Owners Package.Oct 4 2019, 11:31 PM