← Back to Pull requests

Refactor: avoid C-style macros by refactoring macros.h to proper templated functions for better type-safety #69

Closed
unknown closed this pull request without merging on Feb 04, 2026 13:04 UTC
View on GitHub
unknown unknown commented on Dec 27, 2025 20:17 UTC
Author

Description:


After having a few warning messages regarding C-style macros, I started refactoring the whole macros.h file to support templated functions as an initiative to study them a bit better and to have more type-safety for a proper Logger. I think it's also important to modernize how we're using C++ here and how to ensure safety through compile time evaluations.

Addition of the log_t<log_level>(...) API:


With this, it will now be possible to call the log functions as:
log_t<info>("Info message goes here {}", args);

or even without a template argument as such:
log_t("Normal log message with pure white text");

Addition of the color_str<color>(...) API:


With this API it's now possible to format strings using colors for object naming in a way they are more visible in the console, hence more debuggeable:
appDeviceRef->debugUtilsObjectNameInfoEXT(
    VK_OBJECT_TYPE_SEMAPHORE,
    reinterpret_cast<uint64_t>(renderFinishedSemaphores[i]),      
    color_str<red>("SyncObject::VkSemaphore:renderFinishedSemaphore[{}]", i)
);
 

Link to compiler explorer


The current changes can be studied and debugged inside compiler explorer through the link:
https://godbolt.org/z/1vKW77TnY

Useful Resources


https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2347r2.pdf

Diff: 171 lines (+128 / -43) across 2 files Reviewer: lknknm Review duration: 55727m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 171 lines diff across 2 files
0.35
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.308
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #69"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35.2% (MEDIUM) · Higher = larger blast radius
35.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 13.9% · Safe to merge
13.9%