aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Engestrom <eric.engestrom@intel.com>2019-12-17 23:01:08 +0000
committerDylan Baker <dylan@pnwbakers.com>2022-01-19 16:08:31 -0800
commit63d06ad3c30483577f194d1d1faafc4fe23aeef3 (patch)
treeae3d2fc6d951b9ce542ba9a0dac41384e4006975
parentfa80f49df8c3355c754a908722a422c610b6110a (diff)
downloadlibdrm-63d06ad3c30483577f194d1d1faafc4fe23aeef3.tar.gz
use standard `__typeof__()` instead of GNU extension `typeof()`
And switch to c_std=c99. This simplifies using libdrm as a meson subproject for mesa. v2: (dylan) - switch to c99 as the standard - Fix amdgpu security tests as well Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Signed-off-by: Dylan Baker <dylan@pnwbakers.com> Reviewed-by: Simon Ser <contact@emersion.fr> Reviewed-by: Emma Anholt <emma@anholt.net>
-rw-r--r--libdrm_lists.h22
-rw-r--r--meson.build2
-rw-r--r--tests/amdgpu/security_tests.c4
-rw-r--r--tests/nouveau/threaded.c2
-rw-r--r--util_double_list.h2
5 files changed, 16 insertions, 16 deletions
diff --git a/libdrm_lists.h b/libdrm_lists.h
index 8926d8d1..7f55fc0d 100644
--- a/libdrm_lists.h
+++ b/libdrm_lists.h
@@ -96,19 +96,19 @@ typedef struct _drmMMListHead
(__item) = (__temp), (__temp) = (__item)->prev)
#define DRMLISTFOREACHENTRY(__item, __list, __head) \
- for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head); \
- &(__item)->__head != (__list); \
- (__item) = DRMLISTENTRY(typeof(*__item), \
- (__item)->__head.next, __head))
+ for ((__item) = DRMLISTENTRY(__typeof__(*__item), (__list)->next, __head); \
+ &(__item)->__head != (__list); \
+ (__item) = DRMLISTENTRY(__typeof__(*__item), \
+ (__item)->__head.next, __head))
#define DRMLISTFOREACHENTRYSAFE(__item, __temp, __list, __head) \
- for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head), \
- (__temp) = DRMLISTENTRY(typeof(*__item), \
- (__item)->__head.next, __head); \
- &(__item)->__head != (__list); \
- (__item) = (__temp), \
- (__temp) = DRMLISTENTRY(typeof(*__item), \
- (__temp)->__head.next, __head))
+ for ((__item) = DRMLISTENTRY(__typeof__(*__item), (__list)->next, __head), \
+ (__temp) = DRMLISTENTRY(__typeof__(*__item), \
+ (__item)->__head.next, __head); \
+ &(__item)->__head != (__list); \
+ (__item) = (__temp), \
+ (__temp) = DRMLISTENTRY(__typeof__(*__item), \
+ (__temp)->__head.next, __head))
#define DRMLISTJOIN(__list, __join) if (!DRMLISTEMPTY(__list)) { \
(__list)->next->prev = (__join); \
diff --git a/meson.build b/meson.build
index f5704cf1..5b87a227 100644
--- a/meson.build
+++ b/meson.build
@@ -24,7 +24,7 @@ project(
version : '2.4.109',
license : 'MIT',
meson_version : '>= 0.46',
- default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
+ default_options : ['buildtype=debugoptimized', 'c_std=c99'],
)
pkg = import('pkgconfig')
diff --git a/tests/amdgpu/security_tests.c b/tests/amdgpu/security_tests.c
index 280e862d..e6c9f9a8 100644
--- a/tests/amdgpu/security_tests.c
+++ b/tests/amdgpu/security_tests.c
@@ -305,7 +305,7 @@ static void amdgpu_secure_bounce(void)
/* Fill Alice with a pattern.
*/
for (pp = alice.bo->cpu_ptr;
- pp < (typeof(pp)) alice.bo->cpu_ptr + SECURE_BUFFER_SIZE;
+ pp < (__typeof__(pp)) alice.bo->cpu_ptr + SECURE_BUFFER_SIZE;
pp += sizeof(secure_pattern))
memcpy(pp, secure_pattern, sizeof(secure_pattern));
@@ -343,7 +343,7 @@ static void amdgpu_secure_bounce(void)
/* Verify the contents of Alice.
*/
for (pp = alice.bo->cpu_ptr;
- pp < (typeof(pp)) alice.bo->cpu_ptr + SECURE_BUFFER_SIZE;
+ pp < (__typeof__(pp)) alice.bo->cpu_ptr + SECURE_BUFFER_SIZE;
pp += sizeof(secure_pattern)) {
res = memcmp(pp, secure_pattern, sizeof(secure_pattern));
if (res) {
diff --git a/tests/nouveau/threaded.c b/tests/nouveau/threaded.c
index ddbac74e..eaa469e0 100644
--- a/tests/nouveau/threaded.c
+++ b/tests/nouveau/threaded.c
@@ -31,7 +31,7 @@
#include "xf86drm.h"
#include "nouveau.h"
-static typeof(ioctl) *old_ioctl;
+static __typeof__(ioctl) *old_ioctl;
static int failed;
static int import_fd;
diff --git a/util_double_list.h b/util_double_list.h
index 7e48b26c..9bdca137 100644
--- a/util_double_list.h
+++ b/util_double_list.h
@@ -110,7 +110,7 @@ static inline void list_delinit(struct list_head *item)
#ifndef container_of
#define container_of(ptr, sample, member) \
(void *)((char *)(ptr) \
- - ((char *)&((typeof(sample))0)->member))
+ - ((char *)&((__typeof__(sample))0)->member))
#endif
#define LIST_FOR_EACH_ENTRY(pos, head, member) \