emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117862: Pacify --enable-gcc-warnings when no window


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117862: Pacify --enable-gcc-warnings when no window system is used.
Date: Thu, 11 Sep 2014 00:49:04 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117862
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2014-09-10 17:48:57 -0700
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/composite.c                
composite.c-20091113204419-o5vbwnq5f7feedwu-1728
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
  src/frame.h                    frame.h-20091113204419-o5vbwnq5f7feedwu-229
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/window.h                   window.h-20091113204419-o5vbwnq5f7feedwu-271
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-11 00:29:54 +0000
+++ b/src/ChangeLog     2014-09-11 00:48:57 +0000
@@ -1,3 +1,18 @@
+2014-09-11  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        * charset.c (Fget_unused_iso_final_char): Fix subscript error.

=== modified file 'src/composite.c'
--- a/src/composite.c   2014-06-25 12:11:08 +0000
+++ b/src/composite.c   2014-09-11 00:48:57 +0000
@@ -928,7 +928,7 @@
 char_composable_p (int c)
 {
   Lisp_Object val;
-  return (c > ' '                      
+  return (c > ' '
          && (c == 0x200C || c == 0x200D
              || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
                  (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
@@ -1016,24 +1016,19 @@
          val = CHAR_TABLE_REF (Vcomposition_function_table, c);
          if (! NILP (val))
            {
-             Lisp_Object elt;
-             int ridx;
-
-             for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
+             for (int ridx = 0; CONSP (val); val = XCDR (val), ridx++)
                {
-                 elt = XCAR (val);
+                 Lisp_Object elt = XCAR (val);
                  if (VECTORP (elt) && ASIZE (elt) == 3
                      && NATNUMP (AREF (elt, 1))
                      && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
-                   break;
-               }
-             if (CONSP (val))
-               {
-                 cmp_it->rule_idx = ridx;
-                 cmp_it->lookback = XFASTINT (AREF (elt, 1));
-                 cmp_it->stop_pos = charpos - 1 - cmp_it->lookback;
-                 cmp_it->ch = c;
-                 return;
+                   {
+                     cmp_it->rule_idx = ridx;
+                     cmp_it->lookback = XFASTINT (AREF (elt, 1));
+                     cmp_it->stop_pos = charpos - 1 - cmp_it->lookback;
+                     cmp_it->ch = c;
+                     return;
+                   }
                }
            }
        }

=== modified file 'src/frame.c'
--- a/src/frame.c       2014-09-07 07:04:01 +0000
+++ b/src/frame.c       2014-09-11 00:48:57 +0000
@@ -3002,7 +3002,7 @@
   /* 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
      entire list before we set them.  */
-  int width, height;
+  int width, height IF_LINT (= 0);
   bool width_change = 0, height_change = 0;
 
   /* Same here.  */
@@ -3771,9 +3771,7 @@
 void
 x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object 
oldval)
 {
-#if (defined (HAVE_WINDOW_SYSTEM)                                      \
-     && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS))     \
-        || defined (HAVE_NTGUI)))
+#if USE_HORIZONTAL_SCROLL_BARS
   if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))
       || (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)))
     {
@@ -3823,9 +3821,7 @@
 void
 x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
-#if (defined (HAVE_WINDOW_SYSTEM)                                      \
-     && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS))     \
-        || defined (HAVE_NTGUI)))
+#if USE_HORIZONTAL_SCROLL_BARS
   int unit = FRAME_LINE_HEIGHT (f);
 
   if (NILP (arg))

=== modified file 'src/frame.h'
--- a/src/frame.h       2014-08-04 16:47:27 +0000
+++ b/src/frame.h       2014-09-11 00:48:57 +0000
@@ -868,9 +868,7 @@
 #endif /* HAVE_WINDOW_SYSTEM */
 
 /* Whether horizontal scroll bars are currently enabled for frame F.  */
-#if (defined (HAVE_WINDOW_SYSTEM)                                      \
-     && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS))     \
-        || defined (HAVE_NTGUI)))
+#if USE_HORIZONTAL_SCROLL_BARS
 #define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
   ((f)->horizontal_scroll_bars)
 #else
@@ -1501,4 +1499,11 @@
 
 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 */

=== modified file 'src/window.c'
--- a/src/window.c      2014-09-07 07:04:01 +0000
+++ b/src/window.c      2014-09-11 00:48:57 +0000
@@ -7376,9 +7376,7 @@
        }
     }
 
-#if (defined (HAVE_WINDOW_SYSTEM)                                      \
-     && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS))     \
-        || defined (HAVE_NTGUI)))
+#if USE_HORIZONTAL_SCROLL_BARS
   {
     int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT 
(height)));
 

=== modified file 'src/window.h'
--- a/src/window.h      2014-08-04 16:47:27 +0000
+++ b/src/window.h      2014-09-11 00:48:57 +0000
@@ -785,11 +785,17 @@
   (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (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)                                      \
      && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS))     \
         || 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)                    \
   ((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W))         \
    ? false                                                     \


reply via email to

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