Fix more problems found by GCC 4.5.2's static checks.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 23 Mar 2011 01:01:59 +0000 (18:01 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 23 Mar 2011 01:01:59 +0000 (18:01 -0700)
1  2 
ChangeLog
lib-src/ChangeLog
src/ChangeLog

diff --cc ChangeLog
index d13832b9060e807aef808c4bcaf51d6eb48dca92,5d840caf4911a050d79e71f840affd730469f479..f833e736e02ac456deb57dedb659b3d146a201b7
+++ b/ChangeLog
@@@ -1,3 -1,14 +1,16 @@@
 -2011-03-22  Paul Eggert  <eggert@cs.ucla.edu>
++2011-03-23  Paul Eggert  <eggert@cs.ucla.edu>
++      Fix more problems found by GCC 4.5.2's static checks.
+       * Makefile.in (GNULIB_MODULES): Add socklen.
+       * configure.in: Do not check for sys/socket.h, since socklen does that.
+       * m4/socklen.m4: New automatically-generated file, from gnulib.
+       fakemail: Remove dependency on ignore-value.
+       * Makefile.in (GNULIB_MODULES): Add stdio.
+       * lib/stdio.in.h, m4/stdio_h.m4: New files, automatically
+       imported from gnulib.
+       * .bzrignore: Add lib/stdio.h.
++
  2011-03-22  Glenn Morris  <rgm@gnu.org>
  
        * autogen/copy_autogen: Work from ./ or ../.
index bd1a84cf0b959db6a9ebdf14c46045d2583cd4d1,909bee743bb9502878ac8ce29430ba05ca827fdb..3df2f6881dba9ebe4bb0fcd324490ac3a9a9805d
@@@ -1,3 -1,33 +1,33 @@@
 -2011-03-21  Paul Eggert  <eggert@cs.ucla.edu>
++2011-03-23  Paul Eggert  <eggert@cs.ucla.edu>
+       * ebrowse.c: Use size_t, not int, for sizes.
+       This avoids a warning with gcc -Wstrict-overflow, and works
+       better for very large objects.
+       (inbuffer_size): Now size_t.  All uses changed.
+       (xmalloc, xrealloc, operator_name, process_file): Use size_t for
+       sizes.  Don't bother testing whether a size_t value can be negative.
+       * etags.c (Ada_funcs): Redo slightly to avoid overflow warning.
+       etags: In Prolog functions, don't assume int fits in size_t.
+       This avoids a warning with gcc -Wstrict-overflow.
+       * etags.c (Prolog_functions, prolog_pr, prolog_atom): Use size_t,
+       not int, to store sizes.
+       (prolog_atom): Return 0, not -1, on error.  All callers changed.
+       update-game-score: fix bug with -r
+       * update-game-score.c (main): Don't set 'scores' to garbage when
+       -r is specified and scorecount != MAX_SCORES (Bug#8310).  This bug
+       was introduced in the 2002-04-10 change, and was found with gcc
+       -Wstrict-overflow (GCC 4.5.2, x86-64).
+       fakemail: Remove dependency on ignore-value.
+       This undoes some of the recent fakemail-related changes.
+       It is made possible due to recent changes to gnulib's stdio module.
+       * Makefile.in (fakemail${EXEEXT}): Do not depend on ignore-value.h.
+       * fakemail.c: Do not include ignore-value.h.
+       (put_line): Do not use ignore_value.
  2011-03-03  Drake Wilson  <drake@begriffli.ch>  (tiny change)
  
        * emacsclient.c (longopts): Add quiet.
diff --cc src/ChangeLog
index f489a23368318283a5dd07320e68fc03a44d0ca1,007a21e0353cdd89f23775ebc9b6a75a10553c89..a4312efceb952fa0bd1f35049d165648c156c6ee
+ 2011-03-23  Paul Eggert  <eggert@cs.ucla.edu>
++      Fix more problems found by GCC 4.5.2's static checks.
++
+       * coding.c (encode_coding_raw_text): Avoid unnecessary test
+       the first time through the loop, since we know p0 < p1 then.
+       This also avoids a gcc -Wstrict-overflow warning.
+       * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow
+       leading to a memory leak, possible in functions like
+       load_charset_map_from_file that can allocate an unbounded number
+       of objects (Bug#8318).
+       * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes
+       that could (at least in theory) be that large.
+       * xdisp.c (message_log_check_duplicate): Return unsigned long, not int.
+       This is less likely to overflow, and avoids undefined behavior if
+       overflow does occur.  All callers changed.  Use strtoul to scan
+       for the unsigned long integer.
+       (pint2hrstr): Simplify and tune code slightly.
+       This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow.
+       * scroll.c (do_scrolling): Work around GCC bug 48228.
+       See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>.
+       * frame.c (Fmodify_frame_parameters): Simplify loop counter.
+       This also avoids a warning with gcc -Wstrict-overflow.
+       (validate_x_resource_name): Simplify count usage.
+       This also avoids a warning with gcc -Wstrict-overflow.
+       * fileio.c (Fcopy_file): Report error if fchown or fchmod
+       fail (Bug#8306).
+       * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303).
+       * process.c (Fmake_network_process): Use socklen_t, not int,
+       where POSIX says socklen_t is required in portable programs.
+       This fixes a porting bug on hosts like 64-bit HP-UX, where
+       socklen_t is wider than int (Bug#8277).
+       (Fmake_network_process, server_accept_connection):
+       (wait_reading_process_output, read_process_output):
+       Likewise.
+       * process.c: Rename or move locals to avoid shadowing.
+       (list_processes_1, Fmake_network_process):
+       (read_process_output_error_handler, exec_sentinel_error_handler):
+       Rename or move locals.
+       (Fmake_network_process): Define label "retry_connect" only if needed.
+       (Fnetwork_interface_info): Fix pointer signedness.
+       (process_send_signal): Add cast to avoid pointer signedness problem.
+       (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros.
+       (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298).
+       Make tparam.h and terminfo.c consistent.
+       * cm.c (tputs, tgoto, BC, UP): Remove extern decls.  Include
+       tparam.h instead, since it declares them.
+       * cm.h (PC): Remove extern decl; tparam.h now does this.
+       * deps.mk (cm.o, terminfo.o): Depend on tparam.h.
+       * terminfo.c: Include tparam.h, to check interfaces.
+       (tparm): Make 1st arg a const pointer in decl.  Put it at top level.
+       (tparam): Adjust signature to match interface in tparam.h;
+       this removes some undefined behavior.  Check that outstring and len
+       are zero, which they always are with Emacs.
+       * tparam.h (PC, BC, UP): New extern decls.
+       * xftfont.c (xftfont_shape): Now static, and defined only if needed.
+       (xftfont_open): Rename locals to avoid shadowing.
+       * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness.
+       (ftfont_otf_capability, ftfont_shape): Omit decls if not needed.
+       (OTF_TAG_SYM): Omit macro if not needed.
+       (ftfont_list): Remove unused local.
+       (get_adstyle_property, ftfont_pattern_entity):
+       (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
+       Rename locals to avoid shadowing.
+       * xfont.c (xfont_list_family): Mark var as initialized.
+       * xml.c (make_dom): Now static.
+       * composite.c (composition_compute_stop_pos): Rename local to
+       avoid shadowing.
+       (composition_reseat_it): Remove unused locals.
+       (find_automatic_composition, composition_adjust_point): Likewise.
+       (composition_update_it): Mark var as initialized.
+       (find_automatic_composition): Mark vars as initialized,
+       with a FIXME (Bug#8290).
+       character.h: Rename locals to avoid shadowing.
+       * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE):
+       (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE):
+       (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS):
+       (BUF_DEC_POS): Be more systematic about renaming local temporaries
+       to avoid shadowing.
+       * textprop.c (property_change_between_p): Remove; unused.
+       * intervals.c (interval_start_pos): Now static.
+       * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else".
+       * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename
+       locals to avoid shadowing.
+       * sound.c (wav_play, au_play, Fplay_sound_internal):
+       Fix pointer signedness.
+       (alsa_choose_format): Remove unused local var.
+       (wav_play): Initialize a variable to 0, to prevent undefined
+       behavior (Bug#8278).
+       * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing.
+       * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes.
+       * callproc.c (Fcall_process): Use 'volatile' to avoid vfork
+       clobbering (Bug#8298).
+       * sysdep.c (sys_subshell): Likewise.
+       Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out.
+       * lisp.h (child_setup): Now NO_RETURN unless DOS_NT.
+       This should get cleaned up, so that child_setup has the
+       same signature on all platforms.
+       * callproc.c (call_process_cleanup): Now static.
+       (relocate_fd): Rename locals to avoid shadowing.
  2011-03-22  Chong Yidong  <cyd@stupidchicken.com>
  
        * xterm.c (x_clear_frame): Remove XClearWindow call.  This appears