Skip to content

Fixed GCC ODR warnings: enum name clashes in CRegion, CSector and CWorld - #1619

Open
DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/odr-enum-names
Open

DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/odr-enum-names

Conversation

@DavideRei

@DavideRei DavideRei commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

RC_TYPE (CServerConfig/CRegion), SC_TYPE (CServerDef/CSector) and WC_TYPE (CWebPageDef/CWorld) were defined with different contents in different translation units, which violates the One Definition Rule (GCC -Wodr with LTO). The local enums of CRegion.cpp, CSector.cpp and CWorld.cpp are renamed (REGC_TYPE, SECC_TYPE, WLDC_TYPE), and their values too, to match (REGC_*, SECC_*, WLDC_*). No functional change.


Type of Change

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation update
  • Build / CI change
  • Other (please describe): behaviour change

Related Issues

None.


Testing

  • Compiled with MSVC 2022 (Windows x64, Release) on top of the current dev.
  • The same change has been running on our shard (a private fork kept aligned with dev); the code in this PR was adapted to the current dev and was not tested in game in this form.

Checklist

  • Code compiles successfully
  • Changes follow the project's coding style
  • No unrelated code was modified
  • Documentation updated where necessary (Changelog.txt)
  • This PR does not introduce breaking changes (or they are documented)

Additional Notes

None.

🤖 Generated with Claude Code

@mtwango

mtwango commented Nov 5, 2026

Copy link
Copy Markdown
Member

Maybe the prefixes in those enums should be renamed too, to match types renames?

RC_TYPE (CServerConfig/CRegion), SC_TYPE (CServerDef/CSector) and WC_TYPE (CWebPageDef/CWorld) were defined
with different contents in different translation units, which violates the One Definition Rule (GCC -Wodr with LTO).
The local enums of CRegion.cpp, CSector.cpp and CWorld.cpp are renamed (REGC_TYPE, SECC_TYPE, WLDC_TYPE), and
their values too, to match (REGC_*, SECC_*, WLDC_*). No functional change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@DavideRei

Copy link
Copy Markdown
Contributor Author

Sure, done: the values are renamed too, to match the types: RC_ → REGC_, SC_ → SECC_, WC_ → WLDC_. The same prefixes are used by other enums in CServerConfig.cpp, CServerDef.cpp and CWebPageDef.cpp, so this removes that ambiguity as well. I also rebased the branch on the current dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants