From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#23771: Eliminating compiler warnings Date: Wed, 22 Jun 2016 03:12:59 +0200 Message-ID: <5769E61B.9020200@cs.ucla.edu> References: <08ec82d8-305e-5a95-7fbb-76162a49f5cc@cornell.edu> <83bn32eclh.fsf@gnu.org> <3f178870-9b99-8104-cb34-1967790436a5@cornell.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050500040108000805070604" X-Trace: ger.gmane.org 1466558077 1519 80.91.229.3 (22 Jun 2016 01:14:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jun 2016 01:14:37 +0000 (UTC) Cc: 23771@debbugs.gnu.org To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 22 03:14:29 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFWkF-0007qt-Mo for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Jun 2016 03:14:20 +0200 Original-Received: from localhost ([::1]:55074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFWkE-0000In-Qj for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Jun 2016 21:14:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFWk2-0000FQ-VD for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 21:14:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFWjy-0004x7-Hb for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 21:14:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFWjy-0004x0-B9 for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 21:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bFWjy-0005Sb-76 for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 21:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2016 01:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23771 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23771-submit@debbugs.gnu.org id=B23771.146655799620925 (code B ref 23771); Wed, 22 Jun 2016 01:14:02 +0000 Original-Received: (at 23771) by debbugs.gnu.org; 22 Jun 2016 01:13:16 +0000 Original-Received: from localhost ([127.0.0.1]:50200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFWjD-0005RQ-4h for submit@debbugs.gnu.org; Tue, 21 Jun 2016 21:13:16 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFWjA-0005RD-MT for 23771@debbugs.gnu.org; Tue, 21 Jun 2016 21:13:14 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B1C4D160F84; Tue, 21 Jun 2016 18:13:06 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 1tRM-SYQjh0s; Tue, 21 Jun 2016 18:13:04 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 443B816140E; Tue, 21 Jun 2016 18:13:04 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6AIDU7vnVjQM; Tue, 21 Jun 2016 18:13:04 -0700 (PDT) Original-Received: from [192.168.1.2] (host144-218-dynamic.32-79-r.retail.telecomitalia.it [79.32.218.144]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 9B9B9160F84; Tue, 21 Jun 2016 18:13:02 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <3f178870-9b99-8104-cb34-1967790436a5@cornell.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119911 Archived-At: This is a multi-part message in MIME format. --------------050500040108000805070604 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Thanks for all the work in improving static checking for Cygwin builds. I just now checked the attached patch into master, which I hope improves on it. I tested it on Fedora (both with and without window systems). I had one problem with the recent changes, in that they suppressed all warnings about jumps over AUTO_STRING calls. That's pretty drastic, as the warnings are typically useful, so the attached patch reverts that. Can you let me know which call needs the warning suppressed in the Cygwin-specific code in the new master? I can suggest something which disables the warning just for that call. --------------050500040108000805070604 Content-Type: text/x-patch; name="0001-Improve-without-x-GCC-pacification.patch" Content-Disposition: attachment; filename="0001-Improve-without-x-GCC-pacification.patch" Content-Transfer-Encoding: quoted-printable >From 984f3658a73a1a970b417a7544c97eae2c236d57 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 22 Jun 2016 03:04:16 +0200 Subject: [PATCH] Improve --without-x GCC pacification MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * src/composite.c (autocmp_chars): * src/conf_post.h (DebPrint) [HAVE_NTGUI && !DebPrint && !EMACSDEBUG]: Use simpler ((void) 0) for no-op expression returning void. * src/dispextern.h [HAVE_WINDOW_SYSTEM]: Include fontset.h, for face_for_char. (FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_FOR_CHAR): Now inline functions instead of macros. This avoids the need for all those casts to void. (FACE_SUITABLE_FOR_ASCII_CHAR_P): Omit 2nd (unused) arg. All uses changed. * src/frame.c (Ficonify_frame, Fset_frame_position): * src/xdisp.c (Fmove_point_visually, show_mouse_face): * src/xdisp.c (note_mode_line_or_margin_highlight) (note_mouse_highlight): Assume HAVE_WINDOW_SYSTEM for simplicity, since the code should now work either way without generating warnings. * src/frame.c (display_available) [HAVE_WINDOW_SYSTEM]: New function. (window_system_available) [HAVE_WINDOW_SYSTEM]: Move to frame.h. (decode_window_system_frame): Use check_window_system instead of rolling the code ourself. Return needed only if HAVE_WINDOW_SYSTEM. (decode_window_system_frame, check_window_system): Merge the HAVE_WINDOW_SYSTEM and !HAVE_WINDOW_SYSTEM versions into one. * src/frame.c (Ficonify_frame, Fset_frame_position): * src/xdisp.c (show_mouse_face, define_frame_cursor1) (note_mouse_highlight): Narrow the scope of the HAVE_WINDOW_SYSTEM #ifdef; this is a better way to pacify GCC. * src/xdisp.c (x_set_left_fringe, x_set_right_fringe) (x_set_right_divider_width, x_set_bottom_divider_width): * src/xfns.c (x_set_internal_border_width): Don=E2=80=99t use what are now function calls as lvalues. * src/frame.h (WINDOW_SYSTEM_RETURN): New macro. (decode_window_system_frame, check_window_system): Use it, to avoid the need for duplicate declarations. (window_system_available): Now an inline function. (display_available): New decl. (frame_dimension): New inline function. (FRAME_FRINGE_COLS, FRAME_LEFT_FRINGE_WIDTH) (FRAME_RIGHT_FRINGE_WIDTH, FRAME_TOTAL_FRINGE_WIDTH) (FRAME_INTERNAL_BORDER_WIDTH, FRAME_RIGHT_DIVIDER_WIDTH) (FRAME_BOTTOM_DIVIDER_WIDTH): Use it, to avoid the need for duplicate definitions. Now inline functions instead of macros. * src/gnutls.c (gnutls_log_function2i): Remove. * src/gnutls.h (GNUTLS_LOG2i): Use =E2=80=98message=E2=80=99 directly. This avoids complaints about gnutls_log_function2i being defined and not used on older platforms that do not need to call GNUTLS_LOG2i. * src/image.c (DefaultDepthOfScreen) [0]: Remove unused macro. * src/lisp.h (AUTO_STRING_WITH_LEN): Revert change from =E2=80=98type id = =3D expr=E2=80=99 to =E2=80=98type id; id =3D expr=E2=80=99, as this would su= ppress valid jump-misses-init diagnostics. Let=E2=80=99s find a better way to address the problem. * src/vm-limit.c (__MALLOC_HOOK_VOLATILE): Define only if needed. * src/xdisp.c (handle_single_display_spec): Simplify fringe_bitmap computation. (define_frame_cursor1): Do nothing unless in a window system. All callers changed and simplified. * src/xfaces.c (realize_default_face): Use a simpler way to pacify GCC when a return value is not used on some platforms. --- src/composite.c | 6 ---- src/conf_post.h | 3 +- src/dispextern.h | 40 ++++++++++++----------- src/frame.c | 75 ++++++++++++++++++------------------------- src/frame.h | 96 ++++++++++++++++++++++++++++++++++++++------------= ------ src/gnutls.c | 7 ----- src/gnutls.h | 2 +- src/image.c | 3 -- src/lisp.h | 4 +-- src/vm-limit.c | 6 ++-- src/xdisp.c | 78 +++++++++++---------------------------------- src/xfaces.c | 12 +++---- src/xfns.c | 2 +- 13 files changed, 148 insertions(+), 186 deletions(-) diff --git a/src/composite.c b/src/composite.c index 5696e3e..8aa6974 100644 --- a/src/composite.c +++ b/src/composite.c @@ -867,11 +867,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, = ptrdiff_t bytepos, Lisp_Object string) { ptrdiff_t count =3D SPECPDL_INDEX (); -#ifdef HAVE_WINDOW_SYSTEM struct frame *f =3D XFRAME (win->frame); -#else - (void) XFRAME (win->frame); -#endif Lisp_Object pos =3D make_number (charpos); ptrdiff_t to; ptrdiff_t pt =3D PT, pt_byte =3D PT_BYTE; @@ -895,7 +891,6 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, p= trdiff_t bytepos, if (len <=3D 0) return unbind_to (count, Qnil); to =3D limit =3D charpos + len; -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) { font_object =3D font_range (charpos, bytepos, &to, win, face, stri= ng); @@ -906,7 +901,6 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, p= trdiff_t bytepos, return unbind_to (count, Qnil); } else -#endif /* not HAVE_WINDOW_SYSTEM */ font_object =3D win->frame; lgstring =3D Fcomposition_get_gstring (pos, make_number (to), font_obj= ect, string); diff --git a/src/conf_post.h b/src/conf_post.h index 431b7a9..7aa5bae 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -211,8 +211,7 @@ You lose; /* Emacs for DOS must be compiled with DJGP= P */ extern void _DebPrint (const char *fmt, ...); # define DebPrint(stuff) _DebPrint stuff # else -/* Avoid compiler warnings about empty body of 'if' statement. */ -# define DebPrint(stuff) do {} while (false) +# define DebPrint(stuff) ((void) 0) # endif #endif =20 diff --git a/src/dispextern.h b/src/dispextern.h index 987d7f8..d0fc3b2 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -82,6 +82,7 @@ typedef XImagePtr XImagePtr_or_DC; =20 #ifdef HAVE_WINDOW_SYSTEM # include +# include "fontset.h" #endif =20 #ifndef HAVE_WINDOW_SYSTEM @@ -1825,31 +1826,32 @@ struct face_cache ? FACE_FROM_ID (F, ID) \ : NULL) =20 +/* True if FACE is suitable for displaying ASCII characters. */ +INLINE bool +FACE_SUITABLE_FOR_ASCII_CHAR_P (struct face *face) +{ #ifdef HAVE_WINDOW_SYSTEM - -/* Non-zero if FACE is suitable for displaying character CHAR. */ - -#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) \ - ((FACE) =3D=3D (FACE)->ascii_face) + return face =3D=3D face->ascii_face; +#else + return true; +#endif +} =20 /* Return the id of the realized face on frame F that is like the face - FACE, but is suitable for displaying character CHAR at buffer or + FACE, but is suitable for displaying character CHARACTER at buffer or string position POS. OBJECT is the string object, or nil for buffer. This macro is only meaningful for multibyte character CHAR. */ - -#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \ - face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT)) - -#else /* not HAVE_WINDOW_SYSTEM */ - -#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 */ +INLINE int +FACE_FOR_CHAR (struct frame *f, struct face *face, int character, + ptrdiff_t pos, Lisp_Object object) +{ +#ifdef HAVE_WINDOW_SYSTEM + return face_for_char (f, face, character, pos, object); +#else + return face->id; +#endif +} =20 /* Return true if G contains a valid character code. */ INLINE bool diff --git a/src/frame.c b/src/frame.c index 9048452..aa06a38 100644 --- a/src/frame.c +++ b/src/frame.c @@ -106,39 +106,32 @@ decode_any_frame (register Lisp_Object frame) } =20 #ifdef HAVE_WINDOW_SYSTEM - bool -window_system_available (struct frame *f) +display_available (void) { - return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : x_display_list !=3D= NULL; + return x_display_list !=3D NULL; } +#endif =20 struct frame * decode_window_system_frame (Lisp_Object frame) { struct frame *f =3D decode_live_frame (frame); - - if (!window_system_available (f)) - error ("Window system frame should be used"); + check_window_system (f); +#ifdef HAVE_WINDOW_SYSTEM return f; +#endif } =20 -#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) { - if (!window_system_available (f)) - error (f ? "Window system frame should be used" - : "Window system is not in use or not initialized"); +#ifdef HAVE_WINDOW_SYSTEM + if (window_system_available (f)) + return; +#endif + error (f ? "Window system frame should be used" + : "Window system is not in use or not initialized"); } =20 /* Return the value of frame parameter PROP in frame FRAME. */ @@ -2137,20 +2130,18 @@ 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 =3D decode_live_frame (frame); -#else - (void) decode_live_frame (frame); -#endif =20 /* Don't allow minibuf_window to remain on an iconified frame. */ check_minibuf_window (frame, EQ (minibuf_window, selected_window)); =20 /* I think this should be done with a hook. */ -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) + { +#ifdef HAVE_WINDOW_SYSTEM x_iconify_frame (f); #endif + } =20 /* Make menu bar update for the Buffers and Frames menus. */ windows_or_buffers_changed =3D 17; @@ -3013,20 +3004,18 @@ or bottom edge of the outer frame of FRAME relati= ve 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 =3D decode_live_frame (frame); -#else - (void) decode_live_frame (frame); -#endif + struct frame *f =3D decode_live_frame (frame); =20 CHECK_TYPE_RANGED_INTEGER (int, x); CHECK_TYPE_RANGED_INTEGER (int, y); =20 /* I think this should be done with a hook. */ -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) - x_set_offset (f, XINT (x), XINT (y), 1); + { +#ifdef HAVE_WINDOW_SYSTEM + x_set_offset (f, XINT (x), XINT (y), 1); #endif + } =20 return Qt; } @@ -3755,8 +3744,8 @@ x_set_left_fringe (struct frame *f, Lisp_Object new= _value, Lisp_Object old_value =20 if (new_width !=3D old_width) { - FRAME_LEFT_FRINGE_WIDTH (f) =3D new_width; - FRAME_FRINGE_COLS (f) /* Round up. */ + f->left_fringe_width =3D new_width; + f->fringe_cols /* Round up. */ =3D (new_width + FRAME_RIGHT_FRINGE_WIDTH (f) + unit - 1) / unit; =20 if (FRAME_X_WINDOW (f) !=3D 0) @@ -3779,8 +3768,8 @@ x_set_right_fringe (struct frame *f, Lisp_Object ne= w_value, Lisp_Object old_valu =20 if (new_width !=3D old_width) { - FRAME_RIGHT_FRINGE_WIDTH (f) =3D new_width; - FRAME_FRINGE_COLS (f) /* Round up. */ + f->right_fringe_width =3D new_width; + f->fringe_cols /* Round up. */ =3D (new_width + FRAME_LEFT_FRINGE_WIDTH (f) + unit - 1) / unit; =20 if (FRAME_X_WINDOW (f) !=3D 0) @@ -3809,13 +3798,11 @@ void x_set_right_divider_width (struct frame *f, Lisp_Object arg, Lisp_Object= oldval) { int old =3D FRAME_RIGHT_DIVIDER_WIDTH (f); - CHECK_TYPE_RANGED_INTEGER (int, arg); - FRAME_RIGHT_DIVIDER_WIDTH (f) =3D XINT (arg); - if (FRAME_RIGHT_DIVIDER_WIDTH (f) < 0) - FRAME_RIGHT_DIVIDER_WIDTH (f) =3D 0; - if (FRAME_RIGHT_DIVIDER_WIDTH (f) !=3D old) + int new =3D max (0, XINT (arg)); + if (new !=3D old) { + f->right_divider_width =3D new; adjust_frame_size (f, -1, -1, 4, 0, Qright_divider_width); adjust_frame_glyphs (f); SET_FRAME_GARBAGED (f); @@ -3827,13 +3814,11 @@ void x_set_bottom_divider_width (struct frame *f, Lisp_Object arg, Lisp_Objec= t oldval) { int old =3D FRAME_BOTTOM_DIVIDER_WIDTH (f); - CHECK_TYPE_RANGED_INTEGER (int, arg); - FRAME_BOTTOM_DIVIDER_WIDTH (f) =3D XINT (arg); - if (FRAME_BOTTOM_DIVIDER_WIDTH (f) < 0) - FRAME_BOTTOM_DIVIDER_WIDTH (f) =3D 0; - if (FRAME_BOTTOM_DIVIDER_WIDTH (f) !=3D old) + int new =3D max (0, XINT (arg)); + if (new !=3D old) { + f->bottom_divider_width =3D new; adjust_frame_size (f, -1, -1, 4, 0, Qbottom_divider_width); adjust_frame_glyphs (f); SET_FRAME_GARBAGED (f); diff --git a/src/frame.h b/src/frame.h index 4ee0a74..5e3ee68 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1102,23 +1102,37 @@ extern Lisp_Object selected_frame; extern int frame_default_tool_bar_height; #endif =20 +#ifdef HAVE_WINDOW_SYSTEM +# define WINDOW_SYSTEM_RETURN +#else +# define WINDOW_SYSTEM_RETURN _Noreturn +#endif + +extern WINDOW_SYSTEM_RETURN 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 bool display_available (void); +#endif + +INLINE bool +window_system_available (struct frame *f) +{ +#ifdef HAVE_WINDOW_SYSTEM + return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : display_available= (); +#else + return false; +#endif +} + +extern WINDOW_SYSTEM_RETURN 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); @@ -1152,46 +1166,68 @@ extern Lisp_Object Vframe_list; This value currently equals the average width of the default font of = F. */ #define FRAME_COLUMN_WIDTH(F) ((F)->column_width) =20 -/* Pixel width of areas used to display truncation marks, continuation - marks, overlay arrows. This is 0 for terminal frames. */ +/* Get a frame's window system dimension. If no window system, this is = 0. */ =20 +INLINE int +frame_dimension (int x) +{ #ifdef HAVE_WINDOW_SYSTEM + return x; +#else + return 0; +#endif +} =20 /* Total width of fringes reserved for drawing truncation bitmaps, continuation bitmaps and alike. The width is in canonical char units of the frame. This must currently be the case because window sizes aren't pixel values. If it weren't the case, we wouldn't be able to split windows horizontally nicely. */ -#define FRAME_FRINGE_COLS(F) ((F)->fringe_cols) +INLINE int +FRAME_FRINGE_COLS (struct frame *f) +{ + return frame_dimension (f->fringe_cols); +} =20 /* Pixel-width of the left and right fringe. */ =20 -#define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width) -#define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width) +INLINE int +FRAME_LEFT_FRINGE_WIDTH (struct frame *f) +{ + return frame_dimension (f->left_fringe_width); +} +INLINE int +FRAME_RIGHT_FRINGE_WIDTH (struct frame *f) +{ + return frame_dimension (f->right_fringe_width); +} =20 /* Total width of fringes in pixels. */ =20 -#define FRAME_TOTAL_FRINGE_WIDTH(F) \ - (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F)) +INLINE int +FRAME_TOTAL_FRINGE_WIDTH (struct frame *f) +{ + return FRAME_LEFT_FRINGE_WIDTH (f) + FRAME_RIGHT_FRINGE_WIDTH (f); +} =20 /* Pixel-width of internal border lines */ -#define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width) +INLINE int +FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) +{ + return frame_dimension (f->internal_border_width); +} =20 /* Pixel-size of window border lines */ -#define FRAME_RIGHT_DIVIDER_WIDTH(F) ((F)->right_divider_width) -#define FRAME_BOTTOM_DIVIDER_WIDTH(F) ((F)->bottom_divider_width) - -#else /* not HAVE_WINDOW_SYSTEM */ - -#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 */ +INLINE int +FRAME_RIGHT_DIVIDER_WIDTH (struct frame *f) +{ + return frame_dimension (f->right_divider_width); +} +INLINE int +FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f) +{ + return frame_dimension (f->bottom_divider_width); +} =0C /*********************************************************************** Conversion between canonical units and pixels diff --git a/src/gnutls.c b/src/gnutls.c index 8ee066f..7f05ac4 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -383,13 +383,6 @@ gnutls_log_function2 (int level, const char *string,= const char *extra) message ("gnutls.c: [%d] %s %s", level, string, extra); } =20 -/* Log a message and an integer. */ -static void -gnutls_log_function2i (int level, const char *string, int extra) -{ - message ("gnutls.c: [%d] %s %d", level, string, extra); -} - int gnutls_try_handshake (struct Lisp_Process *proc) { diff --git a/src/gnutls.h b/src/gnutls.h index 47e11f2..41769a4 100644 --- a/src/gnutls.h +++ b/src/gnutls.h @@ -71,7 +71,7 @@ typedef enum #define GNUTLS_LOG2i(level, max, string, extra) \ do { \ if ((level) <=3D (max)) \ - gnutls_log_function2i (level, "(Emacs) " string, extra); \ + message ("gnutls.c: [%d] %s %d", level, string, extra); \ } while (false) =20 extern ptrdiff_t diff --git a/src/image.c b/src/image.c index 0df415c..572557d 100644 --- a/src/image.c +++ b/src/image.c @@ -80,9 +80,6 @@ typedef struct w32_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 =20 #define x_defined_color w32_defined_color -#if 0 /* unused */ -#define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) -#endif =20 #endif /* HAVE_NTGUI */ =20 diff --git a/src/lisp.h b/src/lisp.h index 6a8f829..e0eb52a 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4634,10 +4634,8 @@ enum STR's value is not necessarily copied. The resulting Lisp string should not be modified or made visible to user code. */ =20 -/* Avoid initializing NAME to prevent "jump-misses-init" compiler - warnings. */ #define AUTO_STRING_WITH_LEN(name, str, len) \ - Lisp_Object name; name =3D \ + Lisp_Object name =3D \ (USE_STACK_STRING \ ? (make_lisp_ptr \ ((&(union Aligned_String) \ diff --git a/src/vm-limit.c b/src/vm-limit.c index 7eeca3c..58e7729 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c @@ -54,10 +54,10 @@ char data_start[1] =3D { 1 }; #ifdef HAVE_MALLOC_H # include #endif -#ifndef __MALLOC_HOOK_VOLATILE -# define __MALLOC_HOOK_VOLATILE volatile -#endif #ifndef HAVE_MALLOC_H +# ifndef __MALLOC_HOOK_VOLATILE +# define __MALLOC_HOOK_VOLATILE volatile +# endif extern void *(*__morecore) (ptrdiff_t); extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); #endif diff --git a/src/xdisp.c b/src/xdisp.c index da0e84f..9df73f2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5040,11 +5040,9 @@ handle_single_display_spec (struct it *it, Lisp_Ob= ject spec, Lisp_Object object, return 1; =20 #ifdef HAVE_WINDOW_SYSTEM - int fringe_bitmap; - value =3D XCAR (XCDR (spec)); - if (!SYMBOLP (value) - || !(fringe_bitmap =3D lookup_fringe_bitmap (value))) + int fringe_bitmap =3D SYMBOLP (value) ? lookup_fringe_bitmap (valu= e) : 0; + if (! fringe_bitmap) /* If we return here, POSITION has been advanced across the text with this property. */ { @@ -21691,9 +21689,7 @@ Value is the new character position of point. */= ) int pt_x, target_x, pixel_width, pt_vpos; bool at_eol_p; bool overshoot_expected =3D false; -#ifdef HAVE_WINDOW_SYSTEM bool target_is_eol_p =3D false; -#endif =20 /* Setup the arena. */ SET_TEXT_POS (pt, PT, PT_BYTE); @@ -21808,9 +21804,7 @@ Value is the new character position of point. */= ) { move_it_by_lines (&it, -1); target_x =3D it.last_visible_x - !FRAME_WINDOW_P (it.f); -#ifdef HAVE_WINDOW_SYSTEM target_is_eol_p =3D 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 @@ -21851,7 +21845,6 @@ Value is the new character position of point. */= ) } =20 /* Move to the target X coordinate. */ -#ifdef HAVE_WINDOW_SYSTEM /* On GUI frames, as we don't know the X coordinate of the character to the left of point, moving point to the left requires walking, one grapheme cluster at a time, until we @@ -21908,9 +21901,7 @@ Value is the new character position of point. */= ) new_pos.bytepos =3D CHAR_TO_BYTE (new_pos.charpos); it.current.pos =3D new_pos; } - else -#endif - if (it.current_x !=3D target_x) + else if (it.current_x !=3D target_x) move_it_in_display_line_to (&it, ZV, target_x, MOVE_TO_POS | MOVE_TO_X)= ; =20 /* If we ended up in a display string that covers point, move to @@ -28602,11 +28593,7 @@ static void show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) { struct window *w =3D XWINDOW (hlinfo->mouse_face_window); -#ifdef HAVE_WINDOW_SYSTEM struct frame *f =3D XFRAME (WINDOW_FRAME (w)); -#else - (void) XFRAME (WINDOW_FRAME (w)); -#endif =20 if (/* If window is in the process of being destroyed, don't bother to do anything. */ @@ -28617,9 +28604,7 @@ 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 =3D w->phys_cursor_on_p; -#endif struct glyph_row *row, *first, *last; =20 first =3D MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_ro= w); @@ -28695,12 +28680,12 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum dra= w_glyphs_face draw) } } =20 -#ifdef HAVE_WINDOW_SYSTEM /* When we've written over the cursor, arrange for it to be displayed again. */ if (FRAME_WINDOW_P (f) && phys_cursor_on_p && !w->phys_cursor_on_p) { +#ifdef HAVE_WINDOW_SYSTEM int hpos =3D w->phys_cursor.hpos; =20 /* When the window is hscrolled, cursor hpos can legitimately be @@ -28715,8 +28700,8 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_= glyphs_face draw) display_and_set_cursor (w, true, hpos, w->phys_cursor.vpos, w->phys_cursor.x, w->phys_cursor.y); unblock_input (); - } #endif /* HAVE_WINDOW_SYSTEM */ + } } =20 #ifdef HAVE_WINDOW_SYSTEM @@ -29656,12 +29641,17 @@ Returns the alist element for the first matchin= g AREA in MAP. */) clip_to_bounds (INT_MIN, XINT (x), INT_MAX), clip_to_bounds (INT_MIN, XINT (y), INT_MAX)); } +#endif /* HAVE_WINDOW_SYSTEM */ =20 =20 /* Display frame CURSOR, optionally using shape defined by POINTER. */ static void define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointe= r) { +#ifdef HAVE_WINDOW_SYSTEM + if (!FRAME_WINDOW_P (f)) + return; + /* Do not change cursor shape while dragging mouse. */ if (EQ (do_mouse_tracking, Qdragging)) return; @@ -29678,10 +29668,10 @@ define_frame_cursor1 (struct frame *f, Cursor c= ursor, Lisp_Object pointer) cursor =3D FRAME_X_OUTPUT (f)->horizontal_drag_cursor; else if (EQ (pointer, intern ("nhdrag"))) cursor =3D FRAME_X_OUTPUT (f)->vertical_drag_cursor; -#ifdef HAVE_X_WINDOWS +# ifdef HAVE_X_WINDOWS else if (EQ (pointer, intern ("vdrag"))) cursor =3D FRAME_DISPLAY_INFO (f)->vertical_scroll_bar_cursor; -#endif +# endif else if (EQ (pointer, intern ("hourglass"))) cursor =3D FRAME_X_OUTPUT (f)->hourglass_cursor; else if (EQ (pointer, Qmodeline)) @@ -29692,10 +29682,9 @@ define_frame_cursor1 (struct frame *f, Cursor cu= rsor, Lisp_Object pointer) =20 if (cursor !=3D No_Cursor) FRAME_RIF (f)->define_frame_cursor (f, cursor); +#endif } =20 -#endif /* HAVE_WINDOW_SYSTEM */ - /* Take proper action when mouse has moved to the mode or header line or marginal area AREA of window W, x-position X and y-position Y. X is relative to the start of the text display area of W, so the @@ -29711,9 +29700,9 @@ note_mode_line_or_margin_highlight (Lisp_Object w= indow, int x, int y, Mouse_HLInfo *hlinfo =3D MOUSE_HL_INFO (f); #ifdef HAVE_WINDOW_SYSTEM Display_Info *dpyinfo; +#endif Cursor cursor =3D No_Cursor; Lisp_Object pointer =3D Qnil; -#endif int dx, dy, width, height; ptrdiff_t charpos; Lisp_Object string, object =3D Qnil; @@ -29964,12 +29953,8 @@ note_mode_line_or_margin_highlight (Lisp_Object = window, int x, int y, && hlinfo->mouse_face_beg_row =3D=3D vpos ) return; =20 -#ifdef HAVE_WINDOW_SYSTEM if (clear_mouse_face (hlinfo)) cursor =3D No_Cursor; -#else - (void) clear_mouse_face (hlinfo); -#endif =20 if (!row->reversed_p) { @@ -30003,10 +29988,8 @@ note_mode_line_or_margin_highlight (Lisp_Object = window, int x, int y, show_mouse_face (hlinfo, DRAW_MOUSE_FACE); mouse_face_shown =3D true; =20 -#ifdef HAVE_WINDOW_SYSTEM if (NILP (pointer)) pointer =3D Qhand; -#endif } } =20 @@ -30015,10 +29998,7 @@ note_mode_line_or_margin_highlight (Lisp_Object = window, int x, int y, if ((area =3D=3D ON_MODE_LINE || area =3D=3D ON_HEADER_LINE) && !mouse= _face_shown) clear_mouse_face (hlinfo); =20 -#ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (f)) - define_frame_cursor1 (f, cursor, pointer); -#endif + define_frame_cursor1 (f, cursor, pointer); } =20 =20 @@ -30037,10 +30017,8 @@ note_mouse_highlight (struct frame *f, int x, in= t y) enum window_part part =3D ON_NOTHING; Lisp_Object window; struct window *w; -#ifdef HAVE_WINDOW_SYSTEM Cursor cursor =3D No_Cursor; Lisp_Object pointer =3D Qnil; /* Takes precedence over cursor! */ -#endif struct buffer *b; =20 /* When a menu is active, don't highlight because this looks odd. */ @@ -30223,19 +30201,17 @@ note_mouse_highlight (struct frame *f, int x, i= nt y) && glyph->type =3D=3D 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 =3D No_Cursor; if (FRAME_WINDOW_P (f) && NILP (pointer)) { +#ifdef HAVE_WINDOW_SYSTEM if (area !=3D TEXT_AREA) cursor =3D FRAME_X_OUTPUT (f)->nontext_cursor; else pointer =3D Vvoid_text_area_pointer; +#endif } -#endif /* HAVE_WINDOW_SYSTEM */ goto set_cursor; } =20 @@ -30280,10 +30256,8 @@ note_mouse_highlight (struct frame *f, int x, in= t y) =20 same_region =3D coords_in_mouse_face_p (w, hpos, vpos); =20 -#ifdef HAVE_WINDOW_SYSTEM if (same_region) cursor =3D No_Cursor; -#endif =20 /* Check mouse-face highlighting. */ if (! same_region @@ -30310,12 +30284,8 @@ note_mouse_highlight (struct frame *f, int x, in= t y) hlinfo->mouse_face_overlay =3D overlay; =20 /* Clear the display of the old active region, if any. */ -#ifdef HAVE_WINDOW_SYSTEM if (clear_mouse_face (hlinfo)) cursor =3D No_Cursor; -#else - (void) clear_mouse_face (hlinfo); -#endif =20 /* If no overlay applies, get a text property. */ if (NILP (overlay)) @@ -30346,9 +30316,7 @@ note_mouse_highlight (struct frame *f, int x, int= y) =3D 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 =3D No_Cursor; -#endif } else { @@ -30432,9 +30400,7 @@ note_mouse_highlight (struct frame *f, int x, int= y) : XFASTINT (after), before_string, after_string, disp_string); -#ifdef HAVE_WINDOW_SYSTEM cursor =3D No_Cursor; -#endif } } } @@ -30557,15 +30523,7 @@ note_mouse_highlight (struct frame *f, int x, in= t y) } =20 set_cursor: - -#ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (f)) - define_frame_cursor1 (f, cursor, pointer); -#else - /* This is here to prevent a compiler error, about "label at end of - compound statement". */ - return; -#endif + define_frame_cursor1 (f, cursor, pointer); } =20 =20 diff --git a/src/xfaces.c b/src/xfaces.c index faf28fc..97a5ae0 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5287,11 +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); - -#ifndef HAVE_X_WINDOWS - (void) realize_face (c, attrs, DEFAULT_FACE_ID); -#else /* HAVE_X_WINDOWS */ struct face *face =3D realize_face (c, attrs, DEFAULT_FACE_ID); + +#ifndef HAVE_WINDOW_SYSTEM + (void) face; +#else if (FRAME_X_P (f) && face->font !=3D FRAME_FONT (f)) { /* This can happen when making a frame on a display that does @@ -5305,7 +5305,7 @@ realize_default_face (struct frame *f) font. */ x_set_font (f, LFACE_FONT (lface), Qnil); } -#endif /* HAVE_X_WINDOWS */ +#endif return true; } =20 @@ -6093,7 +6093,7 @@ face_at_string_position (struct window *w, Lisp_Obj= ect string, if we don't have fonts, so we can stop here if not working on a window-system frame. */ || !FRAME_WINDOW_P (f) - || FACE_SUITABLE_FOR_ASCII_CHAR_P (base_face, 0))) + || FACE_SUITABLE_FOR_ASCII_CHAR_P (base_face))) return base_face->id; =20 /* Begin with attributes from the base face. */ diff --git a/src/xfns.c b/src/xfns.c index 35e2a23..1120c33 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1434,7 +1434,7 @@ x_set_internal_border_width (struct frame *f, Lisp_= Object arg, Lisp_Object oldva =20 if (border !=3D FRAME_INTERNAL_BORDER_WIDTH (f)) { - FRAME_INTERNAL_BORDER_WIDTH (f) =3D border; + f->internal_border_width =3D border; =20 #ifdef USE_X_TOOLKIT if (FRAME_X_OUTPUT (f)->edit_widget) --=20 2.5.5 --------------050500040108000805070604--