]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
sysdefs.h: Avoid <stdalign.h> even with C11 compilers
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 29 Mar 2025 10:41:32 +0000 (12:41 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 29 Mar 2025 10:41:32 +0000 (12:41 +0200)
Oracle Developer Studio 12.6 on Solaris 10 claims C11 support in
__STDC_VERSION__ and supports _Alignas. However, <stdalign.h> is missing.
We only need alignas, so define it to _Alignas with C11/C17 compilers.
If something included <stdalign.h> later, it shouldn't cause problems.

Thanks to Ihsan Dogan for reporting the issue and testing the fix.

Fixes: c0e7eaae8d6eef1e313c9d0da20ccf126ec61f38
src/common/sysdefs.h

index 8e01bd1704d274312b221db7be2e2539b09cfbfc..b10ffa7c3b182185d6f021d51888e93beebb037c 100644 (file)
@@ -172,7 +172,9 @@ typedef unsigned char _Bool;
 #if __STDC_VERSION__ >= 202311
        // alignas is a keyword in C23. Do nothing.
 #elif __STDC_VERSION__ >= 201112
-#      include <stdalign.h>
+       // Oracle Developer Studio 12.6 lacks <stdalign.h>.
+       // For simplicity, avoid the header with all C11/C17 compilers.
+#      define alignas _Alignas
 #elif defined(__GNUC__) || defined(__clang__)
 #      define alignas(n) __attribute__((__aligned__(n)))
 #else