diff options
| author | Paul Eggert | 2025-11-27 00:39:17 -0800 |
|---|---|---|
| committer | Paul Eggert | 2025-11-27 00:40:26 -0800 |
| commit | 1ddc28997b75ff4eaa8d04171764eeb6d8d86922 (patch) | |
| tree | d1ed30825c0850740ecb6c3e21e099bfdbea6179 /src | |
| parent | 18a346da6ac0eaa28f835d66378ef023b7f5a1ab (diff) | |
| download | emacs-1ddc28997b75ff4eaa8d04171764eeb6d8d86922.tar.gz emacs-1ddc28997b75ff4eaa8d04171764eeb6d8d86922.zip | |
Work around a bug in GCC 14 i386 C23 alignas
Problem reported by Helmut Eller (bug#79886).
* src/lisp.h (USE_LSB_TAG): Adjust to alignas changes.
(alignas): For GCC and Clang, prefer __attribute__ ((__aligned__ (A)))
to alignas (A) even if the compiler claims to support the latter.
This works around a bug in GCC 14 i386 C23 alignas.
No need to worry about whether __alignas_is_defined is defined.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lisp.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/lisp.h b/src/lisp.h index 0d457345d85..47442a29f50 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -253,10 +253,10 @@ DEFINE_GDB_SYMBOL_END (INTTYPEBITS) | |||
| 253 | So, USE_LSB_TAG is true only on hosts where it might be useful. */ | 253 | So, USE_LSB_TAG is true only on hosts where it might be useful. */ |
| 254 | DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG) | 254 | DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG) |
| 255 | #if (ALIGNOF_EMACS_INT < IDEAL_GCALIGNMENT && !defined alignas \ | 255 | #if (ALIGNOF_EMACS_INT < IDEAL_GCALIGNMENT && !defined alignas \ |
| 256 | && ! (__GNUC__ || 4 <= __clang_major__) \ | ||
| 257 | && __STDC_VERSION__ < 202311 && __cplusplus < 201103) \ | ||
| 256 | && !defined WIDE_EMACS_INT \ | 258 | && !defined WIDE_EMACS_INT \ |
| 257 | && !defined HAVE_STRUCT_ATTRIBUTE_ALIGNED \ | 259 | && !defined HAVE_STRUCT_ATTRIBUTE_ALIGNED |
| 258 | && !defined __alignas_is_defined \ | ||
| 259 | && __STDC_VERSION__ < 202311 && __cplusplus < 201103) | ||
| 260 | #define USE_LSB_TAG 0 | 260 | #define USE_LSB_TAG 0 |
| 261 | #else /* ALIGNOF_EMACS_INT >= IDEAL_GCALIGNMENT || defined alignas ... */ | 261 | #else /* ALIGNOF_EMACS_INT >= IDEAL_GCALIGNMENT || defined alignas ... */ |
| 262 | #define USE_LSB_TAG (VAL_MAX / 2 < INTPTR_MAX) | 262 | #define USE_LSB_TAG (VAL_MAX / 2 < INTPTR_MAX) |
| @@ -268,10 +268,14 @@ DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) | |||
| 268 | # define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) | 268 | # define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) |
| 269 | DEFINE_GDB_SYMBOL_END (VALMASK) | 269 | DEFINE_GDB_SYMBOL_END (VALMASK) |
| 270 | 270 | ||
| 271 | /* Ignore 'alignas' on compilers lacking it. */ | 271 | /* Support 'alignas (A)' if possible, where A is an integer constant. */ |
| 272 | #if (!defined alignas && !defined __alignas_is_defined \ | 272 | #ifndef alignas |
| 273 | && __STDC_VERSION__ < 202311 && __cplusplus < 201103) | 273 | # if __GNUC__ || 4 <= __clang_major__ |
| 274 | # define alignas(a) | 274 | /* This is more reliable than the alignas operator, in GCC 14. */ |
| 275 | # define alignas(a) __attribute__ ((__aligned__ (a))) | ||
| 276 | # elif __STDC_VERSION__ < 202311 && __cplusplus < 201103 | ||
| 277 | # define alignas(a) /* not supported */ | ||
| 278 | # endif | ||
| 275 | #endif | 279 | #endif |
| 276 | 280 | ||
| 277 | /* The minimum alignment requirement for Lisp objects that is imposed by the | 281 | /* The minimum alignment requirement for Lisp objects that is imposed by the |