Skip to content

Fix ODR violations in headers - #68

Merged
LimiNode merged 2 commits into
mainfrom
codex/make-code-odr-compliant-and-header-only
Sep 20, 2025
Merged

Fix ODR violations in headers#68
LimiNode merged 2 commits into
mainfrom
codex/make-code-odr-compliant-and-header-only

Conversation

@LimiNode

Copy link
Copy Markdown
Owner

Summary

  • mark non-template header utilities as inline and replace the NTP client's static thread-local with a function-local storage helper to prevent multiple definitions
  • add a two-translation-unit minimal project that builds under C++11 and C++17 to demonstrate safe multi-TU inclusion

Testing

  • cmake -S . -B build -DTIME_SHIELD_CPP_BUILD_TESTS=ON
  • cmake --build build --target odr_mwe_cxx11 odr_mwe_cxx17

https://chatgpt.com/codex/tasks/task_e_68ce008ce380832c8993eb8c9de41175

Inline non-template header functions and replace static thread local storage to avoid ODR violations. Add a two-TU minimal project to prove multi-translation-unit compatibility.
Rename the ODR sample project folder to tests/odr, rename the executables, and register them as ctest cases so CI covers them.

Also adjust the helper return value to keep the tests passing.
@LimiNode
LimiNode merged commit 2b8c980 into main Sep 20, 2025
7 checks passed
@LimiNode
LimiNode deleted the codex/make-code-odr-compliant-and-header-only branch September 20, 2025 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant