Page MenuHomeWildfire Games

Fix duplication and clang warning in unreachable gathering target fix rP22816 / D2120
ClosedPublic

Authored by wraitii on Sep 1 2019, 2:53 PM.

Details

Summary

As reported by elexis in rP22816 / D2120.

Function marked Inline for it's declared only in the TU, and could be redeclared in another TU with exactly the same behaviour, and we don't really want to have linking issues over this.

Test Plan

Notice things are deduplicated and fixed.

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.Sep 1 2019, 2:53 PM
Vulcan added a comment.Sep 1 2019, 2:55 PM

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

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

Vulcan added a comment.Sep 1 2019, 3:03 PM

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

Linter detected issues:
Executing section Source...

source/simulation2/components/ICmpRangeManager.h
|  69| class·ICmpRangeManager·:·public·IComponent
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classICmpRangeManager:' 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/543/display/redirect

elexis accepted this revision.Sep 1 2019, 3:03 PM
elexis added a subscriber: elexis.

As far as I know inline doesn't do anything, because the compiler decides to inline according to its own heuristics.
Only effect I found was that gcc shows a compiler warning if it decides to not inline.
Thanks for the fix and duplication removal.
Tested with clang 8.0.1.

This revision is now accepted and ready to land.Sep 1 2019, 3:03 PM
elexis retitled this revision from Fix duplication and clang warning in rP22816 to Fix duplication and clang warning in unreachable gathering target fix rP22816 / D2120.Sep 1 2019, 3:08 PM
elexis edited the summary of this revision. (Show Details)
elexis added inline comments.
source/simulation2/components/ICmpRangeManager.cpp
24 ↗(On Diff #9580)

Perhaps it should return std::string like the using functions?

wraitii updated this revision to Diff 9581.Sep 1 2019, 3:17 PM

inline can be used to get around the ODR. However it seems an anonymous namespace is safer.

Also return std::string directly.

Vulcan added a comment.Sep 1 2019, 3:19 PM

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

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

Vulcan added a comment.Sep 1 2019, 3:26 PM

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

Linter detected issues:
Executing section Source...

source/simulation2/components/ICmpRangeManager.h
|  69| class·ICmpRangeManager·:·public·IComponent
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classICmpRangeManager:' 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/544/display/redirect

This revision was landed with ongoing or failed builds.Sep 1 2019, 4:10 PM
This revision was automatically updated to reflect the committed changes.