Page MenuHomeWildfire Games

Fix ODR violation for ShaderModelRendererInternals
ClosedPublic

Authored by StefanBruens on Aug 4 2020, 8:44 PM.

Details

Summary

ShaderModelRendererInternals is defined twice, once by ModelRenderer.cpp
and once by HWLightingModelRenderer.cpp. Having both in the global
namespace is a violation of the C++ One-Definition-Rule.

Move both definitions into their "parent" classes.

Test Plan

Building with LTO enabled finishes without warnings

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

StefanBruens requested review of this revision.Aug 4 2020, 8:44 PM
StefanBruens created this revision.
StefanBruens added a reviewer: Imarok.
Stan added a subscriber: Stan.Aug 5 2020, 7:24 AM

Hey thanks for the patch

Can you add context to the patch?

e.g.
svn diff -x -U5000
git diff -U5000

Or if you use arcanist see

https://trac.wildfiregames.com/wiki/Phabricator

wraitii updated this revision to Diff 13059.Aug 5 2020, 8:55 AM
wraitii edited the summary of this revision. (Show Details)

Upload with context.

I can actually compile with LTO anyways on clang, but this seems correct to me and it works.

Owners added a subscriber: Restricted Owners Package.Aug 5 2020, 8:55 AM

I'd like to have @vladislavbelov's take on this before merging

Indeed, there is the violation of ODR. The patch seems legit.

You need to add yourself in credits: binaries/data/mods/public/gui/credits/texts/programming.json if you're not there yet.

source/renderer/HWLightingModelRenderer.h
1 ↗(On Diff #13059)

The year should be updated when the file has been changed.

source/renderer/ModelRenderer.h
1 ↗(On Diff #13059)

The same.

wraitii updated this revision to Diff 13092.Aug 6 2020, 9:08 AM

Years, programming credits.

Owners added a subscriber: Restricted Owners Package.Aug 6 2020, 9:08 AM
wraitii accepted this revision.Aug 6 2020, 9:09 AM

@StefanBruens Let me know if the credits are OK for you or if you want to appear differently. I'll commit then.

This revision is now accepted and ready to land.Aug 6 2020, 9:09 AM
Vulcan added a comment.Aug 6 2020, 9:18 AM

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

Linter detected issues:
Executing section Source...

Project wide:
**** CPPCheckBear (syntaxError) [Section: Source | Severity: MAJOR] ****
!    ! Code 'classShaderModelVertexRenderer:' is invalid C code. Use --std or --language to configure the language.

Project wide:
**** CPPCheckBear (syntaxError) [Section: Source | Severity: MAJOR] ****
!    ! Code 'classCModelRData:' 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/2907/display/redirect

StefanBruens added inline comments.Aug 6 2020, 12:24 PM
binaries/data/mods/public/gui/credits/texts/programming.json
233 ↗(On Diff #13092)

The second one should be "name", otherwise looks fine.

wraitii updated this revision to Diff 13100.Aug 6 2020, 12:38 PM

Fixed and umlauted. Committing when lights are green.

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

Linter detected issues:
Executing section Source...

Project wide:
**** CPPCheckBear (syntaxError) [Section: Source | Severity: MAJOR] ****
!    ! Code 'classShaderModelVertexRenderer:' is invalid C code. Use --std or --language to configure the language.

Project wide:
**** CPPCheckBear (syntaxError) [Section: Source | Severity: MAJOR] ****
!    ! Code 'classCModelRData:' 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/2913/display/redirect

This revision was automatically updated to reflect the committed changes.