Skip to content

C4_LIKELY now uses [[likely]] when possible#172

Merged
biojppm merged 2 commits into
masterfrom
refac/unlikely
Jun 30, 2026
Merged

C4_LIKELY now uses [[likely]] when possible#172
biojppm merged 2 commits into
masterfrom
refac/unlikely

Conversation

@biojppm

@biojppm biojppm commented Jun 29, 2026

Copy link
Copy Markdown
Owner
  • [BREAKING] C4_LIKELY() and C4_UNLIKELY() now use [[likely]] and [[unlikely]] in C++20. Every use of this macro needs to refactored:
    if(C4_LIKELY(condition)) ... // error now
    // needs to be rewritten as:
    if C4_LIKELY(condition)  ...
    // same for C4_UNLIKELY
  • Add C4_LIKELY20 and C4_UNLIKELY20, which resolve directly into [[likely]] and [[unlikely]] when C++ is 20 or later, or nothing otherwise.
  • Add C++23 detection (C4_CPP and C4_CPP23)

@biojppm biojppm changed the title C4_LIKELY now uses [[restrict]] when possible C4_LIKELY now uses [[likely]] when possible Jun 29, 2026
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.54%. Comparing base (ee72737) to head (2560fb1).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #172   +/-   ##
=======================================
  Coverage   97.54%   97.54%           
=======================================
  Files          29       29           
  Lines        3341     3341           
=======================================
  Hits         3259     3259           
  Misses         82       82           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@biojppm biojppm merged commit b66bebf into master Jun 30, 2026
253 checks passed
@biojppm biojppm deleted the refac/unlikely branch June 30, 2026 00:32
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