[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aUkFyPymJPge2hVS@1wt.eu>
Date: Mon, 22 Dec 2025 09:48:08 +0100
From: Willy Tarreau <w@....eu>
To: Thomas Weißschuh <linux@...ssschuh.net>
Cc: Shuah Khan <shuah@...nel.org>, Arnd Bergmann <arnd@...db.de>,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v3 12/14] tools/nolibc: add compiler version detection
macros
On Sat, Dec 20, 2025 at 02:55:56PM +0100, Thomas Weißschuh wrote:
> Some upcoming logic needs to depend on the version of GCC or clang.
>
> Add some helper macros to keep the conditionals readable.
>
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
> ---
> tools/include/nolibc/compiler.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h
> index 87090bbc53e0..c9ffd0496dae 100644
> --- a/tools/include/nolibc/compiler.h
> +++ b/tools/include/nolibc/compiler.h
> @@ -47,4 +47,20 @@
> # define __nolibc_fallthrough do { } while (0)
> #endif /* __nolibc_has_attribute(fallthrough) */
>
> +#define __nolibc_version(_major, _minor, _patch) ((_major) * 10000 + (_minor) * 100 + (_patch))
> +
> +#ifdef __GNUC__
> +# define __nolibc_gnuc_version \
> + __nolibc_version(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
> +#else
> +# define __nolibc_gnuc_version 0
> +#endif /* __GNUC__ */
> +
> +#ifdef __clang__
> +# define __nolibc_clang_version \
> + __nolibc_version(__clang_major__, __clang_minor__, __clang_patchlevel__)
> +#else
> +# define __nolibc_clang_version 0
> +#endif /* __clang__ */
> +
> #endif /* _NOLIBC_COMPILER_H */
Acked-by: Willy Tarreau <w@....eu>
Thanks,
Willy
Powered by blists - more mailing lists