Skip to content

Commit c1ba118

Browse files
author
MarcoFalke
committed
Merge #15938: refactor: Silence "control reaches end of non-void function" (-Wreturn-type) in psbt.cpp
beb42d7 Silence GCC 7 warning "control reaches end of non-void function" (-Wreturn-type) in psbt.cpp (practicalswift) Pull request description: Silence GCC 7 warning "control reaches end of non-void function" (`-Wreturn-type`) in `psbt.cpp`. Context: bitcoin/bitcoin@ef22fe8#r33370109 Before this patch: ``` $ ./configure CC=gcc-7 CXX=g++-7 $ make 2>&1 | grep -A2 "warning: " leveldb/util/logging.cc:58:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] (v == kMaxUint64/10 && delta > kMaxUint64%10)) { ~~~~~~^~~~~~~~~~~~~~~ -- leveldb/port/port_posix.cc:60:15: warning: ‘ecx’ may be used uninitialized in this function [-Wmaybe-uninitialized] return (ecx & (1 << 20)) != 0; ~~~~~^~~~~~~~~~~~ -- psbt.cpp:341:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ $ ``` After this patch: ``` $ ./configure CC=gcc-7 CXX=g++-7 $ make 2>&1 | grep -A2 "warning: " leveldb/util/logging.cc:58:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] (v == kMaxUint64/10 && delta > kMaxUint64%10)) { ~~~~~~^~~~~~~~~~~~~~~ -- leveldb/port/port_posix.cc:60:15: warning: ‘ecx’ may be used uninitialized in this function [-Wmaybe-uninitialized] return (ecx & (1 << 20)) != 0; ~~~~~^~~~~~~~~~~~ $ ``` ACKs for commit beb42d: Tree-SHA512: b068b9aef565cae0bd1fa1f79c8d422ed2c3e7645edfa14a780a36dd66095a3c627f4111a6b16e706ce6c8abafe51725af8b3bf60778821de0aa8f6193bfadf8
2 parents c4560a7 + beb42d7 commit c1ba118

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/psbt.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ std::string PSBTRoleName(PSBTRole role) {
337337
case PSBTRole::SIGNER: return "signer";
338338
case PSBTRole::FINALIZER: return "finalizer";
339339
case PSBTRole::EXTRACTOR: return "extractor";
340+
// no default case, so the compiler can warn about missing cases
340341
}
342+
assert(false);
341343
}
342344

343345
bool DecodeBase64PSBT(PartiallySignedTransaction& psbt, const std::string& base64_tx, std::string& error)

0 commit comments

Comments
 (0)