From 6f3620898b5808360e6c59a1a7ada71e427e8027 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 22 Aug 2017 09:36:06 +0200 Subject: [PATCH] Merge #10843: Add attribute [[noreturn]] (C++11) to functions that will not return b82c55a Add attribute [[noreturn]] (C++11) to functions that will not return (practicalswift) Pull request description: Add attribute `[[noreturn]]` (C++11) to functions that will not return. Rationale: * Reduce the number of false positives/false negatives from static analyzers with regards to things such as unused or unreachable code * Potentially enable additional compiler optimizations Tree-SHA512: 899683fe8b2fcf19bd334352271d368b46b805be9d426aac1808335fd95732d6d7078d3296951b9879196f3f6e3ec0fdb7695d0afdc3fbe4dd78a2ca70e91ff7 Signed-off-by: Pasta Fixes for bitcoin#10843 backport --- src/random.cpp | 4 ++-- src/test/test_dash_main.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/random.cpp b/src/random.cpp index 4f42bb9e3088e8..c58e63bed6c563 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -46,10 +46,10 @@ #include #include -static void RandFailure() +[[noreturn]] static void RandFailure() { LogPrintf("Failed to read randomness, aborting\n"); - abort(); + std::abort(); } static inline int64_t GetPerformanceCounter() diff --git a/src/test/test_dash_main.cpp b/src/test/test_dash_main.cpp index 802aaa83a50600..25b875cf286040 100644 --- a/src/test/test_dash_main.cpp +++ b/src/test/test_dash_main.cpp @@ -12,12 +12,12 @@ std::unique_ptr g_connman; -void Shutdown(void* parg) +[[noreturn]] void Shutdown(void* parg) { exit(EXIT_SUCCESS); } -void StartShutdown() +[[noreturn]] void StartShutdown() { exit(EXIT_SUCCESS); }