include: drop obsolete check for typeof operator

It really seems that compilers on all our supported platforms
(including Solaris) supporting `typeof`, so we can always use it
and drop hacks with undefind behaviour entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1432>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-03-21 16:16:03 +01:00
committed by Marge Bot
parent 17db4ba3de
commit 86d0f6dafa
3 changed files with 0 additions and 24 deletions

View File

@@ -274,19 +274,8 @@ xorg_list_is_empty(struct xorg_list *head)
#define xorg_list_last_entry(ptr, type, member) \
xorg_list_entry((ptr)->prev, type, member)
#ifdef HAVE_TYPEOF
#define __container_of(ptr, sample, member) \
container_of(ptr, typeof(*sample), member)
#else
/* This implementation of __container_of has undefined behavior according
* to the C standard, but it works in many cases. If your compiler doesn't
* support typeof() and fails with this implementation, please try a newer
* compiler.
*/
#define __container_of(ptr, sample, member) \
(void *)((char *)(ptr) \
- ((char *)&(sample)->member - (char *)(sample)))
#endif
/**
* Loop through the list given by head and set pos to struct in the list.