emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115280: Fix minor problems found by static checking


From: Paul Eggert
Subject: [Emacs-diffs] trunk r115280: Fix minor problems found by static checking.
Date: Fri, 29 Nov 2013 05:25:30 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115280
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-11-28 21:25:25 -0800
message:
  Fix minor problems found by static checking.
  
  * buffer.h (struct buffer_text, struct buffer):
  * frame.h (struct frame):
  * window.h (struct window):
  Avoid 'bool foo : 1;', as it's not portable to pre-C99 compilers,
  as described in ../lib/stdbool.in.h.  Use 'unsigned foo : 1;' instead.
  * menu.c (syms_of_menu): Define x-popup-dialog, removing a
  no-longer-valid use of HAVE_MENUS.
  * xdisp.c (propagate_buffer_redisplay): Now static.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/buffer.h                   buffer.h-20091113204419-o5vbwnq5f7feedwu-196
  src/frame.h                    frame.h-20091113204419-o5vbwnq5f7feedwu-229
  src/menu.c                     menu.c-20091113204419-o5vbwnq5f7feedwu-8676
  src/window.h                   window.h-20091113204419-o5vbwnq5f7feedwu-271
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-11-29 01:22:40 +0000
+++ b/src/ChangeLog     2013-11-29 05:25:25 +0000
@@ -1,3 +1,15 @@
+2013-11-29  Paul Eggert  <address@hidden>
+
+       Fix minor problems found by static checking.
+       * buffer.h (struct buffer_text, struct buffer):
+       * frame.h (struct frame):
+       * window.h (struct window):
+       Avoid 'bool foo : 1;', as it's not portable to pre-C99 compilers,
+       as described in ../lib/stdbool.in.h.  Use 'unsigned foo : 1;' instead.
+       * menu.c (syms_of_menu): Define x-popup-dialog, removing a
+       no-longer-valid use of HAVE_MENUS.
+       * xdisp.c (propagate_buffer_redisplay): Now static.
+
 2013-11-29  Stefan Monnier  <address@hidden>
 
        * xmenu.c (Fmenu_or_popup_active_p):

=== modified file 'src/buffer.h'
--- a/src/buffer.h      2013-11-28 22:43:09 +0000
+++ b/src/buffer.h      2013-11-29 05:25:25 +0000
@@ -475,10 +475,10 @@
     /* Usually 0.  Temporarily set to 1 in decode_coding_gap to
        prevent Fgarbage_collect from shrinking the gap and losing
        not-yet-decoded bytes.  */
-    bool inhibit_shrinking : 1;
+    unsigned inhibit_shrinking : 1;
 
     /* True if it needs to be redisplayed.  */
-    bool redisplay : 1;
+    unsigned redisplay : 1;
   };
 
 /* Most code should use this macro to access Lisp fields in struct buffer.  */
@@ -849,10 +849,10 @@
 
   /* Non-zero means don't use redisplay optimizations for
      displaying this buffer.  */
-  bool prevent_redisplay_optimizations_p : 1;
+  unsigned prevent_redisplay_optimizations_p : 1;
 
   /* Non-zero whenever the narrowing is changed in this buffer.  */
-  bool clip_changed : 1;
+  unsigned clip_changed : 1;
 
   /* List of overlays that end at or before the current center,
      in order of end-position.  */

=== modified file 'src/frame.h'
--- a/src/frame.h       2013-11-28 22:43:09 +0000
+++ b/src/frame.h       2013-11-29 05:25:25 +0000
@@ -178,44 +178,44 @@
 
   /* 1 means that glyphs on this frame have been initialized so it can
      be used for output.  */
-  bool glyphs_initialized_p : 1;
+  unsigned glyphs_initialized_p : 1;
 
   /* Set to non-zero in change_frame_size when size of frame changed
      Clear the frame in clear_garbaged_frames if set.  */
-  bool resized_p : 1;
+  unsigned resized_p : 1;
 
   /* Set to non-zero if the default face for the frame has been
      realized.  Reset to zero whenever the default face changes.
      Used to see the difference between a font change and face change.  */
-  bool default_face_done_p : 1;
+  unsigned default_face_done_p : 1;
 
   /* Set to non-zero if this frame has already been hscrolled during
      current redisplay.  */
-  bool already_hscrolled_p : 1;
+  unsigned already_hscrolled_p : 1;
 
   /* Set to non-zero when current redisplay has updated frame.  */
-  bool updated_p : 1;
+  unsigned updated_p : 1;
 
 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
   /* Set to non-zero to minimize tool-bar height even when
      auto-resize-tool-bar is set to grow-only.  */
-  bool minimize_tool_bar_window_p : 1;
+  unsigned minimize_tool_bar_window_p : 1;
 #endif
 
 #if defined (USE_GTK) || defined (HAVE_NS)
   /* Nonzero means using a tool bar that comes from the toolkit.  */
-  bool external_tool_bar : 1;
+  unsigned external_tool_bar : 1;
 #endif
 
   /* Nonzero means that fonts have been loaded since the last glyph
      matrix adjustments.  */
-  bool fonts_changed : 1;
+  unsigned fonts_changed : 1;
 
   /* Nonzero means that cursor type has been changed.  */
-  bool cursor_type_changed : 1;
+  unsigned cursor_type_changed : 1;
 
   /* True if it needs to be redisplayed.  */
-  bool redisplay : 1;
+  unsigned redisplay : 1;
 
   /* Margin at the top of the frame.  Used to display the tool-bar.  */
   int tool_bar_lines;
@@ -330,7 +330,7 @@
 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
     || defined (HAVE_NS) || defined (USE_GTK)
   /* Nonzero means using a menu bar that comes from the X toolkit.  */
-  bool external_menu_bar : 1;
+  unsigned external_menu_bar : 1;
 #endif
 
   /* Next two bitfields are mutually exclusive.  They might both be
@@ -349,43 +349,43 @@
 
   /* Nonzero if the frame is currently iconified.  Do not
      set this directly, use SET_FRAME_ICONIFIED instead.  */
-  bool iconified : 1;
+  unsigned iconified : 1;
 
   /* Nonzero if this frame should be redrawn.  */
-  bool garbaged : 1;
+  unsigned garbaged : 1;
 
   /* 0 means, if this frame has just one window,
      show no modeline for that window.  */
-  bool wants_modeline : 1;
+  unsigned wants_modeline : 1;
 
   /* Non-0 means raise this frame to the top of the heap when selected.  */
-  bool auto_raise : 1;
+  unsigned auto_raise : 1;
 
   /* Non-0 means lower this frame to the bottom of the stack when left.  */
-  bool auto_lower : 1;
+  unsigned auto_lower : 1;
 
   /* True if frame's root window can't be split.  */
-  bool no_split : 1;
+  unsigned no_split : 1;
 
   /* If this is set, then Emacs won't change the frame name to indicate
      the current buffer, etcetera.  If the user explicitly sets the frame
      name, this gets set.  If the user sets the name to Qnil, this is
      cleared.  */
-  bool explicit_name : 1;
+  unsigned explicit_name : 1;
 
   /* Nonzero if size of some window on this frame has changed.  */
-  bool window_sizes_changed : 1;
+  unsigned window_sizes_changed : 1;
 
   /* Nonzero if the mouse has moved on this display device
      since the last time we checked.  */
-  bool mouse_moved : 1;
+  unsigned mouse_moved : 1;
 
   /* Nonzero means that the pointer is invisible.  */
-  bool pointer_invisible : 1;
+  unsigned pointer_invisible : 1;
 
   /* Nonzero means that all windows except mini-window and
      selected window on this frame have frozen window starts.  */
-  bool frozen_window_starts : 1;
+  unsigned frozen_window_starts : 1;
 
   /* Nonzero if we should actually display the scroll bars on this frame.  */
   enum vertical_scroll_bar_type vertical_scroll_bar_type;

=== modified file 'src/menu.c'
--- a/src/menu.c        2013-11-29 01:22:40 +0000
+++ b/src/menu.c        2013-11-29 05:25:25 +0000
@@ -1606,9 +1606,6 @@
   menu_items_inuse = Qnil;
 
   defsubr (&Sx_popup_menu);
-
-#ifdef HAVE_MENUS
   defsubr (&Sx_popup_dialog);
-#endif
   defsubr (&Smenu_bar_menu_at_x_y);
 }

=== modified file 'src/window.h'
--- a/src/window.h      2013-11-28 22:43:09 +0000
+++ b/src/window.h      2013-11-29 05:25:25 +0000
@@ -282,63 +282,63 @@
     int window_end_vpos;
 
     /* Non-zero if this window is a minibuffer window.  */
-    bool mini : 1;
+    unsigned mini : 1;
 
     /* Meaningful only if contents is a window, non-zero if this
        internal window is used in horizontal combination.  */
-    bool horizontal : 1;
+    unsigned horizontal : 1;
 
     /* Non-zero means must regenerate mode line of this window.  */
-    bool update_mode_line : 1;
+    unsigned update_mode_line : 1;
 
     /* Non-nil if the buffer was "modified" when the window
        was last updated.  */
-    bool last_had_star : 1;
+    unsigned last_had_star : 1;
 
     /* Non-zero means current value of `start'
        was the beginning of a line when it was chosen.  */
-    bool start_at_line_beg : 1;
+    unsigned start_at_line_beg : 1;
 
     /* Non-zero means next redisplay must use the value of start
        set up for it in advance.  Set by scrolling commands.  */
-    bool force_start : 1;
+    unsigned force_start : 1;
 
     /* Non-zero means we have explicitly changed the value of start,
        but that the next redisplay is not obliged to use the new value.
        This is used in Fdelete_other_windows to force a call to
        Vwindow_scroll_functions; also by Frecenter with argument.  */
-    bool optional_new_start : 1;
+    unsigned optional_new_start : 1;
 
     /* Non-zero means the cursor is currently displayed.  This can be
        set to zero by functions overpainting the cursor image.  */
-    bool phys_cursor_on_p : 1;
+    unsigned phys_cursor_on_p : 1;
 
     /* 0 means cursor is logically on, 1 means it's off.  Used for
        blinking cursor.  */
-    bool cursor_off_p : 1;
+    unsigned cursor_off_p : 1;
 
     /* Value of cursor_off_p as of the last redisplay.  */
-    bool last_cursor_off_p : 1;
+    unsigned last_cursor_off_p : 1;
 
     /* 1 means desired matrix has been build and window must be
        updated in update_frame.  */
-    bool must_be_updated_p : 1;
+    unsigned must_be_updated_p : 1;
 
     /* Flag indicating that this window is not a real one.
        Currently only used for menu bar windows of frames.  */
-    bool pseudo_window_p : 1;
+    unsigned pseudo_window_p : 1;
 
     /* Non-zero means fringes are drawn outside display margins.
        Otherwise draw them between margin areas and text.  */
-    bool fringes_outside_margins : 1;
+    unsigned fringes_outside_margins : 1;
 
     /* Nonzero if window_end_pos and window_end_vpos are truly valid.
        This is zero if nontrivial redisplay is preempted since in that case
        the frame image that window_end_pos did not get onto the frame.  */
-    bool window_end_valid : 1;
+    unsigned window_end_valid : 1;
 
     /* True if it needs to be redisplayed.  */
-    bool redisplay : 1;
+    unsigned redisplay : 1;
 
     /* Amount by which lines of this window are scrolled in
        y-direction (smooth scrolling).  */
@@ -347,7 +347,7 @@
     /* Z_BYTE - buffer position of the last glyph in the current matrix of W.
        Should be nonnegative, and only valid if window_end_valid is nonzero.  
*/
     ptrdiff_t window_end_bytepos;
-};
+  };
 
 /* Most code should use these functions to set Lisp fields in struct
    window.  */

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-11-29 01:22:40 +0000
+++ b/src/xdisp.c       2013-11-29 05:25:25 +0000
@@ -610,25 +610,29 @@
 /* Functions to mark elements as needing redisplay.  */
 enum { REDISPLAY_SOME = 2};    /* Arbitrary choice.  */
 
-void redisplay_other_windows (void)
+void
+redisplay_other_windows (void)
 {
   if (!windows_or_buffers_changed)
     windows_or_buffers_changed = REDISPLAY_SOME;
 }
 
-void wset_redisplay (struct window *w)
+void
+wset_redisplay (struct window *w)
 {
   redisplay_other_windows ();
   w->redisplay = true;
 }
 
-void fset_redisplay (struct frame *f)
+void
+fset_redisplay (struct frame *f)
 {
   redisplay_other_windows ();
   f->redisplay = true;
 }
 
-void bset_redisplay (struct buffer *b)
+void
+bset_redisplay (struct buffer *b)
 {
   int count = buffer_window_count (b);
   if (count > 0)
@@ -643,7 +647,8 @@
     }
 }
 
-extern void bset_update_mode_line (struct buffer *b)
+void
+bset_update_mode_line (struct buffer *b)
 {
   if (!update_mode_lines)
     update_mode_lines = REDISPLAY_SOME;
@@ -11201,11 +11206,10 @@
 prepare_menu_bars (void)
 {
   bool all_windows = windows_or_buffers_changed || update_mode_lines;
-  bool some_windows
-    = (windows_or_buffers_changed == 0
-       || windows_or_buffers_changed == REDISPLAY_SOME)
-    && (update_mode_lines == 0
-       || update_mode_lines == REDISPLAY_SOME);
+  bool some_windows = ((windows_or_buffers_changed == 0
+                       || windows_or_buffers_changed == REDISPLAY_SOME)
+                      && (update_mode_lines == 0
+                          || update_mode_lines == REDISPLAY_SOME));
   struct gcpro gcpro1, gcpro2;
   Lisp_Object tooltip_frame;
 
@@ -12922,7 +12926,8 @@
     }
 }
 
-void propagate_buffer_redisplay (void)
+static void
+propagate_buffer_redisplay (void)
 { /* Resetting b->text->redisplay is problematic!
      We can't just reset it in the case that some window that displays
      it has not been redisplayed; and such a window can stay


reply via email to

[Prev in Thread] Current Thread [Next in Thread]