From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id 973FB385800A; Thu, 13 May 2021 20:18:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 973FB385800A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-780] libsanitizer, Darwin : Handle missing __builtin_os_log_format. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/master X-Git-Oldrev: 8aa8a2af8fdc2e0939c0d803bd45b45d251e1a3f X-Git-Newrev: adab7b2bf42b469e51154a09a1b4fa0726a7073c Message-Id: <20210513201828.973FB385800A@sourceware.org> Date: Thu, 13 May 2021 20:18:28 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 20:18:28 -0000 https://gcc.gnu.org/g:adab7b2bf42b469e51154a09a1b4fa0726a7073c commit r12-780-gadab7b2bf42b469e51154a09a1b4fa0726a7073c Author: Iain Sandoe Date: Thu May 13 19:43:09 2021 +0100 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: --- libsanitizer/sanitizer_common/sanitizer_mac.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cpp b/libsanitizer/sanitizer_common/sanitizer_mac.cpp index f455856c85d..30a94fcba14 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