Subject: Re: [PATCH v7 16/29] compat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Tue, 22 Mar 2022 19:19:53 +0100

On Tue, Mar 22 2022, Jeff Hostetler via GitGitGadget wrote:

> From: Jeff Hostetler <[email-masked]>
> 
>  compat/fsmonitor/fsm-darwin-gcc.h    | 92 ++++++++++++++++++++++++++++

It's much nicer to have this compat-for-the-compat in its own
header. Thanks.

>  compat/fsmonitor/fsm-listen-darwin.c | 24 ++++++++
>  2 files changed, 116 insertions(+)
>  create mode 100644 compat/fsmonitor/fsm-darwin-gcc.h
>
> diff --git a/compat/fsmonitor/fsm-darwin-gcc.h b/compat/fsmonitor/fsm-darwin-gcc.h
> new file mode 100644
> index 00000000000..1c75c3d48e7
> --- /dev/null
> +++ b/compat/fsmonitor/fsm-darwin-gcc.h
> @@ -0,0 +1,92 @@
> +#ifndef FSM_DARWIN_GCC_H
> +#define FSM_DARWIN_GCC_H
> +
> +#ifndef __clang__

This was surprising, until I remembered that clang tries really hard to
pretend to be other compilers. I wonder if we should steal the macro
check from compat/compiler.h into something more generic & use it here,
probably best as a follow-up...

> [...]
> +#endif /* !clang */
> +#endif /* FSM_DARWIN_GCC_H */
> diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c
> index c84e3344ab9..d2ce942cade 100644
> --- a/compat/fsmonitor/fsm-listen-darwin.c
> +++ b/compat/fsmonitor/fsm-listen-darwin.c
> @@ -1,3 +1,27 @@
> +#ifndef __clang__
> +#include "fsm-darwin-gcc.h"
> +#else
> +#include <CoreFoundation/CoreFoundation.h>
> +#include <CoreServices/CoreServices.h>
> +
> [...]