Commit b3ed13e8 authored by Paul Eggert's avatar Paul Eggert
Browse files

Pacify --enable-gcc-warnings when no window system is used.

These warnings found that subscript error, so they seem worthwhile.
* composite.c (char_composable_p): Simplify a bit.
* frame.c (x_set_frame_parameters): Add an IF_LINT.
* frame.c (x_set_horizontal_scroll_bars, x_set_scroll_bar_height):
* frame.h (FRAME_HAS_HORIZONTAL_SCROLL_BARS):
* window.c (set_window_scroll_bars):
Use USE_HORIZONTAL_SCROLL_BARS for simplicity.
* frame.h [! USE_HORIZONTAL_SCROLL_BARS]:
Ignore -Wsuggest-attribute=const.
* window.h (USE_HORIZONTAL_SCROLL_BARS): New macro.
(WINDOW_HAS_HORIZONTAL_SCROLL_BAR): Use it.
parent fe252976
2014-09-11 Paul Eggert <eggert@cs.ucla.edu>
Pacify --enable-gcc-warnings when no window system is used.
These warnings found that subscript error, so they seem worthwhile.
* composite.c (char_composable_p): Simplify a bit.
* frame.c (x_set_frame_parameters): Add an IF_LINT.
* frame.c (x_set_horizontal_scroll_bars, x_set_scroll_bar_height):
* frame.h (FRAME_HAS_HORIZONTAL_SCROLL_BARS):
* window.c (set_window_scroll_bars):
Use USE_HORIZONTAL_SCROLL_BARS for simplicity.
* frame.h [! USE_HORIZONTAL_SCROLL_BARS]:
Ignore -Wsuggest-attribute=const.
* window.h (USE_HORIZONTAL_SCROLL_BARS): New macro.
(WINDOW_HAS_HORIZONTAL_SCROLL_BAR): Use it.
2014-09-10 Paul Eggert <eggert@penguin.cs.ucla.edu> 2014-09-10 Paul Eggert <eggert@penguin.cs.ucla.edu>
* charset.c (Fget_unused_iso_final_char): Fix subscript error. * charset.c (Fget_unused_iso_final_char): Fix subscript error.
......
...@@ -1016,18 +1016,12 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, ...@@ -1016,18 +1016,12 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
val = CHAR_TABLE_REF (Vcomposition_function_table, c); val = CHAR_TABLE_REF (Vcomposition_function_table, c);
if (! NILP (val)) if (! NILP (val))
{ {
Lisp_Object elt; for (int ridx = 0; CONSP (val); val = XCDR (val), ridx++)
int ridx;
for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
{ {
elt = XCAR (val); Lisp_Object elt = XCAR (val);
if (VECTORP (elt) && ASIZE (elt) == 3 if (VECTORP (elt) && ASIZE (elt) == 3
&& NATNUMP (AREF (elt, 1)) && NATNUMP (AREF (elt, 1))
&& charpos - 1 - XFASTINT (AREF (elt, 1)) >= start) && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
break;
}
if (CONSP (val))
{ {
cmp_it->rule_idx = ridx; cmp_it->rule_idx = ridx;
cmp_it->lookback = XFASTINT (AREF (elt, 1)); cmp_it->lookback = XFASTINT (AREF (elt, 1));
...@@ -1037,6 +1031,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, ...@@ -1037,6 +1031,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
} }
} }
} }
}
if (charpos == endpos) if (charpos == endpos)
{ {
/* We couldn't find a composition point before ENDPOS. But, /* We couldn't find a composition point before ENDPOS. But,
......
...@@ -3002,7 +3002,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) ...@@ -3002,7 +3002,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
/* If both of these parameters are present, it's more efficient to /* If both of these parameters are present, it's more efficient to
set them both at once. So we wait until we've looked at the set them both at once. So we wait until we've looked at the
entire list before we set them. */ entire list before we set them. */
int width, height; int width, height IF_LINT (= 0);
bool width_change = 0, height_change = 0; bool width_change = 0, height_change = 0;
/* Same here. */ /* Same here. */
...@@ -3771,9 +3771,7 @@ x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval ...@@ -3771,9 +3771,7 @@ x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval
void void
x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{ {
#if (defined (HAVE_WINDOW_SYSTEM) \ #if USE_HORIZONTAL_SCROLL_BARS
&& ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
|| defined (HAVE_NTGUI)))
if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)) if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))
|| (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))) || (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)))
{ {
...@@ -3823,9 +3821,7 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) ...@@ -3823,9 +3821,7 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
void void
x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{ {
#if (defined (HAVE_WINDOW_SYSTEM) \ #if USE_HORIZONTAL_SCROLL_BARS
&& ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
|| defined (HAVE_NTGUI)))
int unit = FRAME_LINE_HEIGHT (f); int unit = FRAME_LINE_HEIGHT (f);
if (NILP (arg)) if (NILP (arg))
......
...@@ -868,9 +868,7 @@ default_pixels_per_inch_y (void) ...@@ -868,9 +868,7 @@ default_pixels_per_inch_y (void)
#endif /* HAVE_WINDOW_SYSTEM */ #endif /* HAVE_WINDOW_SYSTEM */
/* Whether horizontal scroll bars are currently enabled for frame F. */ /* Whether horizontal scroll bars are currently enabled for frame F. */
#if (defined (HAVE_WINDOW_SYSTEM) \ #if USE_HORIZONTAL_SCROLL_BARS
&& ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
|| defined (HAVE_NTGUI)))
#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \ #define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
((f)->horizontal_scroll_bars) ((f)->horizontal_scroll_bars)
#else #else
...@@ -1501,4 +1499,11 @@ extern Lisp_Object make_monitor_attribute_list (struct MonitorInfo *monitors, ...@@ -1501,4 +1499,11 @@ extern Lisp_Object make_monitor_attribute_list (struct MonitorInfo *monitors,
INLINE_HEADER_END INLINE_HEADER_END
/* Suppress -Wsuggest-attribute=const if there are no scroll bars.
This is for functions like x_set_horizontal_scroll_bars that have
no effect in this case. */
#if ! USE_HORIZONTAL_SCROLL_BARS && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
#endif
#endif /* not EMACS_FRAME_H */ #endif /* not EMACS_FRAME_H */
...@@ -7376,9 +7376,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object width, ...@@ -7376,9 +7376,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object width,
} }
} }
#if (defined (HAVE_WINDOW_SYSTEM) \ #if USE_HORIZONTAL_SCROLL_BARS
&& ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
|| defined (HAVE_NTGUI)))
{ {
int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height))); int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height)));
......
...@@ -785,11 +785,17 @@ wset_next_buffers (struct window *w, Lisp_Object val) ...@@ -785,11 +785,17 @@ wset_next_buffers (struct window *w, Lisp_Object val)
(WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (W) \ (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (W) \
|| WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (W)) || WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (W))
/* Say whether horizontal scroll bars are currently enabled for window
W. Horizontal scrollbars exist for toolkit versions only. */
#if (defined (HAVE_WINDOW_SYSTEM) \ #if (defined (HAVE_WINDOW_SYSTEM) \
&& ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \ && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
|| defined (HAVE_NTGUI))) || defined (HAVE_NTGUI)))
# define USE_HORIZONTAL_SCROLL_BARS true
#else
# define USE_HORIZONTAL_SCROLL_BARS false
#endif
/* Say whether horizontal scroll bars are currently enabled for window
W. Horizontal scrollbars exist for toolkit versions only. */
#if USE_HORIZONTAL_SCROLL_BARS
#define WINDOW_HAS_HORIZONTAL_SCROLL_BAR(W) \ #define WINDOW_HAS_HORIZONTAL_SCROLL_BAR(W) \
((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W)) \ ((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W)) \
? false \ ? false \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment