summaryrefslogtreecommitdiff
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-05-18 00:06:12 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-05-18 00:49:29 -0700
commit374f6a5f34a83d3e4c518f0726558642293fdd71 (patch)
tree1b99d7c785c9916322ea03565b846a5056a0d25e /src/xfaces.c
parent6f5db0255cab2e17ab53ee68f6dc2f4d75978d80 (diff)
downloademacs-374f6a5f34a83d3e4c518f0726558642293fdd71.tar.gz
Port --enable-gcc-warnings to GCC 6.1
* configure.ac (WERROR_CFLAGS): Omit -Wunused-const-variable=2. * lib-src/etags.c (LOOKING_AT, LOOKING_AT_NOCASE): Omit test whether pointer plus a constant equals a null pointer. * src/alloc.c (compact_small_strings): Avoid pointer arithmetic on null pointers. * src/alloc.c (mark_face_cache): * src/fontset.c (free_realized_fontsets, Fset_fontset_font): * src/fringe.c (draw_fringe_bitmap_1) (Fset_fringe_bitmap_face): * src/macfont.m (macfont_draw): * src/msdos.c (IT_set_face, IT_clear_screen): * src/nsfont.m (nsfont_draw): * src/nsterm.h (FRAME_DEFAULT_FACE): * src/nsterm.m (ns_draw_window_cursor) (ns_draw_vertical_window_border, ns_draw_window_divider) (ns_dumpglyphs_box_or_relief) (ns_maybe_dumpglyphs_background, ns_dumpglyphs_image) (ns_dumpglyphs_stretch): * src/w32term.c (w32_draw_vertical_window_border) (w32_draw_window_divider, x_set_mouse_face_gc): * src/xdisp.c (estimate_mode_line_height, init_iterator) (handle_face_prop, handle_single_display_spec, pop_it) (CHAR_COMPOSED_P, get_next_display_element) (next_element_from_display_vector, extend_face_to_end_of_line) (fill_gstring_glyph_string,BUILD_COMPOSITE_GLYPH_STRING): * src/xfaces.c (Finternal_merge_in_global_face, Fface_font) (lookup_named_face): * src/xterm.c (x_draw_vertical_window_border) (x_draw_window_divider, x_set_mouse_face_gc): Prefer FACE_OPT_FROM_ID to FACE_FROM_ID when the result might be null. * src/xterm.c (try_window_id): Redo loop to convince GCC 6.1 that it is null pointer safe. (x_color_cells): Use eassume as necessary to pacify GCC 6.1. * src/dispextern.h (FACE_FROM_ID, IMAGE_FROM_ID): Now returns non-null. (FACE_OPT_FROM_ID, IMAGE_OPT_FROM_ID): New macro, with the old behavior of the non-_OPT macro, to be used when the result might be a null pointer. * src/dispnew.c (buffer_posn_from_coords, marginal_area_string) [HAVE_WINDOW_SYSTEM]: * src/intervals.h (INTERVAL_WRITABLE_P): * src/term.c (turn_off_face): * src/xdisp.c (get_glyph_face_and_encoding, fill_image_glyph_string) (produce_image_glyph, produce_xwidget_glyph): * src/xfaces.c (lookup_named_face): Remove unnecessary test for null pointer. * src/keyboard.c (read_char): Suppress bogus -Wclobbered warning. * src/process.c (would_block): New function. (server_accept_connection, wait_reading_process_output, send_process): Use it. * src/xdisp.c (get_window_cursor_type, note_mouse_highlight): Prefer IMAGE_OPT_FROM_ID to IMAGE_FROM_ID when the result might be null.
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index ac1370003df..c42e55333cf 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3694,7 +3694,7 @@ Default face attributes override any local face attributes. */)
if (EQ (face, Qdefault))
{
struct face_cache *c = FRAME_FACE_CACHE (f);
- struct face *newface, *oldface = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ struct face *newface, *oldface = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
Lisp_Object attrs[LFACE_VECTOR_SIZE];
/* This can be NULL (e.g., in batch mode). */
@@ -3777,7 +3777,7 @@ return the font name used for CHARACTER. */)
{
struct frame *f = decode_live_frame (frame);
int face_id = lookup_named_face (f, face, true);
- struct face *fface = FACE_FROM_ID (f, face_id);
+ struct face *fface = FACE_OPT_FROM_ID (f, face_id);
if (! fface)
return Qnil;
@@ -4429,15 +4429,13 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, bool signal_p)
{
Lisp_Object attrs[LFACE_VECTOR_SIZE];
Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
- struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ struct face *default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
if (default_face == NULL)
{
if (!realize_basic_faces (f))
return -1;
default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- if (default_face == NULL)
- emacs_abort (); /* realize_basic_faces must have set it up */
}
if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
@@ -4600,9 +4598,6 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id,
Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
struct face *default_face = FACE_FROM_ID (f, face_id);
- if (!default_face)
- emacs_abort ();
-
if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1;
@@ -4706,7 +4701,7 @@ x_supports_face_attributes_p (struct frame *f,
merge_face_vectors (f, attrs, merged_attrs, 0);
face_id = lookup_face (f, merged_attrs);
- face = FACE_FROM_ID (f, face_id);
+ face = FACE_OPT_FROM_ID (f, face_id);
if (! face)
error ("Cannot make face");
@@ -4976,14 +4971,12 @@ face for italic. */)
attrs[i] = Qunspecified;
merge_face_ref (f, attributes, attrs, true, 0);
- def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ def_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
if (def_face == NULL)
{
if (! realize_basic_faces (f))
error ("Cannot realize default face");
def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- if (def_face == NULL)
- emacs_abort (); /* realize_basic_faces must have set it up */
}
/* Dispatch to the appropriate handler. */
@@ -5453,7 +5446,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE])
/* Determine the font to use. Most of the time, the font will be
the same as the font of the default face, so try that first. */
- default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
if (default_face
&& lface_same_font_attributes_p (default_face->lface, attrs))
{
@@ -6093,7 +6086,6 @@ face_at_string_position (struct window *w, Lisp_Object string,
*endptr = -1;
base_face = FACE_FROM_ID (f, base_face_id);
- eassert (base_face);
/* Optimize the default case that there is no face property. */
if (NILP (prop)
@@ -6140,7 +6132,7 @@ merge_faces (struct frame *f, Lisp_Object face_name, int face_id,
Lisp_Object attrs[LFACE_VECTOR_SIZE];
struct face *base_face;
- base_face = FACE_FROM_ID (f, base_face_id);
+ base_face = FACE_OPT_FROM_ID (f, base_face_id);
if (!base_face)
return base_face_id;
@@ -6168,7 +6160,7 @@ merge_faces (struct frame *f, Lisp_Object face_name, int face_id,
struct face *face;
if (face_id < 0)
return base_face_id;
- face = FACE_FROM_ID (f, face_id);
+ face = FACE_OPT_FROM_ID (f, face_id);
if (!face)
return base_face_id;
merge_face_vectors (f, face->lface, attrs, 0);
@@ -6288,7 +6280,7 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */)
{
struct face *face;
CHECK_NUMBER (n);
- face = FACE_FROM_ID (SELECTED_FRAME (), XINT (n));
+ face = FACE_OPT_FROM_ID (SELECTED_FRAME (), XINT (n));
if (face == NULL)
error ("Not a valid face");
dump_realized_face (face);