aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpracticalswift <[email protected]>2017-07-16 14:56:43 +0200
committerpracticalswift <[email protected]>2017-07-17 18:46:18 +0200
commitb82c55af78738258b56bd8fe7b5f8d5ccf85f832 (patch)
treed2d0e2d5c533bd9ff6a6ddf4ef5cce5ff8b9161c
parentMerge #10235: Track keypool entries as internal vs external in memory (diff)
downloaddiscoin-b82c55af78738258b56bd8fe7b5f8d5ccf85f832.tar.xz
discoin-b82c55af78738258b56bd8fe7b5f8d5ccf85f832.zip
Add attribute [[noreturn]] (C++11) to functions that will not return
Rationale: * Reduce the number of false positives from static analyzers * Potentially enable additional compiler optimizations
-rw-r--r--src/random.cpp4
-rw-r--r--src/test/test_bitcoin_main.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/random.cpp b/src/random.cpp
index 67efc7d94..b0044af51 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -39,10 +39,10 @@
#include <openssl/err.h>
#include <openssl/rand.h>
-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_bitcoin_main.cpp b/src/test/test_bitcoin_main.cpp
index 34beef553..b556c953b 100644
--- a/src/test/test_bitcoin_main.cpp
+++ b/src/test/test_bitcoin_main.cpp
@@ -10,14 +10,14 @@
std::unique_ptr<CConnman> g_connman;
-void Shutdown(void* parg)
+[[noreturn]] void Shutdown(void* parg)
{
- exit(EXIT_SUCCESS);
+ std::exit(EXIT_SUCCESS);
}
-void StartShutdown()
+[[noreturn]] void StartShutdown()
{
- exit(EXIT_SUCCESS);
+ std::exit(EXIT_SUCCESS);
}
bool ShutdownRequested()