commit 560c4ab1c32eacc48f62e4176a1e9fb10ac7665b (HEAD, refs/remotes/origin/master) Author: Ken Brown Date: Mon Jun 20 23:05:12 2016 -0400 Fix compiler warnings in Cygwin-w32 build * src/conf_post.h (DebPrint) [!EMACSDEBUG]: Add empty do-while loop to avoid compiler warnings about empty body of 'if' statement. * src/image.c [HAVE_NTGUI] (DefaultDepthOfScreen): Disable unused macro. (x_create_bitmap_from_data): Declare 'frame'. (x_create_bitmap_from_file): Don't declare unused variable 'dpyinfo'. * src/lisp.h (AUTO_STRING_WITH_LEN): Avoid initialization to prevent "jump-misses-init" compiler warnings. * src/w32fns.c (check_w32_winkey_state): Define and use only if WINDOWSNT. (Fx_show_tip): Declare 'f'. (Fx_file_dialog): Declare 'filter_a' only if not NTGUI_UNICODE. (w32_strerror): Use format specifier %d for sprintf argument of type int. (emacs_abort): Cast sprintf argument of type DWORD to unsigned int, and use format specifier %x, for compatibility with Cygwin. (unicode_append_menu) [NTGUI_UNICODE]: * src/w32menu.c [NTGUI_UNICODE] (get_menu_item_info) (set_menu_item_info, unicode_append_menu) (unicode_message_box): * src/menu.c [NTGUI_UNICODE] (unicode_append_menu): Define as functions rather than macros to avoid "address will always evaluate as true" compiler warnings. * src/w32font.c (w32_to_x_charset): Use format specifier %d for sprintf argument of type int. * src/w32term.c (x_draw_glyphless_glyph_string_foreground): Cast sprintf argument of type int to unsigned int to match %X format specifier. (w32_scroll_bar_handle_click): (w32_horizontal_scroll_bar_handle_click): Declare 'f'. * src/w32term.h (FRAME_DISPLAY_INFO): Explicitly discard unused argument. diff --git a/src/conf_post.h b/src/conf_post.h index 4459caf..431b7a9 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -211,7 +211,8 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ extern void _DebPrint (const char *fmt, ...); # define DebPrint(stuff) _DebPrint stuff # else -# define DebPrint(stuff) +/* Avoid compiler warnings about empty body of 'if' statement. */ +# define DebPrint(stuff) do {} while (false) # endif #endif diff --git a/src/image.c b/src/image.c index 657852b..0df415c 100644 --- a/src/image.c +++ b/src/image.c @@ -80,7 +80,9 @@ typedef struct w32_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 #define x_defined_color w32_defined_color +#if 0 /* unused */ #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) +#endif #endif /* HAVE_NTGUI */ @@ -223,6 +225,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; /* The value is not used. */ Pixmap bitmap; bitmap = CreateBitmap (width, height, FRAME_DISPLAY_INFO (XFRAME (frame))->n_planes, @@ -272,9 +275,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/lisp.h b/src/lisp.h index e0eb52a..6a8f829 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4634,8 +4634,10 @@ enum STR's value is not necessarily copied. The resulting Lisp string should not be modified or made visible to user code. */ +/* Avoid initializing NAME to prevent "jump-misses-init" compiler + warnings. */ #define AUTO_STRING_WITH_LEN(name, str, len) \ - Lisp_Object name = \ + Lisp_Object name; name = \ (USE_STACK_STRING \ ? (make_lisp_ptr \ ((&(union Aligned_String) \ diff --git a/src/menu.c b/src/menu.c index e3d943e..90bb19a 100644 --- a/src/menu.c +++ b/src/menu.c @@ -42,11 +42,7 @@ along with GNU Emacs. If not, see . */ #endif /* HAVE_WINDOW_SYSTEM */ #ifdef HAVE_NTGUI -# ifdef NTGUI_UNICODE -# define unicode_append_menu AppendMenuW -# else /* !NTGUI_UNICODE */ extern AppendMenuW_Proc unicode_append_menu; -# endif /* NTGUI_UNICODE */ #endif /* HAVE_NTGUI */ #include "menu.h" diff --git a/src/w32fns.c b/src/w32fns.c index f2b438c..bc9c747 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -186,11 +186,7 @@ MonitorFromWindow_Proc monitor_from_window_fn = NULL; EnumDisplayMonitors_Proc enum_display_monitors_fn = NULL; GetTitleBarInfo_Proc get_title_bar_info_fn = NULL; -#ifdef NTGUI_UNICODE -#define unicode_append_menu AppendMenuW -#else /* !NTGUI_UNICODE */ extern AppendMenuW_Proc unicode_append_menu; -#endif /* NTGUI_UNICODE */ /* Flag to selectively ignore WM_IME_CHAR messages. */ static int ignore_ime_char = 0; @@ -2406,6 +2402,7 @@ hook_w32_key (int hook, int modifier, int vkey) } } +#ifdef WINDOWSNT /* Check the current Win key pressed state. */ int check_w32_winkey_state (int vkey) @@ -2433,6 +2430,7 @@ check_w32_winkey_state (int vkey) } return 0; } +#endif /* WINDOWSNT */ /* Reset the keyboard hook state. Locking the workstation with Win-L leaves the Win key(s) "down" from the hook's point of view - the @@ -2623,8 +2621,10 @@ modifier_set (int vkey) else return (GetKeyState (vkey) & 0x1); } +#ifdef WINDOWSNT if (w32_kbdhook_active && (vkey == VK_LWIN || vkey == VK_RWIN)) return check_w32_winkey_state (vkey); +#endif if (!modifiers_recorded) return (GetKeyState (vkey) & 0x8000); @@ -7043,6 +7043,7 @@ Text larger than the specified size is clipped. */) /* Create a frame for the tooltip, and record it in the global variable tip_frame. */ + struct frame *f; /* The value is unused. */ if (NILP (tip_frame = x_create_tip_frame (FRAME_DISPLAY_INFO (f), parms))) { /* Creating the tip frame failed. */ @@ -7288,7 +7289,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 (); @@ -8962,7 +8965,7 @@ w32_strerror (int error_no) --ret; buf[ret] = '\0'; if (!ret) - sprintf (buf, "w32 error %u", error_no); + sprintf (buf, "w32 error %d", error_no); return buf; } @@ -10331,8 +10334,8 @@ emacs_abort (void) but not on Windows 7. addr2line doesn't mind a missing "0x", but will be confused by an extra one. */ if (except_addr) - sprintf (buf, "\r\nException 0x%lx at this address:\r\n%p\r\n", - except_code, except_addr); + sprintf (buf, "\r\nException 0x%x at this address:\r\n%p\r\n", + (unsigned int) except_code, except_addr); if (stderr_fd >= 0) { if (except_addr) diff --git a/src/w32font.c b/src/w32font.c index b8884a5..4d15cff 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -1747,7 +1747,7 @@ w32_to_x_charset (int fncharset, char *matching) default: /* Encode numerical value of unknown charset. */ - sprintf (buf, "*-#%u", fncharset); + sprintf (buf, "*-#%d", fncharset); return buf; } @@ -1834,7 +1834,7 @@ w32_to_x_charset (int fncharset, char *matching) /* If no match, encode the numeric value. */ if (!best_match) { - sprintf (buf, "*-#%u", fncharset); + sprintf (buf, "*-#%d", fncharset); return buf; } diff --git a/src/w32menu.c b/src/w32menu.c index fecbf33..13296d9 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -77,10 +77,10 @@ typedef int (WINAPI * MessageBoxW_Proc) ( IN UINT type); #ifdef NTGUI_UNICODE -#define get_menu_item_info GetMenuItemInfoA -#define set_menu_item_info SetMenuItemInfoA -#define unicode_append_menu AppendMenuW -#define unicode_message_box MessageBoxW +GetMenuItemInfoA_Proc get_menu_item_info = GetMenuItemInfoA; +SetMenuItemInfoA_Proc set_menu_item_info = SetMenuItemInfoA; +AppendMenuW_Proc unicode_append_menu = AppendMenuW; +MessageBoxW_Proc unicode_message_box = MessageBoxW; #else /* !NTGUI_UNICODE */ GetMenuItemInfoA_Proc get_menu_item_info = NULL; SetMenuItemInfoA_Proc set_menu_item_info = NULL; diff --git a/src/w32term.c b/src/w32term.c index c16c8f4..7ef3407 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1434,7 +1434,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) { sprintf ((char *) buf, "%0*X", glyph->u.glyphless.ch < 0x10000 ? 4 : 6, - glyph->u.glyphless.ch); + (unsigned int) glyph->u.glyphless.ch); str = buf; } @@ -4198,6 +4198,7 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, y = si.nPos; bar->dragging = 0; + struct frame *f; /* Value is not used. */ FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam; switch (sb_event) @@ -4313,6 +4314,7 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, y = si.nMax - si.nPage; bar->dragging = 0; + struct frame *f; /* Value is not used. */ FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam; switch (sb_event) 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) commit d4c1535c6321318e3ba96a482303bfc790a47266 Author: Ken Brown Date: Mon Jun 20 17:54:23 2016 -0400 Fix compiler warnings in no-window-system-build * src/composite.c (autocmp_chars): Declare and set 'f' only if HAVE_WINDOW_SYSTEM. * src/dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P) (FACE_FOR_CHAR): Explicitly discard unused arguments. * src/font.c (font_open_entity): Declare 'min_width' where it is first set, and only if HAVE_WINDOW_SYSTEM. * src/frame.c [!HAVE_WINDOW_SYSTEM] (decode_window_system_frame): Define _Noreturn version to avoid "suggest attribute noreturn" compiler warning. (check_window_system): Declare as _Noreturn. (Ficonify_frame): (Fset_frame_position): Don’t declare and set 'f'. * src/frame.h [!HAVE_WINDOW_SYSTEM] (decode_window_system_frame) (check_window_system): Add _Noreturn prototypes. (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/xdisp.c (handle_single_display_spec): Declare 'fringe_bitmap' only if HAVE_WINDOW_SYSTEM. (append_space_for_newline): Declare 'g' where it is first set. (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_on_p' only if HAVE_WINDOW_SYSTEM. (note_mode_line_or_margin_highlight): (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. Remove redundant #ifdef. diff --git a/src/composite.c b/src/composite.c index bef1c5f..5696e3e 100644 --- a/src/composite.c +++ b/src/composite.c @@ -867,7 +867,11 @@ 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); +#else + (void) 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..144ba07 100644 --- a/src/font.c +++ b/src/font.c @@ -2863,7 +2863,7 @@ 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; eassert (FONT_ENTITY_P (entity)); size = AREF (entity, FONT_SIZE_INDEX); @@ -2907,10 +2907,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); - min_width = (font->min_width ? font->min_width - : font->average_width ? font->average_width - : font->space_width ? font->space_width - : 1); +#ifdef HAVE_WINDOW_SYSTEM + int 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 df97539..9048452 100644 --- a/src/frame.c +++ b/src/frame.c @@ -113,8 +113,6 @@ window_system_available (struct frame *f) return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : x_display_list != NULL; } -#endif /* HAVE_WINDOW_SYSTEM */ - struct frame * decode_window_system_frame (Lisp_Object frame) { @@ -125,6 +123,16 @@ decode_window_system_frame (Lisp_Object frame) return f; } +#else /* not HAVE_WINDOW_SYSTEM */ + +_Noreturn void +decode_window_system_frame (Lisp_Object frame) +{ + error ("Window system is not in use"); +} + +_Noreturn +#endif /* not HAVE_WINDOW_SYSTEM */ void check_window_system (struct frame *f) { @@ -2129,7 +2137,11 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, If omitted, FRAME defaults to the currently selected frame. */) (Lisp_Object frame) { +#ifdef HAVE_WINDOW_SYSTEM struct frame *f = decode_live_frame (frame); +#else + (void) decode_live_frame (frame); +#endif /* Don't allow minibuf_window to remain on an iconified frame. */ check_minibuf_window (frame, EQ (minibuf_window, selected_window)); @@ -3001,7 +3013,11 @@ 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) { +#ifdef HAVE_WINDOW_SYSTEM register struct frame *f = decode_live_frame (frame); +#else + (void) decode_live_frame (frame); +#endif CHECK_TYPE_RANGED_INTEGER (int, x); CHECK_TYPE_RANGED_INTEGER (int, y); diff --git a/src/frame.h b/src/frame.h index 7d64e00..4ee0a74 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1102,21 +1102,23 @@ extern Lisp_Object selected_frame; extern int frame_default_tool_bar_height; #endif -extern struct frame *decode_window_system_frame (Lisp_Object); extern struct frame *decode_live_frame (Lisp_Object); extern struct frame *decode_any_frame (Lisp_Object); extern struct frame *make_initial_frame (void); extern struct frame *make_frame (bool); #ifdef HAVE_WINDOW_SYSTEM +extern void check_window_system (struct frame *); +extern struct frame *decode_window_system_frame (Lisp_Object); extern struct frame *make_minibuffer_frame (void); extern struct frame *make_frame_without_minibuffer (Lisp_Object, struct kboard *, Lisp_Object); extern bool window_system_available (struct frame *); #else /* not HAVE_WINDOW_SYSTEM */ +extern _Noreturn void check_window_system (struct frame *); +extern _Noreturn void decode_window_system_frame (Lisp_Object); #define window_system_available(f) ((void) (f), false) #endif /* HAVE_WINDOW_SYSTEM */ -extern void check_window_system (struct frame *); extern void frame_make_pointer_invisible (struct frame *); extern void frame_make_pointer_visible (struct frame *); extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object); @@ -1181,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/xdisp.c b/src/xdisp.c index d589080..bcb283f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5017,8 +5017,6 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, || EQ (XCAR (spec), Qright_fringe)) && CONSP (XCDR (spec))) { - int fringe_bitmap; - if (it) { if (!FRAME_WINDOW_P (it->f)) @@ -5042,6 +5040,8 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, return 1; #ifdef HAVE_WINDOW_SYSTEM + int fringe_bitmap; + value = XCAR (XCDR (spec)); if (!SYMBOLP (value) || !(fringe_bitmap = lookup_fringe_bitmap (value))) @@ -19509,7 +19509,6 @@ append_space_for_newline (struct it *it, bool default_face_p) struct text_pos saved_pos; Lisp_Object saved_object; struct face *face; - struct glyph *g; saved_object = it->object; saved_pos = it->position; @@ -19545,7 +19544,7 @@ append_space_for_newline (struct it *it, bool default_face_p) /* Make sure this space glyph has the right ascent and descent values, or else cursor at end of line will look funny, and height of empty lines will be incorrect. */ - g = it->glyph_row->glyphs[TEXT_AREA] + n; + struct glyph *g = it->glyph_row->glyphs[TEXT_AREA] + n; struct font *font = face->font ? face->font : FRAME_FONT (it->f); if (n == 0) { @@ -21687,7 +21686,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); @@ -21802,7 +21803,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 +28597,11 @@ 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)); +#else + (void) XFRAME (WINDOW_FRAME (w)); +#endif if (/* If window is in the process of being destroyed, don't bother to do anything. */ @@ -28605,7 +28612,9 @@ 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,9 +29706,9 @@ 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; Lisp_Object pointer = Qnil; +#endif int dx, dy, width, height; ptrdiff_t charpos; Lisp_Object string, object = Qnil; @@ -29950,8 +29959,12 @@ 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; +#else + (void) clear_mouse_face (hlinfo); +#endif if (!row->reversed_p) { @@ -29985,8 +29998,10 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, show_mouse_face (hlinfo, DRAW_MOUSE_FACE); mouse_face_shown = true; +#ifdef HAVE_WINDOW_SYSTEM if (NILP (pointer)) pointer = Qhand; +#endif } } @@ -30017,8 +30032,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 +30218,11 @@ note_mouse_highlight (struct frame *f, int x, int y) && glyph->type == STRETCH_GLYPH && glyph->avoid_cursor_p)) { +#ifndef HAVE_WINDOW_SYSTEM + (void) clear_mouse_face (hlinfo); +#else /* 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) @@ -30211,7 +30230,7 @@ note_mouse_highlight (struct frame *f, int x, int y) else pointer = Vvoid_text_area_pointer; } -#endif +#endif /* HAVE_WINDOW_SYSTEM */ goto set_cursor; } @@ -30256,8 +30275,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 @@ -30284,8 +30305,12 @@ note_mouse_highlight (struct frame *f, int x, int y) hlinfo->mouse_face_overlay = overlay; /* Clear the display of the old active region, if any. */ +#ifdef HAVE_WINDOW_SYSTEM if (clear_mouse_face (hlinfo)) cursor = No_Cursor; +#else + (void) clear_mouse_face (hlinfo); +#endif /* If no overlay applies, get a text property. */ if (NILP (overlay)) @@ -30316,7 +30341,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 +30427,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 ea02ee7..faf28fc 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5198,7 +5198,6 @@ realize_default_face (struct frame *f) struct face_cache *c = FRAME_FACE_CACHE (f); 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 +5287,11 @@ 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 +#ifndef HAVE_X_WINDOWS + (void) realize_face (c, attrs, DEFAULT_FACE_ID); +#else /* HAVE_X_WINDOWS */ + struct face *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 @@ -5306,7 +5306,6 @@ realize_default_face (struct frame *f) x_set_font (f, LFACE_FONT (lface), Qnil); } #endif /* HAVE_X_WINDOWS */ -#endif /* HAVE_WINDOW_SYSTEM */ return true; } commit 9eaec6859df69f0baac57f0801bfbf195ee88dc5 Author: Michael Albinus Date: Mon Jun 20 15:05:52 2016 +0200 ; Simplify in filenotify-tests.el diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 30e7450..0e6e58e 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -1040,26 +1040,25 @@ the file watch." ;; Run the test. (file-notify--test-with-events ;; There could be one or two `changed' events. - (append - (list - (append - '(:random) - ;; Directory monitor and file monitor. - (make-list (/ n 2) 'changed) - (make-list (/ n 2) 'changed) - ;; Just the directory monitor. - (make-list (/ n 2) 'created) - (make-list (/ n 2) 'changed)) - (append - '(:random) - ;; Directory monitor and file monitor. - (make-list (/ n 2) 'changed) - (make-list (/ n 2) 'changed) - (make-list (/ n 2) 'changed) - (make-list (/ n 2) 'changed) - ;; Just the directory monitor. - (make-list (/ n 2) 'created) - (make-list (/ n 2) 'changed)))) + (list + (append + '(:random) + ;; Directory monitor and file monitor. + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + ;; Just the directory monitor. + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed)) + (append + '(:random) + ;; Directory monitor and file monitor. + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + ;; Just the directory monitor. + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed))) (dotimes (i n) (read-event nil nil file-notify--test-read-event-timeout) (if (zerop (mod i 2)) commit f11f6e5486387b43993c114db20a84506e5a6fc1 Author: Michael Albinus Date: Mon Jun 20 14:41:41 2016 +0200 Weaken test conditions in filenotify-tests.el * test/lisp/filenotify-tests.el (file-notify--test-with-events): Fix thinko in test. (file-notify-test02-events, file-notify-test04-file-validity) (file-notify-test07-backup) (file-notify-test08-watched-file-in-watched-dir): Make test conditions more weak. (Bug#23618) diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 518a1eb..30e7450 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -1,4 +1,4 @@ -;;; file-notify-tests.el --- Tests of file notifications -*- lexical-binding: t; -*- +;;; filenotify-tests.el --- Tests of file notifications -*- lexical-binding: t; -*- ;; Copyright (C) 2013-2016 Free Software Foundation, Inc. @@ -385,7 +385,7 @@ delivered." ;; Flush pending events. (file-notify--wait-for-events (file-notify--test-timeout) - (input-pending-p)) + (not (input-pending-p))) (setq file-notify--test-events nil file-notify--test-results nil) ,@body @@ -444,16 +444,9 @@ delivered." ;; cygwin recognizes only `deleted' and `stopped' events. ((eq system-type 'cygwin) '(deleted stopped)) - ;; inotify and kqueue raise just one `changed' event. - ((or (string-equal "inotify" (file-notify--test-library)) - (string-equal "kqueue" (file-notify--test-library))) - '(changed deleted stopped)) - ;; gfilenotify raises one or two `changed' events - ;; randomly, no chance to test. So we accept both cases. - ((string-equal "gfilenotify" (file-notify--test-library)) - '((changed deleted stopped) - (changed changed deleted stopped))) - (t '(changed changed deleted stopped))) + ;; There could be one or two `changed' events. + (t '((changed deleted stopped) + (changed changed deleted stopped)))) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) (read-event nil nil file-notify--test-read-event-timeout) @@ -739,16 +732,9 @@ delivered." ;; cygwin recognizes only `deleted' and `stopped' events. ((eq system-type 'cygwin) '(deleted stopped)) - ;; inotify and kqueue raise just one `changed' event. - ((or (string-equal "inotify" (file-notify--test-library)) - (string-equal "kqueue" (file-notify--test-library))) - '(changed deleted stopped)) - ;; gfilenotify raises one or two `changed' events - ;; randomly, no chance to test. So we accept both cases. - ((string-equal "gfilenotify" (file-notify--test-library)) - '((changed deleted stopped) - (changed changed deleted stopped))) - (t '(changed changed deleted stopped))) + ;; There could be one or two `changed' events. + (t '((changed deleted stopped) + (changed changed deleted stopped)))) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) (read-event nil nil file-notify--test-read-event-timeout) @@ -944,21 +930,9 @@ delivered." '(change) #'file-notify--test-event-handler))) (should (file-notify-valid-p file-notify--test-desc)) (file-notify--test-with-events - (cond - ;; On Cygwin there is one `changed' event in both the - ;; local and remote cases. - ((eq system-type 'cygwin) '(changed)) - ;; For w32notify and in the remote case, there are two - ;; `changed' events. - ((or (string-equal (file-notify--test-library) "w32notify") - (file-remote-p temporary-file-directory)) - '(changed changed)) - ;; gfilenotify raises one or two `changed' events - ;; randomly, no chance to test. So we accept both cases. - ((string-equal "gfilenotify" (file-notify--test-library)) - '((changed) - (changed changed))) - (t '(changed))) + ;; There could be one or two `changed' events. + '((changed) + (changed changed)) ;; There shouldn't be any problem, because the file is kept. (with-temp-buffer (let ((buffer-file-name file-notify--test-tmpfile) @@ -993,7 +967,7 @@ delivered." (should (file-notify-valid-p file-notify--test-desc)) (file-notify--test-with-events (cond - ;; On Cygwin we only get the `changed' event. + ;; On cygwin we only get the `changed' event. ((eq system-type 'cygwin) '(changed)) (t '(renamed created changed))) ;; The file is renamed when creating a backup. It shall @@ -1062,53 +1036,39 @@ the file watch." (should (file-notify-valid-p file-notify--test-desc1)) (should (file-notify-valid-p file-notify--test-desc2)) (should-not (equal file-notify--test-desc1 file-notify--test-desc2)) - ;; gfilenotify raises one or two `changed' events randomly in - ;; the file monitor, no chance to test. - (unless (string-equal "gfilenotify" (file-notify--test-library)) - (let ((n 100) events) - ;; Compute the expected events. - (dotimes (_i (/ n 2)) - (setq events - (append - (append - ;; Directory monitor and file monitor. - (cond - ;; In the remote case, there are two `changed' - ;; events. - ((file-remote-p temporary-file-directory) - '(changed changed changed changed)) - ;; The directory monitor in kqueue does not - ;; raise any `changed' event. Just the file - ;; monitor event is received. - ((string-equal (file-notify--test-library) "kqueue") - '(changed)) - ;; Otherwise, both monitors report the - ;; `changed' event. - (t '(changed changed))) - - ;; Just the directory monitor. - (cond - ;; In kqueue, there is an additional `changed' - ;; event. Why? - ((string-equal (file-notify--test-library) "kqueue") - '(changed created changed)) - (t '(created changed)))) - events))) - ;; gvfs-monitor-dir returns the events in random order. - (when (string-equal "gvfs-monitor-dir" (file-notify--test-library)) - (setq events (cons :random events))) - - ;; Run the test. - (file-notify--test-with-events events - (dotimes (i n) - (read-event nil nil file-notify--test-read-event-timeout) - (if (zerop (mod i 2)) - (write-region - "any text" nil file-notify--test-tmpfile1 t 'no-message) - (let ((temporary-file-directory file-notify--test-tmpfile)) - (write-region - "any text" nil - (file-notify--test-make-temp-name) nil 'no-message))))))) + (let ((n 100)) + ;; Run the test. + (file-notify--test-with-events + ;; There could be one or two `changed' events. + (append + (list + (append + '(:random) + ;; Directory monitor and file monitor. + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + ;; Just the directory monitor. + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed)) + (append + '(:random) + ;; Directory monitor and file monitor. + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + ;; Just the directory monitor. + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed)))) + (dotimes (i n) + (read-event nil nil file-notify--test-read-event-timeout) + (if (zerop (mod i 2)) + (write-region + "any text" nil file-notify--test-tmpfile1 t 'no-message) + (let ((temporary-file-directory file-notify--test-tmpfile)) + (write-region + "any text" nil + (file-notify--test-make-temp-name) nil 'no-message)))))) ;; If we delete the file, the directory monitor shall still be ;; active. We receive the `deleted' event from both the @@ -1218,4 +1178,4 @@ the file watch." ;; * Check, why cygwin recognizes only `deleted' and `stopped' events. (provide 'file-notify-tests) -;;; file-notify-tests.el ends here +;;; filenotify-tests.el ends here