From 3a373d7dc22bee795519f619e0504d23fb784cac Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Tue, 14 Jun 2016 15:09:35 -0400 Subject: [PATCH 2/7] Fix "unused variable" compiler warnings * src/frame.h (FRAME_FRINGE_COLS, FRAME_TOTAL_FRINGE_WIDTH) (FRAME_LEFT_FRINGE_WIDTH, FRAME_RIGHT_FRINGE_WIDTH) (FRAME_INTERNAL_BORDER_WIDTH, FRAME_RIGHT_DIVIDER_WIDTH) (FRAME_BOTTOM_DIVIDER_WIDTH): Explicitly discard unused argument. * src/image.c [HAVE_NTGUI] (DefaultDepthOfScreen): Remove unused macro. (x_create_bitmap_from_data): Declare 'frame'. (x_create_bitmap_from_file): Don't declare unused variable dpyinfo. * src/w32fns.c (Fx_show_tip): Declare 'f'. (Fx_file_dialog): Declare 'filter_a' only if not NTGUI_UNICODE. * src/w32term.c (w32_scroll_bar_handle_click): (w32_horizontal_scroll_bar_handle_click): Declare 'f'. * src/w32term.h (FRAME_DISPLAY_INFO): Explicitly discard unused argument. * src/xdisp.c (handle_single_display_spec): Declare 'fringe_bitmap' only if HAVE_WINDOW_SYSTEM. (append_space_for_newline): Declare 'g' only if HAVE_WINDOW_SYSTEM. (Fmove_point_visually): Declare and set 'target_is_eol_p' only if HAVE_WINDOW_SYSTEM. (show_mouse_face): Declare and set 'f' and 'phys_cursor_p' only if HAVE_WINDOW_SYSTEM. (note_mode_line_or_margin_highlight): Declare and set 'cursor' only if HAVE_WINDOW_SYSTEM. (note_mouse_highlight): Declare and set 'cursor' and 'pointer' only if HAVE_WINDOW_SYSTEM. * src/xfaces.c (realize_default_face): Declare and set 'face' only if HAVE_X_WINDOWS. * src/frame.c (Ficonify_frame, Fset_frame_position): Declare and set 'f' only if HAVE_WINDOW_SYSTEM. * src/font.c (font_open_entity): Declare and set 'min_width' only if HAVE_WINDOW_SYSTEM. * src/dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P) (FACE_FOR_CHAR): Explicitly discard unused arguments. * src/composite.c (autocmp_chars): Declare and set 'f' only if HAVE_WINDOW_SYSTEM. --- src/composite.c | 2 ++ src/dispextern.h | 7 +++++-- src/font.c | 7 ++++++- src/frame.c | 6 ++---- src/frame.h | 14 +++++++------- src/image.c | 6 +++--- src/w32fns.c | 4 +++- src/w32term.c | 2 ++ src/w32term.h | 2 +- src/xdisp.c | 34 +++++++++++++++++++++++++++------- src/xfaces.c | 6 ++++-- 11 files changed, 62 insertions(+), 28 deletions(-) diff --git a/src/composite.c b/src/composite.c index bef1c5f..4f9758b 100644 --- a/src/composite.c +++ b/src/composite.c @@ -867,7 +867,9 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, Lisp_Object string) { ptrdiff_t count = SPECPDL_INDEX (); +#ifdef HAVE_WINDOW_SYSTEM struct frame *f = XFRAME (win->frame); +#endif Lisp_Object pos = make_number (charpos); ptrdiff_t to; ptrdiff_t pt = PT, pt_byte = PT_BYTE; diff --git a/src/dispextern.h b/src/dispextern.h index e83b7c7..987d7f8 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1843,8 +1843,11 @@ struct face_cache #else /* not HAVE_WINDOW_SYSTEM */ -#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) true -#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) ((FACE)->id) +#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) \ + ((void) (FACE), (void) (CHAR), true) +#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \ + ((void) (F), (void) (FACE), (void) (CHAR), (void) (POS), \ + (void) (OBJECT), (FACE)->id) #endif /* not HAVE_WINDOW_SYSTEM */ diff --git a/src/font.c b/src/font.c index f289891..cedb400 100644 --- a/src/font.c +++ b/src/font.c @@ -2863,7 +2863,10 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size) struct font_driver_list *driver_list; Lisp_Object objlist, size, val, font_object; struct font *font; - int min_width, height, psize; + int height, psize; +#ifdef HAVE_WINDOW_SYSTEM + int min_width; +#endif eassert (FONT_ENTITY_P (entity)); size = AREF (entity, FONT_SIZE_INDEX); @@ -2907,10 +2910,12 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size) Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); font = XFONT_OBJECT (font_object); +#ifdef HAVE_WINDOW_SYSTEM min_width = (font->min_width ? font->min_width : font->average_width ? font->average_width : font->space_width ? font->space_width : 1); +#endif int font_ascent, font_descent; get_font_ascent_descent (font, &font_ascent, &font_descent); diff --git a/src/frame.c b/src/frame.c index 653d660..3fcdd58 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2143,13 +2143,12 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, If omitted, FRAME defaults to the currently selected frame. */) (Lisp_Object frame) { - struct frame *f = decode_live_frame (frame); - /* Don't allow minibuf_window to remain on an iconified frame. */ check_minibuf_window (frame, EQ (minibuf_window, selected_window)); /* I think this should be done with a hook. */ #ifdef HAVE_WINDOW_SYSTEM + struct frame *f = decode_live_frame (frame); if (FRAME_WINDOW_P (f)) x_iconify_frame (f); #endif @@ -3015,13 +3014,12 @@ or bottom edge of the outer frame of FRAME relative to the right or bottom edge of FRAME's display. */) (Lisp_Object frame, Lisp_Object x, Lisp_Object y) { - register struct frame *f = decode_live_frame (frame); - CHECK_TYPE_RANGED_INTEGER (int, x); CHECK_TYPE_RANGED_INTEGER (int, y); /* I think this should be done with a hook. */ #ifdef HAVE_WINDOW_SYSTEM + register struct frame *f = decode_live_frame (frame); if (FRAME_WINDOW_P (f)) x_set_offset (f, XINT (x), XINT (y), 1); #endif diff --git a/src/frame.h b/src/frame.h index 0189ca1..ea68421 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1183,13 +1183,13 @@ extern Lisp_Object Vframe_list; #else /* not HAVE_WINDOW_SYSTEM */ -#define FRAME_FRINGE_COLS(F) 0 -#define FRAME_TOTAL_FRINGE_WIDTH(F) 0 -#define FRAME_LEFT_FRINGE_WIDTH(F) 0 -#define FRAME_RIGHT_FRINGE_WIDTH(F) 0 -#define FRAME_INTERNAL_BORDER_WIDTH(F) 0 -#define FRAME_RIGHT_DIVIDER_WIDTH(F) 0 -#define FRAME_BOTTOM_DIVIDER_WIDTH(F) 0 +#define FRAME_FRINGE_COLS(F) ((void) (F), 0) +#define FRAME_TOTAL_FRINGE_WIDTH(F) ((void) (F), 0) +#define FRAME_LEFT_FRINGE_WIDTH(F) ((void) (F), 0) +#define FRAME_RIGHT_FRINGE_WIDTH(F) ((void) (F), 0) +#define FRAME_INTERNAL_BORDER_WIDTH(F) ((void) (F), 0) +#define FRAME_RIGHT_DIVIDER_WIDTH(F) ((void) (F), 0) +#define FRAME_BOTTOM_DIVIDER_WIDTH(F) ((void) (F), 0) #endif /* not HAVE_WINDOW_SYSTEM */ diff --git a/src/image.c b/src/image.c index 657852b..88ec2b7 100644 --- a/src/image.c +++ b/src/image.c @@ -80,7 +80,6 @@ typedef struct w32_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 #define x_defined_color w32_defined_color -#define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) #endif /* HAVE_NTGUI */ @@ -223,6 +222,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi #endif /* HAVE_X_WINDOWS */ #ifdef HAVE_NTGUI + Lisp_Object frame UNINIT; Pixmap bitmap; bitmap = CreateBitmap (width, height, FRAME_DISPLAY_INFO (XFRAME (frame))->n_planes, @@ -272,9 +272,9 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file) { #ifdef HAVE_NTGUI return -1; /* W32_TODO : bitmap support */ -#endif /* HAVE_NTGUI */ - +#else Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); +#endif #ifdef HAVE_NS ptrdiff_t id; diff --git a/src/w32fns.c b/src/w32fns.c index f2b438c..ff45f53 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6888,7 +6888,7 @@ A tooltip's maximum size is specified by `x-max-tooltip-size'. Text larger than the specified size is clipped. */) (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) { - struct frame *tip_f; + struct frame *f, *tip_f; struct window *w; int root_x, root_y; struct buffer *old_buffer; @@ -7288,7 +7288,9 @@ value of DIR as in previous invocations; this is standard Windows behavior. */) { /* Filter index: 1: All Files, 2: Directories only */ static const wchar_t filter_w[] = L"All Files (*.*)\0*.*\0Directories\0*|*\0"; +#ifndef NTGUI_UNICODE static const char filter_a[] = "All Files (*.*)\0*.*\0Directories\0*|*\0"; +#endif Lisp_Object filename = default_filename; struct frame *f = SELECTED_FRAME (); diff --git a/src/w32term.c b/src/w32term.c index c16c8f4..649e743 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4184,6 +4184,7 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, int dragging = bar->dragging; SCROLLINFO si; int sb_event = LOWORD (msg->msg.wParam); + struct frame *f; si.cbSize = sizeof (si); if (sb_event == SB_THUMBTRACK) @@ -4298,6 +4299,7 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, int dragging = bar->dragging; SCROLLINFO si; int sb_event = LOWORD (msg->msg.wParam); + struct frame *f; si.cbSize = sizeof (si); if (sb_event == SB_THUMBTRACK) diff --git a/src/w32term.h b/src/w32term.h index e134da5..3204770 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -399,7 +399,7 @@ extern struct w32_output w32term_display; #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.w32->baseline_offset) /* This gives the w32_display_info structure for the display F is on. */ -#define FRAME_DISPLAY_INFO(f) (&one_w32_display_info) +#define FRAME_DISPLAY_INFO(f) ((void) (f), (&one_w32_display_info)) /* This is the `Display *' which frame F is on. */ #define FRAME_X_DISPLAY(f) (0) diff --git a/src/xdisp.c b/src/xdisp.c index d589080..9a58238 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5017,7 +5017,9 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, || EQ (XCAR (spec), Qright_fringe)) && CONSP (XCDR (spec))) { +#ifdef HAVE_WINDOW_SYSTEM int fringe_bitmap; +#endif if (it) { @@ -19509,8 +19511,9 @@ append_space_for_newline (struct it *it, bool default_face_p) struct text_pos saved_pos; Lisp_Object saved_object; struct face *face; +#ifdef HAVE_WINDOW_SYSTEM struct glyph *g; - +#endif saved_object = it->object; saved_pos = it->position; @@ -21687,8 +21690,9 @@ Value is the new character position of point. */) int pt_x, target_x, pixel_width, pt_vpos; bool at_eol_p; bool overshoot_expected = false; +#ifdef HAVE_WINDOW_SYSTEM bool target_is_eol_p = false; - +#endif /* Setup the arena. */ SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); @@ -21802,7 +21806,9 @@ Value is the new character position of point. */) { move_it_by_lines (&it, -1); target_x = it.last_visible_x - !FRAME_WINDOW_P (it.f); +#ifdef HAVE_WINDOW_SYSTEM target_is_eol_p = true; +#endif /* Under word-wrap, we don't know the x coordinate of the last character displayed on the previous line, which immediately precedes the wrap point. To find @@ -28594,7 +28600,9 @@ static void show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) { struct window *w = XWINDOW (hlinfo->mouse_face_window); +#ifdef HAVE_WINDOW_SYSTEM struct frame *f = XFRAME (WINDOW_FRAME (w)); +#endif if (/* If window is in the process of being destroyed, don't bother to do anything. */ @@ -28605,7 +28613,10 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) anymore. This can happen when a window is split. */ && hlinfo->mouse_face_end_row < w->current_matrix->nrows) { +#ifdef HAVE_WINDOW_SYSTEM bool phys_cursor_on_p = w->phys_cursor_on_p; +#endif + struct glyph_row *row, *first, *last; first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); @@ -29697,8 +29708,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); #ifdef HAVE_WINDOW_SYSTEM Display_Info *dpyinfo; -#endif Cursor cursor = No_Cursor; +#endif Lisp_Object pointer = Qnil; int dx, dy, width, height; ptrdiff_t charpos; @@ -29950,9 +29961,10 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, && hlinfo->mouse_face_beg_row == vpos ) return; +#ifdef HAVE_WINDOW_SYSTEM if (clear_mouse_face (hlinfo)) cursor = No_Cursor; - +#endif if (!row->reversed_p) { hlinfo->mouse_face_beg_col = hpos; @@ -30017,8 +30029,10 @@ note_mouse_highlight (struct frame *f, int x, int y) enum window_part part = ON_NOTHING; Lisp_Object window; struct window *w; +#ifdef HAVE_WINDOW_SYSTEM Cursor cursor = No_Cursor; Lisp_Object pointer = Qnil; /* Takes precedence over cursor! */ +#endif struct buffer *b; /* When a menu is active, don't highlight because this looks odd. */ @@ -30201,9 +30215,9 @@ note_mouse_highlight (struct frame *f, int x, int y) && glyph->type == STRETCH_GLYPH && glyph->avoid_cursor_p)) { +#ifdef HAVE_WINDOW_SYSTEM if (clear_mouse_face (hlinfo)) cursor = No_Cursor; -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f) && NILP (pointer)) { if (area != TEXT_AREA) @@ -30256,9 +30270,10 @@ note_mouse_highlight (struct frame *f, int x, int y) same_region = coords_in_mouse_face_p (w, hpos, vpos); +#ifdef HAVE_WINDOW_SYSTEM if (same_region) cursor = No_Cursor; - +#endif /* Check mouse-face highlighting. */ if (! same_region /* If there exists an overlay with mouse-face overlapping @@ -30283,10 +30298,11 @@ note_mouse_highlight (struct frame *f, int x, int y) goto check_help_echo; hlinfo->mouse_face_overlay = overlay; +#ifdef HAVE_WINDOW_SYSTEM /* Clear the display of the old active region, if any. */ if (clear_mouse_face (hlinfo)) cursor = No_Cursor; - +#endif /* If no overlay applies, get a text property. */ if (NILP (overlay)) mouse_face = Fget_text_property (position, Qmouse_face, object); @@ -30316,7 +30332,9 @@ note_mouse_highlight (struct frame *f, int x, int y) = face_at_string_position (w, object, pos, 0, &ignore, glyph->face_id, true); show_mouse_face (hlinfo, DRAW_MOUSE_FACE); +#ifdef HAVE_WINDOW_SYSTEM cursor = No_Cursor; +#endif } else { @@ -30400,7 +30418,9 @@ note_mouse_highlight (struct frame *f, int x, int y) : XFASTINT (after), before_string, after_string, disp_string); +#ifdef HAVE_WINDOW_SYSTEM cursor = No_Cursor; +#endif } } } diff --git a/src/xfaces.c b/src/xfaces.c index de73c01..426b9ab 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5195,10 +5195,12 @@ realize_basic_faces (struct frame *f) static bool realize_default_face (struct frame *f) { +#ifdef HAVE_X_WINDOWS struct face_cache *c = FRAME_FACE_CACHE (f); + struct face *face; +#endif Lisp_Object lface; Lisp_Object attrs[LFACE_VECTOR_SIZE]; - struct face *face; /* If the `default' face is not yet known, create it. */ lface = lface_from_face_name (f, Qdefault, false); @@ -5288,10 +5290,10 @@ realize_default_face (struct frame *f) eassert (lface_fully_specified_p (XVECTOR (lface)->contents)); check_lface (lface); memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs); - face = realize_face (c, attrs, DEFAULT_FACE_ID); #ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_X_WINDOWS + face = realize_face (c, attrs, DEFAULT_FACE_ID); if (FRAME_X_P (f) && face->font != FRAME_FONT (f)) { /* This can happen when making a frame on a display that does -- 2.8.3