From: Iain Sandoe Date: Thu, 13 May 2021 18:43:09 +0000 (+0100) Subject: libsanitizer, Darwin : Handle missing __builtin_os_log_format. X-Git-Tag: basepoints/gcc-13~7533 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=adab7b2bf42b469e51154a09a1b4fa0726a7073c;p=thirdparty%2Fgcc.git libsanitizer, Darwin : Handle missing __builtin_os_log_format. GCC does not, currently, define __builtin_os_log_format, which is needed by os/log.h. Do not include that header unless the builtin is defined (since the header errors out on the same condition). Provide a work-around solution to the missing API provided via the header. libsanitizer/ChangeLog: * sanitizer_common/sanitizer_mac.cpp : Check for the availability of __builtin_os_log_format before trying to include a header depending on it. (OS_LOG_DEFAULT): New. (os_log_error): Define to a fall-back using an older API. --- diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cpp b/libsanitizer/sanitizer_common/sanitizer_mac.cpp index f455856c85dd..30a94fcba149 100644 --- a/libsanitizer/sanitizer_common/sanitizer_mac.cpp +++ b/libsanitizer/sanitizer_common/sanitizer_mac.cpp @@ -70,7 +70,15 @@ extern "C" { #include #include #include -#include +#if defined(__has_builtin) && __has_builtin(__builtin_os_log_format) +# include +#else + /* Without support for __builtin_os_log_format, fall back to the older + method. */ +# define OS_LOG_DEFAULT 0 +# define os_log_error(A,B,C) \ + asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", (C)); +#endif #include #include #include