Skip to content

Commit 2ab7c63

Browse files
committed
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
2 parents 4b65fa5 + b82c55a commit 2ab7c63

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/random.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
#include <openssl/err.h>
4747
#include <openssl/rand.h>
4848

49-
static void RandFailure()
49+
[[noreturn]] static void RandFailure()
5050
{
5151
LogPrintf("Failed to read randomness, aborting\n");
52-
abort();
52+
std::abort();
5353
}
5454

5555
static inline int64_t GetPerformanceCounter()

src/test/test_bitcoin_main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
std::unique_ptr<CConnman> g_connman;
1212

13-
void Shutdown(void* parg)
13+
[[noreturn]] void Shutdown(void* parg)
1414
{
15-
exit(EXIT_SUCCESS);
15+
std::exit(EXIT_SUCCESS);
1616
}
1717

18-
void StartShutdown()
18+
[[noreturn]] void StartShutdown()
1919
{
20-
exit(EXIT_SUCCESS);
20+
std::exit(EXIT_SUCCESS);
2121
}
2222

2323
bool ShutdownRequested()

0 commit comments

Comments
 (0)