aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-08-22 09:36:06 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-08-22 09:38:49 +0200
commit2ab7c6300f87a1c7f5a5805f7677e07ab809cac7 (patch)
treedf580dbcd69797eb7760fd8f94e75b531fc2faec /src
parent4b65fa592123f3715d7ba878fc3f5110430c4b21 (diff)
parentb82c55af78738258b56bd8fe7b5f8d5ccf85f832 (diff)
downloadbitcoin-2ab7c6300f87a1c7f5a5805f7677e07ab809cac7.tar.xz
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
Diffstat (limited to 'src')
-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 4bcb8945f3..7e0e94439e 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -46,10 +46,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 34beef5539..b556c953b9 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()