It is impossible to code with recent gcc because there are more than 4500 compile warnings burying any information referring to ones local diff.
1 -Warray-bounds 1 -Waligned-new= 2 -Wcast-function-type 3 -Wcatch-value= 3 -Wclass-memaccess 4496 -Wdeprecated-copy 1 -Wmaybe-uninitialized 1 -Wstringop-truncation 2 -Wunused-but-set-variable 1 -Wunused-parameter
The Atlas COMANND macro and the Path.h warning make up 4375 of the 4496 -Wdeprecated-copy warnings.
The complete buildlog spam is attached.
One example for the path:
In file included from ../../../source/lib/file/vfs/vfs_path.h:26, from ../../../source/scriptinterface/ScriptInterface.h:21, from ../../../source/simulation2/helpers/SimulationCommand.h:21, from ../../../source/simulation2/system/TurnManager.h:21, from ../../../source/network/NetClientTurnManager.h:21, from ../../../source/network/NetClient.cpp:22: ../../../source/lib/path.h: In member function ‘Path Path::Basename() const’: ../../../source/lib/path.h:197:11: warning: implicitly-declared ‘Path::Path(const Path&)’ is deprecated [-Wdeprecated-copy] 197 | return filename; | ^~~~~~~~ ../../../source/lib/path.h:113:8: note: because ‘Path’ has user-provided ‘Path& Path::operator=(const Path&)’ 113 | Path& operator=(const Path& rhs) | ^~~~~~~~ ../../../source/lib/path.h: In member function ‘Path Path::operator/(Path) const’: ../../../source/lib/path.h:218:15: warning: implicitly-declared ‘Path::Path(const Path&)’ is deprecated [-Wdeprecated-copy] 218 | Path ret = *this;
One example for the Atlas COMMAND:
In file included from ../../../source/tools/atlas/GameInterface/Messages.h:22, from ../../../source/tools/atlas/GameInterface/View.h:25, from ../../../source/ps/GameSetup/GameSetup.cpp:89: ../../../source/tools/atlas/GameInterface/Messages.h: In constructor ‘AtlasMessage::mSetMapSettings::mSetMapSettings(const AtlasMessage::dSetMapSettings&)’: ../../../source/tools/atlas/GameInterface/MessagesSetup.h:99:31: warning: implicitly-declared ‘AtlasMessage::dSetMapSettings::dSetMapSettings(const AtlasMessage::dSetMapSettings&)’ is deprecated [-Wdeprecated-copy] 99 | m##t(const d##t& d) : d##t(d) {} \ | ^ ../../../source/tools/atlas/GameInterface/MessagesSetup.h:161:2: note: in expansion of macro ‘COMMANDSTRUCT’ 161 | COMMANDSTRUCT(name, merge) | ^~~~~~~~~~~~~ ../../../source/tools/atlas/GameInterface/Messages.h:185:1: note: in expansion of macro ‘COMMAND’ 185 | COMMAND(SetMapSettings, MERGE, | ^~~~~~~ ../../../source/tools/atlas/GameInterface/MessagesSetup.h:94:15: note: because ‘AtlasMessage::dSetMapSettings’ has user-provided ‘const AtlasMessage::dSetMapSettings& AtlasMessage::dSetMapSettings::operator=(const AtlasMessage::dSetMapSettings&)’ 94 | const d##t& operator=(const d##t&); \ | ^~~~~~~~ ../../../source/tools/atlas/GameInterface/MessagesSetup.h:94:15: note: in definition of macro ‘COMMANDDATASTRUCT’ 94 | const d##t& operator=(const d##t&); \ | ^~~~~~~~ ../../../source/tools/atlas/GameInterface/Messages.h:185:1: note: in expansion of macro ‘COMMAND’ 185 | COMMAND(SetMapSettings, MERGE, | ^~~~~~~
The fixed -Wcatch-value= warnings are:
/path/to/trunk/source/simulation2/tests/test_Serializer.h: In member function ‘void TestSerializer::test_bounds()’: /path/to/trunk/source/simulation2/tests/test_Serializer.h:286:59: warning: catching polymorphic type ‘class PSERROR_Serialize_OutOfBounds’ by value [-Wcatch-value=] 286 | TS_ASSERT_THROWS(serialize.NumberI32("x", 17, -16, 16), PSERROR_Serialize_OutOfBounds); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /path/to/trunk/source/simulation2/tests/test_Serializer.h:287:60: warning: catching polymorphic type ‘class PSERROR_Serialize_OutOfBounds’ by value [-Wcatch-value=] 287 | TS_ASSERT_THROWS(serialize.NumberI32("x", -17, -16, 16), PSERROR_Serialize_OutOfBounds); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /path/to/trunk/source/simulation2/tests/test_Serializer.h: In member function ‘void TestSerializer::test_script_exceptions()’: /path/to/trunk/source/simulation2/tests/test_Serializer.h:769:57: warning: catching polymorphic type ‘class PSERROR_Serialize_InvalidScriptValue’ by value [-Wcatch-value=] 769 | TS_ASSERT_THROWS(serialize.ScriptVal("script", &obj), PSERROR_Serialize_InvalidScriptValue);
The -Waligned-new= comes from Modio:
../../../source/ps/ModIo.cpp: In member function ‘void ModIo::StartDownloadMod(size_t)’: ../../../source/ps/ModIo.cpp:321:82: warning: ‘new’ of type ‘DownloadCallbackData’ with extended alignment 64 [-Waligned-new=] 321 | m_CallbackData = new DownloadCallbackData(sys_OpenFile(m_DownloadFilePath, "wb")); | ^ ../../../source/ps/ModIo.cpp:321:82: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter ../../../source/ps/ModIo.cpp:321:82: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
The -Wmaybe-uninitialized warning comes from:
In file included from ../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:21, from ../../../source/tools/atlas/GameInterface/Handlers/TerrainHandlers.cpp:20: ../../../source/tools/atlas/GameInterface/Handlers/../Messages.h: In function ‘void AtlasMessage::fGetTerrainTexturePreview(AtlasMessage::qGetTerrainTexturePreview*)’: ../../../source/tools/atlas/GameInterface/Handlers/../Messages.h:292:8: warning: ‘*((void*)& noPreview +16)’ may be used uninitialized in this function [-Wmaybe-uninitialized] 292 | struct sTerrainTexturePreview | ^~~~~~~~~~~~~~~~~~~~~~ ../../../source/tools/atlas/GameInterface/Handlers/TerrainHandlers.cpp:178:26: note: ‘*((void*)& noPreview +16)’ was declared here 178 | sTerrainTexturePreview noPreview; | ^~~~~~~~~
Not fixed, the -Wstringop-truncation warning is:
In file included from /usr/include/string.h:494, from /usr/include/c++/9.1.0/cstring:42, from /usr/local/include/boost/system/error_code.hpp:20, from /usr/local/include/boost/filesystem/path_traits.hpp:22, from /usr/local/include/boost/filesystem/path.hpp:26, from /usr/local/include/boost/filesystem.hpp:16, from ../../../source/lib/pch/pch_boost.h:57, from ../../../source/lib/precompiled.h:76, from ../../../source/pch/engine/precompiled.h:18, from ../../../source/ps/FileIo.cpp:22: In function ‘char* strncpy(char*, const char*, size_t)’, inlined from ‘CFilePacker::CFilePacker(u32, const char*)’ at ../../../source/ps/FileIo.cpp:50:9: /usr/include/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 4 equals destination size [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Not fixed, the -Wclass-memaccess are:
../../../source/lib/res/h_mgr.cpp: In function ‘void h_free_hd(HDATA*)’: ../../../source/lib/res/h_mgr.cpp:578: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] 578 | memset(hd, 0, sizeof(*hd)); | ^ ../../../source/lib/res/h_mgr.cpp:140:8: note: ‘struct HDATA’ declared here 140 | struct HDATA | ^~~~~ In file included from ../../../source/simulation2/helpers/Pathfinding.h:27, from ../../../source/simulation2/helpers/LongPathfinder.h:21, from ../../../source/simulation2/helpers/LongPathfinder.cpp:20: ../../../source/simulation2/helpers/Grid.h: In instantiation of ‘T* SparseGrid<T>::GetBucket(int, int) [with T = PathfindTile]’: ../../../source/simulation2/helpers/Grid.h:238:10: required from ‘T& SparseGrid<T>::get(int, int) [with T = PathfindTile]’ ../../../source/simulation2/helpers/LongPathfinder.cpp:407:41: required from here ../../../source/simulation2/helpers/Grid.h:194:10: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct PathfindTile’; use assignment or value-initialization instead [-Wclass-memaccess] 194 | memset(m_Data[b], 0, BucketSize*BucketSize*sizeof(T)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../../../source/simulation2/helpers/LongPathfinder.cpp:20: ../../../source/simulation2/helpers/LongPathfinder.h:63:8: note: ‘struct PathfindTile’ declared here 63 | struct PathfindTile | ^~~~~~~~~~~~ In file included from ../../../source/lib/res/graphics/tests/test_tex.cpp:17: /path/to/trunk/source/lib/res/graphics/tests/test_tex.h: In member function ‘void TestTex::generate_encode_decode_compare(size_t, size_t, size_t, size_t, const OsPath&)’: /path/to/trunk/source/lib/res/graphics/tests/test_tex.h:49:27: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct Tex’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess] 49 | memset(&t, 0, sizeof(t)); | ^ In file included from /path/to/trunk/source/lib/res/graphics/tests/test_tex.h:25, from ../../../source/lib/res/graphics/tests/test_tex.cpp:17: ../../../source/lib/tex/tex.h:209:8: note: ‘struct Tex’ declared here 209 | struct Tex | ^~~
Not fixed, the -Warray-bounds is:
In function ‘void* memcpy(void*, const void*, size_t)’, inlined from ‘void rewriteBuffer(u8*, u32&)’ at ../../../source/ps/Profiler2.cpp:565:10: /usr/include/bits/string_fortified.h:34:33: warning: ‘void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)’ forming offset [257, 4294967295] is out of the bounds [0, 256] of object ‘message’ with type ‘char [256]’ [-Warray-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../source/ps/Profiler2.cpp: In function ‘void rewriteBuffer(u8*, u32&)’: ../../../source/ps/Profiler2.cpp:564:9: note: ‘message’ declared here 564 | char message[CProfiler2::MAX_ATTRIBUTE_LENGTH] = {0}; | ^~~~~~~
Not fixed, the unused warnings are in UnitMotion from rP22352 and rP22429:
../../../source/simulation2/components/CCmpUnitMotion.cpp: In member function ‘bool CCmpUnitMotion::MoveToPointRange(entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_id_t)’: ../../../source/simulation2/components/CCmpUnitMotion.cpp:1342:129: warning: unused parameter ‘target’ [-Wunused-parameter] 1342 | bool CCmpUnitMotion::MoveToPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange, entity_id_t target) | ~~~~~~~~~~~~^~~~~~ ../../../source/simulation2/components/CCmpUnitMotion.cpp: In member function ‘virtual bool CCmpUnitMotion::MoveToTargetRange(entity_id_t, entity_pos_t, entity_pos_t)’: ../../../source/simulation2/components/CCmpUnitMotion.cpp:1524:17: warning: variable ‘circleDistance’ set but not used [-Wunused-but-set-variable] 1524 | entity_pos_t circleDistance = (pos - CFixedVector2D(obstruction.x, obstruction.z)).Length() - circleRadius; | ^~~~~~~~~~~~~~ ../../../source/simulation2/components/CCmpUnitMotion.cpp:1525:17: warning: variable ‘previousCircleDistance’ set but not used [-Wunused-but-set-variable] 1525 | entity_pos_t previousCircleDistance = (pos - CFixedVector2D(previousObstruction.x, previousObstruction.z)).Length() - circleRadius; | ^~~~~~~~~~~~~~~~~~~~~~
Not fixed, the -Wcast-function-type come from mongoose:
../../../source/third_party/mongoose/mongoose.cpp: In function ‘mg_context* mg_start(mg_callback_t, void*, const char**)’: ../../../source/third_party/mongoose/mongoose.cpp:4297:40: warning: cast between incompatible function types from ‘void (*)(mg_context*)’ to ‘mg_thread_func_t’ {aka ‘void* (*)(void*)’} [-Wcast-function-type] 4297 | start_thread(ctx, (mg_thread_func_t) master_thread, ctx); | ^~~~~~~~~~~~~ ../../../source/third_party/mongoose/mongoose.cpp:4301:46: warning: cast between incompatible function types from ‘void (*)(mg_context*)’ to ‘mg_thread_func_t’ {aka ‘void* (*)(void*)’} [-Wcast-function-type] 4301 | if (start_thread(ctx, (mg_thread_func_t) worker_thread, ctx) != 0) { | ^~~~~~~~~~~~~