Mesa (main): util: Fix invalid usage of alignas in u_cpu_detect.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 22:02:52 UTC 2022


Module: Mesa
Branch: main
Commit: e1accb1c4c505b4b32b5141d89865181a47567dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e1accb1c4c505b4b32b5141d89865181a47567dc

Author: Mike Lothian <mike at fireburn.co.uk>
Date:   Tue Jun 14 20:00:22 2022 +0100

util: Fix invalid usage of alignas in u_cpu_detect.c

This fixes the following errors when compiling Mesa with Clang 14:
../mesa-9999/src/util/u_cpu_detect.c:368:5: error: expected ';' after struct
   } alignas(16) fxarea;
    ^
    ;

This has been tested with Clang 14.0.5 and GCC 12.1

Fixes: e3bc78b8e39 ("util: use c11 alignas instead of rolling our own")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6667
Signed-off-by: Mike Lothian <mike at fireburn.co.uk>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Reviewed-by: Yonggang Luo <luoyonggang at gmail.com>
Acked-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17035>

---

 src/util/u_cpu_detect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c
index 4d65804561a..83321a10859 100644
--- a/src/util/u_cpu_detect.c
+++ b/src/util/u_cpu_detect.c
@@ -361,11 +361,11 @@ static inline uint64_t xgetbv(void)
 #if defined(PIPE_ARCH_X86)
 PIPE_ALIGN_STACK static inline boolean sse2_has_daz(void)
 {
-   struct {
+   alignas(16) struct {
       uint32_t pad1[7];
       uint32_t mxcsr_mask;
       uint32_t pad2[128-8];
-   } alignas(16) fxarea;
+   } fxarea;
 
    fxarea.mxcsr_mask = 0;
 #if defined(PIPE_CC_GCC)



More information about the mesa-commit mailing list