Commit ef1b0ba7 authored by Stefan Monnier's avatar Stefan Monnier

Minor clean up to silence some gcc warnings.

* src/window.c (Fset_window_buffer):
* src/xterm.c (x_set_frame_alpha): Restructure code to silence
compiler warning.
(handle_one_xevent): Remove unused var `p'.
(do_ewmh_fullscreen): Remove unused var `lval'.
(xembed_set_info): Remove unused var `atom'.
* src/textprop.c (Fremove_list_of_text_properties): Add braces to silence
compiler warning.
* src/fontset.c (fontset_id_valid_p, dump_fontset):
* src/ftfont.c (ftfont_drive_otf): Modernize k&r declaration.
* src/eval.c (Feval, Ffuncall): Avoid unneeded gotos.
* src/dispnew.c (update_frame, update_frame_1): Compile the `do_pause'
label only when it's used.
* src/image.c (x_create_bitmap_from_xpm_data):
* src/dispextern.h (x_create_bitmap_from_xpm_data): Use const char** like
its callers.
* src/coding.c (detect_coding_utf_16): Remove unused vars `src_base' and
`consumed_chars'.
(DECODE_EMACS_MULE_21_COMPOSITION): Remove unused var `charbuf_base'.
(decode_coding_emacs_mule): Remove unused label `retry'.
(detect_eol): Add parens to silence compiler warning.
* src/alloc.c (bytes_used_when_reconsidered): Move to the #ifdef where
it's used to silence the compiler.
(make_number): Modernize k&r declaration.
(mark_char_table): Add parens to silence compiler warning.
parent 45720dc3
This diff is collapsed.
......@@ -143,8 +143,6 @@ static pthread_mutex_t alloc_mutex;
static __malloc_size_t bytes_used_when_full;
static __malloc_size_t bytes_used_when_reconsidered;
/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
to a struct Lisp_String. */
......@@ -1140,6 +1138,8 @@ 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*);
static __malloc_size_t bytes_used_when_reconsidered;
/* This function is used as the hook for free to call. */
static void
......@@ -1491,8 +1491,7 @@ mark_interval_tree (register INTERVAL tree)
can't create number objects in macros. */
#ifndef make_number
Lisp_Object
make_number (n)
EMACS_INT n;
make_number (EMACS_INT n)
{
Lisp_Object obj;
obj.s.val = n;
......@@ -5270,7 +5269,7 @@ mark_char_table (struct Lisp_Vector *ptr)
{
Lisp_Object val = ptr->contents[i];
if (INTEGERP (val) || SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)
if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit))
continue;
if (SUB_CHAR_TABLE_P (val))
{
......
......@@ -1607,10 +1607,9 @@ static int
detect_coding_utf_16 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base = src;
const unsigned char *src = coding->source;
const unsigned char *src_end = coding->source + coding->src_bytes;
int multibytep = coding->src_multibyte;
int consumed_chars = 0;
int c1, c2;
detect_info->checked |= CATEGORY_MASK_UTF_16;
......@@ -2277,7 +2276,6 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
#define DECODE_EMACS_MULE_21_COMPOSITION() \
do { \
enum composition_method method = c - 0xF2; \
int *charbuf_base = charbuf; \
int nbytes, nchars; \
\
ONE_MORE_BYTE (c); \
......@@ -2633,7 +2631,6 @@ decode_coding_emacs_mule (struct coding_system *coding)
}
continue;
retry:
src = src_base;
consumed_chars = consumed_chars_base;
continue;
......@@ -6260,8 +6257,9 @@ detect_eol (const unsigned char *source, EMACS_INT src_bytes,
{
/* The found type is different from what found before.
Allow for stray ^M characters in DOS EOL files. */
if (eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF
|| eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR)
if ((eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF)
|| (eol_seen == EOL_SEEN_CRLF
&& this_eol == EOL_SEEN_CR))
eol_seen = EOL_SEEN_CRLF;
else
{
......@@ -6276,42 +6274,40 @@ detect_eol (const unsigned char *source, EMACS_INT src_bytes,
}
}
else
{
while (src < src_end)
{
c = *src++;
if (c == '\n' || c == '\r')
{
int this_eol;
while (src < src_end)
{
c = *src++;
if (c == '\n' || c == '\r')
{
int this_eol;
if (c == '\n')
this_eol = EOL_SEEN_LF;
else if (src >= src_end || *src != '\n')
this_eol = EOL_SEEN_CR;
else
this_eol = EOL_SEEN_CRLF, src++;
if (c == '\n')
this_eol = EOL_SEEN_LF;
else if (src >= src_end || *src != '\n')
this_eol = EOL_SEEN_CR;
else
this_eol = EOL_SEEN_CRLF, src++;
if (eol_seen == EOL_SEEN_NONE)
/* This is the first end-of-line. */
eol_seen = this_eol;
else if (eol_seen != this_eol)
{
/* The found type is different from what found before.
Allow for stray ^M characters in DOS EOL files. */
if (eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF
|| eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR)
eol_seen = EOL_SEEN_CRLF;
else
{
eol_seen = EOL_SEEN_LF;
break;
}
}
if (++total == MAX_EOL_CHECK_COUNT)
break;
}
}
}
if (eol_seen == EOL_SEEN_NONE)
/* This is the first end-of-line. */
eol_seen = this_eol;
else if (eol_seen != this_eol)
{
/* The found type is different from what found before.
Allow for stray ^M characters in DOS EOL files. */
if ((eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF)
|| (eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR))
eol_seen = EOL_SEEN_CRLF;
else
{
eol_seen = EOL_SEEN_LF;
break;
}
}
if (++total == MAX_EOL_CHECK_COUNT)
break;
}
}
return eol_seen;
}
......
......@@ -3131,7 +3131,7 @@ extern int x_create_bitmap_from_data (struct frame *, char *,
unsigned int, unsigned int);
extern int x_create_bitmap_from_file (struct frame *, Lisp_Object);
#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
extern int x_create_bitmap_from_xpm_data (struct frame *f, char **bits);
extern int x_create_bitmap_from_xpm_data (struct frame *f, const char **bits);
#endif
#ifndef x_destroy_bitmap
extern void x_destroy_bitmap (struct frame *, int);
......
......@@ -3447,7 +3447,9 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
#endif
}
#if PERIODIC_PREEMPTION_CHECKING
do_pause:
#endif
/* Reset flags indicating that a window should be updated. */
set_window_update_flags (root_window, 0);
......@@ -4908,7 +4910,9 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
}
}
#if !PERIODIC_PREEMPTION_CHECKING
do_pause:
#endif
clear_desired_matrices (f);
return pause;
......
......@@ -2291,14 +2291,12 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
(XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs)))
xsignal2 (Qwrong_number_of_arguments, original_fun, numargs);
if (XSUBR (fun)->max_args == UNEVALLED)
else if (XSUBR (fun)->max_args == UNEVALLED)
{
backtrace.evalargs = 0;
val = (XSUBR (fun)->function.aUNEVALLED) (args_left);
goto done;
}
if (XSUBR (fun)->max_args == MANY)
else if (XSUBR (fun)->max_args == MANY)
{
/* Pass a vector of evaluated arguments */
Lisp_Object *vals;
......@@ -2324,73 +2322,76 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals);
UNGCPRO;
SAFE_FREE ();
goto done;
}
GCPRO3 (args_left, fun, fun);
gcpro3.var = argvals;
gcpro3.nvars = 0;
maxargs = XSUBR (fun)->max_args;
for (i = 0; i < maxargs; args_left = Fcdr (args_left))
else
{
argvals[i] = Feval (Fcar (args_left));
gcpro3.nvars = ++i;
}
GCPRO3 (args_left, fun, fun);
gcpro3.var = argvals;
gcpro3.nvars = 0;
UNGCPRO;
maxargs = XSUBR (fun)->max_args;
for (i = 0; i < maxargs; args_left = Fcdr (args_left))
{
argvals[i] = Feval (Fcar (args_left));
gcpro3.nvars = ++i;
}
backtrace.args = argvals;
backtrace.nargs = XINT (numargs);
UNGCPRO;
switch (i)
{
case 0:
val = (XSUBR (fun)->function.a0) ();
goto done;
case 1:
val = (XSUBR (fun)->function.a1) (argvals[0]);
goto done;
case 2:
val = (XSUBR (fun)->function.a2) (argvals[0], argvals[1]);
goto done;
case 3:
val = (XSUBR (fun)->function.a3) (argvals[0], argvals[1],
argvals[2]);
goto done;
case 4:
val = (XSUBR (fun)->function.a4) (argvals[0], argvals[1],
argvals[2], argvals[3]);
goto done;
case 5:
val = (XSUBR (fun)->function.a5) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4]);
goto done;
case 6:
val = (XSUBR (fun)->function.a6) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5]);
goto done;
case 7:
val = (XSUBR (fun)->function.a7) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5],
argvals[6]);
goto done;
case 8:
val = (XSUBR (fun)->function.a8) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5],
argvals[6], argvals[7]);
goto done;
default:
/* Someone has created a subr that takes more arguments than
is supported by this code. We need to either rewrite the
subr to use a different argument protocol, or add more
cases to this switch. */
abort ();
backtrace.args = argvals;
backtrace.nargs = XINT (numargs);
switch (i)
{
case 0:
val = (XSUBR (fun)->function.a0 ());
break;
case 1:
val = (XSUBR (fun)->function.a1 (argvals[0]));
break;
case 2:
val = (XSUBR (fun)->function.a2 (argvals[0], argvals[1]));
break;
case 3:
val = (XSUBR (fun)->function.a3
(argvals[0], argvals[1], argvals[2]));
break;
case 4:
val = (XSUBR (fun)->function.a4
(argvals[0], argvals[1], argvals[2], argvals[3]));
break;
case 5:
val = (XSUBR (fun)->function.a5
(argvals[0], argvals[1], argvals[2], argvals[3],
argvals[4]));
break;
case 6:
val = (XSUBR (fun)->function.a6
(argvals[0], argvals[1], argvals[2], argvals[3],
argvals[4], argvals[5]));
break;
case 7:
val = (XSUBR (fun)->function.a7
(argvals[0], argvals[1], argvals[2], argvals[3],
argvals[4], argvals[5], argvals[6]));
break;
case 8:
val = (XSUBR (fun)->function.a8
(argvals[0], argvals[1], argvals[2], argvals[3],
argvals[4], argvals[5], argvals[6], argvals[7]));
break;
default:
/* Someone has created a subr that takes more arguments than
is supported by this code. We need to either rewrite the
subr to use a different argument protocol, or add more
cases to this switch. */
abort ();
}
}
}
if (COMPILEDP (fun))
else if (COMPILEDP (fun))
val = apply_lambda (fun, original_args, 1);
else
{
......@@ -2413,7 +2414,6 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
else
xsignal1 (Qinvalid_function, original_fun);
}
done:
CHECK_CONS_LIST ();
lisp_eval_depth--;
......@@ -2956,83 +2956,84 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
if (SUBRP (fun))
{
if (numargs < XSUBR (fun)->min_args
if (numargs < XSUBR (fun)->min_args
|| (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
{
XSETFASTINT (lisp_numargs, numargs);
xsignal2 (Qwrong_number_of_arguments, original_fun, lisp_numargs);
}
if (XSUBR (fun)->max_args == UNEVALLED)
else if (XSUBR (fun)->max_args == UNEVALLED)
xsignal1 (Qinvalid_function, original_fun);
if (XSUBR (fun)->max_args == MANY)
{
val = (XSUBR (fun)->function.aMANY) (numargs, args + 1);
goto done;
}
if (XSUBR (fun)->max_args > numargs)
{
internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object));
memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
for (i = numargs; i < XSUBR (fun)->max_args; i++)
internal_args[i] = Qnil;
}
else if (XSUBR (fun)->max_args == MANY)
val = (XSUBR (fun)->function.aMANY) (numargs, args + 1);
else
internal_args = args + 1;
switch (XSUBR (fun)->max_args)
{
case 0:
val = (XSUBR (fun)->function.a0) ();
goto done;
case 1:
val = (XSUBR (fun)->function.a1) (internal_args[0]);
goto done;
case 2:
val = (XSUBR (fun)->function.a2) (internal_args[0], internal_args[1]);
goto done;
case 3:
val = (XSUBR (fun)->function.a3) (internal_args[0], internal_args[1],
internal_args[2]);
goto done;
case 4:
val = (XSUBR (fun)->function.a4) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3]);
goto done;
case 5:
val = (XSUBR (fun)->function.a5) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4]);
goto done;
case 6:
val = (XSUBR (fun)->function.a6) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5]);
goto done;
case 7:
val = (XSUBR (fun)->function.a7) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5],
internal_args[6]);
goto done;
case 8:
val = (XSUBR (fun)->function.a8) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5],
internal_args[6], internal_args[7]);
goto done;
default:
/* If a subr takes more than 8 arguments without using MANY
or UNEVALLED, we need to extend this function to support it.
Until this is done, there is no way to call the function. */
abort ();
if (XSUBR (fun)->max_args > numargs)
{
internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object));
memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
for (i = numargs; i < XSUBR (fun)->max_args; i++)
internal_args[i] = Qnil;
}
else
internal_args = args + 1;
switch (XSUBR (fun)->max_args)
{
case 0:
val = (XSUBR (fun)->function.a0 ());
break;
case 1:
val = (XSUBR (fun)->function.a1 (internal_args[0]));
break;
case 2:
val = (XSUBR (fun)->function.a2
(internal_args[0], internal_args[1]));
break;
case 3:
val = (XSUBR (fun)->function.a3
(internal_args[0], internal_args[1], internal_args[2]));
break;
case 4:
val = (XSUBR (fun)->function.a4
(internal_args[0], internal_args[1], internal_args[2],
internal_args[3]));
break;
case 5:
val = (XSUBR (fun)->function.a5
(internal_args[0], internal_args[1], internal_args[2],
internal_args[3], internal_args[4]));
break;
case 6:
val = (XSUBR (fun)->function.a6
(internal_args[0], internal_args[1], internal_args[2],
internal_args[3], internal_args[4], internal_args[5]));
break;
case 7:
val = (XSUBR (fun)->function.a7
(internal_args[0], internal_args[1], internal_args[2],
internal_args[3], internal_args[4], internal_args[5],
internal_args[6]));
break;
case 8:
val = (XSUBR (fun)->function.a8
(internal_args[0], internal_args[1], internal_args[2],
internal_args[3], internal_args[4], internal_args[5],
internal_args[6], internal_args[7]));
break;
default:
/* If a subr takes more than 8 arguments without using MANY
or UNEVALLED, we need to extend this function to support it.
Until this is done, there is no way to call the function. */
abort ();
}
}
}
if (COMPILEDP (fun))
else if (COMPILEDP (fun))
val = funcall_lambda (fun, numargs, args + 1);
else
{
......@@ -3054,7 +3055,6 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
else
xsignal1 (Qinvalid_function, original_fun);
}
done:
CHECK_CONS_LIST ();
lisp_eval_depth--;
if (backtrace.debug_on_exit)
......
......@@ -225,8 +225,7 @@ static void set_fontset_font (Lisp_Object, Lisp_Object);
/* Return 1 if ID is a valid fontset id, else return 0. */
static int
fontset_id_valid_p (id)
int id;
fontset_id_valid_p (int id)
{
return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
}
......@@ -2128,8 +2127,7 @@ DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
#ifdef FONTSET_DEBUG
Lisp_Object
dump_fontset (fontset)
Lisp_Object fontset;
dump_fontset (Lisp_Object fontset)
{
Lisp_Object vec;
......
......@@ -1767,13 +1767,13 @@ setup_otf_gstring (int size)
position adjustment information in ADJUSTMENT. */
static int
ftfont_drive_otf (font, spec, in, from, to, out, adjustment)
MFLTFont *font;
MFLTOtfSpec *spec;
MFLTGlyphString *in;
int from, to;
MFLTGlyphString *out;
MFLTGlyphAdjustment *adjustment;
ftfont_drive_otf (MFLTFont *font,
MFLTOtfSpec *spec,
MFLTGlyphString *in,
int from,
int to,
MFLTGlyphString *out,
MFLTGlyphAdjustment *adjustment)
{
struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
FT_Face ft_face = flt_font_ft->ft_face;
......
......@@ -3332,7 +3332,7 @@ xpm_image_p (Lisp_Object object)
#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
int
x_create_bitmap_from_xpm_data (struct frame *f, char **bits)
x_create_bitmap_from_xpm_data (struct frame *f, const char **bits)
{
Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
int id, rc;
......
......@@ -2888,10 +2888,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
{
char *end = read_buffer + read_buffer_size;
while (c > 040
&& c != 0x8a0 /* NBSP */
&& (c >= 0200
|| !(strchr ("\"';()[]#`,", c))))
do
{
if (end - p < MAX_MULTIBYTE_LENGTH)
{
......@@ -2915,7 +2912,10 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
else
*p++ = c;
c = READCHAR;
}
} while (c > 040
&& c != 0x8a0 /* NBSP */
&& (c >= 0200
|| !(strchr ("\"';()[]#`,", c))));
if (p == end)
{
......
......@@ -1604,17 +1604,19 @@ Return t if any property was actually removed, nil otherwise. */)
if (LENGTH (i) >= len)
{
if (! interval_has_some_properties_list (properties, i))
if (modified)
{
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
XINT (end) - XINT (start));
return Qt;
}
else
return Qnil;
if (LENGTH (i) == len)
{
if (modified)
{
if (BUFFERP (object))
signal_after_change (XINT (start),
XINT (end) - XINT (start),
XINT (end) - XINT (start));
return Qt;
}
else
return Qnil;
}
else if (LENGTH (i) == len)
{
if (!modified && BUFFERP (object))
modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
......@@ -1624,20 +1626,20 @@ Return t if any property was actually removed, nil otherwise. */)
XINT (end) - XINT (start));
return Qt;
}
/* i has the properties, and goes past the change limit */
unchanged = i;
i = split_interval_left (i, len);
copy_properties (unchanged, i);
if (!modified && BUFFERP (object))
modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
XINT (end) - XINT (start));
return Qt;
else
{ /* i has the properties, and goes past the change limit. */
unchanged = i;
i = split_interval_left (i, len);
copy_properties (unchanged, i);
if (!modified && BUFFERP (object))
modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
XINT (end) - XINT (start));
return Qt;
}
}
if (interval_has_some_properties_list (properties, i))
{
if (!modified && BUFFERP (object))
......