build: Replace MAC_OSX macro with existing __APPLE__

Adopting `__APPLE__` aligns our project with broader industry practices, including those in prominent projects such as the Linux kernel (and even our own code).

See: https://sourceforge.net/p/predef/wiki/OperatingSystems/#macos
pull/29450/head
Lőrinc 9 months ago
parent d94adc7270
commit 6c6b2442ed

@ -324,10 +324,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_compile_definitions(core_interface INTERFACE
MAC_OSX
OBJC_OLD_DISPATCH_PROTOTYPES=0
)
target_compile_definitions(core_interface INTERFACE OBJC_OLD_DISPATCH_PROTOTYPES=0)
# 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
# "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++) {
std::string key(argv[i]);
#ifdef MAC_OSX
#ifdef __APPLE__
// At the first time when a user gets the "App downloaded from the
// internet" warning, and clicks the Open button, macOS passes
// a unique process serial number (PSN) as -psn_... command-line
@ -741,7 +741,7 @@ fs::path GetDefaultDataDir()
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
#ifdef __APPLE__
// macOS
return pathRet / "Library/Application Support/Bitcoin";
#else

@ -70,7 +70,7 @@ void SetupEnvironment()
#endif
// 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.
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
try {
std::locale(""); // Raises a runtime error if current locale is invalid
} catch (const std::runtime_error&) {

@ -34,7 +34,7 @@
#include <sys/time.h>
#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>
#endif
@ -387,7 +387,7 @@ void GetOSRand(unsigned char *ent32)
The function call is always successful.
*/
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) {
RandFailure();
}

@ -117,7 +117,7 @@ bool FileCommit(FILE* file)
LogPrintf("FlushFileBuffers failed: %s\n", Win32ErrorString(GetLastError()));
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
LogPrintf("fcntl F_FULLFSYNC failed: %s\n", SysErrorString(errno));
return false;
@ -195,7 +195,7 @@ void AllocateFileRange(FILE* file, unsigned int offset, unsigned int length)
nFileSize.u.HighPart = nEndPos >> 32;
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
SetEndOfFile(hFile);
#elif defined(MAC_OSX)
#elif defined(__APPLE__)
// OSX specific version
// NOTE: Contrary to other OS versions, the OSX version assumes that
// 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);
#elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
pthread_set_name_np(pthread_self(), name);
#elif defined(MAC_OSX)
#elif defined(__APPLE__)
pthread_setname_np(name);
#else
// Prevent warnings for unused parameters...

Loading…
Cancel
Save