[vlc-devel] [PATCH 1/2] posix/wait: do not use alignof on expression

Marvin Scholz epirat07 at gmail.com
Fri Aug 7 06:44:08 CEST 2020


Using alignof not on a type but an expression is a GNU extension and
causes the following warning:

   warning: '_Alignof' applied to an expression is a GNU extension
---
 src/posix/wait.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/posix/wait.c b/src/posix/wait.c
index 584cc493b1a..3fa6890193a 100644
--- a/src/posix/wait.c
+++ b/src/posix/wait.c
@@ -52,7 +52,7 @@ static struct wait_bucket
 static struct wait_bucket *wait_bucket_get(atomic_uint *addr)
 {
     uintptr_t u = (uintptr_t)addr;
-    size_t idx = (u / alignof (*addr)) % ARRAY_SIZE(wait_buckets);
+    size_t idx = (u / alignof (atomic_uint)) % ARRAY_SIZE(wait_buckets);
 
     return &wait_buckets[idx];
 }
-- 
2.24.3 (Apple Git-128)



More information about the vlc-devel mailing list