From: Aydın Mercan Date: Tue, 3 Feb 2026 07:56:00 +0000 (+0300) Subject: add types compatible builtin X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=0eacec592a2f6775298e529674968e8f06eff891;p=thirdparty%2Fbind9.git add types compatible builtin This builtin function makes macros gain type safety and also the ability to statically assert the correctness of typedefs that target external libraries. --- diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 43026a01ef4..ddfce87c324 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -39,6 +39,10 @@ #define __has_header(x) 0 #endif +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + /*** *** General Macros. ***/ @@ -303,3 +307,9 @@ mock_assert(const int result, const char *const expression, a = b; \ b = __tmp_swap; \ } + +#if __has_builtin(__builtin_types_compatible_p) +#define ISC_TYPES_COMPATIBLE(x, y) __builtin_types_compatible_p(x, y) +#else /* __has_builtin(__builtin_types_compatible_p) */ +#define ISC_TYPES_COMPATIBLE(x, y) 1 +#endif /* __has_builtin(__builtin_types_compatible_p) */