Commit 4973679b authored by Paul Eggert's avatar 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.
parent 83c85d8e
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> 2012-10-20 Chong Yidong <cyd@gnu.org>
* lread.c (Fload): Doc fix (Bug#12592). * lread.c (Fload): Doc fix (Bug#12592).
......
...@@ -1501,10 +1501,7 @@ and returns whatever that function returns. */) ...@@ -1501,10 +1501,7 @@ and returns whatever that function returns. */)
{ {
FRAME_PTR f; FRAME_PTR f;
Lisp_Object lispy_dummy; Lisp_Object lispy_dummy;
enum scroll_bar_part party_dummy;
Lisp_Object x, y, retval; Lisp_Object x, y, retval;
int col, row;
Time long_dummy;
struct gcpro gcpro1; struct gcpro gcpro1;
f = SELECTED_FRAME (); f = SELECTED_FRAME ();
...@@ -1513,14 +1510,19 @@ and returns whatever that function returns. */) ...@@ -1513,14 +1510,19 @@ and returns whatever that function returns. */)
#if defined (HAVE_MOUSE) || defined (HAVE_GPM) #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
/* It's okay for the hook to refrain from storing anything. */ /* It's okay for the hook to refrain from storing anything. */
if (FRAME_TERMINAL (f)->mouse_position_hook) if (FRAME_TERMINAL (f)->mouse_position_hook)
(*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1, {
&lispy_dummy, &party_dummy, enum scroll_bar_part party_dummy;
&x, &y, Time time_dummy;
&long_dummy); (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
&lispy_dummy, &party_dummy,
&x, &y,
&time_dummy);
}
if (! NILP (x)) if (! NILP (x))
{ {
col = XINT (x); int col = XINT (x);
row = XINT (y); int row = XINT (y);
pixel_to_glyph_coords (f, col, row, &col, &row, NULL, 1); pixel_to_glyph_coords (f, col, row, &col, &row, NULL, 1);
XSETINT (x, col); XSETINT (x, col);
XSETINT (y, row); XSETINT (y, row);
...@@ -1547,9 +1549,7 @@ and nil for X and Y. */) ...@@ -1547,9 +1549,7 @@ and nil for X and Y. */)
{ {
FRAME_PTR f; FRAME_PTR f;
Lisp_Object lispy_dummy; Lisp_Object lispy_dummy;
enum scroll_bar_part party_dummy;
Lisp_Object x, y; Lisp_Object x, y;
Time long_dummy;
f = SELECTED_FRAME (); f = SELECTED_FRAME ();
x = y = Qnil; x = y = Qnil;
...@@ -1557,10 +1557,15 @@ and nil for X and Y. */) ...@@ -1557,10 +1557,15 @@ and nil for X and Y. */)
#if defined (HAVE_MOUSE) || defined (HAVE_GPM) #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
/* It's okay for the hook to refrain from storing anything. */ /* It's okay for the hook to refrain from storing anything. */
if (FRAME_TERMINAL (f)->mouse_position_hook) if (FRAME_TERMINAL (f)->mouse_position_hook)
(*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1, {
&lispy_dummy, &party_dummy, enum scroll_bar_part party_dummy;
&x, &y, Time time_dummy;
&long_dummy); (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
&lispy_dummy, &party_dummy,
&x, &y,
&time_dummy);
}
#endif #endif
XSETFRAME (lispy_dummy, f); XSETFRAME (lispy_dummy, f);
return Fcons (lispy_dummy, Fcons (x, y)); return Fcons (lispy_dummy, Fcons (x, y));
......
...@@ -646,7 +646,7 @@ typedef struct frame *FRAME_PTR; ...@@ -646,7 +646,7 @@ typedef struct frame *FRAME_PTR;
#define FRAME_WINDOW_P(f) FRAME_NS_P(f) #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
#endif #endif
#ifndef FRAME_WINDOW_P #ifndef FRAME_WINDOW_P
#define FRAME_WINDOW_P(f) (0) #define FRAME_WINDOW_P(f) ((void) (f), 0)
#endif #endif
/* Return a pointer to the structure holding information about the /* Return a pointer to the structure holding information about the
......
...@@ -365,7 +365,6 @@ static Lisp_Object command_loop (void); ...@@ -365,7 +365,6 @@ static Lisp_Object command_loop (void);
static Lisp_Object Qextended_command_history; static Lisp_Object Qextended_command_history;
EMACS_TIME timer_check (void); EMACS_TIME timer_check (void);
static void record_menu_key (Lisp_Object c);
static void echo_now (void); static void echo_now (void);
static ptrdiff_t echo_length (void); static ptrdiff_t echo_length (void);
...@@ -1963,12 +1962,12 @@ safe_run_hooks (Lisp_Object hook) ...@@ -1963,12 +1962,12 @@ safe_run_hooks (Lisp_Object hook)
int poll_suppress_count; 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 /* 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 function is called from x_make_frame_visible, see comment
......
...@@ -507,10 +507,12 @@ typedef struct { ...@@ -507,10 +507,12 @@ typedef struct {
#ifndef ElfW #ifndef ElfW
# define ElfBitsW(bits, type) Elf##bits##_##type # define ElfBitsW(bits, type) Elf##bits##_##type
# ifdef _LP64 # ifndef ELFSIZE
# define ELFSIZE 64 # ifdef _LP64
# else # define ELFSIZE 64
# define ELFSIZE 32 # else
# define ELFSIZE 32
# endif
# endif # endif
/* This macro expands `bits' before invoking ElfBitsW. */ /* This macro expands `bits' before invoking ElfBitsW. */
# define ElfExpandBitsW(bits, type) ElfBitsW (bits, type) # define ElfExpandBitsW(bits, type) ElfBitsW (bits, type)
......
...@@ -24076,17 +24076,16 @@ produce_stretch_glyph (struct it *it) ...@@ -24076,17 +24076,16 @@ produce_stretch_glyph (struct it *it)
Lisp_Object prop, plist; Lisp_Object prop, plist;
int width = 0, height = 0, align_to = -1; int width = 0, height = 0, align_to = -1;
int zero_width_ok_p = 0; int zero_width_ok_p = 0;
int ascent = 0;
double tem; double tem;
struct face *face = NULL;
struct font *font = NULL; struct font *font = NULL;
#ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_WINDOW_SYSTEM
int ascent = 0;
int zero_height_ok_p = 0; int zero_height_ok_p = 0;
if (FRAME_WINDOW_P (it->f)) 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); font = face->font ? face->font : FRAME_FONT (it->f);
PREPARE_FACE_FOR_DISPLAY (it->f, face); PREPARE_FACE_FOR_DISPLAY (it->f, face);
} }
......
...@@ -1323,7 +1323,8 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, ...@@ -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. */ try to emulate gray colors with a stipple from Vface_default_stipple. */
static void 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; Lisp_Object fg, bg;
...@@ -1802,7 +1803,7 @@ the WIDTH times as wide as FACE on FRAME. */) ...@@ -1802,7 +1803,7 @@ the WIDTH times as wide as FACE on FRAME. */)
/* Check consistency of Lisp face attribute vector ATTRS. */ /* Check consistency of Lisp face attribute vector ATTRS. */
static void static void
check_lface_attrs (Lisp_Object *attrs) check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
{ {
eassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) eassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
|| IGNORE_DEFFACE_P (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) ...@@ -2049,7 +2050,8 @@ lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
static int static int
get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, 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; Lisp_Object lface;
...@@ -2071,7 +2073,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, ...@@ -2071,7 +2073,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
static int static int
get_lface_attributes (struct frame *f, Lisp_Object face_name, 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) struct named_merge_point *named_merge_points)
{ {
Lisp_Object face_remapping; Lisp_Object face_remapping;
...@@ -2108,7 +2110,7 @@ get_lface_attributes (struct frame *f, Lisp_Object face_name, ...@@ -2108,7 +2110,7 @@ get_lface_attributes (struct frame *f, Lisp_Object face_name,
specified, i.e. are non-nil. */ specified, i.e. are non-nil. */
static int static int
lface_fully_specified_p (Lisp_Object *attrs) lface_fully_specified_p (Lisp_Object attrs[LFACE_VECTOR_SIZE])
{ {
int i; int i;
...@@ -4760,7 +4762,8 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, ...@@ -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. */ \(2) `close in spirit' to what the attributes specify, if not exact. */
static int 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) struct face *def_face)
{ {
Lisp_Object *def_attrs = def_face->lface; Lisp_Object *def_attrs = def_face->lface;
...@@ -4862,7 +4865,8 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, ...@@ -4862,7 +4865,8 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
substitution of a `dim' face for italic. */ substitution of a `dim' face for italic. */
static int 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) struct face *def_face)
{ {
int weight, slant; int weight, slant;
...@@ -5245,7 +5249,7 @@ be found. Value is ALIST. */) ...@@ -5245,7 +5249,7 @@ be found. Value is ALIST. */)
attribute of ATTRS doesn't name a fontset. */ attribute of ATTRS doesn't name a fontset. */
static int static int
face_fontset (Lisp_Object *attrs) face_fontset (Lisp_Object attrs[LFACE_VECTOR_SIZE])
{ {
Lisp_Object name; Lisp_Object name;
...@@ -5474,7 +5478,8 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id) ...@@ -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. */ face. Value is a pointer to the newly created realized face. */
static struct 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; struct face *face;
...@@ -5551,7 +5556,7 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object, ...@@ -5551,7 +5556,7 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
created realized face. */ created realized face. */
static struct 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; struct face *face = NULL;
#ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_WINDOW_SYSTEM
...@@ -5878,7 +5883,8 @@ map_tty_color (struct frame *f, struct face *face, ...@@ -5878,7 +5883,8 @@ map_tty_color (struct frame *f, struct face *face,
Value is a pointer to the newly created realized face. */ Value is a pointer to the newly created realized face. */
static struct 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; struct face *face;
int weight, slant; int weight, slant;
......
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