From: Paul Eggert Date: Sat, 20 Oct 2012 21:30:51 +0000 (-0700) Subject: Port to OpenBSD 5.1. X-Git-Tag: emacs-24.2.90~211^2~23 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4973679b3f9f9d6251579c5949abe18f964c24b6;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 1a309066703..c7170dec164 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2012-10-20 Paul Eggert + + 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 * lread.c (Fload): Doc fix (Bug#12592). diff --git a/src/frame.c b/src/frame.c index 017d051fc1d..6478ad1e06f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -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)); diff --git a/src/frame.h b/src/frame.h index 7bf76c21c56..f8c3d99fedd 100644 --- a/src/frame.h +++ b/src/frame.h @@ -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 diff --git a/src/keyboard.c b/src/keyboard.c index d58178b7561..ab20ef71660 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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 diff --git a/src/unexelf.c b/src/unexelf.c index f35b53aeab3..121e6042fc9 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -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) diff --git a/src/xdisp.c b/src/xdisp.c index 6964719f958..b3b08edcd0a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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); } diff --git a/src/xfaces.c b/src/xfaces.c index 3e6e9dc8ec0..eb9d2dc9f04 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -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;