Skip to content

Commit e36c612

Browse files
committed
Merge bitcoin/bitcoin#24988: lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py
fa82a1e lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py (MacroFake) Pull request description: Follow up to commit b1c5991. Also remove empty newline added in that commit. ACKs for top commit: fanquake: ACK fa82a1e Tree-SHA512: cf398eceb135672137183bfa19ee57a82553a3dbcbce74db954c6fcd79f9606092cc0d8217610fe6cd67b7ef2d4f01d90329f0f568516d9b14aa2cd0f0715478
2 parents 85aea18 + fa82a1e commit e36c612

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/util/check.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ T&& inline_check_non_fatal(T&& val, const char* file, int line, const char* func
3030
throw NonFatalCheckError(
3131
format_internal_error(assertion, file, line, func, PACKAGE_BUGREPORT));
3232
}
33-
3433
return std::forward<T>(val);
3534
}
3635

test/lint/lint-assertions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ def main():
3030
r"[^_]assert\(.*(\+\+|\-\-|[^=!<>]=[^=!<>]).*\);",
3131
"--",
3232
"*.cpp",
33-
"*.h"
33+
"*.h",
3434
], "Assertions should not have side effects:")
3535

36-
# Macro CHECK_NONFATAL(condition) should be used instead of assert for RPC code, where it
37-
# is undesirable to crash the whole program. See: src/util/check.h
36+
# Aborting the whole process is undesirable for RPC code. So nonfatal
37+
# checks should be used over assert. See: src/util/check.h
3838
# src/rpc/server.cpp is excluded from this check since it's mostly meta-code.
3939
exit_code |= git_grep([
4040
"-nE",
41-
r"\<(A|a)ssert *\(.*\);",
41+
r"\<(A|a)ss(ume|ert) *\(.*\);",
4242
"--",
4343
"src/rpc/",
4444
"src/wallet/rpc*",
45-
":(exclude)src/rpc/server.cpp"
46-
], "CHECK_NONFATAL(condition) should be used instead of assert for RPC code.")
45+
":(exclude)src/rpc/server.cpp",
46+
], "CHECK_NONFATAL(condition) or NONFATAL_UNREACHABLE should be used instead of assert for RPC code.")
4747

4848
sys.exit(exit_code)
4949

0 commit comments

Comments
 (0)