Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions loguru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
#endif

#ifdef __APPLE__
#include "TargetConditionals.h"
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
#endif

// TODO: use defined(_POSIX_VERSION) for some of these things?
Expand Down Expand Up @@ -1096,7 +1097,11 @@ namespace loguru

#ifdef __APPLE__
uint64_t thread_id;
pthread_threadid_np(pthread_self(), &thread_id);
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 || defined(__POWERPC__)
thread_id = pthread_mach_thread_np(pthread_self());
#else
pthread_threadid_np(pthread_self(), &thread_id);
#endif
Comment on lines +1100 to +1104
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite the right check. MAC_OS_X_VERSION_MAX_ALLOWED checks the SDK being built against. Better to check MAC_OS_X_VERSION_MIN_REQUIRED which is the deployment version. You could build against the 10.5 SDK but deploy back to 10.4 for example.

I suggest:

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
  new_fn();
#else
  old_fun();
#endif

#elif defined(__FreeBSD__)
long thread_id;
(void)thr_self(&thread_id);
Expand Down