From 6bbd7a29592594e23e5cb98467e608f10b00f877 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 21 Sep 2000 20:54:57 +0000 Subject: [PATCH] Avoid some more compiler warnings. --- src/alloc.c | 9 ++++++--- src/data.c | 6 ++++-- src/dired.c | 6 ++++-- src/emacs.c | 3 ++- src/fileio.c | 7 ++++--- src/indent.c | 6 +++--- src/insdel.c | 1 + src/keymap.c | 12 ++++++++---- src/macros.c | 1 + src/minibuf.c | 19 +++++++++++-------- src/search.c | 10 ++++++---- src/term.c | 2 +- src/window.c | 5 +++++ src/xmenu.c | 9 +++++---- src/xrdb.c | 2 +- 15 files changed, 62 insertions(+), 36 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 678bdfa425..75466a787c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2934,6 +2934,9 @@ mark_maybe_object (obj) } } break; + + case Lisp_Int: + break; } if (mark_p) @@ -3138,7 +3141,7 @@ static void mark_stack () { jmp_buf j; - int stack_grows_down_p = (char *) &j > (char *) stack_base; + volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; void *end; /* This trick flushes the register windows so that all the state of @@ -3362,8 +3365,8 @@ Does not copy symbols. Copies strings without text properties.") } else if (MARKERP (obj)) error ("Attempt to copy a marker to pure storage"); - else - return obj; + + return obj; } diff --git a/src/data.c b/src/data.c index 0e393bf450..c85e5485d6 100644 --- a/src/data.c +++ b/src/data.c @@ -1751,6 +1751,8 @@ or a byte-code object. IDX starts at 0.") { Lisp_Object val; + val = Qnil; + if (idxval < 0) args_out_of_range (array, idx); if (idxval < CHAR_TABLE_ORDINARY_SLOTS) @@ -1821,7 +1823,7 @@ or a byte-code object. IDX starts at 0.") } else { - int size; + int size = 0; if (VECTORP (array)) size = XVECTOR (array)->size; else if (COMPILEDP (array)) @@ -2010,7 +2012,7 @@ arithcompare (num1, num2, comparison) Lisp_Object num1, num2; enum comparison comparison; { - double f1, f2; + double f1 = 0, f2 = 0; int floatp = 0; CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0); diff --git a/src/dired.c b/src/dired.c index bedda2a7f1..e0dce3ae46 100644 --- a/src/dired.c +++ b/src/dired.c @@ -131,7 +131,7 @@ directory_files_internal (directory, full, match, nosort, attrs) Lisp_Object list, name, dirfilename; Lisp_Object encoded_directory; Lisp_Object handler; - struct re_pattern_buffer *bufp; + struct re_pattern_buffer *bufp = NULL; int needsep = 0; struct gcpro gcpro1, gcpro2; @@ -389,7 +389,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) { DIR *d; DIRENTRY *dp; - int bestmatchsize, skip; + int bestmatchsize = 0, skip; register int compare, matchsize; unsigned char *p1, *p2; int matchcount = 0; @@ -402,6 +402,8 @@ file_name_completion (file, dirname, all_flag, ver_flag) int count = specpdl_ptr - specpdl; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; + elt = Qnil; + #ifdef VMS extern DIRENTRY * readdirver (); diff --git a/src/emacs.c b/src/emacs.c index 47aadd866d..9c2645f361 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -604,7 +604,7 @@ argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr) char **valptr; int *skipptr; { - char *p; + char *p = NULL; int arglen; char *arg; @@ -1506,6 +1506,7 @@ main (argc, argv, envp) /* Enter editor command loop. This never returns. */ Frecursive_edit (); /* NOTREACHED */ + return 0; } /* Sort the args so we can find the most important ones diff --git a/src/fileio.c b/src/fileio.c index b8c50d0f50..a07ea27b1d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1973,7 +1973,7 @@ duplicates what `expand-file-name' does.") unsigned char *nm; register unsigned char *s, *p, *o, *x, *endp; - unsigned char *target; + unsigned char *target = NULL; int total = 0; int substituted = 0; unsigned char *xnm; @@ -2180,6 +2180,7 @@ duplicates what `expand-file-name' does.") /* NOTREACHED */ #endif /* not VMS */ + return Qnil; } /* A slightly faster and more convenient way to get @@ -3421,7 +3422,7 @@ actually used.") struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; Lisp_Object handler, val, insval, orig_filename; Lisp_Object p; - int total; + int total = 0; int not_regular = 0; unsigned char read_buf[READ_BUF_SIZE]; struct coding_system coding; @@ -4397,7 +4398,7 @@ This does code conversion according to the value of\n\ { register int desc; int failure; - int save_errno; + int save_errno = 0; unsigned char *fn; struct stat st; int tem; diff --git a/src/indent.c b/src/indent.c index 7a7be2fe30..f5f44d93c4 100644 --- a/src/indent.c +++ b/src/indent.c @@ -835,8 +835,8 @@ The return value is the current column.") register int multibyte = !NILP (current_buffer->enable_multibyte_characters); Lisp_Object val; - int prev_col; - int c; + int prev_col = 0; + int c = 0; int next_boundary; int pos_byte, end_byte, next_boundary_byte; @@ -1053,7 +1053,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, register int pos; int pos_byte; - register int c; + register int c = 0; register int tab_width = XFASTINT (current_buffer->tab_width); register int ctl_arrow = !NILP (current_buffer->ctl_arrow); register struct Lisp_Char_Table *dp = window_display_table (win); diff --git a/src/insdel.c b/src/insdel.c index acc1d47395..4229fb6abb 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1347,6 +1347,7 @@ replace_range (from, to, new, prepare, inherit, markers) CHECK_MARKERS (); GCPRO1 (new); + deletion = Qnil; if (prepare) { diff --git a/src/keymap.c b/src/keymap.c index 2665941022..864c860db5 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -269,8 +269,7 @@ get_keymap_1 (object, error, autoload) end: if (error) wrong_type_argument (Qkeymapp, object); - else - return Qnil; + return Qnil; } @@ -1775,10 +1774,10 @@ spaces are put between sequence elements, etc.") (keys) Lisp_Object keys; { - int len; + int len = 0; int i, i_byte; Lisp_Object sep; - Lisp_Object *args; + Lisp_Object *args = NULL; if (STRINGP (keys)) { @@ -2021,6 +2020,7 @@ around function keys and event symbols.") return Fcopy_sequence (key); else error ("KEY must be an integer, cons, symbol, or string"); + return Qnil; } char * @@ -2846,6 +2846,8 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) int first = 1; struct gcpro gcpro1, gcpro2, gcpro3; + suppress = Qnil; + if (!NILP (keys) && XFASTINT (Flength (keys)) > 0) { /* Call Fkey_description first, to avoid GC bug for the other string. */ @@ -3027,6 +3029,8 @@ describe_vector (vector, elt_prefix, elt_describer, int character; int starting_i; + suppress = Qnil; + if (indices == 0) indices = (int *) alloca (3 * sizeof (int)); diff --git a/src/macros.c b/src/macros.c index 5c37f0daa3..3c6e0b33ed 100644 --- a/src/macros.c +++ b/src/macros.c @@ -213,6 +213,7 @@ DEFUN ("cancel-kbd-macro-events", Fcancel_kbd_macro_events, () { current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_end; + return Qnil; } DEFUN ("store-kbd-macro-event", Fstore_kbd_macro_event, diff --git a/src/minibuf.c b/src/minibuf.c index 740f73cbd4..8df082bc19 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -281,6 +281,7 @@ read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag, fprintf (stdout, "%s", XSTRING (prompt)->data); fflush (stdout); + val = Qnil; size = 100; len = 0; line = (char *) xmalloc (size * sizeof *line); @@ -1046,11 +1047,11 @@ is used to further constrain the set of candidates.") { Lisp_Object bestmatch, tail, elt, eltstring; /* Size in bytes of BESTMATCH. */ - int bestmatchsize; + int bestmatchsize = 0; /* These are in bytes, too. */ int compare, matchsize; int list = CONSP (alist) || NILP (alist); - int index, obsize; + int index = 0, obsize = 0; int matchcount = 0; Lisp_Object bucket, zero, end, tem; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -1059,7 +1060,7 @@ is used to further constrain the set of candidates.") if (!list && !VECTORP (alist)) return call3 (alist, string, predicate, Qnil); - bestmatch = Qnil; + bestmatch = bucket = Qnil; /* If ALIST is not a list, set TAIL just for gc pro. */ tail = alist; @@ -1299,7 +1300,7 @@ are ignored unless STRING itself starts with a space.") Lisp_Object tail, elt, eltstring; Lisp_Object allmatches; int list = CONSP (alist) || NILP (alist); - int index, obsize; + int index = 0, obsize = 0; Lisp_Object bucket, tem; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -1308,7 +1309,7 @@ are ignored unless STRING itself starts with a space.") { return call3 (alist, string, predicate, Qt); } - allmatches = Qnil; + allmatches = bucket = Qnil; /* If ALIST is not a list, set TAIL just for gc pro. */ tail = alist; @@ -1809,7 +1810,7 @@ a repetition of this command will exit.") return Qnil; } exit: - Fthrow (Qexit, Qnil); + return Fthrow (Qexit, Qnil); /* NOTREACHED */ } @@ -2028,6 +2029,8 @@ It can find the completion buffer in `standard-output'.") int length; Lisp_Object startpos, endpos; + startpos = Qnil; + elt = Fcar (tail); /* Compute the length of this element. */ if (CONSP (elt)) @@ -2202,14 +2205,14 @@ DEFUN ("self-insert-and-exit", Fself_insert_and_exit, Sself_insert_and_exit, 0, else bitch_at_user (); - Fthrow (Qexit, Qnil); + return Fthrow (Qexit, Qnil); } DEFUN ("exit-minibuffer", Fexit_minibuffer, Sexit_minibuffer, 0, 0, "", "Terminate this minibuffer argument.") () { - Fthrow (Qexit, Qnil); + return Fthrow (Qexit, Qnil); } DEFUN ("minibuffer-depth", Fminibuffer_depth, Sminibuffer_depth, 0, 0, 0, diff --git a/src/search.c b/src/search.c index 3ba413ae8c..48528bea12 100644 --- a/src/search.c +++ b/src/search.c @@ -1527,7 +1527,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, { int direction = ((n > 0) ? 1 : -1); register int dirlen; - int infinity, limit, k, stride_for_teases; + int infinity, limit, k, stride_for_teases = 0; register int *BM_tab; int *BM_tab_base; register unsigned char *cursor, *p_limit; @@ -1536,8 +1536,8 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, int multibyte = ! NILP (current_buffer->enable_multibyte_characters); unsigned char simple_translate[0400]; - int translate_prev_byte; - int translate_anteprev_byte; + int translate_prev_byte = 0; + int translate_anteprev_byte = 0; #ifdef C_ALLOCA int BM_tab_space[0400]; @@ -2337,7 +2337,7 @@ since only regular expressions have distinguished subexpressions.") for (pos_byte = 0, pos = 0; pos_byte < length;) { int substart = -1; - int subend; + int subend = 0; int delbackslash = 0; FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); @@ -2633,6 +2633,8 @@ to hold all the values, and if INTEGERS is non-nil, no consing is done.") if (NILP (last_thing_searched)) return Qnil; + prev = Qnil; + data = (Lisp_Object *) alloca ((2 * search_regs.num_regs) * sizeof (Lisp_Object)); diff --git a/src/term.c b/src/term.c index 07e633fec6..e704f0db0b 100644 --- a/src/term.c +++ b/src/term.c @@ -1146,7 +1146,7 @@ insert_glyphs (start, len) register int len; { char *buf; - struct glyph *glyph; + struct glyph *glyph = NULL; struct frame *f, *sf; if (len <= 0) diff --git a/src/window.c b/src/window.c index d9c807ccf9..6cdf2943e6 100644 --- a/src/window.c +++ b/src/window.c @@ -1770,6 +1770,9 @@ window_loop (type, obj, mini, frames) && NILP (XBUFFER (w->buffer)->name)) abort (); break; + + case WINDOW_LOOP_UNUSED: + break; } } @@ -3476,6 +3479,8 @@ shrink_window_lowest_first (w, height) Lisp_Object last_child; int delta = old_height - height; int last_top; + + last_child = Qnil; /* Find the last child. We are taking space from lowest windows first, so we iterate over children from the last child diff --git a/src/xmenu.c b/src/xmenu.c index 07e050018f..fa7c352cc8 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -691,11 +691,11 @@ cached information about equivalent key sequences.") Lisp_Object position, menu; { Lisp_Object keymap, tem; - int xpos, ypos; + int xpos = 0, ypos = 0; Lisp_Object title; char *error_name; Lisp_Object selection; - FRAME_PTR f; + struct frame *f = NULL; Lisp_Object x, y, window; int keymaps = 0; int for_click = 0; @@ -899,7 +899,7 @@ on the left of the dialog box and all following items on the right.\n\ (position, contents) Lisp_Object position, contents; { - FRAME_PTR f; + struct frame * f = NULL; Lisp_Object window; check_x (); @@ -1247,6 +1247,7 @@ menubar_selection_callback (widget, id, client_data) if (!f) return; + entry = Qnil; subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object)); vector = f->menu_bar_vector; prefix = Qnil; @@ -2233,7 +2234,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) { Lisp_Object prefix, entry; - prefix = Qnil; + prefix = entry = Qnil; i = 0; while (i < menu_items_used) { diff --git a/src/xrdb.c b/src/xrdb.c index 82603c75fe..830610945a 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -180,7 +180,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix) while (p < string + string_len) { /* The chunk we're about to stick on the end of result. */ - char *next; + char *next = NULL; int next_len; if (*p == '%') -- 2.20.1