Skip to content

Commit

Permalink
Add check for __APPLE__ to restrict overmatching __MACH__ ifdefs (#5482)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zopolis4 authored Aug 14, 2023
1 parent d693b2f commit 6e7846d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/gaptime.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <sys/resource.h>
#endif

#if defined(__MACH__) // macOS
#if defined(__APPLE__) && defined(__MACH__) // macOS
#include <mach/mach_time.h>
#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
#include <time.h>
Expand Down Expand Up @@ -101,7 +101,7 @@ Int8 SyNanosecondsSinceEpoch(void)
{
Int8 res;

#if defined(__MACH__) // macOS
#if defined(__APPLE__) && defined(__MACH__) // macOS
static mach_timebase_info_data_t timeinfo;
if (timeinfo.denom == 0) {
(void)mach_timebase_info(&timeinfo);
Expand Down Expand Up @@ -161,7 +161,7 @@ static Int8 SyNanosecondsSinceEpochResolution(void)
{
Int8 res;

#if defined(__MACH__)
#if defined(__APPLE__) && defined(__MACH__)
static mach_timebase_info_data_t timeinfo;
if (timeinfo.denom == 0) {
(void)mach_timebase_info(&timeinfo);
Expand Down Expand Up @@ -269,7 +269,7 @@ static Obj FuncNanosecondsSinceEpochInfo(Obj self)
const char * method = "unsupported";
Int monotonic = 0;

#if defined(__MACH__)
#if defined(__APPLE__) && defined(__MACH__)
method = "mach_absolute_time";
monotonic = 1;
#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
Expand Down
2 changes: 1 addition & 1 deletion src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

#include <sys/stat.h>

#ifdef __MACH__
#if defined(__APPLE__) && defined(__MACH__)
// Workaround: TRUE / FALSE are also defined by the macOS Mach-O headers
#define ENUM_DYLD_BOOL
#include <mach-o/dyld.h>
Expand Down

0 comments on commit 6e7846d

Please sign in to comment.