aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-11-28 21:25:25 -0800
committerPaul Eggert2013-11-28 21:25:25 -0800
commit49faeaaf89c820082ba816d089fab5711c9d2b06 (patch)
treed317ea923409fc6948fdc1fd2a7eaaf4d6c08078 /src
parentc8f0efc2e89d9cfc7befa7f20f584f3f0b12f487 (diff)
downloademacs-49faeaaf89c820082ba816d089fab5711c9d2b06.tar.gz
emacs-49faeaaf89c820082ba816d089fab5711c9d2b06.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/buffer.h8
-rw-r--r--src/frame.h44
-rw-r--r--src/menu.c3
-rw-r--r--src/window.h32
-rw-r--r--src/xdisp.c27
6 files changed, 70 insertions, 56 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 134e082a1c9..d117bc2bfba 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12013-11-29 Paul Eggert <eggert@cs.ucla.edu>
2
3 Fix minor problems found by static checking.
4 * buffer.h (struct buffer_text, struct buffer):
5 * frame.h (struct frame):
6 * window.h (struct window):
7 Avoid 'bool foo : 1;', as it's not portable to pre-C99 compilers,
8 as described in ../lib/stdbool.in.h. Use 'unsigned foo : 1;' instead.
9 * menu.c (syms_of_menu): Define x-popup-dialog, removing a
10 no-longer-valid use of HAVE_MENUS.
11 * xdisp.c (propagate_buffer_redisplay): Now static.
12
12013-11-29 Stefan Monnier <monnier@iro.umontreal.ca> 132013-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
2 14
3 * xmenu.c (Fmenu_or_popup_active_p): 15 * xmenu.c (Fmenu_or_popup_active_p):
diff --git a/src/buffer.h b/src/buffer.h
index d26f91b5b06..586090fbe88 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -475,10 +475,10 @@ struct buffer_text
475 /* Usually 0. Temporarily set to 1 in decode_coding_gap to 475 /* Usually 0. Temporarily set to 1 in decode_coding_gap to
476 prevent Fgarbage_collect from shrinking the gap and losing 476 prevent Fgarbage_collect from shrinking the gap and losing
477 not-yet-decoded bytes. */ 477 not-yet-decoded bytes. */
478 bool inhibit_shrinking : 1; 478 unsigned inhibit_shrinking : 1;
479 479
480 /* True if it needs to be redisplayed. */ 480 /* True if it needs to be redisplayed. */
481 bool redisplay : 1; 481 unsigned redisplay : 1;
482 }; 482 };
483 483
484/* Most code should use this macro to access Lisp fields in struct buffer. */ 484/* Most code should use this macro to access Lisp fields in struct buffer. */
@@ -849,10 +849,10 @@ struct buffer
849 849
850 /* Non-zero means don't use redisplay optimizations for 850 /* Non-zero means don't use redisplay optimizations for
851 displaying this buffer. */ 851 displaying this buffer. */
852 bool prevent_redisplay_optimizations_p : 1; 852 unsigned prevent_redisplay_optimizations_p : 1;
853 853
854 /* Non-zero whenever the narrowing is changed in this buffer. */ 854 /* Non-zero whenever the narrowing is changed in this buffer. */
855 bool clip_changed : 1; 855 unsigned clip_changed : 1;
856 856
857 /* List of overlays that end at or before the current center, 857 /* List of overlays that end at or before the current center,
858 in order of end-position. */ 858 in order of end-position. */
diff --git a/src/frame.h b/src/frame.h
index cf42f787fae..657ef489590 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -178,44 +178,44 @@ struct frame
178 178
179 /* 1 means that glyphs on this frame have been initialized so it can 179 /* 1 means that glyphs on this frame have been initialized so it can
180 be used for output. */ 180 be used for output. */
181 bool glyphs_initialized_p : 1; 181 unsigned glyphs_initialized_p : 1;
182 182
183 /* Set to non-zero in change_frame_size when size of frame changed 183 /* Set to non-zero in change_frame_size when size of frame changed
184 Clear the frame in clear_garbaged_frames if set. */ 184 Clear the frame in clear_garbaged_frames if set. */
185 bool resized_p : 1; 185 unsigned resized_p : 1;
186 186
187 /* Set to non-zero if the default face for the frame has been 187 /* Set to non-zero if the default face for the frame has been
188 realized. Reset to zero whenever the default face changes. 188 realized. Reset to zero whenever the default face changes.
189 Used to see the difference between a font change and face change. */ 189 Used to see the difference between a font change and face change. */
190 bool default_face_done_p : 1; 190 unsigned default_face_done_p : 1;
191 191
192 /* Set to non-zero if this frame has already been hscrolled during 192 /* Set to non-zero if this frame has already been hscrolled during
193 current redisplay. */ 193 current redisplay. */
194 bool already_hscrolled_p : 1; 194 unsigned already_hscrolled_p : 1;
195 195
196 /* Set to non-zero when current redisplay has updated frame. */ 196 /* Set to non-zero when current redisplay has updated frame. */
197 bool updated_p : 1; 197 unsigned updated_p : 1;
198 198
199#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS) 199#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
200 /* Set to non-zero to minimize tool-bar height even when 200 /* Set to non-zero to minimize tool-bar height even when
201 auto-resize-tool-bar is set to grow-only. */ 201 auto-resize-tool-bar is set to grow-only. */
202 bool minimize_tool_bar_window_p : 1; 202 unsigned minimize_tool_bar_window_p : 1;
203#endif 203#endif
204 204
205#if defined (USE_GTK) || defined (HAVE_NS) 205#if defined (USE_GTK) || defined (HAVE_NS)
206 /* Nonzero means using a tool bar that comes from the toolkit. */ 206 /* Nonzero means using a tool bar that comes from the toolkit. */
207 bool external_tool_bar : 1; 207 unsigned external_tool_bar : 1;
208#endif 208#endif
209 209
210 /* Nonzero means that fonts have been loaded since the last glyph 210 /* Nonzero means that fonts have been loaded since the last glyph
211 matrix adjustments. */ 211 matrix adjustments. */
212 bool fonts_changed : 1; 212 unsigned fonts_changed : 1;
213 213
214 /* Nonzero means that cursor type has been changed. */ 214 /* Nonzero means that cursor type has been changed. */
215 bool cursor_type_changed : 1; 215 unsigned cursor_type_changed : 1;
216 216
217 /* True if it needs to be redisplayed. */ 217 /* True if it needs to be redisplayed. */
218 bool redisplay : 1; 218 unsigned redisplay : 1;
219 219
220 /* Margin at the top of the frame. Used to display the tool-bar. */ 220 /* Margin at the top of the frame. Used to display the tool-bar. */
221 int tool_bar_lines; 221 int tool_bar_lines;
@@ -330,7 +330,7 @@ struct frame
330#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ 330#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
331 || defined (HAVE_NS) || defined (USE_GTK) 331 || defined (HAVE_NS) || defined (USE_GTK)
332 /* Nonzero means using a menu bar that comes from the X toolkit. */ 332 /* Nonzero means using a menu bar that comes from the X toolkit. */
333 bool external_menu_bar : 1; 333 unsigned external_menu_bar : 1;
334#endif 334#endif
335 335
336 /* Next two bitfields are mutually exclusive. They might both be 336 /* Next two bitfields are mutually exclusive. They might both be
@@ -349,43 +349,43 @@ struct frame
349 349
350 /* Nonzero if the frame is currently iconified. Do not 350 /* Nonzero if the frame is currently iconified. Do not
351 set this directly, use SET_FRAME_ICONIFIED instead. */ 351 set this directly, use SET_FRAME_ICONIFIED instead. */
352 bool iconified : 1; 352 unsigned iconified : 1;
353 353
354 /* Nonzero if this frame should be redrawn. */ 354 /* Nonzero if this frame should be redrawn. */
355 bool garbaged : 1; 355 unsigned garbaged : 1;
356 356
357 /* 0 means, if this frame has just one window, 357 /* 0 means, if this frame has just one window,
358 show no modeline for that window. */ 358 show no modeline for that window. */
359 bool wants_modeline : 1; 359 unsigned wants_modeline : 1;
360 360
361 /* Non-0 means raise this frame to the top of the heap when selected. */ 361 /* Non-0 means raise this frame to the top of the heap when selected. */
362 bool auto_raise : 1; 362 unsigned auto_raise : 1;
363 363
364 /* Non-0 means lower this frame to the bottom of the stack when left. */ 364 /* Non-0 means lower this frame to the bottom of the stack when left. */
365 bool auto_lower : 1; 365 unsigned auto_lower : 1;
366 366
367 /* True if frame's root window can't be split. */ 367 /* True if frame's root window can't be split. */
368 bool no_split : 1; 368 unsigned no_split : 1;
369 369
370 /* If this is set, then Emacs won't change the frame name to indicate 370 /* If this is set, then Emacs won't change the frame name to indicate
371 the current buffer, etcetera. If the user explicitly sets the frame 371 the current buffer, etcetera. If the user explicitly sets the frame
372 name, this gets set. If the user sets the name to Qnil, this is 372 name, this gets set. If the user sets the name to Qnil, this is
373 cleared. */ 373 cleared. */
374 bool explicit_name : 1; 374 unsigned explicit_name : 1;
375 375
376 /* Nonzero if size of some window on this frame has changed. */ 376 /* Nonzero if size of some window on this frame has changed. */
377 bool window_sizes_changed : 1; 377 unsigned window_sizes_changed : 1;
378 378
379 /* Nonzero if the mouse has moved on this display device 379 /* Nonzero if the mouse has moved on this display device
380 since the last time we checked. */ 380 since the last time we checked. */
381 bool mouse_moved : 1; 381 unsigned mouse_moved : 1;
382 382
383 /* Nonzero means that the pointer is invisible. */ 383 /* Nonzero means that the pointer is invisible. */
384 bool pointer_invisible : 1; 384 unsigned pointer_invisible : 1;
385 385
386 /* Nonzero means that all windows except mini-window and 386 /* Nonzero means that all windows except mini-window and
387 selected window on this frame have frozen window starts. */ 387 selected window on this frame have frozen window starts. */
388 bool frozen_window_starts : 1; 388 unsigned frozen_window_starts : 1;
389 389
390 /* Nonzero if we should actually display the scroll bars on this frame. */ 390 /* Nonzero if we should actually display the scroll bars on this frame. */
391 enum vertical_scroll_bar_type vertical_scroll_bar_type; 391 enum vertical_scroll_bar_type vertical_scroll_bar_type;
diff --git a/src/menu.c b/src/menu.c
index 9ef3b88fe86..e33c647d020 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1606,9 +1606,6 @@ syms_of_menu (void)
1606 menu_items_inuse = Qnil; 1606 menu_items_inuse = Qnil;
1607 1607
1608 defsubr (&Sx_popup_menu); 1608 defsubr (&Sx_popup_menu);
1609
1610#ifdef HAVE_MENUS
1611 defsubr (&Sx_popup_dialog); 1609 defsubr (&Sx_popup_dialog);
1612#endif
1613 defsubr (&Smenu_bar_menu_at_x_y); 1610 defsubr (&Smenu_bar_menu_at_x_y);
1614} 1611}
diff --git a/src/window.h b/src/window.h
index a81c1054070..555c386d7bd 100644
--- a/src/window.h
+++ b/src/window.h
@@ -282,63 +282,63 @@ struct window
282 int window_end_vpos; 282 int window_end_vpos;
283 283
284 /* Non-zero if this window is a minibuffer window. */ 284 /* Non-zero if this window is a minibuffer window. */
285 bool mini : 1; 285 unsigned mini : 1;
286 286
287 /* Meaningful only if contents is a window, non-zero if this 287 /* Meaningful only if contents is a window, non-zero if this
288 internal window is used in horizontal combination. */ 288 internal window is used in horizontal combination. */
289 bool horizontal : 1; 289 unsigned horizontal : 1;
290 290
291 /* Non-zero means must regenerate mode line of this window. */ 291 /* Non-zero means must regenerate mode line of this window. */
292 bool update_mode_line : 1; 292 unsigned update_mode_line : 1;
293 293
294 /* Non-nil if the buffer was "modified" when the window 294 /* Non-nil if the buffer was "modified" when the window
295 was last updated. */ 295 was last updated. */
296 bool last_had_star : 1; 296 unsigned last_had_star : 1;
297 297
298 /* Non-zero means current value of `start' 298 /* Non-zero means current value of `start'
299 was the beginning of a line when it was chosen. */ 299 was the beginning of a line when it was chosen. */
300 bool start_at_line_beg : 1; 300 unsigned start_at_line_beg : 1;
301 301
302 /* Non-zero means next redisplay must use the value of start 302 /* Non-zero means next redisplay must use the value of start
303 set up for it in advance. Set by scrolling commands. */ 303 set up for it in advance. Set by scrolling commands. */
304 bool force_start : 1; 304 unsigned force_start : 1;
305 305
306 /* Non-zero means we have explicitly changed the value of start, 306 /* Non-zero means we have explicitly changed the value of start,
307 but that the next redisplay is not obliged to use the new value. 307 but that the next redisplay is not obliged to use the new value.
308 This is used in Fdelete_other_windows to force a call to 308 This is used in Fdelete_other_windows to force a call to
309 Vwindow_scroll_functions; also by Frecenter with argument. */ 309 Vwindow_scroll_functions; also by Frecenter with argument. */
310 bool optional_new_start : 1; 310 unsigned optional_new_start : 1;
311 311
312 /* Non-zero means the cursor is currently displayed. This can be 312 /* Non-zero means the cursor is currently displayed. This can be
313 set to zero by functions overpainting the cursor image. */ 313 set to zero by functions overpainting the cursor image. */
314 bool phys_cursor_on_p : 1; 314 unsigned phys_cursor_on_p : 1;
315 315
316 /* 0 means cursor is logically on, 1 means it's off. Used for 316 /* 0 means cursor is logically on, 1 means it's off. Used for
317 blinking cursor. */ 317 blinking cursor. */
318 bool cursor_off_p : 1; 318 unsigned cursor_off_p : 1;
319 319
320 /* Value of cursor_off_p as of the last redisplay. */ 320 /* Value of cursor_off_p as of the last redisplay. */
321 bool last_cursor_off_p : 1; 321 unsigned last_cursor_off_p : 1;
322 322
323 /* 1 means desired matrix has been build and window must be 323 /* 1 means desired matrix has been build and window must be
324 updated in update_frame. */ 324 updated in update_frame. */
325 bool must_be_updated_p : 1; 325 unsigned must_be_updated_p : 1;
326 326
327 /* Flag indicating that this window is not a real one. 327 /* Flag indicating that this window is not a real one.
328 Currently only used for menu bar windows of frames. */ 328 Currently only used for menu bar windows of frames. */
329 bool pseudo_window_p : 1; 329 unsigned pseudo_window_p : 1;
330 330
331 /* Non-zero means fringes are drawn outside display margins. 331 /* Non-zero means fringes are drawn outside display margins.
332 Otherwise draw them between margin areas and text. */ 332 Otherwise draw them between margin areas and text. */
333 bool fringes_outside_margins : 1; 333 unsigned fringes_outside_margins : 1;
334 334
335 /* Nonzero if window_end_pos and window_end_vpos are truly valid. 335 /* Nonzero if window_end_pos and window_end_vpos are truly valid.
336 This is zero if nontrivial redisplay is preempted since in that case 336 This is zero if nontrivial redisplay is preempted since in that case
337 the frame image that window_end_pos did not get onto the frame. */ 337 the frame image that window_end_pos did not get onto the frame. */
338 bool window_end_valid : 1; 338 unsigned window_end_valid : 1;
339 339
340 /* True if it needs to be redisplayed. */ 340 /* True if it needs to be redisplayed. */
341 bool redisplay : 1; 341 unsigned redisplay : 1;
342 342
343 /* Amount by which lines of this window are scrolled in 343 /* Amount by which lines of this window are scrolled in
344 y-direction (smooth scrolling). */ 344 y-direction (smooth scrolling). */
@@ -347,7 +347,7 @@ struct window
347 /* Z_BYTE - buffer position of the last glyph in the current matrix of W. 347 /* Z_BYTE - buffer position of the last glyph in the current matrix of W.
348 Should be nonnegative, and only valid if window_end_valid is nonzero. */ 348 Should be nonnegative, and only valid if window_end_valid is nonzero. */
349 ptrdiff_t window_end_bytepos; 349 ptrdiff_t window_end_bytepos;
350}; 350 };
351 351
352/* Most code should use these functions to set Lisp fields in struct 352/* Most code should use these functions to set Lisp fields in struct
353 window. */ 353 window. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 16e6341748d..6357f4f5f3b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -610,25 +610,29 @@ bool help_echo_showing_p;
610/* Functions to mark elements as needing redisplay. */ 610/* Functions to mark elements as needing redisplay. */
611enum { REDISPLAY_SOME = 2}; /* Arbitrary choice. */ 611enum { REDISPLAY_SOME = 2}; /* Arbitrary choice. */
612 612
613void redisplay_other_windows (void) 613void
614redisplay_other_windows (void)
614{ 615{
615 if (!windows_or_buffers_changed) 616 if (!windows_or_buffers_changed)
616 windows_or_buffers_changed = REDISPLAY_SOME; 617 windows_or_buffers_changed = REDISPLAY_SOME;
617} 618}
618 619
619void wset_redisplay (struct window *w) 620void
621wset_redisplay (struct window *w)
620{ 622{
621 redisplay_other_windows (); 623 redisplay_other_windows ();
622 w->redisplay = true; 624 w->redisplay = true;
623} 625}
624 626
625void fset_redisplay (struct frame *f) 627void
628fset_redisplay (struct frame *f)
626{ 629{
627 redisplay_other_windows (); 630 redisplay_other_windows ();
628 f->redisplay = true; 631 f->redisplay = true;
629} 632}
630 633
631void bset_redisplay (struct buffer *b) 634void
635bset_redisplay (struct buffer *b)
632{ 636{
633 int count = buffer_window_count (b); 637 int count = buffer_window_count (b);
634 if (count > 0) 638 if (count > 0)
@@ -643,7 +647,8 @@ void bset_redisplay (struct buffer *b)
643 } 647 }
644} 648}
645 649
646extern void bset_update_mode_line (struct buffer *b) 650void
651bset_update_mode_line (struct buffer *b)
647{ 652{
648 if (!update_mode_lines) 653 if (!update_mode_lines)
649 update_mode_lines = REDISPLAY_SOME; 654 update_mode_lines = REDISPLAY_SOME;
@@ -11201,11 +11206,10 @@ static void
11201prepare_menu_bars (void) 11206prepare_menu_bars (void)
11202{ 11207{
11203 bool all_windows = windows_or_buffers_changed || update_mode_lines; 11208 bool all_windows = windows_or_buffers_changed || update_mode_lines;
11204 bool some_windows 11209 bool some_windows = ((windows_or_buffers_changed == 0
11205 = (windows_or_buffers_changed == 0 11210 || windows_or_buffers_changed == REDISPLAY_SOME)
11206 || windows_or_buffers_changed == REDISPLAY_SOME) 11211 && (update_mode_lines == 0
11207 && (update_mode_lines == 0 11212 || update_mode_lines == REDISPLAY_SOME));
11208 || update_mode_lines == REDISPLAY_SOME);
11209 struct gcpro gcpro1, gcpro2; 11213 struct gcpro gcpro1, gcpro2;
11210 Lisp_Object tooltip_frame; 11214 Lisp_Object tooltip_frame;
11211 11215
@@ -12922,7 +12926,8 @@ reconsider_clip_changes (struct window *w)
12922 } 12926 }
12923} 12927}
12924 12928
12925void propagate_buffer_redisplay (void) 12929static void
12930propagate_buffer_redisplay (void)
12926{ /* Resetting b->text->redisplay is problematic! 12931{ /* Resetting b->text->redisplay is problematic!
12927 We can't just reset it in the case that some window that displays 12932 We can't just reset it in the case that some window that displays
12928 it has not been redisplayed; and such a window can stay 12933 it has not been redisplayed; and such a window can stay