summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Weigelt, metux IT consult <info@metux.net>2024-03-21 16:16:03 +0100
committerMarge Bot <emma+marge@anholt.net>2024-04-22 22:15:45 +0000
commit86d0f6dafa00e78f7a234d50749c12948f2522ea (patch)
tree1b81aa27c335b98f47f52f1bada11f1b0bc336fa
parent17db4ba3de1058e244292c6071e9cea4cb36c0ed (diff)
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>
-rw-r--r--exa/exa_priv.h8
-rw-r--r--include/list.h11
-rw-r--r--include/meson.build5
3 files changed, 0 insertions, 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