From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Shuah Khan <shuah@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v3 12/14] tools/nolibc: add compiler version detection macros
Date: Mon, 22 Dec 2025 09:48:08 +0100 [thread overview]
Message-ID: <aUkFyPymJPge2hVS@1wt.eu> (raw)
In-Reply-To: <20251220-nolibc-uapi-types-v3-12-c662992f75d7@weissschuh.net>
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@weissschuh.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@1wt.eu>
Thanks,
Willy
next prev parent reply other threads:[~2025-12-22 8:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-20 13:55 [PATCH v3 00/14] tools/nolibc: always use 64-bit time-related types Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 01/14] tools/nolibc/poll: use kernel types for system call invocations Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 02/14] tools/nolibc/poll: drop __NR_poll fallback Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 03/14] tools/nolibc/select: drop non-pselect based implementations Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 04/14] tools/nolibc/time: drop invocation of gettimeofday system call Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 05/14] tools/nolibc: prefer explicit 64-bit time-related system calls Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 06/14] tools/nolibc/gettimeofday: avoid libgcc 64-bit divisions Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 07/14] tools/nolibc/select: avoid libgcc 64-bit multiplications Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 08/14] tools/nolibc: use custom structs timespec and timeval Thomas Weißschuh
2025-12-22 9:38 ` Arnd Bergmann
2025-12-20 13:55 ` [PATCH v3 09/14] tools/nolibc: always use 64-bit time types Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 10/14] selftests/nolibc: test compatibility of nolibc and kernel " Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 11/14] tools/nolibc: remove time conversions Thomas Weißschuh
2025-12-20 13:55 ` [PATCH v3 12/14] tools/nolibc: add compiler version detection macros Thomas Weißschuh
2025-12-22 8:48 ` Willy Tarreau [this message]
2025-12-20 13:55 ` [PATCH v3 13/14] tools/nolibc: add __nolibc_static_assert() Thomas Weißschuh
2025-12-22 8:47 ` Willy Tarreau
2025-12-20 13:55 ` [PATCH v3 14/14] selftests/nolibc: add static assertions around time types handling Thomas Weißschuh
2025-12-22 9:39 ` [PATCH v3 00/14] tools/nolibc: always use 64-bit time-related types Arnd Bergmann
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=aUkFyPymJPge2hVS@1wt.eu \
--to=w@1wt.eu \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=shuah@kernel.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.