diff options
| author | Paul Eggert | 2018-06-10 10:13:45 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-06-10 10:16:53 -0700 |
| commit | 0303fab396a818d796c7513457aa341ab703e8f3 (patch) | |
| tree | cf8471d344ed264e9395f0b1eba183c9d4c0f4bc /src | |
| parent | efa750e68466fb1bab03028701350a745e0504b6 (diff) | |
| download | emacs-0303fab396a818d796c7513457aa341ab703e8f3.tar.gz emacs-0303fab396a818d796c7513457aa341ab703e8f3.zip | |
Use native alignment to access Lisp object data
Instead of using __builtin_assume_aligned (P, GCALIGNMENT) to
tell GCC that P has alignment 8, use (T *) P where T is the
type of the pointed-to object, to tell GCC that P has native
alignment. This is simpler, matches the intent better, and
should help simplify future improvements. Some of these
changes are to pacify gcc -Wnull-dereference, since GCC is
smarter about pointers now that Emacs no longer uses
__builtin_assume_aligned; these minor changes should improve
code efficiency slightly. On Fedora 28 x86-64 with default
optimization this patch shrinks the size of the Emacs text
segment by 0.36%.
* src/conf_post.h (__has_builtin, __builtin_assume_aligned):
Remove; no longer used.
* src/dbusbind.c (XD_OBJECT_TO_DBUS_TYPE):
Pacify -Wnull-dereference by using XCAR instead of CAR_SAFE
and XCDR instead of CDR_SAFE when this is safe.
* src/fileio.c (Fexpand_file_name):
* src/font.c (clear_font_cache):
Pacify -Wnull-dereference by removing unnecessary NILP test.
* src/keyboard.c (xevent_start): New function.
(read_char, read_key_sequence): Pacify -Wnull-dereference by
using xevent_start instead of EVENT_START.
* src/lisp.h (lisp_h_XUNTAG): Remove; XUNTAG is always a macro
now, since it can no longer be implemented as a function.
(XUNTAG): New third argument CTYPE. All uses changed.
Cast result to CTYPE * instead of using __builtin_assume_aligned.
Simplify by using LISP_WORD_TAG.
(LISP_WORD_TAG): New macro.
(TAG_PTR): Use it.
* src/menu.c (x_popup_menu_1):
Pacify -Wnull-dereference by using XCAR instead of Fcar and
XCDR instead of Fcdr where this is safe.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 2 | ||||
| -rw-r--r-- | src/buffer.h | 2 | ||||
| -rw-r--r-- | src/conf_post.h | 13 | ||||
| -rw-r--r-- | src/dbusbind.c | 18 | ||||
| -rw-r--r-- | src/fileio.c | 17 | ||||
| -rw-r--r-- | src/font.c | 5 | ||||
| -rw-r--r-- | src/font.h | 12 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 21 | ||||
| -rw-r--r-- | src/lisp.h | 87 | ||||
| -rw-r--r-- | src/menu.c | 4 | ||||
| -rw-r--r-- | src/process.h | 2 | ||||
| -rw-r--r-- | src/termhooks.h | 2 | ||||
| -rw-r--r-- | src/thread.h | 6 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32menu.c | 3 | ||||
| -rw-r--r-- | src/window.h | 2 | ||||
| -rw-r--r-- | src/xwidget.h | 4 |
18 files changed, 95 insertions, 109 deletions
diff --git a/src/alloc.c b/src/alloc.c index f600c89ae2c..cde2e4b3407 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2916,7 +2916,7 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, | |||
| 2916 | static struct Lisp_Vector * | 2916 | static struct Lisp_Vector * |
| 2917 | next_vector (struct Lisp_Vector *v) | 2917 | next_vector (struct Lisp_Vector *v) |
| 2918 | { | 2918 | { |
| 2919 | return XUNTAG (v->contents[0], Lisp_Int0); | 2919 | return XUNTAG (v->contents[0], Lisp_Int0, struct Lisp_Vector); |
| 2920 | } | 2920 | } |
| 2921 | 2921 | ||
| 2922 | static void | 2922 | static void |
diff --git a/src/buffer.h b/src/buffer.h index b12dad684f2..85b5631736f 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -912,7 +912,7 @@ INLINE struct buffer * | |||
| 912 | XBUFFER (Lisp_Object a) | 912 | XBUFFER (Lisp_Object a) |
| 913 | { | 913 | { |
| 914 | eassert (BUFFERP (a)); | 914 | eassert (BUFFERP (a)); |
| 915 | return XUNTAG (a, Lisp_Vectorlike); | 915 | return XUNTAG (a, Lisp_Vectorlike, struct buffer); |
| 916 | } | 916 | } |
| 917 | 917 | ||
| 918 | /* Most code should use these functions to set Lisp fields in struct | 918 | /* Most code should use these functions to set Lisp fields in struct |
diff --git a/src/conf_post.h b/src/conf_post.h index 30f3b953056..080d7b7e688 100644 --- a/src/conf_post.h +++ b/src/conf_post.h | |||
| @@ -70,14 +70,6 @@ typedef bool bool_bf; | |||
| 70 | # define __has_attribute_no_sanitize_undefined GNUC_PREREQ (4, 9, 0) | 70 | # define __has_attribute_no_sanitize_undefined GNUC_PREREQ (4, 9, 0) |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | /* Simulate __has_builtin on compilers that lack it. It is used only | ||
| 74 | on arguments like __builtin_assume_aligned that are handled in this | ||
| 75 | simulation. */ | ||
| 76 | #ifndef __has_builtin | ||
| 77 | # define __has_builtin(a) __has_builtin_##a | ||
| 78 | # define __has_builtin___builtin_assume_aligned GNUC_PREREQ (4, 7, 0) | ||
| 79 | #endif | ||
| 80 | |||
| 81 | /* Simulate __has_feature on compilers that lack it. It is used only | 73 | /* Simulate __has_feature on compilers that lack it. It is used only |
| 82 | to define ADDRESS_SANITIZER below. */ | 74 | to define ADDRESS_SANITIZER below. */ |
| 83 | #ifndef __has_feature | 75 | #ifndef __has_feature |
| @@ -91,11 +83,6 @@ typedef bool bool_bf; | |||
| 91 | # define ADDRESS_SANITIZER false | 83 | # define ADDRESS_SANITIZER false |
| 92 | #endif | 84 | #endif |
| 93 | 85 | ||
| 94 | /* Yield PTR, which must be aligned to ALIGNMENT. */ | ||
| 95 | #if ! __has_builtin (__builtin_assume_aligned) | ||
| 96 | # define __builtin_assume_aligned(ptr, ...) ((void *) (ptr)) | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifdef DARWIN_OS | 86 | #ifdef DARWIN_OS |
| 100 | #if defined emacs && !defined CANNOT_DUMP | 87 | #if defined emacs && !defined CANNOT_DUMP |
| 101 | #define malloc unexec_malloc | 88 | #define malloc unexec_malloc |
diff --git a/src/dbusbind.c b/src/dbusbind.c index ec3707d18f3..4e0b99bea9d 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -207,10 +207,10 @@ xd_symbol_to_dbus_type (Lisp_Object object) | |||
| 207 | : (STRINGP (object)) ? DBUS_TYPE_STRING \ | 207 | : (STRINGP (object)) ? DBUS_TYPE_STRING \ |
| 208 | : (XD_DBUS_TYPE_P (object)) ? xd_symbol_to_dbus_type (object) \ | 208 | : (XD_DBUS_TYPE_P (object)) ? xd_symbol_to_dbus_type (object) \ |
| 209 | : (CONSP (object)) \ | 209 | : (CONSP (object)) \ |
| 210 | ? ((XD_DBUS_TYPE_P (CAR_SAFE (object))) \ | 210 | ? ((XD_DBUS_TYPE_P (XCAR (object))) \ |
| 211 | ? ((XD_BASIC_DBUS_TYPE (xd_symbol_to_dbus_type (CAR_SAFE (object)))) \ | 211 | ? ((XD_BASIC_DBUS_TYPE (xd_symbol_to_dbus_type (XCAR (object)))) \ |
| 212 | ? DBUS_TYPE_ARRAY \ | 212 | ? DBUS_TYPE_ARRAY \ |
| 213 | : xd_symbol_to_dbus_type (CAR_SAFE (object))) \ | 213 | : xd_symbol_to_dbus_type (XCAR (object))) \ |
| 214 | : DBUS_TYPE_ARRAY) \ | 214 | : DBUS_TYPE_ARRAY) \ |
| 215 | : DBUS_TYPE_INVALID) | 215 | : DBUS_TYPE_INVALID) |
| 216 | 216 | ||
| @@ -396,7 +396,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) | |||
| 396 | CHECK_CONS (object); | 396 | CHECK_CONS (object); |
| 397 | 397 | ||
| 398 | /* Type symbol is optional. */ | 398 | /* Type symbol is optional. */ |
| 399 | if (EQ (QCarray, CAR_SAFE (elt))) | 399 | if (EQ (QCarray, XCAR (elt))) |
| 400 | elt = XD_NEXT_VALUE (elt); | 400 | elt = XD_NEXT_VALUE (elt); |
| 401 | 401 | ||
| 402 | /* If the array is empty, DBUS_TYPE_STRING is the default | 402 | /* If the array is empty, DBUS_TYPE_STRING is the default |
| @@ -416,10 +416,12 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) | |||
| 416 | /* If the element type is DBUS_TYPE_SIGNATURE, and this is the | 416 | /* If the element type is DBUS_TYPE_SIGNATURE, and this is the |
| 417 | only element, the value of this element is used as the | 417 | only element, the value of this element is used as the |
| 418 | array's element signature. */ | 418 | array's element signature. */ |
| 419 | if ((subtype == DBUS_TYPE_SIGNATURE) | 419 | if (subtype == DBUS_TYPE_SIGNATURE) |
| 420 | && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) | 420 | { |
| 421 | && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) | 421 | Lisp_Object elt1 = XD_NEXT_VALUE (elt); |
| 422 | subsig = SSDATA (CAR_SAFE (XD_NEXT_VALUE (elt))); | 422 | if (CONSP (elt1) && STRINGP (XCAR (elt1)) && NILP (XCDR (elt1))) |
| 423 | subsig = SSDATA (XCAR (elt1)); | ||
| 424 | } | ||
| 423 | 425 | ||
| 424 | while (!NILP (elt)) | 426 | while (!NILP (elt)) |
| 425 | { | 427 | { |
diff --git a/src/fileio.c b/src/fileio.c index e8d966e1631..47c5fec8532 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -813,17 +813,14 @@ the root directory. */) | |||
| 813 | #endif | 813 | #endif |
| 814 | } | 814 | } |
| 815 | 815 | ||
| 816 | if (!NILP (default_directory)) | 816 | handler = Ffind_file_name_handler (default_directory, Qexpand_file_name); |
| 817 | if (!NILP (handler)) | ||
| 817 | { | 818 | { |
| 818 | handler = Ffind_file_name_handler (default_directory, Qexpand_file_name); | 819 | handled_name = call3 (handler, Qexpand_file_name, |
| 819 | if (!NILP (handler)) | 820 | name, default_directory); |
| 820 | { | 821 | if (STRINGP (handled_name)) |
| 821 | handled_name = call3 (handler, Qexpand_file_name, | 822 | return handled_name; |
| 822 | name, default_directory); | 823 | error ("Invalid handler in `file-name-handler-alist'"); |
| 823 | if (STRINGP (handled_name)) | ||
| 824 | return handled_name; | ||
| 825 | error ("Invalid handler in `file-name-handler-alist'"); | ||
| 826 | } | ||
| 827 | } | 824 | } |
| 828 | 825 | ||
| 829 | { | 826 | { |
diff --git a/src/font.c b/src/font.c index c886c299d19..3800869c5b3 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -4354,10 +4354,9 @@ clear_font_cache (struct frame *f) | |||
| 4354 | Lisp_Object val, tmp, cache = driver_list->driver->get_cache (f); | 4354 | Lisp_Object val, tmp, cache = driver_list->driver->get_cache (f); |
| 4355 | 4355 | ||
| 4356 | val = XCDR (cache); | 4356 | val = XCDR (cache); |
| 4357 | while (! NILP (val) | 4357 | while (eassert (CONSP (val)), |
| 4358 | && ! EQ (XCAR (XCAR (val)), driver_list->driver->type)) | 4358 | ! EQ (XCAR (XCAR (val)), driver_list->driver->type)) |
| 4359 | val = XCDR (val); | 4359 | val = XCDR (val); |
| 4360 | eassert (! NILP (val)); | ||
| 4361 | tmp = XCDR (XCAR (val)); | 4360 | tmp = XCDR (XCAR (val)); |
| 4362 | if (XINT (XCAR (tmp)) == 0) | 4361 | if (XINT (XCAR (tmp)) == 0) |
| 4363 | { | 4362 | { |
diff --git a/src/font.h b/src/font.h index 469431fee67..6ec32def4b9 100644 --- a/src/font.h +++ b/src/font.h | |||
| @@ -494,42 +494,42 @@ INLINE struct font_spec * | |||
| 494 | XFONT_SPEC (Lisp_Object p) | 494 | XFONT_SPEC (Lisp_Object p) |
| 495 | { | 495 | { |
| 496 | eassert (FONT_SPEC_P (p)); | 496 | eassert (FONT_SPEC_P (p)); |
| 497 | return XUNTAG (p, Lisp_Vectorlike); | 497 | return XUNTAG (p, Lisp_Vectorlike, struct font_spec); |
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | INLINE struct font_spec * | 500 | INLINE struct font_spec * |
| 501 | GC_XFONT_SPEC (Lisp_Object p) | 501 | GC_XFONT_SPEC (Lisp_Object p) |
| 502 | { | 502 | { |
| 503 | eassert (GC_FONT_SPEC_P (p)); | 503 | eassert (GC_FONT_SPEC_P (p)); |
| 504 | return XUNTAG (p, Lisp_Vectorlike); | 504 | return XUNTAG (p, Lisp_Vectorlike, struct font_spec); |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | INLINE struct font_entity * | 507 | INLINE struct font_entity * |
| 508 | XFONT_ENTITY (Lisp_Object p) | 508 | XFONT_ENTITY (Lisp_Object p) |
| 509 | { | 509 | { |
| 510 | eassert (FONT_ENTITY_P (p)); | 510 | eassert (FONT_ENTITY_P (p)); |
| 511 | return XUNTAG (p, Lisp_Vectorlike); | 511 | return XUNTAG (p, Lisp_Vectorlike, struct font_entity); |
| 512 | } | 512 | } |
| 513 | 513 | ||
| 514 | INLINE struct font_entity * | 514 | INLINE struct font_entity * |
| 515 | GC_XFONT_ENTITY (Lisp_Object p) | 515 | GC_XFONT_ENTITY (Lisp_Object p) |
| 516 | { | 516 | { |
| 517 | eassert (GC_FONT_ENTITY_P (p)); | 517 | eassert (GC_FONT_ENTITY_P (p)); |
| 518 | return XUNTAG (p, Lisp_Vectorlike); | 518 | return XUNTAG (p, Lisp_Vectorlike, struct font_entity); |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | INLINE struct font * | 521 | INLINE struct font * |
| 522 | XFONT_OBJECT (Lisp_Object p) | 522 | XFONT_OBJECT (Lisp_Object p) |
| 523 | { | 523 | { |
| 524 | eassert (FONT_OBJECT_P (p)); | 524 | eassert (FONT_OBJECT_P (p)); |
| 525 | return XUNTAG (p, Lisp_Vectorlike); | 525 | return XUNTAG (p, Lisp_Vectorlike, struct font); |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | INLINE struct font * | 528 | INLINE struct font * |
| 529 | GC_XFONT_OBJECT (Lisp_Object p) | 529 | GC_XFONT_OBJECT (Lisp_Object p) |
| 530 | { | 530 | { |
| 531 | eassert (GC_FONT_OBJECT_P (p)); | 531 | eassert (GC_FONT_OBJECT_P (p)); |
| 532 | return XUNTAG (p, Lisp_Vectorlike); | 532 | return XUNTAG (p, Lisp_Vectorlike, struct font); |
| 533 | } | 533 | } |
| 534 | 534 | ||
| 535 | #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) | 535 | #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) |
diff --git a/src/frame.h b/src/frame.h index 2c9c4143886..1f438d3f694 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -726,7 +726,7 @@ default_pixels_per_inch_y (void) | |||
| 726 | #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache) | 726 | #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache) |
| 727 | 727 | ||
| 728 | #define XFRAME(p) \ | 728 | #define XFRAME(p) \ |
| 729 | (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike)) | 729 | (eassert (FRAMEP (p)), XUNTAG (p, Lisp_Vectorlike, struct frame)) |
| 730 | #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) | 730 | #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) |
| 731 | 731 | ||
| 732 | /* Given a window, return its frame as a Lisp_Object. */ | 732 | /* Given a window, return its frame as a Lisp_Object. */ |
diff --git a/src/keyboard.c b/src/keyboard.c index e6b5cf79983..d498ac3feea 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -377,6 +377,15 @@ static void deliver_user_signal (int); | |||
| 377 | static char *find_user_signal_name (int); | 377 | static char *find_user_signal_name (int); |
| 378 | static void store_user_signal_events (void); | 378 | static void store_user_signal_events (void); |
| 379 | 379 | ||
| 380 | /* Like EVENT_START, but assume EVENT is an event. | ||
| 381 | This pacifies gcc -Wnull-dereference, which might otherwise | ||
| 382 | complain about earlier checks that EVENT is indeed an event. */ | ||
| 383 | static Lisp_Object | ||
| 384 | xevent_start (Lisp_Object event) | ||
| 385 | { | ||
| 386 | return XCAR (XCDR (event)); | ||
| 387 | } | ||
| 388 | |||
| 380 | /* These setters are used only in this file, so they can be private. */ | 389 | /* These setters are used only in this file, so they can be private. */ |
| 381 | static void | 390 | static void |
| 382 | kset_echo_string (struct kboard *kb, Lisp_Object val) | 391 | kset_echo_string (struct kboard *kb, Lisp_Object val) |
| @@ -2910,8 +2919,8 @@ read_char (int commandflag, Lisp_Object map, | |||
| 2910 | so we won't do this twice, then queue it up. */ | 2919 | so we won't do this twice, then queue it up. */ |
| 2911 | if (EVENT_HAS_PARAMETERS (c) | 2920 | if (EVENT_HAS_PARAMETERS (c) |
| 2912 | && CONSP (XCDR (c)) | 2921 | && CONSP (XCDR (c)) |
| 2913 | && CONSP (EVENT_START (c)) | 2922 | && CONSP (xevent_start (c)) |
| 2914 | && CONSP (XCDR (EVENT_START (c)))) | 2923 | && CONSP (XCDR (xevent_start (c)))) |
| 2915 | { | 2924 | { |
| 2916 | Lisp_Object posn; | 2925 | Lisp_Object posn; |
| 2917 | 2926 | ||
| @@ -9397,12 +9406,12 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, | |||
| 9397 | } | 9406 | } |
| 9398 | } | 9407 | } |
| 9399 | else if (CONSP (XCDR (key)) | 9408 | else if (CONSP (XCDR (key)) |
| 9400 | && CONSP (EVENT_START (key)) | 9409 | && CONSP (xevent_start (key)) |
| 9401 | && CONSP (XCDR (EVENT_START (key)))) | 9410 | && CONSP (XCDR (xevent_start (key)))) |
| 9402 | { | 9411 | { |
| 9403 | Lisp_Object posn; | 9412 | Lisp_Object posn; |
| 9404 | 9413 | ||
| 9405 | posn = POSN_POSN (EVENT_START (key)); | 9414 | posn = POSN_POSN (xevent_start (key)); |
| 9406 | /* Handle menu-bar events: | 9415 | /* Handle menu-bar events: |
| 9407 | insert the dummy prefix event `menu-bar'. */ | 9416 | insert the dummy prefix event `menu-bar'. */ |
| 9408 | if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar)) | 9417 | if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar)) |
| @@ -9414,7 +9423,7 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, | |||
| 9414 | 9423 | ||
| 9415 | /* Zap the position in key, so we know that we've | 9424 | /* Zap the position in key, so we know that we've |
| 9416 | expanded it, and don't try to do so again. */ | 9425 | expanded it, and don't try to do so again. */ |
| 9417 | POSN_SET_POSN (EVENT_START (key), list1 (posn)); | 9426 | POSN_SET_POSN (xevent_start (key), list1 (posn)); |
| 9418 | 9427 | ||
| 9419 | mock_input = t + 2; | 9428 | mock_input = t + 2; |
| 9420 | goto replay_sequence; | 9429 | goto replay_sequence; |
diff --git a/src/lisp.h b/src/lisp.h index 293cf2783c3..d4499846053 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -375,7 +375,7 @@ typedef EMACS_INT Lisp_Word; | |||
| 375 | #define lisp_h_XCAR(c) XCONS (c)->u.s.car | 375 | #define lisp_h_XCAR(c) XCONS (c)->u.s.car |
| 376 | #define lisp_h_XCDR(c) XCONS (c)->u.s.u.cdr | 376 | #define lisp_h_XCDR(c) XCONS (c)->u.s.u.cdr |
| 377 | #define lisp_h_XCONS(a) \ | 377 | #define lisp_h_XCONS(a) \ |
| 378 | (eassert (CONSP (a)), (struct Lisp_Cons *) XUNTAG (a, Lisp_Cons)) | 378 | (eassert (CONSP (a)), XUNTAG (a, Lisp_Cons, struct Lisp_Cons)) |
| 379 | #define lisp_h_XHASH(a) XUINT (a) | 379 | #define lisp_h_XHASH(a) XUINT (a) |
| 380 | #ifndef GC_CHECK_CONS_LIST | 380 | #ifndef GC_CHECK_CONS_LIST |
| 381 | # define lisp_h_check_cons_list() ((void) 0) | 381 | # define lisp_h_check_cons_list() ((void) 0) |
| @@ -388,7 +388,8 @@ typedef EMACS_INT Lisp_Word; | |||
| 388 | # ifdef __CHKP__ | 388 | # ifdef __CHKP__ |
| 389 | # define lisp_h_XSYMBOL(a) \ | 389 | # define lisp_h_XSYMBOL(a) \ |
| 390 | (eassert (SYMBOLP (a)), \ | 390 | (eassert (SYMBOLP (a)), \ |
| 391 | (struct Lisp_Symbol *) ((char *) XUNTAG (a, Lisp_Symbol) \ | 391 | (struct Lisp_Symbol *) ((char *) XUNTAG (a, Lisp_Symbol, \ |
| 392 | struct Lisp_Symbol) \ | ||
| 392 | + (intptr_t) lispsym)) | 393 | + (intptr_t) lispsym)) |
| 393 | # else | 394 | # else |
| 394 | /* If !__CHKP__ this is equivalent, and is a bit faster as of GCC 7. */ | 395 | /* If !__CHKP__ this is equivalent, and is a bit faster as of GCC 7. */ |
| @@ -398,8 +399,6 @@ typedef EMACS_INT Lisp_Word; | |||
| 398 | + (char *) lispsym)) | 399 | + (char *) lispsym)) |
| 399 | # endif | 400 | # endif |
| 400 | # define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a) & ~VALMASK)) | 401 | # define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a) & ~VALMASK)) |
| 401 | # define lisp_h_XUNTAG(a, type) \ | ||
| 402 | __builtin_assume_aligned ((char *) XLP (a) - (type), GCALIGNMENT) | ||
| 403 | #endif | 402 | #endif |
| 404 | 403 | ||
| 405 | /* When compiling via gcc -O0, define the key operations as macros, as | 404 | /* When compiling via gcc -O0, define the key operations as macros, as |
| @@ -447,7 +446,6 @@ typedef EMACS_INT Lisp_Word; | |||
| 447 | # define XINT(a) lisp_h_XINT (a) | 446 | # define XINT(a) lisp_h_XINT (a) |
| 448 | # define XSYMBOL(a) lisp_h_XSYMBOL (a) | 447 | # define XSYMBOL(a) lisp_h_XSYMBOL (a) |
| 449 | # define XTYPE(a) lisp_h_XTYPE (a) | 448 | # define XTYPE(a) lisp_h_XTYPE (a) |
| 450 | # define XUNTAG(a, type) lisp_h_XUNTAG (a, type) | ||
| 451 | # endif | 449 | # endif |
| 452 | #endif | 450 | #endif |
| 453 | 451 | ||
| @@ -691,20 +689,11 @@ INLINE void | |||
| 691 | lisp_h_CHECK_TYPE (ok, predicate, x); | 689 | lisp_h_CHECK_TYPE (ok, predicate, x); |
| 692 | } | 690 | } |
| 693 | 691 | ||
| 694 | /* Extract A's pointer value, assuming A's type is TYPE. */ | 692 | /* Extract A's pointer value, assuming A's Lisp type is TYPE and the |
| 695 | 693 | extracted pointer's type is CTYPE *. */ | |
| 696 | INLINE void * | ||
| 697 | (XUNTAG) (Lisp_Object a, int type) | ||
| 698 | { | ||
| 699 | #if USE_LSB_TAG | ||
| 700 | return lisp_h_XUNTAG (a, type); | ||
| 701 | #else | ||
| 702 | EMACS_UINT utype = type; | ||
| 703 | char *p = XLP (a); | ||
| 704 | return p - (utype << (USE_LSB_TAG ? 0 : VALBITS)); | ||
| 705 | #endif | ||
| 706 | } | ||
| 707 | 694 | ||
| 695 | #define XUNTAG(a, type, ctype) ((ctype *) \ | ||
| 696 | ((char *) XLP (a) - LISP_WORD_TAG (type))) | ||
| 708 | 697 | ||
| 709 | /* Interned state of a symbol. */ | 698 | /* Interned state of a symbol. */ |
| 710 | 699 | ||
| @@ -812,10 +801,9 @@ verify (!USE_LSB_TAG || alignof (struct Lisp_Symbol) % GCALIGNMENT == 0); | |||
| 812 | #define DEFUN_ARGS_8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \ | 801 | #define DEFUN_ARGS_8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \ |
| 813 | Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) | 802 | Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) |
| 814 | 803 | ||
| 815 | /* Typedefs useful for implementing TAG_PTR. untagged_ptr represents | 804 | /* untagged_ptr represents a pointer before tagging, and Lisp_Word_tag |
| 816 | a pointer before tagging, and Lisp_Word_tag contains a | 805 | contains a possibly-shifted tag to be added to an untagged_ptr to |
| 817 | possibly-shifted tag to be added to an untagged_ptr to convert it | 806 | convert it to a Lisp_Word. */ |
| 818 | to a Lisp_Word. */ | ||
| 819 | #if LISP_WORDS_ARE_POINTERS | 807 | #if LISP_WORDS_ARE_POINTERS |
| 820 | /* untagged_ptr is a pointer so that the compiler knows that TAG_PTR | 808 | /* untagged_ptr is a pointer so that the compiler knows that TAG_PTR |
| 821 | yields a pointer; this can help with gcc -fcheck-pointer-bounds. | 809 | yields a pointer; this can help with gcc -fcheck-pointer-bounds. |
| @@ -830,11 +818,13 @@ typedef uintptr_t untagged_ptr; | |||
| 830 | typedef EMACS_UINT Lisp_Word_tag; | 818 | typedef EMACS_UINT Lisp_Word_tag; |
| 831 | #endif | 819 | #endif |
| 832 | 820 | ||
| 821 | /* A integer value tagged with TAG, and otherwise all zero. */ | ||
| 822 | #define LISP_WORD_TAG(tag) \ | ||
| 823 | ((Lisp_Word_tag) (tag) << (USE_LSB_TAG ? 0 : VALBITS)) | ||
| 824 | |||
| 833 | /* An initializer for a Lisp_Object that contains TAG along with PTR. */ | 825 | /* An initializer for a Lisp_Object that contains TAG along with PTR. */ |
| 834 | #define TAG_PTR(tag, ptr) \ | 826 | #define TAG_PTR(tag, ptr) \ |
| 835 | LISP_INITIALLY ((Lisp_Word) \ | 827 | LISP_INITIALLY ((Lisp_Word) ((untagged_ptr) (ptr) + LISP_WORD_TAG (tag))) |
| 836 | ((untagged_ptr) (ptr) \ | ||
| 837 | + ((Lisp_Word_tag) (tag) << (USE_LSB_TAG ? 0 : VALBITS)))) | ||
| 838 | 828 | ||
| 839 | /* LISPSYM_INITIALLY (Qfoo) is equivalent to Qfoo except it is | 829 | /* LISPSYM_INITIALLY (Qfoo) is equivalent to Qfoo except it is |
| 840 | designed for use as an initializer, even for a constant initializer. */ | 830 | designed for use as an initializer, even for a constant initializer. */ |
| @@ -913,7 +903,7 @@ INLINE struct Lisp_Symbol * ATTRIBUTE_NO_SANITIZE_UNDEFINED | |||
| 913 | return lisp_h_XSYMBOL (a); | 903 | return lisp_h_XSYMBOL (a); |
| 914 | #else | 904 | #else |
| 915 | eassert (SYMBOLP (a)); | 905 | eassert (SYMBOLP (a)); |
| 916 | intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol); | 906 | intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol, struct Lisp_Symbol); |
| 917 | void *p = (char *) lispsym + i; | 907 | void *p = (char *) lispsym + i; |
| 918 | # ifdef __CHKP__ | 908 | # ifdef __CHKP__ |
| 919 | /* Bypass pointer checking. Although this could be improved it is | 909 | /* Bypass pointer checking. Although this could be improved it is |
| @@ -1159,7 +1149,7 @@ INLINE Lisp_Object | |||
| 1159 | make_lisp_ptr (void *ptr, enum Lisp_Type type) | 1149 | make_lisp_ptr (void *ptr, enum Lisp_Type type) |
| 1160 | { | 1150 | { |
| 1161 | Lisp_Object a = TAG_PTR (type, ptr); | 1151 | Lisp_Object a = TAG_PTR (type, ptr); |
| 1162 | eassert (XTYPE (a) == type && XUNTAG (a, type) == ptr); | 1152 | eassert (XTYPE (a) == type && XUNTAG (a, type, char) == ptr); |
| 1163 | return a; | 1153 | return a; |
| 1164 | } | 1154 | } |
| 1165 | 1155 | ||
| @@ -1191,8 +1181,8 @@ INLINE bool | |||
| 1191 | /* The cast to union vectorlike_header * avoids aliasing issues. */ | 1181 | /* The cast to union vectorlike_header * avoids aliasing issues. */ |
| 1192 | #define XSETPSEUDOVECTOR(a, b, code) \ | 1182 | #define XSETPSEUDOVECTOR(a, b, code) \ |
| 1193 | XSETTYPED_PSEUDOVECTOR (a, b, \ | 1183 | XSETTYPED_PSEUDOVECTOR (a, b, \ |
| 1194 | (((union vectorlike_header *) \ | 1184 | (XUNTAG (a, Lisp_Vectorlike, \ |
| 1195 | XUNTAG (a, Lisp_Vectorlike)) \ | 1185 | union vectorlike_header) \ |
| 1196 | ->size), \ | 1186 | ->size), \ |
| 1197 | code) | 1187 | code) |
| 1198 | #define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \ | 1188 | #define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \ |
| @@ -1223,7 +1213,7 @@ INLINE bool | |||
| 1223 | INLINE void * | 1213 | INLINE void * |
| 1224 | XINTPTR (Lisp_Object a) | 1214 | XINTPTR (Lisp_Object a) |
| 1225 | { | 1215 | { |
| 1226 | return XUNTAG (a, Lisp_Int0); | 1216 | return XUNTAG (a, Lisp_Int0, char); |
| 1227 | } | 1217 | } |
| 1228 | 1218 | ||
| 1229 | INLINE Lisp_Object | 1219 | INLINE Lisp_Object |
| @@ -1399,7 +1389,7 @@ INLINE struct Lisp_String * | |||
| 1399 | XSTRING (Lisp_Object a) | 1389 | XSTRING (Lisp_Object a) |
| 1400 | { | 1390 | { |
| 1401 | eassert (STRINGP (a)); | 1391 | eassert (STRINGP (a)); |
| 1402 | return XUNTAG (a, Lisp_String); | 1392 | return XUNTAG (a, Lisp_String, struct Lisp_String); |
| 1403 | } | 1393 | } |
| 1404 | 1394 | ||
| 1405 | /* True if STR is a multibyte string. */ | 1395 | /* True if STR is a multibyte string. */ |
| @@ -1524,7 +1514,7 @@ INLINE struct Lisp_Vector * | |||
| 1524 | XVECTOR (Lisp_Object a) | 1514 | XVECTOR (Lisp_Object a) |
| 1525 | { | 1515 | { |
| 1526 | eassert (VECTORLIKEP (a)); | 1516 | eassert (VECTORLIKEP (a)); |
| 1527 | return XUNTAG (a, Lisp_Vectorlike); | 1517 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Vector); |
| 1528 | } | 1518 | } |
| 1529 | 1519 | ||
| 1530 | INLINE ptrdiff_t | 1520 | INLINE ptrdiff_t |
| @@ -1584,8 +1574,9 @@ PSEUDOVECTORP (Lisp_Object a, int code) | |||
| 1584 | else | 1574 | else |
| 1585 | { | 1575 | { |
| 1586 | /* Converting to union vectorlike_header * avoids aliasing issues. */ | 1576 | /* Converting to union vectorlike_header * avoids aliasing issues. */ |
| 1587 | union vectorlike_header *h = XUNTAG (a, Lisp_Vectorlike); | 1577 | return PSEUDOVECTOR_TYPEP (XUNTAG (a, Lisp_Vectorlike, |
| 1588 | return PSEUDOVECTOR_TYPEP (h, code); | 1578 | union vectorlike_header), |
| 1579 | code); | ||
| 1589 | } | 1580 | } |
| 1590 | } | 1581 | } |
| 1591 | 1582 | ||
| @@ -1647,7 +1638,7 @@ INLINE struct Lisp_Bool_Vector * | |||
| 1647 | XBOOL_VECTOR (Lisp_Object a) | 1638 | XBOOL_VECTOR (Lisp_Object a) |
| 1648 | { | 1639 | { |
| 1649 | eassert (BOOL_VECTOR_P (a)); | 1640 | eassert (BOOL_VECTOR_P (a)); |
| 1650 | return XUNTAG (a, Lisp_Vectorlike); | 1641 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Bool_Vector); |
| 1651 | } | 1642 | } |
| 1652 | 1643 | ||
| 1653 | INLINE EMACS_INT | 1644 | INLINE EMACS_INT |
| @@ -1845,7 +1836,7 @@ INLINE struct Lisp_Char_Table * | |||
| 1845 | XCHAR_TABLE (Lisp_Object a) | 1836 | XCHAR_TABLE (Lisp_Object a) |
| 1846 | { | 1837 | { |
| 1847 | eassert (CHAR_TABLE_P (a)); | 1838 | eassert (CHAR_TABLE_P (a)); |
| 1848 | return XUNTAG (a, Lisp_Vectorlike); | 1839 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Char_Table); |
| 1849 | } | 1840 | } |
| 1850 | 1841 | ||
| 1851 | struct Lisp_Sub_Char_Table | 1842 | struct Lisp_Sub_Char_Table |
| @@ -1879,7 +1870,7 @@ INLINE struct Lisp_Sub_Char_Table * | |||
| 1879 | XSUB_CHAR_TABLE (Lisp_Object a) | 1870 | XSUB_CHAR_TABLE (Lisp_Object a) |
| 1880 | { | 1871 | { |
| 1881 | eassert (SUB_CHAR_TABLE_P (a)); | 1872 | eassert (SUB_CHAR_TABLE_P (a)); |
| 1882 | return XUNTAG (a, Lisp_Vectorlike); | 1873 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Sub_Char_Table); |
| 1883 | } | 1874 | } |
| 1884 | 1875 | ||
| 1885 | INLINE Lisp_Object | 1876 | INLINE Lisp_Object |
| @@ -1957,7 +1948,7 @@ INLINE struct Lisp_Subr * | |||
| 1957 | XSUBR (Lisp_Object a) | 1948 | XSUBR (Lisp_Object a) |
| 1958 | { | 1949 | { |
| 1959 | eassert (SUBRP (a)); | 1950 | eassert (SUBRP (a)); |
| 1960 | return XUNTAG (a, Lisp_Vectorlike); | 1951 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Subr); |
| 1961 | } | 1952 | } |
| 1962 | 1953 | ||
| 1963 | enum char_table_specials | 1954 | enum char_table_specials |
| @@ -2210,7 +2201,7 @@ INLINE struct Lisp_Hash_Table * | |||
| 2210 | XHASH_TABLE (Lisp_Object a) | 2201 | XHASH_TABLE (Lisp_Object a) |
| 2211 | { | 2202 | { |
| 2212 | eassert (HASH_TABLE_P (a)); | 2203 | eassert (HASH_TABLE_P (a)); |
| 2213 | return XUNTAG (a, Lisp_Vectorlike); | 2204 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Hash_Table); |
| 2214 | } | 2205 | } |
| 2215 | 2206 | ||
| 2216 | #define XSET_HASH_TABLE(VAR, PTR) \ | 2207 | #define XSET_HASH_TABLE(VAR, PTR) \ |
| @@ -2294,7 +2285,7 @@ INLINE struct Lisp_Misc_Any * | |||
| 2294 | XMISCANY (Lisp_Object a) | 2285 | XMISCANY (Lisp_Object a) |
| 2295 | { | 2286 | { |
| 2296 | eassert (MISCP (a)); | 2287 | eassert (MISCP (a)); |
| 2297 | return XUNTAG (a, Lisp_Misc); | 2288 | return XUNTAG (a, Lisp_Misc, struct Lisp_Misc_Any); |
| 2298 | } | 2289 | } |
| 2299 | 2290 | ||
| 2300 | INLINE enum Lisp_Misc_Type | 2291 | INLINE enum Lisp_Misc_Type |
| @@ -2470,7 +2461,7 @@ INLINE struct Lisp_Save_Value * | |||
| 2470 | XSAVE_VALUE (Lisp_Object a) | 2461 | XSAVE_VALUE (Lisp_Object a) |
| 2471 | { | 2462 | { |
| 2472 | eassert (SAVE_VALUEP (a)); | 2463 | eassert (SAVE_VALUEP (a)); |
| 2473 | return XUNTAG (a, Lisp_Misc); | 2464 | return XUNTAG (a, Lisp_Misc, struct Lisp_Save_Value); |
| 2474 | } | 2465 | } |
| 2475 | 2466 | ||
| 2476 | /* Return the type of V's Nth saved value. */ | 2467 | /* Return the type of V's Nth saved value. */ |
| @@ -2563,7 +2554,7 @@ INLINE struct Lisp_Finalizer * | |||
| 2563 | XFINALIZER (Lisp_Object a) | 2554 | XFINALIZER (Lisp_Object a) |
| 2564 | { | 2555 | { |
| 2565 | eassert (FINALIZERP (a)); | 2556 | eassert (FINALIZERP (a)); |
| 2566 | return XUNTAG (a, Lisp_Misc); | 2557 | return XUNTAG (a, Lisp_Misc, struct Lisp_Finalizer); |
| 2567 | } | 2558 | } |
| 2568 | 2559 | ||
| 2569 | /* A miscellaneous object, when it's on the free list. */ | 2560 | /* A miscellaneous object, when it's on the free list. */ |
| @@ -2594,7 +2585,7 @@ union Lisp_Misc | |||
| 2594 | INLINE union Lisp_Misc * | 2585 | INLINE union Lisp_Misc * |
| 2595 | XMISC (Lisp_Object a) | 2586 | XMISC (Lisp_Object a) |
| 2596 | { | 2587 | { |
| 2597 | return XUNTAG (a, Lisp_Misc); | 2588 | return XUNTAG (a, Lisp_Misc, union Lisp_Misc); |
| 2598 | } | 2589 | } |
| 2599 | 2590 | ||
| 2600 | INLINE bool | 2591 | INLINE bool |
| @@ -2607,7 +2598,7 @@ INLINE struct Lisp_Marker * | |||
| 2607 | XMARKER (Lisp_Object a) | 2598 | XMARKER (Lisp_Object a) |
| 2608 | { | 2599 | { |
| 2609 | eassert (MARKERP (a)); | 2600 | eassert (MARKERP (a)); |
| 2610 | return XUNTAG (a, Lisp_Misc); | 2601 | return XUNTAG (a, Lisp_Misc, struct Lisp_Marker); |
| 2611 | } | 2602 | } |
| 2612 | 2603 | ||
| 2613 | INLINE bool | 2604 | INLINE bool |
| @@ -2620,7 +2611,7 @@ INLINE struct Lisp_Overlay * | |||
| 2620 | XOVERLAY (Lisp_Object a) | 2611 | XOVERLAY (Lisp_Object a) |
| 2621 | { | 2612 | { |
| 2622 | eassert (OVERLAYP (a)); | 2613 | eassert (OVERLAYP (a)); |
| 2623 | return XUNTAG (a, Lisp_Misc); | 2614 | return XUNTAG (a, Lisp_Misc, struct Lisp_Overlay); |
| 2624 | } | 2615 | } |
| 2625 | 2616 | ||
| 2626 | #ifdef HAVE_MODULES | 2617 | #ifdef HAVE_MODULES |
| @@ -2634,7 +2625,7 @@ INLINE struct Lisp_User_Ptr * | |||
| 2634 | XUSER_PTR (Lisp_Object a) | 2625 | XUSER_PTR (Lisp_Object a) |
| 2635 | { | 2626 | { |
| 2636 | eassert (USER_PTRP (a)); | 2627 | eassert (USER_PTRP (a)); |
| 2637 | return XUNTAG (a, Lisp_Misc); | 2628 | return XUNTAG (a, Lisp_Misc, struct Lisp_User_Ptr); |
| 2638 | } | 2629 | } |
| 2639 | #endif | 2630 | #endif |
| 2640 | 2631 | ||
| @@ -2778,7 +2769,7 @@ INLINE struct Lisp_Float * | |||
| 2778 | XFLOAT (Lisp_Object a) | 2769 | XFLOAT (Lisp_Object a) |
| 2779 | { | 2770 | { |
| 2780 | eassert (FLOATP (a)); | 2771 | eassert (FLOATP (a)); |
| 2781 | return XUNTAG (a, Lisp_Float); | 2772 | return XUNTAG (a, Lisp_Float, struct Lisp_Float); |
| 2782 | } | 2773 | } |
| 2783 | 2774 | ||
| 2784 | INLINE double | 2775 | INLINE double |
| @@ -4055,7 +4046,7 @@ INLINE struct Lisp_Module_Function * | |||
| 4055 | XMODULE_FUNCTION (Lisp_Object o) | 4046 | XMODULE_FUNCTION (Lisp_Object o) |
| 4056 | { | 4047 | { |
| 4057 | eassert (MODULE_FUNCTIONP (o)); | 4048 | eassert (MODULE_FUNCTIONP (o)); |
| 4058 | return XUNTAG (o, Lisp_Vectorlike); | 4049 | return XUNTAG (o, Lisp_Vectorlike, struct Lisp_Module_Function); |
| 4059 | } | 4050 | } |
| 4060 | 4051 | ||
| 4061 | #ifdef HAVE_MODULES | 4052 | #ifdef HAVE_MODULES |
diff --git a/src/menu.c b/src/menu.c index 93e793a5d91..e7d4d782fe8 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -1152,7 +1152,7 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu) | |||
| 1152 | else | 1152 | else |
| 1153 | { | 1153 | { |
| 1154 | menuflags |= MENU_FOR_CLICK; | 1154 | menuflags |= MENU_FOR_CLICK; |
| 1155 | tem = Fcar (Fcdr (position)); /* EVENT_START (position) */ | 1155 | tem = Fcar (XCDR (position)); /* EVENT_START (position) */ |
| 1156 | window = Fcar (tem); /* POSN_WINDOW (tem) */ | 1156 | window = Fcar (tem); /* POSN_WINDOW (tem) */ |
| 1157 | tem2 = Fcar (Fcdr (tem)); /* POSN_POSN (tem) */ | 1157 | tem2 = Fcar (Fcdr (tem)); /* POSN_POSN (tem) */ |
| 1158 | /* The MENU_KBD_NAVIGATION field is set when the menu | 1158 | /* The MENU_KBD_NAVIGATION field is set when the menu |
| @@ -1168,7 +1168,7 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu) | |||
| 1168 | event. */ | 1168 | event. */ |
| 1169 | if (!EQ (POSN_POSN (last_nonmenu_event), | 1169 | if (!EQ (POSN_POSN (last_nonmenu_event), |
| 1170 | POSN_POSN (position)) | 1170 | POSN_POSN (position)) |
| 1171 | && CONSP (tem2) && EQ (Fcar (tem2), Qmenu_bar)) | 1171 | && CONSP (tem2) && EQ (XCAR (tem2), Qmenu_bar)) |
| 1172 | menuflags |= MENU_KBD_NAVIGATION; | 1172 | menuflags |= MENU_KBD_NAVIGATION; |
| 1173 | tem = Fcar (Fcdr (Fcdr (tem))); /* POSN_WINDOW_POSN (tem) */ | 1173 | tem = Fcar (Fcdr (Fcdr (tem))); /* POSN_WINDOW_POSN (tem) */ |
| 1174 | x = Fcar (tem); | 1174 | x = Fcar (tem); |
diff --git a/src/process.h b/src/process.h index 6464a8cc61a..42cc66ec560 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -220,7 +220,7 @@ INLINE struct Lisp_Process * | |||
| 220 | XPROCESS (Lisp_Object a) | 220 | XPROCESS (Lisp_Object a) |
| 221 | { | 221 | { |
| 222 | eassert (PROCESSP (a)); | 222 | eassert (PROCESSP (a)); |
| 223 | return XUNTAG (a, Lisp_Vectorlike); | 223 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Process); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | /* Every field in the preceding structure except for the first two | 226 | /* Every field in the preceding structure except for the first two |
diff --git a/src/termhooks.h b/src/termhooks.h index 1b2c95e8248..d8c5edc948e 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -669,7 +669,7 @@ INLINE struct terminal * | |||
| 669 | XTERMINAL (Lisp_Object a) | 669 | XTERMINAL (Lisp_Object a) |
| 670 | { | 670 | { |
| 671 | eassert (TERMINALP (a)); | 671 | eassert (TERMINALP (a)); |
| 672 | return XUNTAG (a, Lisp_Vectorlike); | 672 | return XUNTAG (a, Lisp_Vectorlike, struct terminal); |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | /* Most code should use these functions to set Lisp fields in struct | 675 | /* Most code should use these functions to set Lisp fields in struct |
diff --git a/src/thread.h b/src/thread.h index 5ab5e90c70d..2c8914e1b28 100644 --- a/src/thread.h +++ b/src/thread.h | |||
| @@ -208,7 +208,7 @@ INLINE struct thread_state * | |||
| 208 | XTHREAD (Lisp_Object a) | 208 | XTHREAD (Lisp_Object a) |
| 209 | { | 209 | { |
| 210 | eassert (THREADP (a)); | 210 | eassert (THREADP (a)); |
| 211 | return XUNTAG (a, Lisp_Vectorlike); | 211 | return XUNTAG (a, Lisp_Vectorlike, struct thread_state); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | /* A mutex in lisp is represented by a system condition variable. | 214 | /* A mutex in lisp is represented by a system condition variable. |
| @@ -255,7 +255,7 @@ INLINE struct Lisp_Mutex * | |||
| 255 | XMUTEX (Lisp_Object a) | 255 | XMUTEX (Lisp_Object a) |
| 256 | { | 256 | { |
| 257 | eassert (MUTEXP (a)); | 257 | eassert (MUTEXP (a)); |
| 258 | return XUNTAG (a, Lisp_Vectorlike); | 258 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Mutex); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | /* A condition variable as a lisp object. */ | 261 | /* A condition variable as a lisp object. */ |
| @@ -289,7 +289,7 @@ INLINE struct Lisp_CondVar * | |||
| 289 | XCONDVAR (Lisp_Object a) | 289 | XCONDVAR (Lisp_Object a) |
| 290 | { | 290 | { |
| 291 | eassert (CONDVARP (a)); | 291 | eassert (CONDVARP (a)); |
| 292 | return XUNTAG (a, Lisp_Vectorlike); | 292 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_CondVar); |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | extern struct thread_state *current_thread; | 295 | extern struct thread_state *current_thread; |
diff --git a/src/w32fns.c b/src/w32fns.c index 5d1c3c84c67..2cb715a356d 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -8542,7 +8542,7 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key, | |||
| 8542 | eassert (CONSP (item)); | 8542 | eassert (CONSP (item)); |
| 8543 | /* Pass the tail of the list as a pointer to a Lisp_Cons cell, | 8543 | /* Pass the tail of the list as a pointer to a Lisp_Cons cell, |
| 8544 | so that it works in a --with-wide-int build as well. */ | 8544 | so that it works in a --with-wide-int build as well. */ |
| 8545 | lparam = (LPARAM) XUNTAG (item, Lisp_Cons); | 8545 | lparam = (LPARAM) XUNTAG (item, Lisp_Cons, struct Lisp_Cons); |
| 8546 | 8546 | ||
| 8547 | /* Notify input thread about hot-key definition being removed, so | 8547 | /* Notify input thread about hot-key definition being removed, so |
| 8548 | that it takes effect without needing focus switch. */ | 8548 | that it takes effect without needing focus switch. */ |
diff --git a/src/w32menu.c b/src/w32menu.c index 30ad54db26d..ece5836498f 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -1407,7 +1407,8 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 1407 | Windows alike. MSVC headers get it right; hopefully, | 1407 | Windows alike. MSVC headers get it right; hopefully, |
| 1408 | MinGW headers will, too. */ | 1408 | MinGW headers will, too. */ |
| 1409 | eassert (STRINGP (wv->help)); | 1409 | eassert (STRINGP (wv->help)); |
| 1410 | info.dwItemData = (ULONG_PTR) XUNTAG (wv->help, Lisp_String); | 1410 | info.dwItemData = (ULONG_PTR) XUNTAG (wv->help, Lisp_String, |
| 1411 | struct Lisp_String); | ||
| 1411 | } | 1412 | } |
| 1412 | if (wv->button_type == BUTTON_TYPE_RADIO) | 1413 | if (wv->button_type == BUTTON_TYPE_RADIO) |
| 1413 | { | 1414 | { |
diff --git a/src/window.h b/src/window.h index 91ef7d90272..013083eb9a8 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -418,7 +418,7 @@ INLINE struct window * | |||
| 418 | XWINDOW (Lisp_Object a) | 418 | XWINDOW (Lisp_Object a) |
| 419 | { | 419 | { |
| 420 | eassert (WINDOWP (a)); | 420 | eassert (WINDOWP (a)); |
| 421 | return XUNTAG (a, Lisp_Vectorlike); | 421 | return XUNTAG (a, Lisp_Vectorlike, struct window); |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | /* Most code should use these functions to set Lisp fields in struct | 424 | /* Most code should use these functions to set Lisp fields in struct |
diff --git a/src/xwidget.h b/src/xwidget.h index 93f4cfb7949..89fc7ff4586 100644 --- a/src/xwidget.h +++ b/src/xwidget.h | |||
| @@ -94,7 +94,7 @@ struct xwidget_view | |||
| 94 | /* Test for xwidget pseudovector. */ | 94 | /* Test for xwidget pseudovector. */ |
| 95 | #define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET) | 95 | #define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET) |
| 96 | #define XXWIDGET(a) (eassert (XWIDGETP (a)), \ | 96 | #define XXWIDGET(a) (eassert (XWIDGETP (a)), \ |
| 97 | (struct xwidget *) XUNTAG (a, Lisp_Vectorlike)) | 97 | XUNTAG (a, Lisp_Vectorlike, struct xwidget)) |
| 98 | 98 | ||
| 99 | #define CHECK_XWIDGET(x) \ | 99 | #define CHECK_XWIDGET(x) \ |
| 100 | CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x) | 100 | CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x) |
| @@ -102,7 +102,7 @@ struct xwidget_view | |||
| 102 | /* Test for xwidget_view pseudovector. */ | 102 | /* Test for xwidget_view pseudovector. */ |
| 103 | #define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW) | 103 | #define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW) |
| 104 | #define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P (a)), \ | 104 | #define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P (a)), \ |
| 105 | (struct xwidget_view *) XUNTAG (a, Lisp_Vectorlike)) | 105 | XUNTAG (a, Lisp_Vectorlike, struct xwidget_view)) |
| 106 | 106 | ||
| 107 | #define CHECK_XWIDGET_VIEW(x) \ | 107 | #define CHECK_XWIDGET_VIEW(x) \ |
| 108 | CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x) | 108 | CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x) |