fatherbushido Posted August 19, 2017 Report Share Posted August 19, 2017 I have many messages when compiling since few revs: Spoiler ElevationHandlers.cpp ../../../source/gui/CInput.cpp: In member function ‘virtual InReaction CInput::ManuallyHandleEvent(const SDL_Event_*)’: ../../../source/gui/CInput.cpp:486:17: warning: this statement may fall through [-Wimplicit-fallthrough=] cooked = '\n'; // Change to '\n' and do default: ^ ../../../source/gui/CInput.cpp:489:3: note: here default: // Insert a character ^~~~~~~ Patch.cpp CStrIntern.cpp CommandHandlers.cpp In member function ‘void CInput::UpdateText(int, int, int)’: cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] ObjectManager.cpp MapHandlers.cpp CCmpFootprint.cpp Filesystem.cpp GUIManager.cpp CCmpCommandQueue.cpp Globals.cpp GameView.cpp SavedGame.cpp ICmpUnitRenderer.cpp TerrainHandlers.cpp ICmpObstructionManager.cpp ShaderDefines.cpp CCmpOwnership.cpp CProgressBar.cpp ICmpVisibility.cpp CGUI.cpp In file included from ../../../source/pch/atlas/precompiled.h:24:0: ../../../source/tools/atlas/GameInterface/Messages.h: In function ‘void AtlasMessage::fGetTerrainGroupPreviews(AtlasMessage::qGetTerrainGroupPreviews*)’: ../../../source/tools/atlas/GameInterface/Messages.h:285: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:285: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:285: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:285: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:285: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:285:8: warning: ‘#‘target_mem_ref’ not supported by dump_expr#<expression error>’ may be used uninitialized in this function [-Wmaybe-uninitialized] Pyrogenesis.cpp [...] AtlasObjectXML.cpp SkyManager.cpp ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp: In function ‘std::__cxx11::wstring fromXmlChar(const xmlChar*)’: ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:96:31: warning: this statement may fall through [-Wimplicit-fallthrough=] case 5: ch += *source++; ch <<= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:97:3: note: here case 4: ch += *source++; ch <<= 6; ^~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:97:31: warning: this statement may fall through [-Wimplicit-fallthrough=] case 4: ch += *source++; ch <<= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:98:3: note: here case 3: ch += *source++; ch <<= 6; ^~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:98:31: warning: this statement may fall through [-Wimplicit-fallthrough=] case 3: ch += *source++; ch <<= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:99:3: note: here case 2: ch += *source++; ch <<= 6; ^~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:99:31: warning: this statement may fall through [-Wimplicit-fallthrough=] case 2: ch += *source++; ch <<= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:100:3: note: here case 1: ch += *source++; ch <<= 6; ^~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:100:31: warning: this statement may fall through [-Wimplicit-fallthrough=] case 1: ch += *source++; ch <<= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:101:3: note: here case 0: ch += *source++; ^~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp: In constructor ‘toXmlChar::toXmlChar(const wstring&)’: ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:67:49: warning: this statement may fall through [-Wimplicit-fallthrough=] case 4: *--target = ((ch | 0x80) & 0xBF); ch >>= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:68:4: note: here case 3: *--target = ((ch | 0x80) & 0xBF); ch >>= 6; ^~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:68:49: warning: this statement may fall through [-Wimplicit-fallthrough=] case 3: *--target = ((ch | 0x80) & 0xBF); ch >>= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:69:4: note: here case 2: *--target = ((ch | 0x80) & 0xBF); ch >>= 6; ^~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:69:49: warning: this statement may fall through [-Wimplicit-fallthrough=] case 2: *--target = ((ch | 0x80) & 0xBF); ch >>= 6; ~~~^~~~~ ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:70:4: note: here case 1: *--target = (char)(ch | firstByteMark[bytesToWrite]); ^~~~ ICmpMotion.cpp AtlasObjectJS.cpp format.cpp ICmpMirage.cpp ICmpMinimap.cpp precompiled.cpp PostprocManager.cpp Preprocessor.cpp TerrainRenderer.cpp ../../../source/ps/Preprocessor.cpp: In member function ‘CPreprocessor::Token CPreprocessor::GetArgument(CPreprocessor::Token&, bool)’: ../../../source/ps/Preprocessor.cpp:773:23: warning: this statement may fall through [-Wimplicit-fallthrough=] Error (Line, "Unfinished list of arguments"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../source/ps/Preprocessor.cpp:774:13: note: here case Token::TK_ERROR: ^~~~ ../../../source/ps/Preprocessor.cpp: In member function ‘CPreprocessor::Token CPreprocessor::GetArguments(int&, CPreprocessor::Token*&, bool)’: ../../../source/ps/Preprocessor.cpp:846:23: warning: this statement may fall through [-Wimplicit-fallthrough=] Error (Line, "Unfinished list of arguments"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../source/ps/Preprocessor.cpp:847:13: note: here case Token::TK_ERROR: ^~~~ ../../../source/ps/Preprocessor.cpp: In member function ‘CPreprocessor::Token CPreprocessor::Parse(const CPreprocessor::Token&)’: ../../../source/ps/Preprocessor.cpp:1276:17: warning: this statement may fall through [-Wimplicit-fallthrough=] if (empty_lines) ^~ ../../../source/ps/Preprocessor.cpp:1285:13: note: here case Token::TK_WHITESPACE: ^~~~ ICmpVisual.cpp Quote Link to comment Share on other sites More sharing options...
Stan` Posted August 19, 2017 Report Share Posted August 19, 2017 @vladislavbelov @elexis Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted August 19, 2017 Report Share Posted August 19, 2017 (edited) It looks like you have enabled -Wimplicit-fallthrough in GCC/Clang. And to prevent this, you need to add a comment like or disable the option: case 0: ... // fall through case 1: https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them https://dzone.com/articles/implicit-fallthrough-in-gcc-7 Edited August 19, 2017 by vladislavbelov Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted August 19, 2017 Author Report Share Posted August 19, 2017 40 minutes ago, stanislas69 said: @vladislavbelov @elexis I guess that I could have done that myself? Quote Link to comment Share on other sites More sharing options...
Stan` Posted August 19, 2017 Report Share Posted August 19, 2017 @fatherbushido You didn't so I thought it might help. Apologies. Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted August 19, 2017 Author Report Share Posted August 19, 2017 3 minutes ago, stanislas69 said: @fatherbushido You didn't so I thought it might help. Apologies. no problem Quote Link to comment Share on other sites More sharing options...
elexis Posted August 19, 2017 Report Share Posted August 19, 2017 refs D740 Quote Link to comment Share on other sites More sharing options...
fatherbushido Posted August 20, 2017 Author Report Share Posted August 20, 2017 Thx for the ref. @vladislavbelov: some warnings seem not related to that, do they? edit: those ones remain Spoiler In file included from ../../../source/pch/atlas/precompiled.h:24:0: ../../../source/tools/atlas/GameInterface/Messages.h: In function ‘void AtlasMessage::fGetTerrainGroupPreviews(AtlasMessage::qGetTerrainGroupPreviews*)’: ../../../source/tools/atlas/GameInterface/Messages.h:285: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:285: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:285: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:285: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:285: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:285:8: warning: ‘#‘target_mem_ref’ not supported by dump_expr#<expression error>’ may be used uninitialized in this function [-Wmaybe-uninitialized] CinemaHandler.cpp and Spoiler Renderer.cpp In member function ‘void CInput::UpdateText(int, int, int)’: cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] JSInterface_VFS.cpp Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted August 20, 2017 Report Share Posted August 20, 2017 (edited) 1 hour ago, fatherbushido said: cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] We don't use memset/__builtin_memset directly inside CInput at all. So it looks like a compiler issue (wrong message or something else): https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79095 1 hour ago, fatherbushido said: In file included from ../../../source/pch/atlas/precompiled.h:24:0: ../../../source/tools/atlas/GameInterface/Messages.h: In function ‘void AtlasMessage::fGetTerrainGroupPreviews(AtlasMessage::qGetTerrainGroupPreviews*)’: ../../../source/tools/atlas/GameInterface/Messages.h:285:8: warning: ‘#‘target_mem_ref’ not supported by dump_expr#<expression error>’ may be used uninitialized in this function [-Wmaybe-uninitialized] struct sTerrainTexturePreview ^~~~~~~~~~~~~~~~~~~~~~ It looks like the compile can't follow some call stack. We use threads/events in Atlas (to send between wxWidgets/Pyrogenesis), so the compiler can't find a place where the var was really initialized. By the code there is only the one place where it has assigned AFAIK. Edited August 20, 2017 by vladislavbelov Quote Link to comment Share on other sites More sharing options...
eecsninja Posted April 4, 2018 Report Share Posted April 4, 2018 Resurrecting an old thread... I just built 0AD for the first time and saw a bunch of these compiler warnings: ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp: In function ‘std::__cxx11::wstring fromXmlChar(const xmlChar*)’: ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:96:31: warning: this statement may fall through [-Wimplicit-fallthrough=] case 5: ch += *source++; ch <<= 6; ~~~^~~~~ To get my feet wet with 0AD, I think I can rewrite the code to avoid these warnings and be a little cleaner. These break-less case statements are all repetitive. I could replace them with for loops. The number of cases (and if I were to make the change in #1, loop iterations) is hard-coded. They should be replaced with a constant for more clarity. Let me know what you think. 1 Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted April 4, 2018 Report Share Posted April 4, 2018 2 minutes ago, eecsninja said: Resurrecting an old thread... I just built 0AD for the first time and saw a bunch of these compiler warnings: ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp: In function ‘std::__cxx11::wstring fromXmlChar(const xmlChar*)’: ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:96:31: warning: this statement may fall through [-Wimplicit-fallthrough=] case 5: ch += *source++; ch <<= 6; ~~~^~~~~ To get my feet wet with 0AD, I think I can rewrite the code to avoid these warnings and be a little cleaner. These break-less case statements are all repetitive. I could replace them with for loops. The number of cases (and if I were to make the change in #1, loop iterations) is hard-coded. They should be replaced with a constant for more clarity. Let me know what you think. We need the warnings. Quote Link to comment Share on other sites More sharing options...
eecsninja Posted April 4, 2018 Report Share Posted April 4, 2018 ^^^ I can't tell why we need the warnings when I read over the thread. What's the reason? Quote Link to comment Share on other sites More sharing options...
Stan` Posted April 4, 2018 Report Share Posted April 4, 2018 4 hours ago, eecsninja said: ^^^ I can't tell why we need the warnings when I read over the thread. What's the reason? Hey @eecsninja Have you read on how to contribute yet ? If not I'd suggest your read GettingStartedProgrammers and SubmittingPatches on trac.wildfiregames.com I can't promise your changes will make it to the game but they are most likely welcome. Regards, 1 Quote Link to comment Share on other sites More sharing options...
s0600204 Posted June 3, 2019 Report Share Posted June 3, 2019 For what it's worth, the warnings above for AtlasObjectXML.cpp concerning the implicit fallthroughs should no longer occur as the code has been rewritten to no longer need the break-less switch...case statements at all. @eecsninja, thank you for your patch. It is unfortunate that it wasn't included (due to it being superseded by work being undertaken pursuing another objective), but we appreciate the effort . 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.