1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix possible use of undefined macros on very old macOS [ci skip]

This commit is contained in:
Nobuyoshi Nakada 2022-10-17 14:46:10 +09:00
parent 85cee29357
commit f08fcd0e80
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
3 changed files with 13 additions and 7 deletions

8
dln.c
View file

@ -298,15 +298,15 @@ COMPILER_WARNING_POP
/* assume others than old Mac OS X have no problem */ /* assume others than old Mac OS X have no problem */
# define dln_disable_dlclose() false # define dln_disable_dlclose() false
#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11
/* targeting newer versions only */
# define dln_disable_dlclose() false
#elif !defined(MAC_OS_X_VERSION_10_11) || \ #elif !defined(MAC_OS_X_VERSION_10_11) || \
(MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11) (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11)
/* targeting older versions only */ /* targeting older versions only */
# define dln_disable_dlclose() true # define dln_disable_dlclose() true
#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11
/* targeting newer versions only */
# define dln_disable_dlclose() false
#else #else
/* support both versions, and check at runtime */ /* support both versions, and check at runtime */
# include <sys/sysctl.h> # include <sys/sysctl.h>

View file

@ -666,6 +666,11 @@ bug_important_message(FILE *out, const char *const msg, size_t len)
fwrite(p, 1, endmsg - p, out); fwrite(p, 1, endmsg - p, out);
} }
#undef CRASH_REPORTER_MAY_BE_CREATED
#if defined(__APPLE__) && \
(!defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
# define CRASH_REPORTER_MAY_BE_CREATED
#endif
static void static void
preface_dump(FILE *out) preface_dump(FILE *out)
{ {
@ -674,7 +679,7 @@ preface_dump(FILE *out)
"-- Crash Report log information " "-- Crash Report log information "
"--------------------------------------------\n" "--------------------------------------------\n"
" See Crash Report log file in one of the following locations:\n" " See Crash Report log file in one of the following locations:\n"
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 # ifdef CRASH_REPORTER_MAY_BE_CREATED
" * ~/Library/Logs/CrashReporter\n" " * ~/Library/Logs/CrashReporter\n"
" * /Library/Logs/CrashReporter\n" " * /Library/Logs/CrashReporter\n"
# endif # endif
@ -699,7 +704,7 @@ postscript_dump(FILE *out)
"[IMPORTANT]" "[IMPORTANT]"
/*" ------------------------------------------------"*/ /*" ------------------------------------------------"*/
"\n""Don't forget to include the Crash Report log file under\n" "\n""Don't forget to include the Crash Report log file under\n"
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 # ifdef CRASH_REPORTER_MAY_BE_CREATED
"CrashReporter or " "CrashReporter or "
# endif # endif
"DiagnosticReports directory in bug reports.\n" "DiagnosticReports directory in bug reports.\n"

View file

@ -1861,7 +1861,8 @@ native_thread_native_thread_id(rb_thread_t *target_th)
return INT2FIX(tid); return INT2FIX(tid);
#elif defined(__APPLE__) #elif defined(__APPLE__)
uint64_t tid; uint64_t tid;
# if ((MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6) || \ # if (!defined(MAC_OS_X_VERSION_10_6) || \
(MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6) || \
defined(__POWERPC__) /* never defined for PowerPC platforms */) defined(__POWERPC__) /* never defined for PowerPC platforms */)
const bool no_pthread_threadid_np = true; const bool no_pthread_threadid_np = true;
# define NO_PTHREAD_MACH_THREAD_NP 1 # define NO_PTHREAD_MACH_THREAD_NP 1