Page MenuHomeWildfire Games

Update to C++17
ClosedPublic

Authored by wraitii on Nov 30 2020, 11:03 AM.

Details

Reviewers
None
Commits
rP24308: Use C++17 to compile 0 A.D.
Trac Tickets
#5862
Summary

This makes the game compile with C++17.

Supported compilers are Clang 5, GCC7, VS17, Xcode 9.3

Test Plan

Compile the game on those.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.Nov 30 2020, 11:03 AM

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

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

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

builderr-debug-macos.txt
error: errorerrorC++17 was disabled in PCH file but is currently enablederror
: : : C++17 was disabled in PCH file but is currently enabled
C++17 was disabled in PCH file but is currently enabledC++17 was disabled in PCH file but is currently enabled

1 error generated.
1 error generated.
1 error generated1 error generated.
.
make[1]: *** [obj/network_Debug/NetHost.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [obj/network_Debug/NetFileTransfer.o] Error 1
make[1]: *** [obj/network_Debug/NetClientTurnManager.o] Error 1
make[1]: *** [obj/network_Debug/NetClient.o] Error 1
make: *** [network] Error 2

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/2190/display/redirect

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

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

wraitii requested review of this revision.Nov 30 2020, 11:30 AM
wraitii updated this revision to Diff 14315.Dec 1 2020, 8:45 AM

Fix wxwidgets compilation on C++17 by not using sct, update minor version while at it.

Vulcan added a comment.Dec 1 2020, 8:59 AM

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

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

Vulcan added a comment.Dec 1 2020, 9:00 AM

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

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Cocoa.framework/Cocoa.tbd and library file /System/Library/Frameworks//Cocoa.framework/Cocoa are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/IOKit are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//QuartzCore.framework/QuartzCore.tbd and library file /System/Library/Frameworks//QuartzCore.framework/QuartzCore are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Metal.framework/Metal.tbd and library file /System/Library/Frameworks//Metal.framework/Metal are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//OpenGL.framework/OpenGL.tbd and library file /System/Library/Frameworks//OpenGL.framework/OpenGL are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//OpenAL.framework/OpenAL.tbd and library file /System/Library/Frameworks//OpenAL.framework/OpenAL are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ApplicationServices.framework/ApplicationServices.tbd and library file /System/Library/Frameworks//ApplicationServices.framework/ApplicationServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Cocoa.framework/Cocoa.tbd and library file /System/Library/Frameworks//Cocoa.framework/Cocoa are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: library not found for -lbc6h
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [../../../binaries/system/pyrogenesis_dbg] Error 1
make: *** [pyrogenesis] Error 2

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/2212/display/redirect

Vulcan added a comment.Dec 1 2020, 9:08 AM

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

builderr-release-gcc7.txt
In file included from ../../../source/lib/os_path.h:26,
                 from ../../../source/lib/self_test.h:28,
                 from ../../../source/simulation2/system/ComponentTest.h:21,
                 from ../../../source/pch/test/precompiled.h:22:
../../../source/lib/path.h: In member function 'virtual void TestMapGenerator::setUp()':
../../../source/lib/path.h:264:68: warning: '<anonymous>.Path::separator' may be used uninitialized in this function [-Wmaybe-uninitialized]
   debug_printf("Path %s, separator %c\n", string8().c_str(), (char)separator);
                                                                    ^~~~~~~~~
In file included from ../../../source/lib/os_path.h:26,
                 from ../../../source/lib/self_test.h:28,
                 from ../../../source/simulation2/system/ComponentTest.h:21,
                 from ../../../source/pch/test/precompiled.h:22:
../../../source/lib/path.h: In member function 'virtual void TestComponentScripts::setUp()':
../../../source/lib/path.h:264:68: warning: '<anonymous>.Path::separator' may be used uninitialized in this function [-Wmaybe-uninitialized]
   debug_printf("Path %s, separator %c\n", string8().c_str(), (char)separator);
                                                                    ^~~~~~~~~
In file included from ../../../source/lib/os_path.h:26,
                 from ../../../source/lib/self_test.h:28,
                 from ../../../source/simulation2/system/ComponentTest.h:21,
                 from ../../../source/pch/test/precompiled.h:22:
../../../source/lib/path.h: In function 'OsPath DataDir()':
../../../source/lib/path.h:264:68: warning: '<anonymous>.Path::separator' may be used uninitialized in this function [-Wmaybe-uninitialized]
   debug_printf("Path %s, separator %c\n", string8().c_str(), (char)separator);
                                                                    ^~~~~~~~~

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

wraitii updated this revision to Diff 14318.Dec 1 2020, 10:27 AM

Merge atlas fix in here since it's C++17 only

Owners added subscribers: Restricted Owners Package, Restricted Owners Package.Dec 1 2020, 10:28 AM

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

builderr-debug-gcc7.txt
cc1plus: error: one or more PCH files were found, but they were invalid
cc1plus: error: use -Winvalid-pch for more information
cc1plus: fatal error: obj/AtlasUI_Debug/precompiled.h: No such file or directory
compilation terminated.
make[1]: *** [AtlasUI.make:213: obj/AtlasUI_Debug/ToolButton.o] Error 1
make: *** [Makefile:173: AtlasUI] Error 2

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

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

builderr-debug-gcc7.txt
../../../source/lib/res/h_mgr.cpp: In function 'void h_free_hd(HDATA*)':
../../../source/lib/res/h_mgr.cpp:560:27: warning: 'void* memset(void*, int, size_t)' clearing an object of type 'struct HDATA' with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
  memset(hd, 0, sizeof(*hd));
                           ^
../../../source/lib/res/h_mgr.cpp:132:8: note: 'struct HDATA' declared here
 struct HDATA
        ^~~~~
../../../source/third_party/mongoose/mongoose.cpp: In function 'mg_context* mg_start(mg_callback_t, void*, const char**)':
../../../source/third_party/mongoose/mongoose.cpp:4295:40: warning: cast between incompatible function types from 'void (*)(mg_context*)' to 'mg_thread_func_t' {aka 'void* (*)(void*)'} [-Wcast-function-type]
   start_thread(ctx, (mg_thread_func_t) master_thread, ctx);
                                        ^~~~~~~~~~~~~
../../../source/third_party/mongoose/mongoose.cpp:4299:46: warning: cast between incompatible function types from 'void (*)(mg_context*)' to 'mg_thread_func_t' {aka 'void* (*)(void*)'} [-Wcast-function-type]
     if (start_thread(ctx, (mg_thread_func_t) worker_thread, ctx) != 0) {
                                              ^~~~~~~~~~~~~
builderr-release-gcc7.txt
In file included from ../../../source/pch/atlas/precompiled.h:26:
../../../source/tools/atlas/GameInterface/Messages.h: In function 'void AtlasMessage::fGetTerrainGroupPreviews(AtlasMessage::qGetTerrainGroupPreviews*)':
../../../source/tools/atlas/GameInterface/Messages.h:310:8: warning: '#'target_mem_ref' not supported by dump_expr#<expression error>' may be used uninitialized in this function [-Wmaybe-uninitialized]
 struct sTerrainTexturePreview
        ^~~~~~~~~~~~~~~~~~~~~~
../../../source/tools/atlas/GameInterface/Messages.h:310:8: warning: '#'target_mem_ref' not supported by dump_expr#<expression error>' may be used uninitialized in this function [-Wmaybe-uninitialized]
../../../source/tools/atlas/GameInterface/Messages.h:310:8: warning: '#'target_mem_ref' not supported by dump_expr#<expression error>' may be used uninitialized in this function [-Wmaybe-uninitialized]
../../../source/tools/atlas/GameInterface/Messages.h:310:8: warning: '#'target_mem_ref' not supported by dump_expr#<expression error>' may be used uninitialized in this function [-Wmaybe-uninitialized]
 struct sTerrainTexturePreview
        ^~~~~~~~~~~~~~~~~~~~~~
../../../source/tools/atlas/GameInterface/Messages.h:310:8: warning: '#'target_mem_ref' not supported by dump_expr#<expression error>' may be used uninitialized in this function [-Wmaybe-uninitialized]
../../../source/tools/atlas/GameInterface/Messages.h:310:8: warning: '#'target_mem_ref' not supported by dump_expr#<expression error>' may be used uninitialized in this function [-Wmaybe-uninitialized]
../../../source/lib/res/h_mgr.cpp: In function 'void h_free_hd(HDATA*)':
../../../source/lib/res/h_mgr.cpp:560:27: warning: 'void* memset(void*, int, size_t)' clearing an object of type 'struct HDATA' with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
  memset(hd, 0, sizeof(*hd));
                           ^
../../../source/lib/res/h_mgr.cpp:132:8: note: 'struct HDATA' declared here
 struct HDATA
        ^~~~~
../../../source/third_party/mongoose/mongoose.cpp: In function 'mg_context* mg_start(mg_callback_t, void*, const char**)':
../../../source/third_party/mongoose/mongoose.cpp:4295:40: warning: cast between incompatible function types from 'void (*)(mg_context*)' to 'mg_thread_func_t' {aka 'void* (*)(void*)'} [-Wcast-function-type]
   start_thread(ctx, (mg_thread_func_t) master_thread, ctx);
                                        ^~~~~~~~~~~~~
../../../source/third_party/mongoose/mongoose.cpp:4299:46: warning: cast between incompatible function types from 'void (*)(mg_context*)' to 'mg_thread_func_t' {aka 'void* (*)(void*)'} [-Wcast-function-type]
     if (start_thread(ctx, (mg_thread_func_t) worker_thread, ctx) != 0) {
                                              ^~~~~~~~~~~~~
In file included from ../../../source/lib/os_path.h:26,
                 from ../../../source/lib/self_test.h:28,
                 from ../../../source/simulation2/system/ComponentTest.h:21,
                 from ../../../source/pch/test/precompiled.h:22:
../../../source/lib/path.h: In member function 'virtual void TestMapGenerator::setUp()':
../../../source/lib/path.h:264:68: warning: '<anonymous>.Path::separator' may be used uninitialized in this function [-Wmaybe-uninitialized]
   debug_printf("Path %s, separator %c\n", string8().c_str(), (char)separator);
                                                                    ^~~~~~~~~
In file included from ../../../source/lib/os_path.h:26,
                 from ../../../source/lib/self_test.h:28,
                 from ../../../source/simulation2/system/ComponentTest.h:21,
                 from ../../../source/pch/test/precompiled.h:22:
../../../source/lib/path.h: In member function 'virtual void TestComponentScripts::setUp()':
../../../source/lib/path.h:264:68: warning: '<anonymous>.Path::separator' may be used uninitialized in this function [-Wmaybe-uninitialized]
   debug_printf("Path %s, separator %c\n", string8().c_str(), (char)separator);
                                                                    ^~~~~~~~~
In file included from ../../../source/lib/os_path.h:26,
                 from ../../../source/lib/self_test.h:28,
                 from ../../../source/simulation2/system/ComponentTest.h:21,
                 from ../../../source/pch/test/precompiled.h:22:
../../../source/lib/path.h: In function 'OsPath DataDir()':
../../../source/lib/path.h:264:68: warning: '<anonymous>.Path::separator' may be used uninitialized in this function [-Wmaybe-uninitialized]
   debug_printf("Path %s, separator %c\n", string8().c_str(), (char)separator);
                                                                    ^~~~~~~~~

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

vladislavbelov added inline comments.
libraries/osx/build-osx-libs.sh
400 ↗(On Diff #14318)

Is that required to update to C++17?

430 ↗(On Diff #14318)

Is that required to update to C++17?

wraitii added inline comments.Dec 1 2020, 12:15 PM
libraries/osx/build-osx-libs.sh
400 ↗(On Diff #14318)

That bit, no.

430 ↗(On Diff #14318)

Yes, as Scintilla, the text editor, uses auto_ptr, which is removed.

As we are not using that functionality, it makes sense to disable it to avoid the additional compilation cost.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 1 2020, 3:17 PM
This revision was landed with ongoing or failed builds.
Closed by commit rP24308: Use C++17 to compile 0 A.D. (authored by wraitii). · Explain Why
This revision was automatically updated to reflect the committed changes.