mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge bitcoin/bitcoin#24988: lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py
fa82a1ed833fd749849fa19267207b63e338d84d lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py (MacroFake) Pull request description: Follow up to commit b1c5991eebb916755be188f355ad36fe01a3f529. Also remove empty newline added in that commit. ACKs for top commit: fanquake: ACK fa82a1ed833fd749849fa19267207b63e338d84d Tree-SHA512: cf398eceb135672137183bfa19ee57a82553a3dbcbce74db954c6fcd79f9606092cc0d8217610fe6cd67b7ef2d4f01d90329f0f568516d9b14aa2cd0f0715478
This commit is contained in:
parent
90ced24f4a
commit
f39fcd1402
@ -30,7 +30,6 @@ T&& inline_check_non_fatal(T&& val, const char* file, int line, const char* func
|
|||||||
throw NonFatalCheckError(
|
throw NonFatalCheckError(
|
||||||
format_internal_error(assertion, file, line, func, PACKAGE_BUGREPORT));
|
format_internal_error(assertion, file, line, func, PACKAGE_BUGREPORT));
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::forward<T>(val);
|
return std::forward<T>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,20 +30,20 @@ def main():
|
|||||||
r"[^_]assert\(.*(\+\+|\-\-|[^=!<>]=[^=!<>]).*\);",
|
r"[^_]assert\(.*(\+\+|\-\-|[^=!<>]=[^=!<>]).*\);",
|
||||||
"--",
|
"--",
|
||||||
"*.cpp",
|
"*.cpp",
|
||||||
"*.h"
|
"*.h",
|
||||||
], "Assertions should not have side effects:")
|
], "Assertions should not have side effects:")
|
||||||
|
|
||||||
# Macro CHECK_NONFATAL(condition) should be used instead of assert for RPC code, where it
|
# Aborting the whole process is undesirable for RPC code. So nonfatal
|
||||||
# is undesirable to crash the whole program. See: src/util/check.h
|
# 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.
|
# src/rpc/server.cpp is excluded from this check since it's mostly meta-code.
|
||||||
exit_code |= git_grep([
|
exit_code |= git_grep([
|
||||||
"-nE",
|
"-nE",
|
||||||
r"\<(A|a)ssert *\(.*\);",
|
r"\<(A|a)ss(ume|ert) *\(.*\);",
|
||||||
"--",
|
"--",
|
||||||
"src/rpc/",
|
"src/rpc/",
|
||||||
"src/wallet/rpc*",
|
"src/wallet/rpc*",
|
||||||
":(exclude)src/rpc/server.cpp"
|
":(exclude)src/rpc/server.cpp",
|
||||||
], "CHECK_NONFATAL(condition) should be used instead of assert for RPC code.")
|
], "CHECK_NONFATAL(condition) or NONFATAL_UNREACHABLE should be used instead of assert for RPC code.")
|
||||||
|
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user