diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2025-10-08 12:49:28 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2025-10-08 12:50:27 +0000 |
| commit | 53ab85a55408562690f58788ea8d01c18b79ef5d (patch) | |
| tree | 81800a199d91b7fcb84b45fb0406fc00b44ca197 | |
| parent | 687cb66411c7bc220ccb90cedc2f7486567d55b6 (diff) | |
cross-build: Define __GNUC_PREREQ__ in cdefs.h
This is required when including stdckdint.h and doesn't seem to be
provided by older clang.
Reviewed by: emaste
Fixes: 7233893e9496 ("lib{c,openbsd}: use ckd_mul() for overflow checking in re(c)allocarray")
Differential Revision: https://reviews.freebsd.org/D52933
| -rw-r--r-- | tools/build/cross-build/include/common/sys/cdefs.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h index 3f9b7866141f..faad5eccb3af 100644 --- a/tools/build/cross-build/include/common/sys/cdefs.h +++ b/tools/build/cross-build/include/common/sys/cdefs.h @@ -270,6 +270,16 @@ #define __ISO_C_VISIBLE 2011 #define __EXT1_VISIBLE 1 +/* + * Macro to test if we're using a specific version of gcc or later. + */ +#if defined(__GNUC__) +#define __GNUC_PREREQ__(ma, mi) \ + (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) +#else +#define __GNUC_PREREQ__(ma, mi) 0 +#endif + /* Alignment builtins for better type checking and improved code generation. */ /* Provide fallback versions for other compilers (GCC/Clang < 10): */ #if !__has_builtin(__builtin_is_aligned) |
