Skip to content

Commit

Permalink
Merge bitcoin#10843: Add attribute [[noreturn]] (C++11) to functions …
Browse files Browse the repository at this point in the history
…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 <pasta@dashboost.org>

Fixes for bitcoin#10843 backport
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jan 2, 2020
1 parent fcdc80b commit 6f36208
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/random.cpp
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/test/test_dash_main.cpp
Expand Up @@ -12,12 +12,12 @@

std::unique_ptr<CConnman> g_connman;

void Shutdown(void* parg)
[[noreturn]] void Shutdown(void* parg)
{
exit(EXIT_SUCCESS);
}

void StartShutdown()
[[noreturn]] void StartShutdown()
{
exit(EXIT_SUCCESS);
}
Expand Down

0 comments on commit 6f36208

Please sign in to comment.