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:
parent
17db4ba3de
commit
86d0f6dafa
|
@ -236,19 +236,11 @@ extern DevPrivateKeyRec exaScreenPrivateKeyRec;
|
||||||
real->mem = priv->Saved##mem; \
|
real->mem = priv->Saved##mem; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_TYPEOF
|
|
||||||
#define swap(priv, real, mem) {\
|
#define swap(priv, real, mem) {\
|
||||||
typeof(real->mem) tmp = priv->Saved##mem; \
|
typeof(real->mem) tmp = priv->Saved##mem; \
|
||||||
priv->Saved##mem = real->mem; \
|
priv->Saved##mem = real->mem; \
|
||||||
real->mem = tmp; \
|
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_) \
|
#define EXA_PRE_FALLBACK(_screen_) \
|
||||||
ExaScreenPriv(_screen_); \
|
ExaScreenPriv(_screen_); \
|
||||||
|
|
|
@ -274,19 +274,8 @@ xorg_list_is_empty(struct xorg_list *head)
|
||||||
#define xorg_list_last_entry(ptr, type, member) \
|
#define xorg_list_last_entry(ptr, type, member) \
|
||||||
xorg_list_entry((ptr)->prev, type, member)
|
xorg_list_entry((ptr)->prev, type, member)
|
||||||
|
|
||||||
#ifdef HAVE_TYPEOF
|
|
||||||
#define __container_of(ptr, sample, member) \
|
#define __container_of(ptr, sample, member) \
|
||||||
container_of(ptr, typeof(*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.
|
* Loop through the list given by head and set pos to struct in the list.
|
||||||
|
|
|
@ -11,11 +11,6 @@ dri_dep = dependency('dri', required: build_glx)
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
conf_data.set('_DIX_CONFIG_H_', '1')
|
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
|
# 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
|
# 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
|
# backwards compatibility with all the existing code that uses #ifdef to check if feature is
|
||||||
|
|
Loading…
Reference in New Issue