From 09e788febc6aff3ed44b7bcee4d2801170c02352 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 20 Jan 2025 01:55:19 +0100 Subject: [PATCH] Remove redundant case_Lisp_Int macro The case_Lisp_Int macro was originally introduced with different definitions depending on USE_2_TAGS_FOR_INTS. However, since commit 2b5701247845, we have assumed that USE_2_TAGS_FOR_INTS is always defined, and the macro has only a single definition. As a result, the macro is now unnecessary, and replacing it with standard C case labels improves readability and understanding. * src/lisp.h (case_Lisp_Int): Delete macro. * src/alloc.c (process_mark_stack, survives_gc_p): * src/data.c (Fcl_type_of): * src/fns.c (value_cmp, sxhash_obj): * src/pdumper.c (dump_object): * src/print.c (print_object): * src/xfaces.c (face_attr_equal_p): Remove uses of above macro. (cherry picked from commit 278d1994af4c52a5590c793d27d8fd2867fe7a66) --- src/alloc.c | 6 ++++-- src/data.c | 3 ++- src/fns.c | 6 ++++-- src/lisp.h | 1 - src/pdumper.c | 3 ++- src/print.c | 3 ++- src/xfaces.c | 3 ++- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index d2d68256139..c4e2ff52015 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -7383,7 +7383,8 @@ process_mark_stack (ptrdiff_t base_sp) break; } - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: break; default: @@ -7437,7 +7438,8 @@ survives_gc_p (Lisp_Object obj) switch (XTYPE (obj)) { - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: survives_p = true; break; diff --git a/src/data.c b/src/data.c index 8236721961f..077719c4062 100644 --- a/src/data.c +++ b/src/data.c @@ -209,7 +209,8 @@ a fixed set of types. */) { switch (XTYPE (object)) { - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: return Qfixnum; case Lisp_Symbol: diff --git a/src/fns.c b/src/fns.c index c13a4b7ffbf..7f7de54383a 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3069,7 +3069,8 @@ value_cmp (Lisp_Object a, Lisp_Object b, int maxdepth) switch (XTYPE (a)) { - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: { EMACS_INT ia = XFIXNUM (a); if (FIXNUMP (b)) @@ -5519,7 +5520,8 @@ sxhash_obj (Lisp_Object obj, int depth) switch (XTYPE (obj)) { - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: return XUFIXNUM (obj); case Lisp_Symbol: diff --git a/src/lisp.h b/src/lisp.h index d0354d83629..0ac1e1933fd 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -468,7 +468,6 @@ typedef EMACS_INT Lisp_Word; /* Fixnums use 2 tags, to give them one extra bit, thus extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ #define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1)) -#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 /* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, and xlc and Oracle Studio c99 complain vociferously about them. */ diff --git a/src/pdumper.c b/src/pdumper.c index 97d3d1412b7..3c143fdc2c5 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -3238,7 +3238,8 @@ dump_object (struct dump_context *ctx, Lisp_Object object) case Lisp_Float: offset = dump_float (ctx, XFLOAT (object)); break; - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: eassert ("should not be dumping int: is self-representing" && 0); abort (); default: diff --git a/src/print.c b/src/print.c index f990d6a5dc1..43698f309b1 100644 --- a/src/print.c +++ b/src/print.c @@ -2291,7 +2291,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) switch (XTYPE (obj)) { - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: { EMACS_INT i = XFIXNUM (obj); char escaped_name; diff --git a/src/xfaces.c b/src/xfaces.c index 5e76e598d84..e9500b98524 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4425,7 +4425,8 @@ face_attr_equal_p (Lisp_Object v1, Lisp_Object v2) return memcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; - case_Lisp_Int: + case Lisp_Int0: + case Lisp_Int1: case Lisp_Symbol: return false; -- 2.39.5