mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge #17563: lib: fix a compiler warning: unused GetDevURandom()
ca2e474372
Fix a compiler warning: unused GetDevURandom() (Vasil Dimov) Pull request description: ~~Only define GetDevURandom() if it is going to be used.~~ Silence by planting a dummy reference to the `GetDevURandom` symbol in the places where we don't call the function. ACKs for top commit: practicalswift: ACKca2e474372
-- increased signal to noise in compiler diagnostics is good sipa: utACKca2e474372
hebasto: re-ACKca2e474372
, tested on macOS 10.15.6 + llvm clang 10.0.0 Tree-SHA512: 03c98f00dad5d9a3c5c9f68553d72ad5489ec02f18b9769108a22003ec7be7819a731b1eab6a9f64dafb5be0efddccf6980de7e3bb90cd20d4f4d72f74124675
This commit is contained in:
commit
04a0676b3f
1 changed files with 6 additions and 0 deletions
|
@ -315,12 +315,16 @@ void GetOSRand(unsigned char *ent32)
|
|||
if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
|
||||
RandFailure();
|
||||
}
|
||||
// Silence a compiler warning about unused function.
|
||||
(void)GetDevURandom;
|
||||
#elif defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
|
||||
/* getentropy() is available on macOS 10.12 and later.
|
||||
*/
|
||||
if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
|
||||
RandFailure();
|
||||
}
|
||||
// Silence a compiler warning about unused function.
|
||||
(void)GetDevURandom;
|
||||
#elif defined(HAVE_SYSCTL_ARND)
|
||||
/* FreeBSD, NetBSD and similar. It is possible for the call to return less
|
||||
* bytes than requested, so need to read in a loop.
|
||||
|
@ -334,6 +338,8 @@ void GetOSRand(unsigned char *ent32)
|
|||
}
|
||||
have += len;
|
||||
} while (have < NUM_OS_RANDOM_BYTES);
|
||||
// Silence a compiler warning about unused function.
|
||||
(void)GetDevURandom;
|
||||
#else
|
||||
/* Fall back to /dev/urandom if there is no specific method implemented to
|
||||
* get system entropy for this OS.
|
||||
|
|
Loading…
Add table
Reference in a new issue