On Sun, Jan 28, 2024 at 6:45 AM Iain Sandoe <[email protected]> wrote:
>
> Tested on i686, x86_64 Darwin, x86_64 Linux,
> OK for trunk?
>
> --- 8< ---
>
> On some targets it seems that ssize_t is not defined by any of the
> headers transitively included by <stdio.h>. This leads to a bootstrap
> fail when jit is enabled.
>
> The fix proposed here is to include sys/types.h when it is available
> since that is where Posix specifies that ssize_t is defined.
>
> gcc/jit/ChangeLog:
>
> * libgccjit.h: Conditionally include <sys/types.h> where it is
> available to ensure declaration of ssize_t.
>
> Signed-off-by: Iain Sandoe <[email protected]>
> ---
> gcc/jit/libgccjit.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h
> index 235cab053e0..db4f27a48bf 100644
> --- a/gcc/jit/libgccjit.h
> +++ b/gcc/jit/libgccjit.h
> @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see
> #define LIBGCCJIT_H
>
> #include <stdio.h>
> +#if __has_include(<sys/types.h>)
Is __has_include() something that we can use unconditionally?
> +# include <sys/types.h> /* For ssize_t. */
> +#endif
>
> #ifdef __cplusplus
> extern "C" {
> --
> 2.39.2 (Apple Git-143)
>