summaryrefslogtreecommitdiff
path: root/src/font.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-06-10 10:13:45 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-06-10 10:16:53 -0700
commit0303fab396a818d796c7513457aa341ab703e8f3 (patch)
treecf8471d344ed264e9395f0b1eba183c9d4c0f4bc /src/font.h
parentefa750e68466fb1bab03028701350a745e0504b6 (diff)
downloademacs-0303fab396a818d796c7513457aa341ab703e8f3.tar.gz
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/font.h')
-rw-r--r--src/font.h12
1 files changed, 6 insertions, 6 deletions
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 *
XFONT_SPEC (Lisp_Object p)
{
eassert (FONT_SPEC_P (p));
- return XUNTAG (p, Lisp_Vectorlike);
+ return XUNTAG (p, Lisp_Vectorlike, struct font_spec);
}
INLINE struct font_spec *
GC_XFONT_SPEC (Lisp_Object p)
{
eassert (GC_FONT_SPEC_P (p));
- return XUNTAG (p, Lisp_Vectorlike);
+ return XUNTAG (p, Lisp_Vectorlike, struct font_spec);
}
INLINE struct font_entity *
XFONT_ENTITY (Lisp_Object p)
{
eassert (FONT_ENTITY_P (p));
- return XUNTAG (p, Lisp_Vectorlike);
+ return XUNTAG (p, Lisp_Vectorlike, struct font_entity);
}
INLINE struct font_entity *
GC_XFONT_ENTITY (Lisp_Object p)
{
eassert (GC_FONT_ENTITY_P (p));
- return XUNTAG (p, Lisp_Vectorlike);
+ return XUNTAG (p, Lisp_Vectorlike, struct font_entity);
}
INLINE struct font *
XFONT_OBJECT (Lisp_Object p)
{
eassert (FONT_OBJECT_P (p));
- return XUNTAG (p, Lisp_Vectorlike);
+ return XUNTAG (p, Lisp_Vectorlike, struct font);
}
INLINE struct font *
GC_XFONT_OBJECT (Lisp_Object p)
{
eassert (GC_FONT_OBJECT_P (p));
- return XUNTAG (p, Lisp_Vectorlike);
+ return XUNTAG (p, Lisp_Vectorlike, struct font);
}
#define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT))