[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 00c3c6d: Avoid segfaults in 64-bit Windows builds
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-26 00c3c6d: Avoid segfaults in 64-bit Windows builds |
Date: |
Sat, 28 Oct 2017 12:41:03 -0400 (EDT) |
branch: emacs-26
commit 00c3c6d88d28c639626c5bbb43901775d5a13314
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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)
---
src/alloc.c | 6 ------
src/lisp.h | 6 ++++++
src/thread.c | 4 +++-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index da0c3ad..d9d7485 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -621,12 +621,6 @@ buffer_memory_full (ptrdiff_t nbytes)
#endif
}
-/* A common multiple of the positive integers A and B. Ideally this
- would be the least common multiple, but there's no way to do that
- as a constant expression in C, so do the best that we can easily do. */
-#define COMMON_MULTIPLE(a, b) \
- ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
-
#ifndef XMALLOC_OVERRUN_CHECK
#define XMALLOC_OVERRUN_CHECK_OVERHEAD 0
#else
diff --git a/src/lisp.h b/src/lisp.h
index 2663703..43b3ec6 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -283,6 +283,12 @@ error !;
# define GCALIGNED /* empty */
#endif
+/* A common multiple of the positive integers A and B. Ideally this
+ would be the least common multiple, but there's no way to do that
+ as a constant expression in C, so do the best that we can easily do. */
+#define COMMON_MULTIPLE(a, b) \
+ ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
+
/* Some operations are so commonly executed that they are implemented
as macros, not functions, because otherwise runtime performance would
suffer too much when compiling with GCC without optimization.
diff --git a/src/thread.c b/src/thread.c
index 6f12d79..7a670ba 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/>. */
#include "coding.h"
#include "syssignal.h"
-static struct thread_state alignas (GCALIGNMENT) main_thread;
+#define THREAD_ALIGNMENT COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT)
+
+static struct thread_state alignas (THREAD_ALIGNMENT) main_thread;
struct thread_state *current_thread = &main_thread;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 00c3c6d: Avoid segfaults in 64-bit Windows builds,
Eli Zaretskii <=