mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge bitcoin/bitcoin#29450: build: replace custom MAC_OSX
macro with existing __APPLE__
6c6b2442ed
build: Replace MAC_OSX macro with existing __APPLE__ (Lőrinc) Pull request description: This PR aims to standardize and simplify macOS-specific checks within our codebase by replacing the custom-defined `MAC_OSX` macro with the existing `__APPLE__`macro, defined in e.g. https://sourceforge.net/p/predef/wiki/OperatingSystems/#macos We already use `__APPLE__` in our own codebase for e.g. https://github.com/bitcoin/bitcoin/blob/master/src/crypto/sha256.cpp#L22 Local Verification confirms that `MAC_OSX` isn't defined, but `__APPLE__` is: ```bash % echo | cpp -dM | egrep 'MAC_OSX|__MACOS__|__APPLE__' #define __APPLE__ 1 ``` ACKs for top commit: fanquake: ACK6c6b2442ed
- at this point it seems unlikely that we'll need to accomodate non-macOS Apple, so consolidating to `__APPLE__` seems ok for now. Tree-SHA512: dbf87c96211d9d55426ee85d76ef1e05cda3efd1c9248b0974a82834dafc1c1aece3165bd46e4252f0460dc97079bdbcebe98bbd81e9de0d7399c0bc69d5c050
This commit is contained in:
commit
2f40e453cc
6 changed files with 9 additions and 12 deletions
|
@ -324,10 +324,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
target_compile_definitions(core_interface INTERFACE
|
target_compile_definitions(core_interface INTERFACE OBJC_OLD_DISPATCH_PROTOTYPES=0)
|
||||||
MAC_OSX
|
|
||||||
OBJC_OLD_DISPATCH_PROTOTYPES=0
|
|
||||||
)
|
|
||||||
# These flags are specific to ld64, and may cause issues with other linkers.
|
# These flags are specific to ld64, and may cause issues with other linkers.
|
||||||
# For example: GNU ld will interpret -dead_strip as -de and then try and use
|
# For example: GNU ld will interpret -dead_strip as -de and then try and use
|
||||||
# "ad_strip" as the symbol for the entry point.
|
# "ad_strip" as the symbol for the entry point.
|
||||||
|
|
|
@ -184,7 +184,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
std::string key(argv[i]);
|
std::string key(argv[i]);
|
||||||
|
|
||||||
#ifdef MAC_OSX
|
#ifdef __APPLE__
|
||||||
// At the first time when a user gets the "App downloaded from the
|
// At the first time when a user gets the "App downloaded from the
|
||||||
// internet" warning, and clicks the Open button, macOS passes
|
// internet" warning, and clicks the Open button, macOS passes
|
||||||
// a unique process serial number (PSN) as -psn_... command-line
|
// a unique process serial number (PSN) as -psn_... command-line
|
||||||
|
@ -741,7 +741,7 @@ fs::path GetDefaultDataDir()
|
||||||
pathRet = fs::path("/");
|
pathRet = fs::path("/");
|
||||||
else
|
else
|
||||||
pathRet = fs::path(pszHome);
|
pathRet = fs::path(pszHome);
|
||||||
#ifdef MAC_OSX
|
#ifdef __APPLE__
|
||||||
// macOS
|
// macOS
|
||||||
return pathRet / "Library/Application Support/Bitcoin";
|
return pathRet / "Library/Application Support/Bitcoin";
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -70,7 +70,7 @@ void SetupEnvironment()
|
||||||
#endif
|
#endif
|
||||||
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
|
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
|
||||||
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
|
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
|
||||||
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
|
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
|
||||||
try {
|
try {
|
||||||
std::locale(""); // Raises a runtime error if current locale is invalid
|
std::locale(""); // Raises a runtime error if current locale is invalid
|
||||||
} catch (const std::runtime_error&) {
|
} catch (const std::runtime_error&) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_GETRANDOM) || (defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX))
|
#if defined(HAVE_GETRANDOM) || (defined(HAVE_GETENTROPY_RAND) && defined(__APPLE__))
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ void GetOSRand(unsigned char *ent32)
|
||||||
The function call is always successful.
|
The function call is always successful.
|
||||||
*/
|
*/
|
||||||
arc4random_buf(ent32, NUM_OS_RANDOM_BYTES);
|
arc4random_buf(ent32, NUM_OS_RANDOM_BYTES);
|
||||||
#elif defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
|
#elif defined(HAVE_GETENTROPY_RAND) && defined(__APPLE__)
|
||||||
if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
|
if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
|
||||||
RandFailure();
|
RandFailure();
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ bool FileCommit(FILE* file)
|
||||||
LogPrintf("FlushFileBuffers failed: %s\n", Win32ErrorString(GetLastError()));
|
LogPrintf("FlushFileBuffers failed: %s\n", Win32ErrorString(GetLastError()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
|
#elif defined(__APPLE__) && defined(F_FULLFSYNC)
|
||||||
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
|
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
|
||||||
LogPrintf("fcntl F_FULLFSYNC failed: %s\n", SysErrorString(errno));
|
LogPrintf("fcntl F_FULLFSYNC failed: %s\n", SysErrorString(errno));
|
||||||
return false;
|
return false;
|
||||||
|
@ -195,7 +195,7 @@ void AllocateFileRange(FILE* file, unsigned int offset, unsigned int length)
|
||||||
nFileSize.u.HighPart = nEndPos >> 32;
|
nFileSize.u.HighPart = nEndPos >> 32;
|
||||||
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
|
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
|
||||||
SetEndOfFile(hFile);
|
SetEndOfFile(hFile);
|
||||||
#elif defined(MAC_OSX)
|
#elif defined(__APPLE__)
|
||||||
// OSX specific version
|
// OSX specific version
|
||||||
// NOTE: Contrary to other OS versions, the OSX version assumes that
|
// NOTE: Contrary to other OS versions, the OSX version assumes that
|
||||||
// NOTE: offset is the size of the file.
|
// NOTE: offset is the size of the file.
|
||||||
|
|
|
@ -29,7 +29,7 @@ static void SetThreadName(const char* name)
|
||||||
::prctl(PR_SET_NAME, name, 0, 0, 0);
|
::prctl(PR_SET_NAME, name, 0, 0, 0);
|
||||||
#elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
|
#elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
|
||||||
pthread_set_name_np(pthread_self(), name);
|
pthread_set_name_np(pthread_self(), name);
|
||||||
#elif defined(MAC_OSX)
|
#elif defined(__APPLE__)
|
||||||
pthread_setname_np(name);
|
pthread_setname_np(name);
|
||||||
#else
|
#else
|
||||||
// Prevent warnings for unused parameters...
|
// Prevent warnings for unused parameters...
|
||||||
|
|
Loading…
Add table
Reference in a new issue