mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
util: Promote __builtin_types_compatible_p compat
Signed-off-by: Rob Clark <robdclark@chromium.org> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7941>
This commit is contained in:
parent
f63c595a73
commit
5a082911cd
3 changed files with 7 additions and 5 deletions
|
|
@ -947,7 +947,7 @@ endif
|
||||||
|
|
||||||
# Check for GCC style builtins
|
# Check for GCC style builtins
|
||||||
foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
|
foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
|
||||||
'ffsll', 'popcount', 'popcountll', 'unreachable']
|
'ffsll', 'popcount', 'popcountll', 'unreachable', 'types_compatible_p']
|
||||||
if cc.has_function(b)
|
if cc.has_function(b)
|
||||||
pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
|
pre_args += '-DHAVE___BUILTIN_@0@'.format(b.to_upper())
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,12 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __builtin_types_compatible_p compat
|
||||||
|
*/
|
||||||
|
#if defined(__cplusplus) || !defined(HAVE___BUILTIN_TYPES_COMPATIBLE_P)
|
||||||
|
# define __builtin_types_compatible_p(type1, type2) (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static (compile-time) assertion.
|
* Static (compile-time) assertion.
|
||||||
|
|
|
||||||
|
|
@ -84,10 +84,6 @@ u_vector_finish(struct u_vector *queue)
|
||||||
free(queue->data);
|
free(queue->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__GNUC__) || defined(__cplusplus)
|
|
||||||
#define __builtin_types_compatible_p(t1, t2) 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define u_vector_foreach(elem, queue) \
|
#define u_vector_foreach(elem, queue) \
|
||||||
STATIC_ASSERT(__builtin_types_compatible_p(__typeof__(queue), struct u_vector *)); \
|
STATIC_ASSERT(__builtin_types_compatible_p(__typeof__(queue), struct u_vector *)); \
|
||||||
for (uint32_t __u_vector_offset = (queue)->tail; \
|
for (uint32_t __u_vector_offset = (queue)->tail; \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue