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.
This commit is contained in:
parent
00f0ad55cd
commit
4645430b92
7 changed files with 32 additions and 10 deletions
|
|
@ -881,7 +881,7 @@ clear_glyph_row (struct glyph_row *row)
|
|||
enum { off = offsetof (struct glyph_row, used) };
|
||||
|
||||
/* Zero everything except pointers in `glyphs'. */
|
||||
memset (row->used, 0, sizeof *row - off);
|
||||
memset ((char *) row + off, 0, sizeof *row - off);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4392,7 +4392,7 @@ hash_clear (struct Lisp_Hash_Table *h)
|
|||
{
|
||||
ptrdiff_t size = HASH_TABLE_SIZE (h);
|
||||
if (!hash_rehash_needed_p (h))
|
||||
memclear (XVECTOR (h->hash)->contents, size * word_size);
|
||||
memclear (xvector_contents (h->hash), size * word_size);
|
||||
for (ptrdiff_t i = 0; i < size; i++)
|
||||
{
|
||||
set_hash_next_slot (h, i, i < size - 1 ? i + 1 : -1);
|
||||
|
|
|
|||
|
|
@ -117,10 +117,11 @@ create_root_interval (Lisp_Object parent)
|
|||
/* Make the interval TARGET have exactly the properties of SOURCE. */
|
||||
|
||||
void
|
||||
copy_properties (register INTERVAL source, register INTERVAL target)
|
||||
copy_properties (INTERVAL source, INTERVAL target)
|
||||
{
|
||||
if (DEFAULT_INTERVAL_P (source) && DEFAULT_INTERVAL_P (target))
|
||||
return;
|
||||
eassume (source && target);
|
||||
|
||||
COPY_INTERVAL_CACHE (source, target);
|
||||
set_interval_plist (target, Fcopy_sequence (source->plist));
|
||||
|
|
|
|||
|
|
@ -8302,7 +8302,7 @@ append_tab_bar_item (void)
|
|||
/* Append entries from tab_bar_item_properties to the end of
|
||||
tab_bar_items_vector. */
|
||||
vcopy (tab_bar_items_vector, ntab_bar_items,
|
||||
XVECTOR (tab_bar_item_properties)->contents, TAB_BAR_ITEM_NSLOTS);
|
||||
xvector_contents (tab_bar_item_properties), TAB_BAR_ITEM_NSLOTS);
|
||||
ntab_bar_items += TAB_BAR_ITEM_NSLOTS;
|
||||
}
|
||||
|
||||
|
|
@ -8779,7 +8779,7 @@ append_tool_bar_item (void)
|
|||
/* Append entries from tool_bar_item_properties to the end of
|
||||
tool_bar_items_vector. */
|
||||
vcopy (tool_bar_items_vector, ntool_bar_items,
|
||||
XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS);
|
||||
xvector_contents (tool_bar_item_properties), TOOL_BAR_ITEM_NSLOTS);
|
||||
ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
|
||||
}
|
||||
|
||||
|
|
|
|||
23
src/lisp.h
23
src/lisp.h
|
|
@ -3350,6 +3350,27 @@ struct frame;
|
|||
#define HAVE_EXT_TOOL_BAR true
|
||||
#endif
|
||||
|
||||
/* Return the address of vector A's element at index I. */
|
||||
|
||||
INLINE Lisp_Object *
|
||||
xvector_contents_addr (Lisp_Object a, ptrdiff_t i)
|
||||
{
|
||||
/* This should return &XVECTOR (a)->contents[i], but that would run
|
||||
afoul of GCC bug 95072. */
|
||||
void *v = XVECTOR (a);
|
||||
char *p = v;
|
||||
void *w = p + header_size + i * word_size;
|
||||
return w;
|
||||
}
|
||||
|
||||
/* Return the address of vector A's elements. */
|
||||
|
||||
INLINE Lisp_Object *
|
||||
xvector_contents (Lisp_Object a)
|
||||
{
|
||||
return xvector_contents_addr (a, 0);
|
||||
}
|
||||
|
||||
/* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */
|
||||
|
||||
INLINE void
|
||||
|
|
@ -3357,7 +3378,7 @@ vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object const *args,
|
|||
ptrdiff_t count)
|
||||
{
|
||||
eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
|
||||
memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args);
|
||||
memcpy (xvector_contents_addr (v, offset), args, count * sizeof *args);
|
||||
}
|
||||
|
||||
/* Functions to modify hash tables. */
|
||||
|
|
|
|||
|
|
@ -1888,7 +1888,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
|
|||
lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
|
||||
|
||||
if (! NILP (lface))
|
||||
memcpy (attrs, XVECTOR (lface)->contents,
|
||||
memcpy (attrs, xvector_contents (lface),
|
||||
LFACE_VECTOR_SIZE * sizeof *attrs);
|
||||
|
||||
return !NILP (lface);
|
||||
|
|
@ -2860,7 +2860,7 @@ The value is TO. */)
|
|||
f = XFRAME (new_frame);
|
||||
}
|
||||
|
||||
vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE);
|
||||
vcopy (copy, 0, xvector_contents (lface), LFACE_VECTOR_SIZE);
|
||||
|
||||
/* Changing a named face means that all realized faces depending on
|
||||
that face are invalid. Since we cannot tell which realized faces
|
||||
|
|
@ -5598,7 +5598,7 @@ realize_default_face (struct frame *f)
|
|||
/* Realize the face; it must be fully-specified now. */
|
||||
eassert (lface_fully_specified_p (XVECTOR (lface)->contents));
|
||||
check_lface (lface);
|
||||
memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
|
||||
memcpy (attrs, xvector_contents (lface), sizeof attrs);
|
||||
struct face *face = realize_face (c, attrs, DEFAULT_FACE_ID);
|
||||
|
||||
#ifndef HAVE_WINDOW_SYSTEM
|
||||
|
|
|
|||
|
|
@ -763,7 +763,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
|
|||
|
||||
/* Save the frame's previous menu bar contents data. */
|
||||
if (previous_menu_items_used)
|
||||
memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
|
||||
memcpy (previous_items, xvector_contents (f->menu_bar_vector),
|
||||
previous_menu_items_used * word_size);
|
||||
|
||||
/* Fill in menu_items with the current menu bar contents.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue