[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/igc 4ba6df1664e: Small changes need for GCC/Linux.
From: |
Gerd Moellmann |
Subject: |
scratch/igc 4ba6df1664e: Small changes need for GCC/Linux. |
Date: |
Mon, 22 Apr 2024 12:26:41 -0400 (EDT) |
branch: scratch/igc
commit 4ba6df1664e86b01bc8914311c12af248f091081
Author: Helmut Eller <eller.helmut@gmail.com>
Commit: Gerd Möllmann <gerd@gnu.org>
Small changes need for GCC/Linux.
* emacs.c (main): Call init_signals before init_igc; this avoids
overwriting MPS's SIGSEGV handler.
* fns.c: Remove spurios #include <sys/_types/_size_t.h>
* igc.c: Minor changes to avoid GCC warnings.
(igc_assert_fail): die() is already declared in lisp.h
(igc_assert, IGC_CHECK_RES): Use the do { ... } while(0) idiom to
avoid GCC warnings about empty statements.
(scan_pure): Tell GCC that pure_bytes_used_lisp exists.
(thread_ap): Abort for unhandled cases.
(fix_image, igc_make_image): Add #ifdef HAVE_WINDOW_SYSTEM in
places that need struct image.
---
src/emacs.c | 4 ++--
src/fns.c | 1 -
src/igc.c | 31 ++++++++++++++++++++++---------
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/src/emacs.c b/src/emacs.c
index 795d43e4d67..885708750da 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1425,6 +1425,8 @@ main (int argc, char **argv)
ns_init_pool ();
#endif
+ init_signals ();
+
#ifdef HAVE_MPS
init_igc ();
#endif
@@ -1946,8 +1948,6 @@ Using an Emacs configured with --with-x-toolkit=lucid
does not have this problem
malloc_enable_thread ();
#endif
- init_signals ();
-
noninteractive1 = noninteractive;
/* Perform basic initializations (not merely interning symbols). */
diff --git a/src/fns.c b/src/fns.c
index 634f67e15ac..65994f45dcc 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <stdlib.h>
-#include <sys/_types/_size_t.h>
#include <sys/random.h>
#include <unistd.h>
#include <filevercmp.h>
diff --git a/src/igc.c b/src/igc.c
index ceddd66abdd..680f1a5ccb6 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -73,15 +73,19 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
static void
igc_assert_fail (const char *file, unsigned line, const char *msg)
{
- extern void die (const char *, const char *, int);
die (msg, file, line);
}
#ifdef IGC_DEBUG
-# define igc_assert(expr) \
- if (!(expr)) \
- igc_assert_fail (__FILE__, __LINE__, #expr); \
- else
+
+#define igc_assert(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ igc_assert_fail (__FILE__, __LINE__, #expr); \
+ } \
+ while (0) \
+
#else
# define igc_assert(expr) (void) 9
#endif
@@ -119,10 +123,13 @@ is_aligned (const mps_addr_t addr)
return ((mps_word_t) addr & IGC_TAG_MASK) == 0;
}
-#define IGC_CHECK_RES(res) \
- if ((res) != MPS_RES_OK) \
- emacs_abort (); \
- else
+#define IGC_CHECK_RES(res) \
+ do \
+ { \
+ if ((res) != MPS_RES_OK) \
+ emacs_abort (); \
+ } \
+ while (0) \
#define IGC_WITH_PARKED(gc) \
for (int i = (mps_arena_park (gc->arena), 1); i; \
@@ -802,6 +809,7 @@ scan_pure (mps_ss_t ss, void *start, void *end, void
*closure)
MPS_SCAN_BEGIN (ss)
{
igc_assert (start == (void *) pure);
+ extern ptrdiff_t pure_bytes_used_lisp;
end = (char *) pure + pure_bytes_used_lisp;
if (end > start)
IGC_FIX_CALL (ss, scan_ambig (ss, start, end, NULL));
@@ -957,11 +965,13 @@ fix_image (mps_ss_t ss, struct image *i)
{
MPS_SCAN_BEGIN (ss)
{
+#ifdef HAVE_WINDOW_SYSTEM
IGC_FIX12_OBJ (ss, &i->spec);
IGC_FIX12_OBJ (ss, &i->dependencies);
IGC_FIX12_OBJ (ss, &i->lisp_data);
IGC_FIX12_RAW (ss, &i->next);
IGC_FIX12_RAW (ss, &i->prev);
+#endif
}
MPS_SCAN_END (ss);
return MPS_RES_OK;
@@ -2343,6 +2353,7 @@ thread_ap (enum igc_obj_type type)
case IGC_OBJ_FLOAT:
return t->d.leaf_ap;
}
+ emacs_abort ();
}
/* Conditional breakpoints can be so slow that it is often more
@@ -2573,12 +2584,14 @@ igc_make_itree_node (void)
return n;
}
+#ifdef HAVE_WINDOW_SYSTEM
struct image *
igc_make_image (void)
{
struct image *img = alloc (sizeof *img, IGC_OBJ_IMAGE, PVEC_FREE);
return img;
}
+#endif
struct face *
igc_make_face (void)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scratch/igc 4ba6df1664e: Small changes need for GCC/Linux.,
Gerd Moellmann <=