aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-09-10 17:48:57 -0700
committerPaul Eggert2014-09-10 17:48:57 -0700
commitb3ed13e84d591eeb2f0dde2e7c2558e7abcc66ca (patch)
tree747ac2d7805b50b1c83be62888a367b2f13061e2 /src
parentfe252976a18bf7bb66009fa80c1c6f02b124404f (diff)
downloademacs-b3ed13e84d591eeb2f0dde2e7c2558e7abcc66ca.tar.gz
emacs-b3ed13e84d591eeb2f0dde2e7c2558e7abcc66ca.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/composite.c25
-rw-r--r--src/frame.c10
-rw-r--r--src/frame.h11
-rw-r--r--src/window.c4
-rw-r--r--src/window.h10
6 files changed, 45 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f6cf9938573..8433127b7c2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12014-09-11 Paul Eggert <eggert@cs.ucla.edu>
2
3 Pacify --enable-gcc-warnings when no window system is used.
4 These warnings found that subscript error, so they seem worthwhile.
5 * composite.c (char_composable_p): Simplify a bit.
6 * frame.c (x_set_frame_parameters): Add an IF_LINT.
7 * frame.c (x_set_horizontal_scroll_bars, x_set_scroll_bar_height):
8 * frame.h (FRAME_HAS_HORIZONTAL_SCROLL_BARS):
9 * window.c (set_window_scroll_bars):
10 Use USE_HORIZONTAL_SCROLL_BARS for simplicity.
11 * frame.h [! USE_HORIZONTAL_SCROLL_BARS]:
12 Ignore -Wsuggest-attribute=const.
13 * window.h (USE_HORIZONTAL_SCROLL_BARS): New macro.
14 (WINDOW_HAS_HORIZONTAL_SCROLL_BAR): Use it.
15
12014-09-10 Paul Eggert <eggert@penguin.cs.ucla.edu> 162014-09-10 Paul Eggert <eggert@penguin.cs.ucla.edu>
2 17
3 * charset.c (Fget_unused_iso_final_char): Fix subscript error. 18 * charset.c (Fget_unused_iso_final_char): Fix subscript error.
diff --git a/src/composite.c b/src/composite.c
index 66a20759ec6..1b1960d1c4d 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -928,7 +928,7 @@ static bool
928char_composable_p (int c) 928char_composable_p (int c)
929{ 929{
930 Lisp_Object val; 930 Lisp_Object val;
931 return (c > ' ' 931 return (c > ' '
932 && (c == 0x200C || c == 0x200D 932 && (c == 0x200C || c == 0x200D
933 || (val = CHAR_TABLE_REF (Vunicode_category_table, c), 933 || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
934 (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So))))); 934 (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
@@ -1016,24 +1016,19 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1016 val = CHAR_TABLE_REF (Vcomposition_function_table, c); 1016 val = CHAR_TABLE_REF (Vcomposition_function_table, c);
1017 if (! NILP (val)) 1017 if (! NILP (val))
1018 { 1018 {
1019 Lisp_Object elt; 1019 for (int ridx = 0; CONSP (val); val = XCDR (val), ridx++)
1020 int ridx;
1021
1022 for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
1023 { 1020 {
1024 elt = XCAR (val); 1021 Lisp_Object elt = XCAR (val);
1025 if (VECTORP (elt) && ASIZE (elt) == 3 1022 if (VECTORP (elt) && ASIZE (elt) == 3
1026 && NATNUMP (AREF (elt, 1)) 1023 && NATNUMP (AREF (elt, 1))
1027 && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start) 1024 && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
1028 break; 1025 {
1029 } 1026 cmp_it->rule_idx = ridx;
1030 if (CONSP (val)) 1027 cmp_it->lookback = XFASTINT (AREF (elt, 1));
1031 { 1028 cmp_it->stop_pos = charpos - 1 - cmp_it->lookback;
1032 cmp_it->rule_idx = ridx; 1029 cmp_it->ch = c;
1033 cmp_it->lookback = XFASTINT (AREF (elt, 1)); 1030 return;
1034 cmp_it->stop_pos = charpos - 1 - cmp_it->lookback; 1031 }
1035 cmp_it->ch = c;
1036 return;
1037 } 1032 }
1038 } 1033 }
1039 } 1034 }
diff --git a/src/frame.c b/src/frame.c
index 7077d42dd1b..d0e585622e2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3002,7 +3002,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
3002 /* If both of these parameters are present, it's more efficient to 3002 /* If both of these parameters are present, it's more efficient to
3003 set them both at once. So we wait until we've looked at the 3003 set them both at once. So we wait until we've looked at the
3004 entire list before we set them. */ 3004 entire list before we set them. */
3005 int width, height; 3005 int width, height IF_LINT (= 0);
3006 bool width_change = 0, height_change = 0; 3006 bool width_change = 0, height_change = 0;
3007 3007
3008 /* Same here. */ 3008 /* Same here. */
@@ -3771,9 +3771,7 @@ x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval
3771void 3771void
3772x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 3772x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3773{ 3773{
3774#if (defined (HAVE_WINDOW_SYSTEM) \ 3774#if USE_HORIZONTAL_SCROLL_BARS
3775 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
3776 || defined (HAVE_NTGUI)))
3777 if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)) 3775 if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))
3778 || (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))) 3776 || (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)))
3779 { 3777 {
@@ -3823,9 +3821,7 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3823void 3821void
3824x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 3822x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3825{ 3823{
3826#if (defined (HAVE_WINDOW_SYSTEM) \ 3824#if USE_HORIZONTAL_SCROLL_BARS
3827 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
3828 || defined (HAVE_NTGUI)))
3829 int unit = FRAME_LINE_HEIGHT (f); 3825 int unit = FRAME_LINE_HEIGHT (f);
3830 3826
3831 if (NILP (arg)) 3827 if (NILP (arg))
diff --git a/src/frame.h b/src/frame.h
index 0f34770d9b4..c942a9008fa 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -868,9 +868,7 @@ default_pixels_per_inch_y (void)
868#endif /* HAVE_WINDOW_SYSTEM */ 868#endif /* HAVE_WINDOW_SYSTEM */
869 869
870/* Whether horizontal scroll bars are currently enabled for frame F. */ 870/* Whether horizontal scroll bars are currently enabled for frame F. */
871#if (defined (HAVE_WINDOW_SYSTEM) \ 871#if USE_HORIZONTAL_SCROLL_BARS
872 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
873 || defined (HAVE_NTGUI)))
874#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \ 872#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
875 ((f)->horizontal_scroll_bars) 873 ((f)->horizontal_scroll_bars)
876#else 874#else
@@ -1501,4 +1499,11 @@ extern Lisp_Object make_monitor_attribute_list (struct MonitorInfo *monitors,
1501 1499
1502INLINE_HEADER_END 1500INLINE_HEADER_END
1503 1501
1502/* Suppress -Wsuggest-attribute=const if there are no scroll bars.
1503 This is for functions like x_set_horizontal_scroll_bars that have
1504 no effect in this case. */
1505#if ! USE_HORIZONTAL_SCROLL_BARS && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
1506# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
1507#endif
1508
1504#endif /* not EMACS_FRAME_H */ 1509#endif /* not EMACS_FRAME_H */
diff --git a/src/window.c b/src/window.c
index 341e3e3dcd2..8736fe13c3b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7376,9 +7376,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object width,
7376 } 7376 }
7377 } 7377 }
7378 7378
7379#if (defined (HAVE_WINDOW_SYSTEM) \ 7379#if USE_HORIZONTAL_SCROLL_BARS
7380 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
7381 || defined (HAVE_NTGUI)))
7382 { 7380 {
7383 int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height))); 7381 int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height)));
7384 7382
diff --git a/src/window.h b/src/window.h
index 7e1c7d619b9..ea5dddc9fc8 100644
--- a/src/window.h
+++ b/src/window.h
@@ -785,11 +785,17 @@ wset_next_buffers (struct window *w, Lisp_Object val)
785 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (W) \ 785 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (W) \
786 || WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (W)) 786 || WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (W))
787 787
788/* Say whether horizontal scroll bars are currently enabled for window
789 W. Horizontal scrollbars exist for toolkit versions only. */
790#if (defined (HAVE_WINDOW_SYSTEM) \ 788#if (defined (HAVE_WINDOW_SYSTEM) \
791 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \ 789 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
792 || defined (HAVE_NTGUI))) 790 || defined (HAVE_NTGUI)))
791# define USE_HORIZONTAL_SCROLL_BARS true
792#else
793# define USE_HORIZONTAL_SCROLL_BARS false
794#endif
795
796/* Say whether horizontal scroll bars are currently enabled for window
797 W. Horizontal scrollbars exist for toolkit versions only. */
798#if USE_HORIZONTAL_SCROLL_BARS
793#define WINDOW_HAS_HORIZONTAL_SCROLL_BAR(W) \ 799#define WINDOW_HAS_HORIZONTAL_SCROLL_BAR(W) \
794 ((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W)) \ 800 ((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W)) \
795 ? false \ 801 ? false \