summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog104
-rw-r--r--src/alloc.c25
-rw-r--r--src/bitmaps/cntrpmsk.xbm8
-rw-r--r--src/bitmaps/cntrptr.xbm8
-rw-r--r--src/bitmaps/crosswv.xbm8
-rw-r--r--src/bitmaps/dimple1.xbm8
-rw-r--r--src/bitmaps/dimple3.xbm8
-rw-r--r--src/bitmaps/gray.xbm2
-rw-r--r--src/bitmaps/gray1.xbm4
-rw-r--r--src/bitmaps/gray3.xbm4
-rw-r--r--src/bitmaps/leftpmsk.xbm8
-rw-r--r--src/bitmaps/leftptr.xbm8
-rw-r--r--src/bitmaps/rtpmsk.xbm8
-rw-r--r--src/bitmaps/rtptr.xbm8
-rw-r--r--src/bitmaps/stipple.xbm4
-rw-r--r--src/data.c4
-rw-r--r--src/dispextern.h7
-rw-r--r--src/emacs.c14
-rw-r--r--src/eval.c1
-rw-r--r--src/fns.c5
-rw-r--r--src/frame.c25
-rw-r--r--src/frame.h4
-rw-r--r--src/insdel.c3
-rw-r--r--src/keyboard.c3
-rw-r--r--src/menu.c23
-rw-r--r--src/process.c11
-rw-r--r--src/s/sol2-6.h3
-rw-r--r--src/s/unixware.h2
-rw-r--r--src/s/usg5-4-common.h6
-rw-r--r--src/sysdep.c2
-rw-r--r--src/termhooks.h8
-rw-r--r--src/xdisp.c7
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c44
-rw-r--r--src/xgselect.c5
-rw-r--r--src/xmenu.c52
-rw-r--r--src/xrdb.c2
-rw-r--r--src/xsmfns.c11
-rw-r--r--src/xterm.c50
-rw-r--r--src/xterm.h4
40 files changed, 336 insertions, 177 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d9f764cde85..908f885cafd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,107 @@
+2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
+
+ Static checks with GCC 4.6.0 and non-default toolkits.
+
+ * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl.
+
+ * process.c (keyboard_bit_set): Define only if SIGIO.
+ (send_process_trap): Mark it with NO_RETURN if it doesn't return.
+ (send_process): Repair possible setjmp clobbering.
+
+ * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'.
+
+ * eval.c: Include <stdio.h>, for vsnprintf on non-GNU/Linux hosts.
+
+ * data.c (arith_error): Mark with NO_RETURN if it doesn't return.
+
+ * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED):
+ Define only if needed.
+
+ * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier
+ by pacifying GCC about it. Maybe it's time to retire it?
+ * xfaces.c (USG, __TIMEVAL__): Likewise.
+
+ * dispextern.h (struct redisplay_interface): Rename param
+ to avoid shadowing.
+ * termhooks.h (struct terminal): Likewise.
+ * xterm.c (xembed_send_message): Likewise.
+
+ * insdel.c (make_gap_smaller): Define only if
+ USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC.
+
+ * keyboard.c (read_char): Make a var volatile so longjmp won't clobber
+ it.
+
+ * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used,
+ so that we aren't warned about unused symbols.
+
+ * xfns.c (Fx_file_dialog): Rename local to avoid shadowing.
+
+ * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512).
+
+ * xfns.c (x_real_positions): Mark locals as initialized.
+
+ * xmenu.c (xmenu_show): Don't use uninitialized vars.
+
+ * xterm.c: Fix problems found by static analysis with other toolkits.
+ (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
+ (x_dispatch_event): Declare static if USE_GTK, and
+ define if USE_GTK || USE_X_TOOLKIT.
+ (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
+ * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT.
+ * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only if
+ defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
+
+ * xmenu.c (menu_help_callback): Pointer type fixes.
+ Use const pointers when pointing at readonly data. Avoid pointer
+ signedness clashes.
+ (FALSE): Remove unused macro.
+ (update_frame_menubar): Remove unused decl.
+
+ * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
+
+ * menu.c (push_submenu_start, push_submenu_end): Do not define unless
+ USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI.
+ (single_menu_item): Rename local to avoid shadowing.
+
+ * keyboard.c (make_lispy_event): Remove unused local var.
+
+ * frame.c, frame.h (x_get_resource_string): Bring this back, but
+ only if HAVE_X_WINDOWS && !USE_X_TOOLKIT.
+
+ * bitmaps: Change bitmaps from unsigned char back to the X11
+ compatible char. Avoid the old compiler warnings about
+ out-of-range initializers by using, for example, '\xab' rather
+ than 0xab.
+
+ * xgselect.c (xgselect_initialize): Check vs interface
+ even if ! (defined (USE_GTK) || defined (HAVE_GCONF)).
+
+ * xmenu.c (xmenu_show): Rename parm to avoid shadowing.
+
+ * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers
+ to read-only memory.
+
+ * fns.c (vector): Remove; this old hack is no longer needed.
+
+ * xsmfns.c (create_client_leader_window): Rename shadowing arg.
+ Remove unused var.
+ (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define.
+
+ * xrdb.c (x_load_resources): Omit unused local.
+
+ * xfns.c (free_frame_menubar, atof): Remove duplicate decls.
+ (x_window): Rename locals to avoid shadowing.
+ (USG): Use the kludged USG macro, to pacify gcc.
+
+ * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused.
+ (x_term_init): Remove local to avoid shadowing.
+
+ * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl.
+
+ * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if
+ USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then.
+
2011-04-16 Eli Zaretskii <eliz@gnu.org>
* gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'.
diff --git a/src/alloc.c b/src/alloc.c
index 16cd183aaa1..412527b41a0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -139,10 +139,6 @@ static pthread_mutex_t alloc_mutex;
#endif /* ! defined HAVE_GTK_AND_PTHREAD */
#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
-/* Value of _bytes_used, when spare_memory was freed. */
-
-static __malloc_size_t bytes_used_when_full;
-
/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
to a struct Lisp_String. */
@@ -198,9 +194,11 @@ static int total_free_floats, total_floats;
static char *spare_memory[7];
+#ifndef SYSTEM_MALLOC
/* Amount of spare memory to keep in large reserve block. */
#define SPARE_MEMORY (1 << 14)
+#endif
/* Number of extra blocks malloc should get when it needs more core. */
@@ -469,13 +467,6 @@ display_malloc_warning (void)
intern ("emergency"));
pending_malloc_warning = 0;
}
-
-
-#ifdef DOUG_LEA_MALLOC
-# define BYTES_USED (mallinfo ().uordblks)
-#else
-# define BYTES_USED _bytes_used
-#endif
/* Called if we can't allocate relocatable space for a buffer. */
@@ -1096,8 +1087,18 @@ static void * (*old_malloc_hook) (size_t, const void *);
static void * (*old_realloc_hook) (void *, size_t, const void*);
static void (*old_free_hook) (void*, const void*);
+#ifdef DOUG_LEA_MALLOC
+# define BYTES_USED (mallinfo ().uordblks)
+#else
+# define BYTES_USED _bytes_used
+#endif
+
static __malloc_size_t bytes_used_when_reconsidered;
+/* Value of _bytes_used, when spare_memory was freed. */
+
+static __malloc_size_t bytes_used_when_full;
+
/* This function is used as the hook for free to call. */
static void
@@ -3296,7 +3297,7 @@ memory_full (void)
/* Record the space now used. When it decreases substantially,
we can refill the memory reserve. */
-#ifndef SYSTEM_MALLOC
+#if !defined SYSTEM_MALLOC && !defined SYNC_INPUT
bytes_used_when_full = BYTES_USED;
#endif
diff --git a/src/bitmaps/cntrpmsk.xbm b/src/bitmaps/cntrpmsk.xbm
index 1eeebc4e896..828830fcde1 100644
--- a/src/bitmaps/cntrpmsk.xbm
+++ b/src/bitmaps/cntrpmsk.xbm
@@ -1,6 +1,6 @@
#define cntr_ptrmsk_width 16
#define cntr_ptrmsk_height 16
-static unsigned char cntr_ptrmsk_bits[] = {
- 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f,
- 0xf8, 0x1f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xdc, 0x3b,
- 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03};
+static char cntr_ptrmsk_bits[] = {
+ '\xc0','\x03','\xc0','\x03','\xe0','\x07','\xe0','\x07','\xf0','\x0f','\xf0','\x0f',
+ '\xf8','\x1f','\xf8','\x1f','\xfc','\x3f','\xfc','\x3f','\xfc','\x3f','\xdc','\x3b',
+ '\xc0','\x03','\xc0','\x03','\xc0','\x03','\xc0','\x03'};
diff --git a/src/bitmaps/cntrptr.xbm b/src/bitmaps/cntrptr.xbm
index 545442cc4f4..ee3b606b3a5 100644
--- a/src/bitmaps/cntrptr.xbm
+++ b/src/bitmaps/cntrptr.xbm
@@ -2,7 +2,7 @@
#define cntr_ptr_height 16
#define cntr_ptr_x_hot 7
#define cntr_ptr_y_hot 1
-static unsigned char cntr_ptr_bits[] = {
- 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07,
- 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0x98, 0x19, 0x88, 0x11, 0x80, 0x01,
- 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00};
+static char cntr_ptr_bits[] = {
+ '\x00','\x00','\x80','\x01','\x80','\x01','\xc0','\x03','\xc0','\x03','\xe0','\x07',
+ '\xe0','\x07','\xf0','\x0f','\xf0','\x0f','\x98','\x19','\x88','\x11','\x80','\x01',
+ '\x80','\x01','\x80','\x01','\x80','\x01','\x00','\x00'};
diff --git a/src/bitmaps/crosswv.xbm b/src/bitmaps/crosswv.xbm
index 45ffbb48bda..ccf2d110887 100644
--- a/src/bitmaps/crosswv.xbm
+++ b/src/bitmaps/crosswv.xbm
@@ -1,6 +1,6 @@
#define cross_weave_width 16
#define cross_weave_height 16
-static unsigned char cross_weave_bits[] = {
- 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88,
- 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22,
- 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22};
+static char cross_weave_bits[] = {
+ '\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88',
+ '\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22',
+ '\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22'};
diff --git a/src/bitmaps/dimple1.xbm b/src/bitmaps/dimple1.xbm
index c1a36e5c91b..6db190e431f 100644
--- a/src/bitmaps/dimple1.xbm
+++ b/src/bitmaps/dimple1.xbm
@@ -1,6 +1,6 @@
#define dimple1_width 16
#define dimple1_height 16
-static unsigned char dimple1_bits[] = {
- 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
- 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
- 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00};
+static char dimple1_bits[] = {
+ '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00',
+ '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00',
+ '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00'};
diff --git a/src/bitmaps/dimple3.xbm b/src/bitmaps/dimple3.xbm
index 25eb294beac..521ac8e5be2 100644
--- a/src/bitmaps/dimple3.xbm
+++ b/src/bitmaps/dimple3.xbm
@@ -1,6 +1,6 @@
#define dimple3_width 16
#define dimple3_height 16
-static unsigned char dimple3_bits[] = {
- 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static char dimple3_bits[] = {
+ '\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00',
+ '\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00',
+ '\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00'};
diff --git a/src/bitmaps/gray.xbm b/src/bitmaps/gray.xbm
index dc7327e5c1a..ec471219011 100644
--- a/src/bitmaps/gray.xbm
+++ b/src/bitmaps/gray.xbm
@@ -1,4 +1,4 @@
#define gray_width 2
#define gray_height 2
static char gray_bits[] = {
- 0x01, 0x02};
+ '\x01','\x02'};
diff --git a/src/bitmaps/gray1.xbm b/src/bitmaps/gray1.xbm
index 186ea2233c6..19ee0e7b44a 100644
--- a/src/bitmaps/gray1.xbm
+++ b/src/bitmaps/gray1.xbm
@@ -1,4 +1,4 @@
#define gray1_width 2
#define gray1_height 2
-static unsigned char gray1_bits[] = {
- 0x01, 0x02};
+static char gray1_bits[] = {
+ '\x01','\x02'};
diff --git a/src/bitmaps/gray3.xbm b/src/bitmaps/gray3.xbm
index 0356c8dab5c..3af2a9c58a0 100644
--- a/src/bitmaps/gray3.xbm
+++ b/src/bitmaps/gray3.xbm
@@ -1,4 +1,4 @@
#define gray3_width 4
#define gray3_height 4
-static unsigned char gray3_bits[] = {
- 0x01, 0x00, 0x04, 0x00};
+static char gray3_bits[] = {
+ '\x01','\x00','\x04','\x00'};
diff --git a/src/bitmaps/leftpmsk.xbm b/src/bitmaps/leftpmsk.xbm
index 722abe63f15..f34c1edf7fd 100644
--- a/src/bitmaps/leftpmsk.xbm
+++ b/src/bitmaps/leftpmsk.xbm
@@ -1,6 +1,6 @@
#define left_ptrmsk_width 16
#define left_ptrmsk_height 16
-static unsigned char left_ptrmsk_bits[] = {
- 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0xfc, 0x00, 0xfc, 0x01,
- 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x01, 0xdc, 0x03,
- 0xcc, 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x03};
+static char left_ptrmsk_bits[] = {
+ '\x0c','\x00','\x1c','\x00','\x3c','\x00','\x7c','\x00','\xfc','\x00','\xfc','\x01',
+ '\xfc','\x03','\xfc','\x07','\xfc','\x0f','\xfc','\x0f','\xfc','\x01','\xdc','\x03',
+ '\xcc','\x03','\x80','\x07','\x80','\x07','\x00','\x03'};
diff --git a/src/bitmaps/leftptr.xbm b/src/bitmaps/leftptr.xbm
index 8a3e0d5aa4f..572f3acf578 100644
--- a/src/bitmaps/leftptr.xbm
+++ b/src/bitmaps/leftptr.xbm
@@ -2,7 +2,7 @@
#define left_ptr_height 16
#define left_ptr_x_hot 3
#define left_ptr_y_hot 1
-static unsigned char left_ptr_bits[] = {
- 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00,
- 0xf8, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x00, 0xd8, 0x00, 0x88, 0x01,
- 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00};
+static char left_ptr_bits[] = {
+ '\x00','\x00','\x08','\x00','\x18','\x00','\x38','\x00','\x78','\x00','\xf8','\x00',
+ '\xf8','\x01','\xf8','\x03','\xf8','\x07','\xf8','\x00','\xd8','\x00','\x88','\x01',
+ '\x80','\x01','\x00','\x03','\x00','\x03','\x00','\x00'};
diff --git a/src/bitmaps/rtpmsk.xbm b/src/bitmaps/rtpmsk.xbm
index 28e83f21430..ba4b399fda9 100644
--- a/src/bitmaps/rtpmsk.xbm
+++ b/src/bitmaps/rtpmsk.xbm
@@ -1,6 +1,6 @@
#define right_ptrmsk_width 16
#define right_ptrmsk_height 16
-static unsigned char right_ptrmsk_bits[] = {
- 0x00, 0x30, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0x3f,
- 0xc0, 0x3f, 0xe0, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0x80, 0x3f, 0xc0, 0x3b,
- 0xc0, 0x33, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00};
+static char right_ptrmsk_bits[] = {
+ '\x00','\x30','\x00','\x38','\x00','\x3c','\x00','\x3e','\x00','\x3f','\x80','\x3f',
+ '\xc0','\x3f','\xe0','\x3f','\xf0','\x3f','\xf0','\x3f','\x80','\x3f','\xc0','\x3b',
+ '\xc0','\x33','\xe0','\x01','\xe0','\x01','\xc0','\x00'};
diff --git a/src/bitmaps/rtptr.xbm b/src/bitmaps/rtptr.xbm
index a8a63806d46..4e71cdf9993 100644
--- a/src/bitmaps/rtptr.xbm
+++ b/src/bitmaps/rtptr.xbm
@@ -2,7 +2,7 @@
#define right_ptr_height 16
#define right_ptr_x_hot 12
#define right_ptr_y_hot 1
-static unsigned char right_ptr_bits[] = {
- 0x00, 0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x1f,
- 0x80, 0x1f, 0xc0, 0x1f, 0xe0, 0x1f, 0x00, 0x1f, 0x00, 0x1b, 0x80, 0x11,
- 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00};
+static char right_ptr_bits[] = {
+ '\x00','\x00','\x00','\x10','\x00','\x18','\x00','\x1c','\x00','\x1e','\x00','\x1f',
+ '\x80','\x1f','\xc0','\x1f','\xe0','\x1f','\x00','\x1f','\x00','\x1b','\x80','\x11',
+ '\x80','\x01','\xc0','\x00','\xc0','\x00','\x00','\x00'};
diff --git a/src/bitmaps/stipple.xbm b/src/bitmaps/stipple.xbm
index 2e5b9411701..5a25ba29a67 100644
--- a/src/bitmaps/stipple.xbm
+++ b/src/bitmaps/stipple.xbm
@@ -1,4 +1,4 @@
#define stipple_width 16
#define stipple_height 4
-static unsigned char stipple_bits[] = {
- 0x55, 0x55, 0xee, 0xee, 0x55, 0x55, 0xba, 0xbb};
+static char stipple_bits[] = {
+ '\x55','\x55','\xee','\xee','\x55','\x55','\xba','\xbb'};
diff --git a/src/data.c b/src/data.c
index 956ff3700f2..c9250a67bf0 100644
--- a/src/data.c
+++ b/src/data.c
@@ -3305,6 +3305,10 @@ syms_of_data (void)
XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
}
+#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
+static void arith_error (int) NO_RETURN;
+#endif
+
static void
arith_error (int signo)
{
diff --git a/src/dispextern.h b/src/dispextern.h
index 840a27ebc62..d00eeae2b19 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2650,9 +2650,9 @@ struct redisplay_interface
int cursor_type, int cursor_width,
int on_p, int active_p);
-/* Draw vertical border for window W from (X,Y0) to (X,Y1). */
+/* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */
void (*draw_vertical_window_border) (struct window *w,
- int x, int y0, int y1);
+ int x, int y_0, int y_1);
/* Shift display of frame F to make room for inserted glyphs.
The area at pixel (X,Y) of width WIDTH and height HEIGHT is
@@ -2953,6 +2953,9 @@ int line_bottom_y (struct it *);
int display_prop_intangible_p (Lisp_Object);
void resize_echo_area_exactly (void);
int resize_mini_window (struct window *, int);
+#if defined USE_TOOLKIT_SCROLL_BARS && !defined USE_GTK
+void set_vertical_scroll_bar (struct window *);
+#endif
int try_window (Lisp_Object, struct text_pos, int);
void window_box (struct window *, int, int *, int *, int *, int *);
int window_box_height (struct window *);
diff --git a/src/emacs.c b/src/emacs.c
index cccd07417e1..0a132e156a0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -164,10 +164,6 @@ static void *my_heap_start;
/* The gap between BSS end and heap start as far as we can tell. */
static unsigned long heap_bss_diff;
-/* If the gap between BSS end and heap start is larger than this
- output a warning in dump-emacs. */
-#define MAX_HEAP_BSS_DIFF (1024*1024)
-
/* Nonzero means running Emacs without interactive terminal. */
int noninteractive;
@@ -2100,7 +2096,6 @@ This is used in the file `loadup.el' when building Emacs.
You must run Emacs in batch mode in order to dump it. */)
(Lisp_Object filename, Lisp_Object symfile)
{
- extern char my_edata[];
Lisp_Object tem;
Lisp_Object symbol;
int count = SPECPDL_INDEX ();
@@ -2111,6 +2106,10 @@ You must run Emacs in batch mode in order to dump it. */)
error ("Dumping Emacs works only in batch mode");
#ifdef GNU_LINUX
+
+ /* Warn if the gap between BSS end and heap start is larger than this. */
+# define MAX_HEAP_BSS_DIFF (1024*1024)
+
if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
{
fprintf (stderr, "**************************************************\n");
@@ -2157,7 +2156,10 @@ You must run Emacs in batch mode in order to dump it. */)
#ifndef WINDOWSNT
/* On Windows, this was done before dumping, and that once suffices.
Meanwhile, my_edata is not valid on Windows. */
- memory_warnings (my_edata, malloc_warning);
+ {
+ extern char my_edata[];
+ memory_warnings (my_edata, malloc_warning);
+ }
#endif /* not WINDOWSNT */
#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
/* Pthread may call malloc before main, and then we will get an endless
diff --git a/src/eval.c b/src/eval.c
index c068f5f3fbf..b843ca5b2ec 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <limits.h>
#include <setjmp.h>
+#include <stdio.h>
#include "lisp.h"
#include "blockinput.h"
#include "commands.h"
diff --git a/src/fns.c b/src/fns.c
index d3009775b81..c057f64469c 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -23,11 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <time.h>
#include <setjmp.h>
-/* Note on some machines this defines `vector' as a typedef,
- so make sure we don't use that name in this file. */
-#undef vector
-#define vector *****
-
#include "lisp.h"
#include "commands.h"
#include "character.h"
diff --git a/src/frame.c b/src/frame.c
index cafcd149503..9024a2fb5e2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3845,6 +3845,31 @@ display_x_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, Lisp_Objec
attribute, class, component, subclass);
}
+#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
+/* Used when C code wants a resource value. */
+/* Called from oldXMenu/Create.c. */
+char *
+x_get_resource_string (const char *attribute, const char *class)
+{
+ char *name_key;
+ char *class_key;
+ struct frame *sf = SELECTED_FRAME ();
+
+ /* Allocate space for the components, the dots which separate them,
+ and the final '\0'. */
+ name_key = (char *) alloca (SBYTES (Vinvocation_name)
+ + strlen (attribute) + 2);
+ class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
+ + strlen (class) + 2);
+
+ sprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute);
+ sprintf (class_key, "%s.%s", EMACS_CLASS, class);
+
+ return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb,
+ name_key, class_key);
+}
+#endif
+
/* Return the value of parameter PARAM.
First search ALIST, then Vdefault_frame_alist, then the X defaults
diff --git a/src/frame.h b/src/frame.h
index 1f176f6f900..944a3270ae5 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1133,6 +1133,10 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
Lisp_Object component,
Lisp_Object subclass);
+#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
+extern char *x_get_resource_string (const char *, const char *);
+#endif
+
/* In xmenu.c */
extern void set_frame_menubar (FRAME_PTR, int, int);
diff --git a/src/insdel.c b/src/insdel.c
index 82dce13af98..5ecb01c9538 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -442,6 +442,7 @@ make_gap_larger (EMACS_INT nbytes_added)
Vinhibit_quit = tem;
}
+#if defined USE_MMAP_FOR_BUFFERS || defined REL_ALLOC || defined DOUG_LEA_MALLOC
/* Make the gap NBYTES_REMOVED bytes shorter. */
@@ -501,6 +502,8 @@ make_gap_smaller (EMACS_INT nbytes_removed)
Vinhibit_quit = tem;
}
+#endif /* USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC */
+
void
make_gap (EMACS_INT nbytes_added)
{
diff --git a/src/keyboard.c b/src/keyboard.c
index c0c53c82714..c601649ebca 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2259,7 +2259,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
volatile Lisp_Object also_record;
volatile int reread;
struct gcpro gcpro1, gcpro2;
- int polling_stopped_here = 0;
+ int volatile polling_stopped_here = 0;
struct kboard *orig_kboard = current_kboard;
also_record = Qnil;
@@ -5455,7 +5455,6 @@ make_lispy_event (struct input_event *event)
&& (event->modifiers & down_modifier))
{
Lisp_Object items, item;
- int i;
/* Find the menu bar item under `column'. */
item = Qnil;
diff --git a/src/menu.c b/src/menu.c
index 3bfb74863ae..f637b92679a 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -180,6 +180,9 @@ grow_menu_items (void)
menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
}
+#if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \
+ || defined HAVE_NTGUI)
+
/* Begin a submenu. */
static void
@@ -204,6 +207,8 @@ push_submenu_end (void)
menu_items_submenu_depth--;
}
+#endif /* USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI */
+
/* Indicate boundary between left and right. */
static void
@@ -368,34 +373,34 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
if (skp->notbuttons)
/* The first button. Line up previous items in this menu. */
{
- int index = skp->notbuttons; /* Index for first item this menu. */
+ int idx = skp->notbuttons; /* Index for first item this menu. */
int submenu = 0;
Lisp_Object tem;
- while (index < menu_items_used)
+ while (idx < menu_items_used)
{
tem
- = XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME];
+ = XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME];
if (NILP (tem))
{
- index++;
+ idx++;
submenu++; /* Skip sub menu. */
}
else if (EQ (tem, Qlambda))
{
- index++;
+ idx++;
submenu--; /* End sub menu. */
}
else if (EQ (tem, Qt))
- index += 3; /* Skip new pane marker. */
+ idx += 3; /* Skip new pane marker. */
else if (EQ (tem, Qquote))
- index++; /* Skip a left, right divider. */
+ idx++; /* Skip a left, right divider. */
else
{
if (!submenu && SREF (tem, 0) != '\0'
&& SREF (tem, 0) != '-')
- XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME]
+ XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME]
= concat2 (build_string (" "), tem);
- index += MENU_ITEMS_ITEM_LENGTH;
+ idx += MENU_ITEMS_ITEM_LENGTH;
}
}
skp->notbuttons = 0;
diff --git a/src/process.c b/src/process.c
index c9c6ab6d4b3..d8851c56cf0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -237,7 +237,9 @@ static int process_output_skip;
static Lisp_Object Fget_process (Lisp_Object);
static void create_process (Lisp_Object, char **, Lisp_Object);
+#ifdef SIGIO
static int keyboard_bit_set (SELECT_TYPE *);
+#endif
static void deactivate_process (Lisp_Object);
static void status_notify (struct Lisp_Process *);
static int read_process_output (Lisp_Object, int);
@@ -5220,6 +5222,10 @@ read_process_output (Lisp_Object proc, register int channel)
static jmp_buf send_process_frame;
static Lisp_Object process_sent_to;
+#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
+static void send_process_trap (int) NO_RETURN;
+#endif
+
static void
send_process_trap (int ignore)
{
@@ -5360,6 +5366,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
when returning with longjmp despite being declared volatile. */
if (!setjmp (send_process_frame))
{
+ p = XPROCESS (proc); /* Repair any setjmp clobbering. */
+
process_sent_to = proc;
while (len > 0)
{
@@ -6583,6 +6591,8 @@ delete_gpm_wait_descriptor (int desc)
delete_keyboard_wait_descriptor (desc);
}
+# ifdef SIGIO
+
/* Return nonzero if *MASK has a bit set
that corresponds to one of the keyboard input descriptors. */
@@ -6598,6 +6608,7 @@ keyboard_bit_set (fd_set *mask)
return 0;
}
+# endif
#else /* not subprocesses */
diff --git a/src/s/sol2-6.h b/src/s/sol2-6.h
index 4c6fd3e2f9b..3d9bd6ddafc 100644
--- a/src/s/sol2-6.h
+++ b/src/s/sol2-6.h
@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define PTY_TTY_NAME_SPRINTF \
{ \
- char *ptsname (), *ptyname; \
+ char *ptsname (int), *ptyname; \
\
sigblock (sigmask (SIGCLD)); \
if (grantpt (fd) == -1) \
@@ -60,4 +60,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define GC_SETJMP_WORKS 1
#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-
diff --git a/src/s/unixware.h b/src/s/unixware.h
index 407282ff78c..8fe28625dd4 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -35,7 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
within, it should be caught after sigrelse(2). */
#define PTY_TTY_NAME_SPRINTF \
{ \
- char *ptsname(), *ptyname; \
+ char *ptsname (int), *ptyname; \
\
sigblock(sigmask(SIGCLD)); \
if (grantpt(fd) == -1) \
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index 236f71e3007..e6d992d8f9c 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -88,11 +88,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Push various streams modules onto a PTY channel. */
#define SETUP_SLAVE_PTY \
if (ioctl (xforkin, I_PUSH, "ptem") == -1) \
- fatal ("ioctl I_PUSH ptem", errno); \
+ fatal ("ioctl I_PUSH ptem"); \
if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
- fatal ("ioctl I_PUSH ldterm", errno); \
+ fatal ("ioctl I_PUSH ldterm"); \
if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
- fatal ("ioctl I_PUSH ttcompat", errno);
+ fatal ("ioctl I_PUSH ttcompat");
/* This definition was suggested for next release. So give it a try. */
#define HAVE_SOCKETS
diff --git a/src/sysdep.c b/src/sysdep.c
index e01bc4b1fbc..45e80ac0155 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2966,6 +2966,8 @@ system_process_attributes (Lisp_Object pid)
#if PROCFS_FILE_OFFSET_BITS_HACK == 1
#define _FILE_OFFSET_BITS 64
+#ifdef _FILE_OFFSET_BITS /* Avoid unused-macro warnings. */
+#endif
#endif /* PROCFS_FILE_OFFSET_BITS_HACK == 1 */
Lisp_Object
diff --git a/src/termhooks.h b/src/termhooks.h
index 2f509009bd9..468381b69aa 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -465,7 +465,7 @@ struct terminal
enum scroll_bar_part *part,
Lisp_Object *x,
Lisp_Object *y,
- unsigned long *time);
+ unsigned long *);
/* The window system handling code should set this if the mouse has
moved since the last call to the mouse_position_hook. Calling that
@@ -484,10 +484,10 @@ struct terminal
support overlapping frames, so there's no need to raise or lower
anything.
- If RAISE is non-zero, F is brought to the front, before all other
- windows. If RAISE is zero, F is sent to the back, behind all other
+ If RAISE_FLAG is non-zero, F is brought to the front, before all other
+ windows. If RAISE_FLAG is zero, F is sent to the back, behind all other
windows. */
- void (*frame_raise_lower_hook) (struct frame *f, int raise);
+ void (*frame_raise_lower_hook) (struct frame *f, int raise_flag);
/* If the value of the frame parameter changed, whis hook is called.
For example, if going from fullscreen to not fullscreen this hook
diff --git a/src/xdisp.c b/src/xdisp.c
index 4f1830f4c6c..3c75a63f4e0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13630,7 +13630,10 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
return rc;
}
-static void
+#if !defined USE_TOOLKIT_SCROLL_BARS || defined USE_GTK
+static
+#endif
+void
set_vertical_scroll_bar (struct window *w)
{
EMACS_INT start, end, whole;
@@ -22709,7 +22712,7 @@ x_produce_glyphs (struct it *it)
int lbearing, rbearing;
int i, width, ascent, descent;
int left_padded = 0, right_padded = 0;
- int c;
+ int c IF_LINT (= 0); /* cmp->glyph_len can't be zero; see Bug#8512 */
XChar2b char2b;
struct font_metrics *pcm;
int font_not_found_p;
diff --git a/src/xfaces.c b/src/xfaces.c
index 5cfe99d1285..fbed183522a 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -273,6 +273,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <X11/Xos.h>
#define USG
#define __TIMEVAL__
+#if defined USG || defined __TIMEVAL__ /* Don't warn about unused macros. */
+#endif
#else /* not XOS_NEEDS_TIME_H */
#include <X11/Xos.h>
#endif /* not XOS_NEEDS_TIME_H */
diff --git a/src/xfns.c b/src/xfns.c
index 290b6161215..51aca3e9670 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -83,6 +83,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#undef USG /* ####KLUDGE for Solaris 2.2 and up */
#include <X11/Xos.h>
#define USG
+#ifdef USG /* Pacify gcc -Wunused-macros. */
+#endif
#else
#include <X11/Xos.h>
#endif
@@ -105,16 +107,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#if !defined(NO_EDITRES)
#define HACK_EDITRES
-extern void _XEditResCheckMessages ();
+extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
#endif /* not defined NO_EDITRES */
/* Unique id counter for widgets created by the Lucid Widget Library. */
extern LWLIB_ID widget_id_tick;
-extern void free_frame_menubar ();
-extern double atof ();
-
#ifdef USE_MOTIF
#endif /* USE_MOTIF */
@@ -428,7 +427,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
void
x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
{
- int win_x, win_y, outer_x, outer_y;
+ int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
int real_x = 0, real_y = 0;
int had_errors = 0;
Window win = f->output_data.x->parent_desc;
@@ -2430,8 +2429,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
{
int len;
char *tem, shell_position[32];
- Arg al[10];
- int ac = 0;
+ Arg gal[10];
+ int gac = 0;
int extra_borders = 0;
int menubar_size
= (f->output_data.x->menubar_widget
@@ -2492,8 +2491,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
If Emacs had just one program position, we could set it in
fallback resources, but since each make-frame call can specify
different program positions, this is easier. */
- XtSetArg (al[ac], XtNx, left); ac++;
- XtSetArg (al[ac], XtNy, top); ac++;
+ XtSetArg (gal[gac], XtNx, left); gac++;
+ XtSetArg (gal[gac], XtNy, top); gac++;
}
}
@@ -2504,8 +2503,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
when the frame is deleted. */
tem = (char *) xmalloc (len);
strncpy (tem, shell_position, len);
- XtSetArg (al[ac], XtNgeometry, tem); ac++;
- XtSetValues (shell_widget, al, ac);
+ XtSetArg (gal[gac], XtNgeometry, tem); gac++;
+ XtSetValues (shell_widget, gal, gac);
}
XtManageChild (pane_widget);
@@ -5206,7 +5205,6 @@ Value is t if tooltip was open, nil otherwise. */)
int count;
Lisp_Object deleted, frame, timer;
struct gcpro gcpro1, gcpro2;
- struct frame *f;
/* Return quickly if nothing to do. */
if (NILP (tip_timer) && NILP (tip_frame))
@@ -5225,11 +5223,13 @@ Value is t if tooltip was open, nil otherwise. */)
call1 (Qcancel_timer, timer);
#ifdef USE_GTK
- /* When using system tooltip, tip_frame is the Emacs frame on which
- the tip is shown. */
- f = XFRAME (frame);
- if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
- frame = Qnil;
+ {
+ /* When using system tooltip, tip_frame is the Emacs frame on which
+ the tip is shown. */
+ struct frame *f = XFRAME (frame);
+ if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
+ frame = Qnil;
+ }
#endif
if (FRAMEP (frame))
@@ -5243,7 +5243,7 @@ Value is t if tooltip was open, nil otherwise. */)
items is unmapped. Redisplay the menu manually... */
{
Widget w;
- f = SELECTED_FRAME ();
+ struct frame *f = SELECTED_FRAME ();
w = f->output_data.x->menubar_widget;
if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
@@ -5462,12 +5462,12 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
/* Get the result. */
if (result == XmCR_OK)
{
- XmString text;
+ XmString text_string;
String data;
- XtVaGetValues (dialog, XmNtextString, &text, NULL);
- XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data);
- XmStringFree (text);
+ XtVaGetValues (dialog, XmNtextString, &text_string, NULL);
+ XmStringGetLtoR (text_string, XmFONTLIST_DEFAULT_TAG, &data);
+ XmStringFree (text_string);
file = build_string (data);
XtFree (data);
}
diff --git a/src/xgselect.c b/src/xgselect.c
index 96d763ff088..0d154f6496a 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -19,11 +19,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
+#include <setjmp.h>
+#include "xgselect.h"
+
#if defined (USE_GTK) || defined (HAVE_GCONF)
+
#include <glib.h>
#include <errno.h>
#include <setjmp.h>
-#include "xgselect.h"
static GPollFD *gfds;
static int gfds_size;
diff --git a/src/xmenu.c b/src/xmenu.c
index 6e84b845a46..938e5696b21 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -108,7 +108,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef TRUE
#define TRUE 1
-#define FALSE 0
#endif /* no TRUE */
static Lisp_Object Qdebug_on_next_call;
@@ -117,8 +116,6 @@ static Lisp_Object Qdebug_on_next_call;
static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
const char **);
#endif
-
-static int update_frame_menubar (struct frame *);
/* Flag which when set indicates a dialog or menu has been posted by
Xt on behalf of one of the widget sets. */
@@ -2185,7 +2182,7 @@ static struct frame *menu_help_frame;
keyboard events. */
static void
-menu_help_callback (char *help_string, int pane, int item)
+menu_help_callback (char const *help_string, int pane, int item)
{
Lisp_Object *first_item;
Lisp_Object pane_name;
@@ -2245,7 +2242,7 @@ pop_down_menu (Lisp_Object arg)
Lisp_Object
xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
- Lisp_Object title, const char **error, EMACS_UINT timestamp)
+ Lisp_Object title, const char **error_name, EMACS_UINT timestamp)
{
Window root;
XMenu *menu;
@@ -2263,13 +2260,13 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
abort ();
- *error = 0;
+ *error_name = 0;
if (menu_items_n_panes == 0)
return Qnil;
if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
{
- *error = "Empty menu";
+ *error_name = "Empty menu";
return Qnil;
}
@@ -2282,7 +2279,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
menu = XMenuCreate (FRAME_X_DISPLAY (f), root, "emacs");
if (menu == NULL)
{
- *error = "Can't create menu";
+ *error_name = "Can't create menu";
return Qnil;
}
@@ -2302,7 +2299,8 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
y += f->top_pos;
/* Create all the necessary panes and their items. */
- maxlines = lines = i = 0;
+ maxwidth = maxlines = lines = i = 0;
+ lpane = XM_FAILURE;
while (i < menu_items_used)
{
if (EQ (XVECTOR (menu_items)->contents[i], Qt))
@@ -2324,13 +2322,12 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
if (lpane == XM_FAILURE)
{
XMenuDestroy (FRAME_X_DISPLAY (f), menu);
- *error = "Can't create pane";
+ *error_name = "Can't create pane";
return Qnil;
}
i += MENU_ITEMS_PANE_LENGTH;
/* Find the width of the widest item in this pane. */
- maxwidth = 0;
j = i;
while (j < menu_items_used)
{
@@ -2358,40 +2355,38 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
{
/* Create a new item within current pane. */
Lisp_Object item_name, enable, descrip, help;
- unsigned char *item_data;
- char *help_string;
+ char *item_data;
+ char const *help_string;
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
descrip
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
- help_string = STRINGP (help) ? SDATA (help) : NULL;
+ help_string = STRINGP (help) ? SSDATA (help) : NULL;
if (!NILP (descrip))
{
- int gap = maxwidth - SBYTES (item_name);
/* if alloca is fast, use that to make the space,
to reduce gc needs. */
- item_data
- = (unsigned char *) alloca (maxwidth
- + SBYTES (descrip) + 1);
- memcpy (item_data, SDATA (item_name), SBYTES (item_name));
+ item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1);
+ memcpy (item_data, SSDATA (item_name), SBYTES (item_name));
for (j = SCHARS (item_name); j < maxwidth; j++)
item_data[j] = ' ';
- memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
+ memcpy (item_data + j, SSDATA (descrip), SBYTES (descrip));
item_data[j + SBYTES (descrip)] = 0;
}
else
- item_data = SDATA (item_name);
+ item_data = SSDATA (item_name);
- if (XMenuAddSelection (FRAME_X_DISPLAY (f),
- menu, lpane, 0, item_data,
- !NILP (enable), help_string)
- == XM_FAILURE)
+ if (lpane == XM_FAILURE
+ || (XMenuAddSelection (FRAME_X_DISPLAY (f),
+ menu, lpane, 0, item_data,
+ !NILP (enable), help_string)
+ == XM_FAILURE))
{
XMenuDestroy (FRAME_X_DISPLAY (f), menu);
- *error = "Can't add selection to menu";
+ *error_name = "Can't add selection to menu";
return Qnil;
}
i += MENU_ITEMS_ITEM_LENGTH;
@@ -2468,6 +2463,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
x, y, ButtonReleaseMask, &datap,
menu_help_callback);
+ entry = pane_prefix = Qnil;
switch (status)
{
@@ -2512,16 +2508,14 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
break;
case XM_FAILURE:
- *error = "Can't activate menu";
+ *error_name = "Can't activate menu";
case XM_IA_SELECT:
- entry = Qnil;
break;
case XM_NO_SELECT:
/* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means
the menu was invoked with a mouse event as POSITION). */
if (! for_click)
Fsignal (Qquit, Qnil);
- entry = Qnil;
break;
}
diff --git a/src/xrdb.c b/src/xrdb.c
index d350f38a8c4..b01e344edf2 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -479,7 +479,9 @@ x_load_resources (Display *display, const char *xrm_string,
XrmDatabase db;
char line[256];
+#if defined USE_MOTIF || !defined HAVE_XFT || !defined USE_LUCID
const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
+#endif
#ifdef USE_MOTIF
const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
diff --git a/src/xsmfns.c b/src/xsmfns.c
index f3879dbcec0..c199036587f 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -41,8 +41,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "process.h"
#include "keyboard.h"
-#ifndef HAVE_GTK3
-#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w)
+#if defined USE_GTK && !defined HAVE_GTK3
+#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w)
#endif
/* This is the event used when SAVE_SESSION_EVENT occurs. */
@@ -250,7 +250,7 @@ smc_save_yourself_CB (SmcConn smcConn,
props[props_idx]->vals[vp_idx++].value = chdir_opt;
}
- for (i = 1; i < initial_argc; ++i)
+ for (i = 1; i < initial_argc; ++i)
{
props[props_idx]->vals[vp_idx].length = strlen (initial_argv[i]);
props[props_idx]->vals[vp_idx++].value = initial_argv[i];
@@ -365,11 +365,10 @@ ice_conn_watch_CB (IceConn iceConn, IcePointer clientData,
#ifndef USE_GTK
static void
-create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
+create_client_leader_window (struct x_display_info *dpyinfo, char *client_ID)
{
Window w;
XClassHint class_hints;
- Atom sm_id;
w = XCreateSimpleWindow (dpyinfo->display,
dpyinfo->root_window,
@@ -383,7 +382,7 @@ create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID,
XA_STRING, 8, PropModeReplace,
- (unsigned char *)client_id, strlen (client_id));
+ (unsigned char *) client_ID, strlen (client_ID));
dpyinfo->client_leader_window = w;
}
diff --git a/src/xterm.c b/src/xterm.c
index bc847388756..a44313d0a56 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -102,7 +102,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef USE_X_TOOLKIT
#if !defined(NO_EDITRES)
#define HACK_EDITRES
-extern void _XEditResCheckMessages ();
+extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
#endif /* not NO_EDITRES */
/* Include toolkit specific headers for the scroll bar widget. */
@@ -187,11 +187,11 @@ static struct {
/* The application context for Xt use. */
XtAppContext Xt_app_con;
static String Xt_default_resources[] = {0};
-#endif /* USE_X_TOOLKIT */
/* Non-zero means user is interacting with a toolkit scroll bar. */
static int toolkit_scroll_bar_interaction;
+#endif /* USE_X_TOOLKIT */
/* Non-zero timeout value means ignore next mouse click if it arrives
before that timeout elapses (i.e. as part of the same sequence of
@@ -349,7 +349,7 @@ static void x_check_expected_move (struct frame *, int, int);
static void x_sync_with_move (struct frame *, int, int, int);
static int handle_one_xevent (struct x_display_info *, XEvent *,
int *, struct input_event *);
-#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
+#ifdef USE_GTK
static int x_dispatch_event (XEvent *, Display *);
#endif
/* Don't declare this NO_RETURN because we want no
@@ -1451,19 +1451,6 @@ x_frame_of_widget (Widget widget)
}
-/* Allocate the color COLOR->pixel on the screen and display of
- widget WIDGET in colormap CMAP. If an exact match cannot be
- allocated, try the nearest color available. Value is non-zero
- if successful. This is called from lwlib. */
-
-int
-x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color)
-{
- struct frame *f = x_frame_of_widget (widget);
- return x_alloc_nearest_color (f, cmap, color);
-}
-
-
/* Allocate a color which is lighter or darker than *PIXEL by FACTOR
or DELTA. Try a color with RGB values multiplied by FACTOR first.
If this produces the same color as PIXEL, try a color where all RGB
@@ -3459,6 +3446,16 @@ x_detect_focus_change (struct x_display_info *dpyinfo, XEvent *event, struct inp
}
+#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
+/* Handle an event saying the mouse has moved out of an Emacs frame. */
+
+void
+x_mouse_leave (struct x_display_info *dpyinfo)
+{
+ x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame);
+}
+#endif
+
/* The focus has changed, or we have redirected a frame's focus to
another frame (this happens when a frame uses a surrogate
mini-buffer frame). Shift the highlight as appropriate.
@@ -4221,8 +4218,8 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
ev->data.l[4] = (long) whole;
/* Make Xt timeouts work while the scroll bar is active. */
- toolkit_scroll_bar_interaction = 1;
#ifdef USE_X_TOOLKIT
+ toolkit_scroll_bar_interaction = 1;
x_activate_timeout_atimer ();
#endif
@@ -4535,7 +4532,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
Widget widget;
Arg av[20];
int ac = 0;
- char *scroll_bar_name = SCROLL_BAR_NAME;
+ char const *scroll_bar_name = SCROLL_BAR_NAME;
unsigned long pixel;
BLOCK_INPUT;
@@ -4687,8 +4684,8 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
f->output_data.x->edit_widget, av, ac);
{
- char *initial = "";
- char *val = initial;
+ char const *initial = "";
+ char const *val = initial;
XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val,
#ifdef XtNarrowScrollbars
XtNarrowScrollbars, (XtPointer) &xaw3d_arrow_scroll,
@@ -5668,6 +5665,7 @@ static struct x_display_info *XTread_socket_fake_io_error;
static struct x_display_info *next_noop_dpyinfo;
+#if defined USE_X_TOOLKIT || defined USE_GTK
#define SET_SAVED_BUTTON_EVENT \
do \
{ \
@@ -5679,6 +5677,7 @@ static struct x_display_info *next_noop_dpyinfo;
XSETFRAME (inev.ie.frame_or_window, f); \
} \
while (0)
+#endif
enum
{
@@ -5764,8 +5763,8 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data)
#endif /* USE_GTK */
-static void xembed_send_message (struct frame *f, Time time,
- enum xembed_message message,
+static void xembed_send_message (struct frame *f, Time,
+ enum xembed_message,
long detail, long data1, long data2);
/* Handles the XEvent EVENT on display DPYINFO.
@@ -6978,15 +6977,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
return count;
}
+#if defined USE_GTK || defined USE_X_TOOLKIT
/* Handles the XEvent EVENT on display DISPLAY.
This is used for event loops outside the normal event handling,
i.e. looping while a popup menu or a dialog is posted.
Returns the value handle_one_xevent sets in the finish argument. */
-#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
-static
-#endif
int
x_dispatch_event (XEvent *event, Display *display)
{
@@ -7000,6 +6997,7 @@ x_dispatch_event (XEvent *event, Display *display)
return finish;
}
+#endif
/* Read events coming from the X server.
@@ -10273,10 +10271,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
#ifdef USE_LUCID
{
- Display *dpy = dpyinfo->display;
XrmValue d, fr, to;
Font font;
+ dpy = dpyinfo->display;
d.addr = (XPointer)&dpy;
d.size = sizeof (Display *);
fr.addr = XtDefaultFont;
diff --git a/src/xterm.h b/src/xterm.h
index bd5cf2dbd31..fbd638fe73b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -982,11 +982,11 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
extern void x_query_colors (struct frame *f, XColor *, int);
extern void x_query_color (struct frame *f, XColor *);
extern void x_clear_area (Display *, Window, int, int, int, int, int);
-#ifdef WINDOWSNT
+#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
extern void x_mouse_leave (struct x_display_info *);
#endif
-#if defined USE_MOTIF || defined USE_X_TOOLKIT
+#ifdef USE_X_TOOLKIT
extern int x_dispatch_event (XEvent *, Display *);
#endif
extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *,