aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-04-26 10:02:08 +0200
committerMacroFake <falke.marco@gmail.com>2022-04-26 10:01:54 +0200
commitfa82a1ed833fd749849fa19267207b63e338d84d (patch)
tree12e9048b8872581feed595ffb76281754889d9d0
parent1ae65b4c5fbffb691e755dc0dacf1c63b55ad81b (diff)
downloadbitcoin-fa82a1ed833fd749849fa19267207b63e338d84d.tar.xz
lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py
-rw-r--r--src/util/check.h1
-rwxr-xr-xtest/lint/lint-assertions.py12
2 files changed, 6 insertions, 7 deletions
diff --git a/src/util/check.h b/src/util/check.h
index 91d62e262d..aca957925a 100644
--- a/src/util/check.h
+++ b/src/util/check.h
@@ -30,7 +30,6 @@ T&& inline_check_non_fatal(T&& val, const char* file, int line, const char* func
throw NonFatalCheckError(
format_internal_error(assertion, file, line, func, PACKAGE_BUGREPORT));
}
-
return std::forward<T>(val);
}
diff --git a/test/lint/lint-assertions.py b/test/lint/lint-assertions.py
index a8d2b3927c..195ff33d11 100755
--- a/test/lint/lint-assertions.py
+++ b/test/lint/lint-assertions.py
@@ -30,20 +30,20 @@ def main():
r"[^_]assert\(.*(\+\+|\-\-|[^=!<>]=[^=!<>]).*\);",
"--",
"*.cpp",
- "*.h"
+ "*.h",
], "Assertions should not have side effects:")
- # Macro CHECK_NONFATAL(condition) should be used instead of assert for RPC code, where it
- # is undesirable to crash the whole program. See: src/util/check.h
+ # Aborting the whole process is undesirable for RPC code. So nonfatal
+ # checks should be used over assert. See: src/util/check.h
# src/rpc/server.cpp is excluded from this check since it's mostly meta-code.
exit_code |= git_grep([
"-nE",
- r"\<(A|a)ssert *\(.*\);",
+ r"\<(A|a)ss(ume|ert) *\(.*\);",
"--",
"src/rpc/",
"src/wallet/rpc*",
- ":(exclude)src/rpc/server.cpp"
- ], "CHECK_NONFATAL(condition) should be used instead of assert for RPC code.")
+ ":(exclude)src/rpc/server.cpp",
+ ], "CHECK_NONFATAL(condition) or NONFATAL_UNREACHABLE should be used instead of assert for RPC code.")
sys.exit(exit_code)