Skip to content

Commit

Permalink
Add attribute [[noreturn]] (C++11) to functions that will not return
Browse files Browse the repository at this point in the history
Rationale:
* Reduce the number of false positives from static analyzers
* Potentially enable additional compiler optimizations
  • Loading branch information
practicalswift committed Jul 17, 2017
1 parent 5cfdda2 commit b82c55a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/random.cpp
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions src/test/test_bitcoin_main.cpp
Expand Up @@ -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()
Expand Down

0 comments on commit b82c55a

Please sign in to comment.