This patch fixes warnings when building the tests and atlas about a variable being redeclared, by getting rid of the macro
Details
- Reviewers
vladislavbelov Silier Itms - Commits
- rP22048: Fix warnings in vs2015 when building tests.
Test I didn't break anything.
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
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Default... Executing section Source... source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp | 33| #include·"graphics/Terrain.h" | | [MAJOR] CPPCheckBear (syntaxError): | | Invalid number of character ({) when these macros are defined: ''. source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp | 33| #include·"graphics/Terrain.h" | | [MAJOR] CPPCheckBear (syntaxError): | | Invalid number of character ({) when these macros are defined: 'MESSAGES_SKIP_STRUCTS'. source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp | 33| #include·"graphics/Terrain.h" | | [MAJOR] CPPCheckBear (syntaxError): | | Invalid number of character ({) when these macros are defined: '_MSC_VER'. Executing section JS...
Link to build: https://jenkins.wildfiregames.com/job/differential/794/
The problem isn't in macros, because we use scoped block to solve the redeclaration. Probably it was missed somewhere. If you still remove macros, you need to remove scoped blocks too.
You can't remove braces see the comment I added : "scoping braces are important to indicate where an element ends. If you don't put them the tag won't be closed until the object's destructor is called, usually when it goes out of scope."
There was no way to update the macros to work because you couldn't know what users would name them. Also some of the macros were hacky.
Can't fix those warnings, because they have no reasons to be.
https://github.com/0ad/0ad/search?q=MESSAGES_SKIP_STRUCTS&unscoped_q=MESSAGES_SKIP_STRUCTS
So far I can tell that warnings are solved. I did not try to run game with this patch yet.
Atlas loads, generates, saves maps -> ok
no error or crash in game starting different maps
The patch looks good and it works for me too! However, I tested building Atlas and got the following warnings:
- C4458 in AtlasObjectImpl.cpp line 292 and in AtlasUI/Object.cpp:547
- C4456 in MapDialog.cpp:173 and in ScenarioEditor.cpp:742
I know that this patch fixes warnings in the non-Atlas-DLL projects, but since there are few warnings left, we could include them in here for completeness ?
@Itms can I commit this separately after fixing the headers ? The other diff is gonna be quite big.