Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 1 | From 6e169bb5fadb73b4dd300b28e9cae1e1772855e8 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 15 Jan 2023 02:05:23 -0800 |
| 4 | Subject: [PATCH] Use __alignof__ with clang. |
| 5 | |
| 6 | For clang versions < 8, use the same |
| 7 | workaround as for GCC versions < 4.9. |
| 8 | |
| 9 | Backport couple of gnulib patches squashed |
| 10 | |
| 11 | [1] https://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/stdalign.in.h?id=57caf9541d98314102a55dd1cd0b8dc2be747471 |
| 12 | [2] https://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/stdalign.in.h?id=2af490a4c4ce85567296e27be6a9528964ca851e |
| 13 | |
| 14 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/stdalign.in.h?id=57caf9541d98314102a55dd1cd0b8dc2be747471] |
| 15 | |
| 16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 17 | --- |
| 18 | gnu/stdalign.in.h | 7 +++++-- |
| 19 | 1 file changed, 5 insertions(+), 2 deletions(-) |
| 20 | |
| 21 | diff --git a/gnu/stdalign.in.h b/gnu/stdalign.in.h |
| 22 | index 5f56eee..e6e6a65 100644 |
| 23 | --- a/gnu/stdalign.in.h |
| 24 | +++ b/gnu/stdalign.in.h |
| 25 | @@ -53,9 +53,12 @@ |
| 26 | #undef _Alignof |
| 27 | |
| 28 | /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 |
| 29 | - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ |
| 30 | + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. |
| 31 | + clang versions < 8.0.0 have the same bug. */ |
| 32 | #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ |
| 33 | - || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9))) |
| 34 | + || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ |
| 35 | + && !defined __clang__) \ |
| 36 | + || (defined __clang__ && __clang_major__ < 8)) |
| 37 | # ifdef __cplusplus |
| 38 | # if 201103 <= __cplusplus |
| 39 | # define _Alignof(type) alignof (type) |
| 40 | -- |
| 41 | 2.39.0 |
| 42 | |