src: modernize likely/unlikely hints
An attempt to modernize C++ code to use [[likely]] and [[unlikely]] available after C++20.
Reference: https://en.cppreference.com/w/cpp/language/attributes/likely
This pull-request also disables readability/braces rule from cpplint, since it doesn't support C++20. Main branch of cpplint supports it, but unfortunately they didn't release a new version in the last 2 years.
Review requested:
- [ ] @nodejs/crypto
- [ ] @nodejs/http2
- [ ] @nodejs/net
- [ ] @nodejs/startup
cc @nodejs/cpp-reviewers
CI: https://ci.nodejs.org/job/node-test-pull-request/62832/
Codecov Report
Attention: Patch coverage is 34.59716% with 138 lines in your changes missing coverage. Please review.
Project coverage is 88.23%. Comparing base (
3800d60) to head (0b257ca). Report is 23 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #55155 +/- ##
==========================================
- Coverage 88.24% 88.23% -0.02%
==========================================
Files 651 651
Lines 183937 183911 -26
Branches 35861 35833 -28
==========================================
- Hits 162318 162274 -44
- Misses 14911 14945 +34
+ Partials 6708 6692 -16
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/api/callback.cc | 78.10% <100.00%> (ø) |
|
| src/api/environment.cc | 76.00% <100.00%> (-0.49%) |
:arrow_down: |
| src/base_object.cc | 84.61% <100.00%> (-0.97%) |
:arrow_down: |
| src/crypto/crypto_keys.cc | 73.06% <ø> (-0.35%) |
:arrow_down: |
| src/crypto/crypto_spkac.cc | 88.88% <100.00%> (ø) |
|
| src/env-inl.h | 96.80% <100.00%> (+<0.01%) |
:arrow_up: |
| src/env.cc | 85.65% <100.00%> (+0.02%) |
:arrow_up: |
| src/node_contextify.cc | 81.45% <100.00%> (+0.10%) |
:arrow_up: |
| src/node_modules.cc | 78.64% <100.00%> (+0.53%) |
:arrow_up: |
| src/permission/permission.h | 80.00% <100.00%> (+2.22%) |
:arrow_up: |
| ... and 42 more |
Landed in 317d2450f94bd8d307e155cf4d50ca9fb02ba503
We've recently released 2.0. Let us know if the [[(un)likely]] detection works!