aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2020-05-11 17:41:16 -0700
committerPaul Eggert2020-05-11 17:54:24 -0700
commit4645430b9287c3f5ae9863d465a5dd4158e313a9 (patch)
tree6c1ca7b2cc52909d0de38ad650569352c511d948 /src/lisp.h
parent00f0ad55cd7cbb71e42de0d52b7607ffb6a3c220 (diff)
downloademacs-4645430b9287c3f5ae9863d465a5dd4158e313a9.tar.gz
emacs-4645430b9287c3f5ae9863d465a5dd4158e313a9.zip
Pacify GCC 10.1.0
Pacify GCC 10.1.0 so that it does not issue false alarms when Emacs is configured with --enable-gcc-warnings. * src/dispnew.c (clear_glyph_row): * src/fns.c (hash_clear): * src/keyboard.c (append_tab_bar_item): * src/lisp.h (vcopy): * src/xfaces.c (get_lface_attributes_no_remap) (Finternal_copy_lisp_face, realize_default_face): * src/xmenu.c (set_frame_menubar): Work around -Warray-bounds false alarm in GCC 10.1.0. * src/intervals.c (copy_properties): Avoid -Wnull-dereference false alarm in GCC 10.1.0. * src/lisp.h (xvector_contents_addr, xvector_contents): New functions, useful for working around GCC bug 95072.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h
index b4ac017dcf5..a55fa32950d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3350,6 +3350,27 @@ struct frame;
3350#define HAVE_EXT_TOOL_BAR true 3350#define HAVE_EXT_TOOL_BAR true
3351#endif 3351#endif
3352 3352
3353/* Return the address of vector A's element at index I. */
3354
3355INLINE Lisp_Object *
3356xvector_contents_addr (Lisp_Object a, ptrdiff_t i)
3357{
3358 /* This should return &XVECTOR (a)->contents[i], but that would run
3359 afoul of GCC bug 95072. */
3360 void *v = XVECTOR (a);
3361 char *p = v;
3362 void *w = p + header_size + i * word_size;
3363 return w;
3364}
3365
3366/* Return the address of vector A's elements. */
3367
3368INLINE Lisp_Object *
3369xvector_contents (Lisp_Object a)
3370{
3371 return xvector_contents_addr (a, 0);
3372}
3373
3353/* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */ 3374/* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */
3354 3375
3355INLINE void 3376INLINE void
@@ -3357,7 +3378,7 @@ vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object const *args,
3357 ptrdiff_t count) 3378 ptrdiff_t count)
3358{ 3379{
3359 eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); 3380 eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
3360 memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); 3381 memcpy (xvector_contents_addr (v, offset), args, count * sizeof *args);
3361} 3382}
3362 3383
3363/* Functions to modify hash tables. */ 3384/* Functions to modify hash tables. */