Skip to content

build: const fmt formatter + suppress C4100 in this lib#41

Merged
alandtse merged 5 commits into
masterfrom
fix/fmt-v12-and-w4
May 31, 2026
Merged

build: const fmt formatter + suppress C4100 in this lib#41
alandtse merged 5 commits into
masterfrom
fix/fmt-v12-and-w4

Conversation

@alandtse

@alandtse alandtse commented May 31, 2026

Copy link
Copy Markdown
Owner

Modernizes against the current toolchain/deps:

  • REL/Version.h: make fmt::formatter<REL::Version>::format const — fmt v12 requires formatter::format() const.
  • CommonLibF4/CMakeLists.txt: add /wd4100 (unreferenced formal parameter) to this library's existing warning-suppression list, so it suppresses its own noisy warning under MSVC 14.4 rather than consumers suppressing globally.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced formatting infrastructure to provide consistent output formatting for logging and debugging scenarios
    • Improved code quality through compiler-level optimizations and modernized attribute handling
    • Updated support for diagnostic and debugging tools integration

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56c03134-a96a-4326-a675-39df8e944655

📥 Commits

Reviewing files that changed from the base of the PR and between 34ca5e4 and ebea956.

📒 Files selected for processing (4)
  • CommonLibF4/include/RE/Bethesda/BSFixedString.h
  • CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h
  • CommonLibF4/include/RE/NetImmerse/NiMatrix3.h
  • CommonLibF4/include/RE/NetImmerse/NiPoint.h

Walkthrough

This PR adds compiler quality improvements and fmt library formatter support across six headers. Two methods mark unused parameters with [[maybe_unused]], and four types receive conditional fmt::formatter specializations to enable formatting with the fmt library when available.

Changes

Compiler Quality Annotations

Layer / File(s) Summary
Parameter annotations for unused arguments
CommonLibF4/include/RE/Bethesda/Actor.h, CommonLibF4/include/RE/Bethesda/BSTSmartPointer.h
RE::Actor::SetLastRiddenMount and BSTSmartPointerAutoPtr<T>::Acquire mark their parameters as [[maybe_unused]] to suppress compiler warnings in no-op implementations.

fmt Formatter Support

Layer / File(s) Summary
fmt formatter specializations for core types
CommonLibF4/include/RE/Bethesda/BSFixedString.h, CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h, CommonLibF4/include/RE/NetImmerse/NiMatrix3.h, CommonLibF4/include/RE/NetImmerse/NiPoint.h
Conditional fmt::formatter specializations guarded by #ifdef FMT_VERSION are added for BSFixedString, SEX, NiMatrix3, and NiPoint2/3/4 types, delegating to std::formatter or implementing equivalent format logic via fmt::format_to.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

Formatters bloom where types once silent lay,
Each point and string now speaks in fmt's way,
Unused parameters whisper, "warning, no more,"
Six files aligned, the library soars. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately summarizes the two main changes: adding const to fmt formatters and suppressing C4100 warnings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fmt-v12-and-w4

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…nused]]

- REL/Version.h: fmt::formatter<REL::Version>::format made const (fmt v11+/v12 call
  format() on a const formatter).
- Actor.h SetLastRiddenMount, BSTSmartPointer.h Acquire: their unused parameters
  now use [[maybe_unused]] (matching this library's existing convention for no-op
  stubs) so they don't trip C4100 under /W4 /WX. No blanket /wd4100 suppression.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alandtse
alandtse force-pushed the fix/fmt-v12-and-w4 branch from 63afa08 to 0ed6f46 Compare May 31, 2026 17:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
CommonLibF4/include/REL/Version.h (1)

145-145: ⚡ Quick win

Inconsistency between AI summary and code; missing constexpr.

The AI summary states that constexpr was added to this method, but the annotated code doesn't show the constexpr keyword. Additionally, the std::formatter specialization at line 134 is marked constexpr, but this fmt::formatter version is not. For consistency and to enable compile-time formatting, add the constexpr qualifier.

Proposed fix
-	auto format(const REL::Version& a_version, FormatContext& a_ctx) const
+	constexpr auto format(const REL::Version& a_version, FormatContext& a_ctx) const
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CommonLibF4/include/REL/Version.h` at line 145, The fmt::formatter
specialization's member function auto format(const REL::Version& a_version,
FormatContext& a_ctx) const is missing the constexpr qualifier causing
inconsistency with the std::formatter specialization; mark this method constexpr
to match the other specialization and allow compile-time formatting (update the
fmt::formatter::format method signature to be constexpr auto format(const
REL::Version& a_version, FormatContext& a_ctx) const).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@CommonLibF4/include/REL/Version.h`:
- Line 145: The fmt::formatter specialization's member function auto
format(const REL::Version& a_version, FormatContext& a_ctx) const is missing the
constexpr qualifier causing inconsistency with the std::formatter
specialization; mark this method constexpr to match the other specialization and
allow compile-time formatting (update the fmt::formatter::format method
signature to be constexpr auto format(const REL::Version& a_version,
FormatContext& a_ctx) const).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bb529dbc-3fbc-4289-885f-544e1e3b1835

📥 Commits

Reviewing files that changed from the base of the PR and between 2b64114 and 34ca5e4.

📒 Files selected for processing (3)
  • CommonLibF4/include/RE/Bethesda/Actor.h
  • CommonLibF4/include/RE/Bethesda/BSTSmartPointer.h
  • CommonLibF4/include/REL/Version.h

alandtse and others added 3 commits May 31, 2026 10:59
fmt v11+/v12 no longer falls back to std::formatter, so types that only had a
std::formatter became unformattable via fmt/spdlog. Add fmt::formatter (guarded by
FMT_VERSION) mirroring the std ones for BSFixedString, NiPoint2/3/4, NiMatrix3 and SEX.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alandtse alandtse changed the title fix: const fmt formatter + suppress C4100 in this lib build: const fmt formatter + suppress C4100 in this lib May 31, 2026
@alandtse
alandtse merged commit e260e4c into master May 31, 2026
10 of 12 checks passed
@alandtse
alandtse deleted the fix/fmt-v12-and-w4 branch May 31, 2026 22:03
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.

1 participant