aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2017-10-28 19:39:48 +0300
committerEli Zaretskii2017-10-28 19:39:48 +0300
commit00c3c6d88d28c639626c5bbb43901775d5a13314 (patch)
treedc26ee06cf74ddc0aec398be15a488d9dc1dffd1 /src
parenta8e67410662e653e60e8dcc7aaf27042492afee8 (diff)
downloademacs-00c3c6d88d28c639626c5bbb43901775d5a13314.tar.gz
emacs-00c3c6d88d28c639626c5bbb43901775d5a13314.zip
Avoid segfaults in 64-bit Windows builds
* src/lisp.h (COMMON_MULTIPLE): Move here from alloc.c. * src/thread.c (THREAD_ALIGNMENT): New macro. (main_thread): Use THREAD_ALIGNMENT to align propertly. (Bug#29040)
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c6
-rw-r--r--src/lisp.h6
-rw-r--r--src/thread.c4
3 files changed, 9 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c
index da0c3ad4b3e..d9d74856799 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -621,12 +621,6 @@ buffer_memory_full (ptrdiff_t nbytes)
621#endif 621#endif
622} 622}
623 623
624/* A common multiple of the positive integers A and B. Ideally this
625 would be the least common multiple, but there's no way to do that
626 as a constant expression in C, so do the best that we can easily do. */
627#define COMMON_MULTIPLE(a, b) \
628 ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
629
630#ifndef XMALLOC_OVERRUN_CHECK 624#ifndef XMALLOC_OVERRUN_CHECK
631#define XMALLOC_OVERRUN_CHECK_OVERHEAD 0 625#define XMALLOC_OVERRUN_CHECK_OVERHEAD 0
632#else 626#else
diff --git a/src/lisp.h b/src/lisp.h
index 266370333f5..43b3ec618f0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -283,6 +283,12 @@ error !;
283# define GCALIGNED /* empty */ 283# define GCALIGNED /* empty */
284#endif 284#endif
285 285
286/* A common multiple of the positive integers A and B. Ideally this
287 would be the least common multiple, but there's no way to do that
288 as a constant expression in C, so do the best that we can easily do. */
289#define COMMON_MULTIPLE(a, b) \
290 ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
291
286/* Some operations are so commonly executed that they are implemented 292/* Some operations are so commonly executed that they are implemented
287 as macros, not functions, because otherwise runtime performance would 293 as macros, not functions, because otherwise runtime performance would
288 suffer too much when compiling with GCC without optimization. 294 suffer too much when compiling with GCC without optimization.
diff --git a/src/thread.c b/src/thread.c
index 6f12d796ff9..7a670ba410b 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -26,7 +26,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
26#include "coding.h" 26#include "coding.h"
27#include "syssignal.h" 27#include "syssignal.h"
28 28
29static struct thread_state alignas (GCALIGNMENT) main_thread; 29#define THREAD_ALIGNMENT COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT)
30
31static struct thread_state alignas (THREAD_ALIGNMENT) main_thread;
30 32
31struct thread_state *current_thread = &main_thread; 33struct thread_state *current_thread = &main_thread;
32 34