From 86d0f6dafa00e78f7a234d50749c12948f2522ea Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 21 Mar 2024 16:16:03 +0100 Subject: 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 Part-of: --- exa/exa_priv.h | 8 -------- include/list.h | 11 ----------- include/meson.build | 5 ----- 3 files changed, 24 deletions(-) diff --git a/exa/exa_priv.h b/exa/exa_priv.h index 02a4e32fd..f9e166c66 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -236,19 +236,11 @@ extern DevPrivateKeyRec exaScreenPrivateKeyRec; real->mem = priv->Saved##mem; \ } -#ifdef HAVE_TYPEOF #define swap(priv, real, mem) {\ typeof(real->mem) tmp = priv->Saved##mem; \ priv->Saved##mem = real->mem; \ real->mem = tmp; \ } -#else -#define swap(priv, real, mem) {\ - const void *tmp = priv->Saved##mem; \ - priv->Saved##mem = real->mem; \ - real->mem = tmp; \ -} -#endif #define EXA_PRE_FALLBACK(_screen_) \ ExaScreenPriv(_screen_); \ diff --git a/include/list.h b/include/list.h index f81d97fc1..f585b8f10 100644 --- a/include/list.h +++ b/include/list.h @@ -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. diff --git a/include/meson.build b/include/meson.build index 025a5443e..9f84f2b95 100644 --- a/include/meson.build +++ b/include/meson.build @@ -11,11 +11,6 @@ dri_dep = dependency('dri', required: build_glx) conf_data = configuration_data() conf_data.set('_DIX_CONFIG_H_', '1') -conf_data.set('HAVE_TYPEOF', cc.compiles(''' - int foo(int bar) { typeof(bar) baz = 1; return baz; } -''', - name: 'typeof()') ? '1' : false) - # For feature macros we're using either false (boolean) or '1', which correspond to the macro being # not defined at all and defined to 1. This is to match autotools behavior and thus preserve # backwards compatibility with all the existing code that uses #ifdef to check if feature is -- cgit v1.2.3