[RFC v2 1/3] cdefs: Add __bool
Florian Weimer
fweimer@redhat.com
Tue Sep 2 13:41:18 GMT 2025
* Alejandro Colomar:
> Signed-off-by: Alejandro Colomar <alx@kernel.org>
> ---
> misc/sys/cdefs.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
> index 215ff937ee..1cd8f1e85b 100644
> --- a/misc/sys/cdefs.h
> +++ b/misc/sys/cdefs.h
> @@ -57,6 +57,18 @@
> # define __glibc_has_extension(ext) 0
> #endif
>
> +#if defined __cplusplus
> +# define __bool bool
> +#elif defined __GNUC__ || defined __clang__
> +# if __GNUC_PREREQ (3, 0)
> +# define __bool _Bool
> +# else
> +# define __bool int
> +# endif
> +#else
> +# define __bool _Bool
> +#endif
This changes ABI based on the detected compiler, so it's really not
possible to do it this way.
Thanks,
Florian
More information about the Libc-alpha
mailing list