Repository navigation
Avoid returning enum in boolean context - #2364
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/0.x #2364 +/- ##
============================================
Coverage 85.46% 85.46%
============================================
Files 126 126
Lines 22710 22710
============================================
Hits 19408 19408
Misses 3302 3302 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
FYI, this, among other things, is also being fixed in PR #2355 |
|
Verified against current main: the same spot in X25519EncMaterial::parse() now already does 'return false;' (the whole function was reworked to return bool properly by the crypto-refresh/PQC refactoring, e.g. 2dcae85 and follow-ups). This PR is a no-op against current main and can probably be closed as superseded. I left it unmerged/unclosed for the author/maintainers to confirm. |
Without this fix, when compiling with `ENABLE_CRYPTO_REFRESH`, we see:
```
…/src/lib/enc_material.cpp: In member function ‘virtual bool pgp::X25519EncMaterial::parse(pgp_packet_body_t&)’:
…/src/lib/enc_material.cpp:154:20: warning: enum constant in boolean context [-Wint-in-bool-context]
154 | return RNP_ERROR_BAD_FORMAT;
| ^~~~~~~~~~~~~~~~~~~~
make[3]: Leaving directory '…/build'
```
dcaa3a1 to
29c6c7d
Compare
|
Correction to my earlier comment: on main this is indeed already fixed, but this PR targets release/0.x where the issue is still present. Rebased onto release/0.x and extended the fix to the identical case in MlkemEcdhEncMaterial::parse (same 'return RNP_ERROR_BAD_FORMAT' in a bool function, line 205). Verified locally on the release/0.x base. |
|
Just need one more approval! |
Without this fix, when compiling with
ENABLE_CRYPTO_REFRESH, we see: