1
0
mirror of https://git.tukaani.org/xz.git synced 2025-04-15 04:00:50 +00:00

sysdefs.h: Avoid <stdalign.h> even with C11 compilers

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
This commit is contained in:
Lasse Collin 2025-03-29 12:41:32 +02:00
parent 7ce38b3183
commit 307c02ed69
No known key found for this signature in database
GPG Key ID: 38EE757D69184620

View 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