Port to OpenBSD 5.1.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 20 Oct 2012 21:30:51 +0000 (14:30 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 20 Oct 2012 21:30:51 +0000 (14:30 -0700)
* frame.c (Fmouse_position, Fmouse_pixel_position):
* xdisp.c (produce_stretch_glyph):
Declare local vars only when they're needed.
This is clearer and avoids a warning on OpenBSD about unused vars.
* frame.h (FRAME_WINDOW_P): Always evaluate its argument.
This is safer, and avoids OpenBSD warnings about unused vars.
* keyboard.c (record_menu_key): Remove unnecessary decl.
(poll_timer): Define only if POLL_FOR_INPUT is defined.
* unexelf.c (ELFSIZE) [!ElfW]: Do not define if already defined,
as our definition clashes with OpenBSD's.
* xfaces.c (load_face_colors, check_lface_attrs)
(get_lface_attributes_no_remap, get_lface_attributes)
(lface_fully_specified_p, x_supports_face_attributes_p)
(tty_supports_face_attributes_p, face_fontset, realize_face)
(realize_x_face, realize_tty_face):
Declare parameters to be Lisp_Object[LFACE_VECTOR_SIZE], not
merely Lisp_Object *.  This is more informative and avoids
a warning on OpenBSD about accessing beyond an object's size.

src/ChangeLog
src/frame.c
src/frame.h
src/keyboard.c
src/unexelf.c
src/xdisp.c
src/xfaces.c

index 1a30906..c7170de 100644 (file)
@@ -1,3 +1,25 @@
+2012-10-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port to OpenBSD 5.1.
+       * frame.c (Fmouse_position, Fmouse_pixel_position):
+       * xdisp.c (produce_stretch_glyph):
+       Declare local vars only when they're needed.
+       This is clearer and avoids a warning on OpenBSD about unused vars.
+       * frame.h (FRAME_WINDOW_P): Always evaluate its argument.
+       This is safer, and avoids OpenBSD warnings about unused vars.
+       * keyboard.c (record_menu_key): Remove unnecessary decl.
+       (poll_timer): Define only if POLL_FOR_INPUT is defined.
+       * unexelf.c (ELFSIZE) [!ElfW]: Do not define if already defined,
+       as our definition clashes with OpenBSD's.
+       * xfaces.c (load_face_colors, check_lface_attrs)
+       (get_lface_attributes_no_remap, get_lface_attributes)
+       (lface_fully_specified_p, x_supports_face_attributes_p)
+       (tty_supports_face_attributes_p, face_fontset, realize_face)
+       (realize_x_face, realize_tty_face):
+       Declare parameters to be Lisp_Object[LFACE_VECTOR_SIZE], not
+       merely Lisp_Object *.  This is more informative and avoids
+       a warning on OpenBSD about accessing beyond an object's size.
+
 2012-10-20  Chong Yidong  <cyd@gnu.org>
 
        * lread.c (Fload): Doc fix (Bug#12592).
index 017d051..6478ad1 100644 (file)
@@ -1501,10 +1501,7 @@ and returns whatever that function returns.  */)
 {
   FRAME_PTR f;
   Lisp_Object lispy_dummy;
-  enum scroll_bar_part party_dummy;
   Lisp_Object x, y, retval;
-  int col, row;
-  Time long_dummy;
   struct gcpro gcpro1;
 
   f = SELECTED_FRAME ();
@@ -1513,14 +1510,19 @@ and returns whatever that function returns.  */)
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   /* It's okay for the hook to refrain from storing anything.  */
   if (FRAME_TERMINAL (f)->mouse_position_hook)
-    (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
-                                                &lispy_dummy, &party_dummy,
-                                                &x, &y,
-                                                &long_dummy);
+    {
+      enum scroll_bar_part party_dummy;
+      Time time_dummy;
+      (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
+                                                 &lispy_dummy, &party_dummy,
+                                                 &x, &y,
+                                                 &time_dummy);
+    }
+
   if (! NILP (x))
     {
-      col = XINT (x);
-      row = XINT (y);
+      int col = XINT (x);
+      int row = XINT (y);
       pixel_to_glyph_coords (f, col, row, &col, &row, NULL, 1);
       XSETINT (x, col);
       XSETINT (y, row);
@@ -1547,9 +1549,7 @@ and nil for X and Y.  */)
 {
   FRAME_PTR f;
   Lisp_Object lispy_dummy;
-  enum scroll_bar_part party_dummy;
   Lisp_Object x, y;
-  Time long_dummy;
 
   f = SELECTED_FRAME ();
   x = y = Qnil;
@@ -1557,10 +1557,15 @@ and nil for X and Y.  */)
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   /* It's okay for the hook to refrain from storing anything.  */
   if (FRAME_TERMINAL (f)->mouse_position_hook)
-    (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
-                                                &lispy_dummy, &party_dummy,
-                                                &x, &y,
-                                                &long_dummy);
+    {
+      enum scroll_bar_part party_dummy;
+      Time time_dummy;
+      (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
+                                                 &lispy_dummy, &party_dummy,
+                                                 &x, &y,
+                                                 &time_dummy);
+    }
+
 #endif
   XSETFRAME (lispy_dummy, f);
   return Fcons (lispy_dummy, Fcons (x, y));
index 7bf76c2..f8c3d99 100644 (file)
@@ -646,7 +646,7 @@ typedef struct frame *FRAME_PTR;
 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
 #endif
 #ifndef FRAME_WINDOW_P
-#define FRAME_WINDOW_P(f) (0)
+#define FRAME_WINDOW_P(f) ((void) (f), 0)
 #endif
 
 /* Return a pointer to the structure holding information about the
index d58178b..ab20ef7 100644 (file)
@@ -365,7 +365,6 @@ static Lisp_Object command_loop (void);
 static Lisp_Object Qextended_command_history;
 EMACS_TIME timer_check (void);
 
-static void record_menu_key (Lisp_Object c);
 static void echo_now (void);
 static ptrdiff_t echo_length (void);
 
@@ -1963,12 +1962,12 @@ safe_run_hooks (Lisp_Object hook)
 
 int poll_suppress_count;
 
-/* Asynchronous timer for polling.  */
 
-static struct atimer *poll_timer;
+#ifdef POLL_FOR_INPUT
 
+/* Asynchronous timer for polling.  */
 
-#ifdef POLL_FOR_INPUT
+static struct atimer *poll_timer;
 
 /* Poll for input, so that we catch a C-g if it comes in.  This
    function is called from x_make_frame_visible, see comment
index f35b53a..121e604 100644 (file)
@@ -507,10 +507,12 @@ typedef struct {
 
 #ifndef ElfW
 # define ElfBitsW(bits, type) Elf##bits##_##type
-# ifdef _LP64
-#  define ELFSIZE 64
-# else
-#  define ELFSIZE 32
+# ifndef ELFSIZE
+#  ifdef _LP64
+#   define ELFSIZE 64
+#  else
+#   define ELFSIZE 32
+#  endif
 # endif
   /* This macro expands `bits' before invoking ElfBitsW.  */
 # define ElfExpandBitsW(bits, type) ElfBitsW (bits, type)
index 6964719..b3b08ed 100644 (file)
@@ -24076,17 +24076,16 @@ produce_stretch_glyph (struct it *it)
   Lisp_Object prop, plist;
   int width = 0, height = 0, align_to = -1;
   int zero_width_ok_p = 0;
-  int ascent = 0;
   double tem;
-  struct face *face = NULL;
   struct font *font = NULL;
 
 #ifdef HAVE_WINDOW_SYSTEM
+  int ascent = 0;
   int zero_height_ok_p = 0;
 
   if (FRAME_WINDOW_P (it->f))
     {
-      face = FACE_FROM_ID (it->f, it->face_id);
+      struct face *face = FACE_FROM_ID (it->f, it->face_id);
       font = face->font ? face->font : FRAME_FONT (it->f);
       PREPARE_FACE_FOR_DISPLAY (it->f, face);
     }
index 3e6e9dc..eb9d2dc 100644 (file)
@@ -1323,7 +1323,8 @@ load_color (struct frame *f, struct face *face, Lisp_Object name,
    try to emulate gray colors with a stipple from Vface_default_stipple.  */
 
 static void
-load_face_colors (struct frame *f, struct face *face, Lisp_Object *attrs)
+load_face_colors (struct frame *f, struct face *face,
+                 Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
   Lisp_Object fg, bg;
 
@@ -1802,7 +1803,7 @@ the WIDTH times as wide as FACE on FRAME.  */)
 /* Check consistency of Lisp face attribute vector ATTRS.  */
 
 static void
-check_lface_attrs (Lisp_Object *attrs)
+check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
   eassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_FAMILY_INDEX])
@@ -2049,7 +2050,8 @@ lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
 
 static int
 get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
-                              Lisp_Object *attrs, int signal_p)
+                              Lisp_Object attrs[LFACE_VECTOR_SIZE],
+                              int signal_p)
 {
   Lisp_Object lface;
 
@@ -2071,7 +2073,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
 
 static int
 get_lface_attributes (struct frame *f, Lisp_Object face_name,
-                     Lisp_Object *attrs, int signal_p,
+                     Lisp_Object attrs[LFACE_VECTOR_SIZE], int signal_p,
                      struct named_merge_point *named_merge_points)
 {
   Lisp_Object face_remapping;
@@ -2108,7 +2110,7 @@ get_lface_attributes (struct frame *f, Lisp_Object face_name,
    specified, i.e. are non-nil.  */
 
 static int
-lface_fully_specified_p (Lisp_Object *attrs)
+lface_fully_specified_p (Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
   int i;
 
@@ -4760,7 +4762,8 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
     \(2) `close in spirit' to what the attributes specify, if not exact.  */
 
 static int
-x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
+x_supports_face_attributes_p (struct frame *f,
+                             Lisp_Object attrs[LFACE_VECTOR_SIZE],
                              struct face *def_face)
 {
   Lisp_Object *def_attrs = def_face->lface;
@@ -4862,7 +4865,8 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
    substitution of a `dim' face for italic.  */
 
 static int
-tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
+tty_supports_face_attributes_p (struct frame *f,
+                               Lisp_Object attrs[LFACE_VECTOR_SIZE],
                                struct face *def_face)
 {
   int weight, slant;
@@ -5245,7 +5249,7 @@ be found.  Value is ALIST.  */)
    attribute of ATTRS doesn't name a fontset.  */
 
 static int
-face_fontset (Lisp_Object *attrs)
+face_fontset (Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
   Lisp_Object name;
 
@@ -5474,7 +5478,8 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id)
    face.  Value is a pointer to the newly created realized face.  */
 
 static struct face *
-realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
+realize_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE],
+             int former_face_id)
 {
   struct face *face;
 
@@ -5551,7 +5556,7 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
    created realized face.  */
 
 static struct face *
-realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
+realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
   struct face *face = NULL;
 #ifdef HAVE_WINDOW_SYSTEM
@@ -5878,7 +5883,8 @@ map_tty_color (struct frame *f, struct face *face,
    Value is a pointer to the newly created realized face.  */
 
 static struct face *
-realize_tty_face (struct face_cache *cache, Lisp_Object *attrs)
+realize_tty_face (struct face_cache *cache,
+                 Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
   struct face *face;
   int weight, slant;