public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-780] libsanitizer, Darwin : Handle missing __builtin_os_log_format. Date: Thu, 13 May 2021 20:18:28 +0000 (GMT) [thread overview] Message-ID: <20210513201828.973FB385800A@sourceware.org> (raw) https://gcc.gnu.org/g:adab7b2bf42b469e51154a09a1b4fa0726a7073c commit r12-780-gadab7b2bf42b469e51154a09a1b4fa0726a7073c Author: Iain Sandoe <iain@sandoe.co.uk> 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 <mach/mach_time.h> #include <mach/vm_statistics.h> #include <malloc/malloc.h> -#include <os/log.h> +#if defined(__has_builtin) && __has_builtin(__builtin_os_log_format) +# include <os/log.h> +#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 <pthread.h> #include <sched.h> #include <signal.h>
reply other threads:[~2021-05-13 20:18 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210513201828.973FB385800A@sourceware.org \ --to=iains@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).