Simplify and avoid signal-handling races.
[bpt/emacs.git] / src / ChangeLog
index 362d0b7..37c1ecf 100644 (file)
@@ -1,3 +1,651 @@
+2012-09-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Simplify and avoid signal-handling races (Bug#12471).
+       * alloc.c (die):
+       * sysdep.c (emacs_abort) [HAVE_NTGUI]:
+       Avoid recursive loop if there's a fatal error in the function itself.
+       * atimer.c (pending_atimers):
+       * blockinput.h: Don't include "atimer.h"; no longer needed.
+       (interrupt_input_pending): Remove.  All uses removed.
+       pending_signals now counts both atimers and ordinary interrupts.
+       This is less racy than having three separate pending-signal flags.
+       (block_input, unblock_input, totally_unblock_input, unblock_input_to)
+       (input_blocked_p):
+       Rename from their upper-case counterparts BLOCK_INPUT,
+       UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO,
+       INPUT_BLOCKED_P, and turn into functions.  All uses changed.
+       This makes it easier to access volatile variables more accurately.
+       (BLOCK_INPUT_RESIGNAL): Remove.  All uses replaced by unblock_input ().
+       (input_blocked_p): Prefer this to 'interrupt_input_blocked', as
+       that's more reliable if the code is buggy and sets
+       interrupt_input_blocked to a negative value.  All uses changed.
+       * atimer.c (deliver_alarm_signal):
+       Remove.  No need to deliver this to the parent; any thread can
+       handle this signal now.  All uses replaced by underlying handler.
+       * atimer.c (turn_on_atimers):
+       * dispnew.c (handle_window_change_signal):
+       * emacs.c (handle_danger_signal):
+       * keyboard.c (kbd_buffer_get_event):
+       Don't reestablish signal handler; not needed with sigaction.
+       * blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT)
+       (UNBLOCK_INPUT_TO):
+       Rework to avoid unnecessary accesses to volatile variables.
+       (UNBLOCK_INPUT_TO): Now a function.
+       (totally_unblock_input, unblock_input): New decls.
+       * data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
+       (init_data): Remove.  Necessary stuff now done in init_signal.
+       * emacs.c, xdisp.c: Include "atimer.h", since we invoke atimer functions.
+       * emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c.
+       (fatal_error_code): Remove; no longer needed.
+       (terminate_due_to_signal): Rename from fatal_error_backtrace, since
+       it doesn't always backtrace.  All uses changed.  No need to reset
+       signal to default, since sigaction and/or die does that for us now.
+       Use emacs_raise (FOO), not kill (getpid (), FOO).
+       (main): Check more-accurately whether we're dumping.
+       Move fatal-error setup to sysdep.c
+       * floatfns.c: Do not include "syssignal.h"; no longer needed.
+       * gtkutil.c (xg_get_file_name, xg_get_font):
+       Remove no-longer-needed signal-mask manipulation.
+       * keyboard.c, process.c (POLL_FOR_INPUT):
+       Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
+       * keyboard.c (read_avail_input): Remove.
+       All uses replaced by gobble_input.
+       (Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code.
+       (kbd_buffer_store_event_hold, gobble_input):
+       (record_asynch_buffer_change) [USABLE_SIGIO]:
+       (store_user_signal_events):
+       No need to mess with signal mask.
+       (gobble_input): If blocking input and there are terminals, simply
+       set pending_signals to 1 and return.  All hooks changed to not
+       worry about whether input is blocked.
+       (process_pending_signals): Clear pending_signals before processing
+       them, in case a signal comes in while we're processing.
+       By convention callers now test pending_signals before calling us.
+       (UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input):
+       New functions, to support changes to blockinput.h.
+       (handle_input_available_signal): Now extern.
+       (reinvoke_input_signal): Remove.  All uses replaced by
+       handle_async_input.
+       (quit_count): Now volatile, since a signal handler uses it.
+       (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg.  All
+       callers changed.  Block SIGINT only if not already blocked.
+       Clear sigmask reliably, even if Fsignal returns, which it can.
+       Omit unnecessary accesses to volatile var.
+       (quit_throw_to_read_char): No need to restore sigmask.
+       * keyboard.c (gobble_input, handle_user_signal):
+       * process.c (wait_reading_process_output):
+       Call signal-handling code rather than killing ourselves.
+       * lisp.h: Include <float.h>, for...
+       (IEEE_FLOATING_POINT): New macro, moved here to avoid duplication.
+       (pending_signals): Now volatile.
+       (syms_of_data): Now const if IEEE floating point.
+       (handle_input_available_signal) [USABLE_SIGIO]:
+       (terminate_due_to_signal, record_child_status_change): New decls.
+       * process.c (create_process): Avoid disaster if memory is exhausted
+       while we're processing a vfork, by tightening the critical section
+       around the vfork.
+       (send_process_frame, process_sent_to, handle_pipe_signal)
+       (deliver_pipe_signal): Remove.  No longer needed, as Emacs now
+       ignores SIGPIPE.
+       (send_process): No need for setjmp/longjmp any more, since the
+       SIGPIPE stuff is now gone.  Instead, report an error if errno
+       is EPIPE.
+       (record_child_status_change): Now extern.  PID and W are now args.
+       Return void, not bool.  All callers changed.
+       * sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]:
+       Remove.  All uses removed.  This bug should be fixed now in a
+       different way.
+       (wait_for_termination_1): Use waitpid rather than sigsuspend,
+       and record the child status change directly.  This avoids the
+       need to futz with the signal mask.
+       (process_fatal_action): Move here from emacs.c.
+       (emacs_sigaction_flags): New function, containing
+       much of what used to be in emacs_sigaction_init.
+       (emacs_sigaction_init): Use it.  Block nonfatal system signals that are
+       caught by emacs, to make races less likely.
+       (deliver_process_signal): Rename from handle_on_main_thread.
+       All uses changed.
+       (BACKTRACE_LIMIT_MAX): Now at top level.
+       (thread_backtrace_buffer, threadback_backtrace_pointers):
+       New static vars.
+       (deliver_thread_signal, deliver_fatal_thread_signal):
+       New functions, for more-accurate delivery of thread-specific signals.
+       (handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c.
+       (deliver_arith_signal): Handle in this thread, not
+       in the main thread, since it's triggered by this thread.
+       (maybe_fatal_sig): New function.
+       (init_signals): New arg DUMPING so that we can be more accurate
+       about whether we're dumping.  Caller changed.
+       Treat thread-specific signals differently from process-general signals.
+       Block all signals while handling fatal error; that's safer.
+       xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal
+       on IEEE hosts.
+       When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored.
+       Ignore SIGPIPE unless batch.
+       (emacs_backtrace): Output backtrace for the appropriate thread,
+       which is not necessarily the main thread.
+       * syssignal.h: Include <stdbool.h>.
+       (emacs_raise): New macro.
+       * xterm.c (x_connection_signal): Remove; no longer needed
+       now that we use sigaction.
+       (x_connection_closed): No need to mess with sigmask now.
+       (x_initialize): No need to reset SIGPIPE handler here, since
+       init_signals does this for us now.
+
+2012-09-23  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into,
+       background rect may be larger (Bug#12445).
+
+2012-09-23  Chong Yidong  <cyd@gnu.org>
+
+       * keyboard.c (timer_check): Avoid quitting during Fcopy_sequence.
+
+2012-09-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * .gdbinit: Just stop at fatal_error_backtrace.
+       See Stefan Monnier's request in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00549.html>.
+       Remove no-longer-used query of system type.
+
+2012-09-22  Chong Yidong  <cyd@gnu.org>
+
+       * search.c (Freplace_match): Doc fix (Bug#12325).
+
+       * minibuf.c (Finternal_complete_buffer): Doc fix (Bug#12391).
+
+       * editfns.c (Fline_beginning_position): Doc fix (Bug#12416).
+       (Fline_end_position): Doc fix.
+
+       * cmds.c (Fforward_char, Fbackward_char): Doc fix (Bug#12414).
+
+2012-09-22  Chong Yidong  <cyd@gnu.org>
+
+       * dispextern.h (struct image_type): Add new slot, storing a type
+       initialization function.
+
+       * image.c (define_image_type): Call the image initializer function
+       if it is defined.  Arguments and return value changed.
+       (valid_image_p, make_image): Callers changed.
+       (xbm_type, xpm_type, pbm_type, png_type, jpeg_type, tiff_type)
+       (gif_type, imagemagick_type, svg_type, gs_type): Add
+       initialization functions.
+       (Finit_image_library): Call lookup_image_type.
+       (CHECK_LIB_AVAILABLE): Macro deleted.
+       (lookup_image_type): Call define_image_type here, rather than via
+       Finit_image_library, and without using CHECK_LIB_AVAILABLE.
+       (syms_of_image): Move define_image_type calls for xbm_type and
+       pbm_type to lookup_image_type.
+
+2012-09-22  Eli Zaretskii  <eliz@gnu.org>
+
+       * keyboard.c (timer_check_2): Move calculation of 'timers' and
+       'idle_timers' from here ...
+       (timer_check): ... to here.  Use Fcopy_sequence to copy the timer
+       lists, to avoid infloops when the timer does something stupid,
+       like reinvoke itself with the same or smaller time-out.
+       (Bug#12447)
+
+2012-09-22  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.c (Fsplit_window_internal): Handle only Qt value of
+       Vwindow_combination_limit separately.
+       (Qtemp_buffer_resize): New symbol.
+       (Vwindow_combination_limit): New default value.  Rewrite
+       doc-string.
+
+2012-09-22  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (next_overlay_string): Initialize it->end_charpos for
+       the new overlay string.  (Bug#10159)
+
+2012-09-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * emacs.c (shut_down_emacs): Don't assume stderr is buffered,
+       or that fprintf is async-signal-safe.  POSIX doesn't require
+       either assumption.
+
+2012-09-22  Chong Yidong  <cyd@gnu.org>
+
+       * buffer.c (Fset_buffer_modified_p): Handle indirect buffers
+       (Bug#8207).
+
+2012-09-22  Kenichi Handa  <handa@gnu.org>
+
+       * composite.c (composition_reseat_it): Handle the case that a
+       grapheme cluster is not covered by a single font (Bug#12352).
+
+2012-09-21  Chong Yidong  <cyd@gnu.org>
+
+       * image.c (define_image_type): Avoid adding duplicate types to
+       image_types (Bug#12463).  Suggested by Jörg Walter.
+
+2012-09-21  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * unexmacosx.c: Define LC_DATA_IN_CODE if not defined.
+       (print_load_command_name): Add case LC_DATA_IN_CODE.
+       (dump_it) [LC_DATA_IN_CODE]: Call copy_linkedit_data.
+
+2012-09-21  Glenn Morris  <rgm@gnu.org>
+
+       * eval.c (Frun_hook_with_args_until_success)
+       (Frun_hook_with_args_until_failure): Doc fixes.  (Bug#12393)
+
+2012-09-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * fileio.c (Ffile_selinux_context): Only call freecon when
+       lgetfilecon succeeded.
+       (Fset_file_selinux_context): Likewise.  (Bug#12444)
+
+2012-09-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (try_window_reusing_current_matrix): Under bidi
+       reordering, locate the cursor by calling set_cursor_from_row; if
+       that fails, clear the desired glyph matrix before returning a
+       failure indication to the caller.  Fixes leaving garbled display
+       when fast scrolling with a down-key.  (Bug#12403)
+       (compute_stop_pos_backwards): Fix a typo that caused crashes while
+       scrolling through multibyte text.
+
+2012-09-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * alloc.c (mark_object) <PVEC_WINDOW>: Mark prev/next_buffers *after*
+       calling mark_vectorlike since that's the one that marks the window.
+       (mark_discard_killed_buffers): Mark the final cdr.
+       * window.h (struct window): Move prev/next_buffers to the
+       non-standard fields.
+       * window.c (make_window): Initialize prev/next_buffers manually.
+
+2012-09-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Omit unused arg EXPECTED from socket hooks.
+       * keyboard.c (gobble_input, read_avail_input, tty_read_avail_input):
+       * nsterm.m (ns_term_init):
+       * termhooks.h (struct terminal.read_socket_hook):
+       * w32inevt.c (w32_console_read_socket):
+       * w32term.c (w32_read_socket):
+       * xterm.c (XTread_socket):
+       Omit unused arg EXPECTED.  All callers changed.
+       (store_user_signal_events): Return void, not int, since callers no
+       longer care about the return value.  All uses changed.
+
+2012-09-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * w32gui.h (XParseGeometry): Do not declare.
+
+2012-09-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * w32inevt.c (w32_console_read_socket): Return -1 on failure, not 0.
+       Ignore 'expected'. See Eli Zaretskii in
+       <http://bugs.gnu.org/12471#8> (last line).
+
+       * frame.c (read_integer): Remove.  All uses replaced by strtol/strtoul.
+       (XParseGeometry): Now static.  Substitute extremal values for
+       values that are out of range.
+
+2012-09-19  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * w32xfns.c (read_integer, XParseGeometry): Move to frame.c.
+
+       * nsfns.m (XParseGeometry): Remove.
+       (Fx_create_frame): Call x_set_offset to correctly interpret
+       top_pos in geometry.
+
+       * frame.c (read_integer, XParseGeometry): Moved from w32xfns.c.
+       (Fx_parse_geometry): If there is a space in string, call
+       Qns_parse_geometry, otherwise do as on other terms (Bug#12368).
+
+2012-09-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * search.c (scan_buffer): Use character positions in calls to
+       region_cache_forward and region_cache_backward, not byte
+       positions.  (Bug#12196)
+
+       * w32term.c (w32_read_socket): Set pending_signals to 1, like
+       xterm.c does.  Reported by Daniel Colascione <dancol@dancol.org>.
+
+       * ralloc.c (r_alloc_init) [!SYSTEM_MALLOC]: Initialize
+       __malloc_extra_blocks to 32 instead of 64, like alloc.c did in
+       emacs_blocked_malloc, now deleted.
+
+2012-09-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove no-longer-needed Solaris 2.4 vfork bug workaround.
+       The workaround was for improving performance on Solaris 2.4, but
+       is getting in the way now.  Emacs will still work if someone is
+       still running Solaris 2.4 in a museum somewhere; Sun dropped
+       support for Solaris 2.4 in 2003.
+       * callproc.c (Fcall_process) [HAVE_WORKING_VFORK]:
+       * process.c (create_process) [HAVE_WORKING_VFORK]:
+       Omit now-unnecessary workaround for the Solaris 2.4 vfork bug,
+       since Emacs no longer uses vfork on that platform.
+
+2012-09-17  Glenn Morris  <rgm@gnu.org>
+
+       * emacs.c: Use COPYRIGHT.
+
+2012-09-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove configure's --without-sync-input option (Bug#12450).
+       When auditing signal-handling in preparation for cleaning it up,
+       I found that SYNC_INPUT has race conditions and would be a real
+       pain to fix.  Since it's an undocumented and deprecated
+       configure-time option, now seems like a good time to remove it.
+       Also see <http://bugs.gnu.org/11080#16>.
+       * alloc.c (_bytes_used, __malloc_extra_blocks, _malloc_internal)
+       (_free_internal) [!DOUG_LEA_MALLOC]: Remove decls.
+       (alloc_mutex) [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]:
+       (malloc_hysteresis):
+       (check_depth) [XMALLOC_OVERRUN_CHECK]:
+       (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT):
+       (__malloc_hook, __realloc_hook, __free_hook, BYTES_USED)
+       (dont_register_blocks, bytes_used_when_reconsidered)
+       (bytes_used_when_full, emacs_blocked_free, emacs_blocked_malloc)
+       (emacs_blocked_realloc, reset_malloc_hooks, uninterrupt_malloc):
+       [!SYSTEM_MALLOC && !SYNC_INPUT]:
+       Remove. All uses removed.
+       (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT): Use a different
+       implementation, one that depends on whether the new macro
+       XMALLOC_BLOCK_INPUT_CHECK is defined, not on whether SYNC_INPUT
+       is defined.
+       * atimer.c (run_timers, handle_alarm_signal):
+       * keyboard.c (pending_signal, poll_for_input_1, poll_for_input)
+       (handle_async_input, process_pending_signals)
+       (handle_input_available_signal, init_keyboard):
+       * nsterm.m (ns_read_socket):
+       * process.c (wait_reading_process_output):
+       * regex.c (immediate_quit, IMMEDIATE_QUIT_CHECK):
+       * sysdep.c (emacs_sigaction_init) [SA_RESTART]:
+       (emacs_write):
+       * xterm.c (XTread_socket):
+       Assume SYNC_INPUT.
+       * conf_post.h (SA_RESTART) [IRIX6_5]: Do not #undef.
+       * eval.c (handling_signal): Remove.  All uses removed.
+       * lisp.h (ELSE_PENDING_SIGNALS): Remove.
+       All uses replaced with the SYNC_INPUT version.
+       (reset_malloc_hooks, uninterrupt_malloc, handling_signal):
+       Remove decls.
+       * sysdep.c, syssignal.h (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
+       Now static.
+
+       * font.c (Ffont_shape_gstring): Remove unused local.
+
+2012-09-16  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (clean): No longer run nextstep's clean.
+
+       * Makefile.in (ns_appdir, ns_appbindir, ns_appsrc): Remove variables.
+       (ns_frag): Remove.
+       (ns-app): Move here from ns.mk, and simplify.
+       (clean): Simplify nextstep entry.
+       * ns.mk: Remove file.
+
+2012-09-17  Kenichi Handa  <handa@gnu.org>
+
+       * font.c (Ffont_shape_gstring): Fix previous change; GLYPHs may
+       not covert the last few charactes.
+
+2012-09-16  Kenichi Handa  <handa@gnu.org>
+
+       * font.c (Ffont_shape_gstring): Don't adjust grapheme cluster
+       here, but just check the validity of glyphs in the glyph-string.
+
+2012-09-16  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.c (Fwindow_parameter, Fset_window_parameter): Accept
+       any window as argument (Bug#12452).
+
+2012-09-16  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsfns.m (Fx_open_connection): Move initialization of ns_*_types
+       to ns_term_init to avoid memory leak.
+
+       * nsterm.m (ns_update_begin): Initialize bp after lcokFocus, use
+       explicit retain/release.
+       (ns_term_init): Only allow one display.  Initialize outerpool and
+       ns_*_types.
+
+2012-09-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port _setjmp fix to POSIXish hosts as well as Microsoft.
+       * image.c (_setjmp) [!HAVE__SETJMP]: Restore definition, as
+       it's needed on POSIXish hosts that lack _setjmp.  Attempt to solve
+       the Microsoft problem in a different way, by altering ../nt/config.nt.
+
+2012-09-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32xfns.c:
+       * w32uniscribe.c:
+       * w32term.c:
+       * w32select.c:
+       * w32reg.c:
+       * w32proc.c:
+       * w32menu.c:
+       * w32inevt.c:
+       * w32heap.c:
+       * w32font.c:
+       * w32fns.c:
+       * w32console.c:
+       * w32.c:
+       * w16select.c: Remove inclusion of setjmp.h, as it is now included
+       by lisp.h.  This completes removal of setjmp.h inclusion
+       erroneously announced in the previous commit.  (Bug#12446)
+
+       * lisp.h [!HAVE__SETJMP, !HAVE_SIGSETJMP]: Make the commentary
+       more accurate.
+
+       * image.c (_setjmp) [!HAVE__SETJMP]: Define only if 'setjmp' is
+       not defined as a macro.  The latter happens on MS-Windows.
+       (Bug#12446)
+
+2012-09-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port better to POSIX hosts lacking _setjmp (Bug#12446).
+       * lisp.h: Include <setjmp.h> here, since we use its symbols here.
+       Some instances of '#include <setjmp.h>' removed, if the
+       only reason for the instance was because "lisp.h" was included.
+       (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols.
+       Unless otherwise specified, replace all uses of jmp_buf, _setjmp,
+       and _longjmp with the new symbols.  Emacs already uses _setjmp if
+       available, so this change affects only POSIXish hosts that have
+       sigsetjmp but not _setjmp, such as some versions of Solaris and
+       Unixware.  (Also, POSIX-2008 marks _setjmp as obsolescent.)
+       * image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros.
+       (png_load_body) [HAVE_PNG]:
+       (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]:
+       (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]:
+       Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp,
+       since PNG requires jmp_buf.  This is the only exception to the
+       general rule that we now use sys_setjmp and sys_longjmp.
+       This exception is OK since this code does not change the signal
+       mask or longjmp out of a signal handler.
+
+2012-09-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]:
+       Include "syssignal.h", for 'main_thread'.
+
+2012-09-14  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Avoid out-of-range marker position (Bug#12426).
+       * insdel.c (replace_range, replace_range_2): Adjust
+       markers before overlays, as suggested by comments.
+       (insert_1_both, insert_from_buffer_1, adjust_after_replace):
+       Remove redundant check before calling offset_intervals.
+
+2012-09-14  Martin Rudalics  <rudalics@gmx.at>
+
+       * xdisp.c (Fformat_mode_line): Unconditionally save/restore
+       current buffer (Bug#12387).
+
+2012-09-14  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/alloc.$(O)): Update dependencies.
+
+2012-09-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use a more backwards-compatible timer format (Bug#12430).
+       * keyboard.c (decode_timer): Get PSECS from the 8th (origin-0)
+       vector element, not from the 4th, since PSECS is now at the end.
+       (Fcurrent_idle_time): Doc fix.
+
+2012-09-13  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Function to mark objects and remove killed buffers at once.
+       * alloc.c (discard_killed_buffers): Rename to ...
+       (mark_discard_killed buffers) ... new name.  Add marking
+       of remaining objects.  Fix comment.  Adjust users.
+       (mark_object): Do not touch frame buffer lists here.
+       * frame.c (delete_frame): Reset frame buffer lists here.
+
+2012-09-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Better workaround for GNOME bug when --enable-gcc-warnings.
+       * emacsgtkfixed.c (G_STATIC_ASSERT): Remove, undoing last change.
+       Instead, disable -Wunused-local-typedefs.  See Dmitry Antipov in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00335.html>.
+
+       Simplify SIGIO usage (Bug#12408).
+       The code that dealt with SIGIO was crufty and confusing, e.g., it
+       played tricks like "#undef SIGIO" but these tricks were not used
+       consistently.  Simplify mostly by not #undeffing standard symbols,
+       e.g., use "defined USABLE_SIGIO" (our symbol, which we can define
+       or not as we please) rather than "defined SIGIO" (standard symbol
+       that we probably shouldn't #undef).
+       * conf_post.h [USG5_4]: Do not include <sys/wait.h> here.
+       Modules that need it can include it.
+       [USG5_4 && emacs]: Likewise, do not include the streams stuff here.
+       * dispextern.h (ignore_sigio): New decl.
+       * emacs.c (shut_down_emacs): Invoke unrequest_sigio
+       unconditionally, since it's now a no-op if !USABLE_SIGIO.
+       * emacs.c (shut_down_emacs):
+       * keyboard.c (kbd_buffer_store_event_hold):
+       Use ignore_sigio rather than invoking 'signal' directly.
+       * keyboard.c (USABLE_FIONREAD && USG5_4): Include <sys/filio.h>,
+       for FIONREAD.
+       (FIONREAD, SIGIO): Do not #undef.
+       (tty_read_avail_input): Use #error rather than a syntax error.
+       * process.c [USG5_4]: Include <sys/stream.h> and <sys/stropts.h>,
+       for I_PIPE, used by SETUP_SLAVE_PTY.
+       (DATAGRAM_SOCKETS): Simplify defn, based on USABLE_FIONREAD.
+       * sysdep.c (croak): Remove; no longer needed.  This bit of
+       temporary code, with Fred N. Fish's comment that it's temporary,
+       has been in Emacs since at least 1992!
+       (init_sigio, reset_sigio, request_sigio, unrequest_sigio):
+       Arrange for them to be no-ops in all cases when ! USABLE_SIGIO.
+       * syssignal.h (croak): Remove decl.
+       (SIGIO, SIGPOO, SIGAIO, SIGPTY): Do not #undef; that's too fragile.
+       * systty.h [!NO_TERMIO]: Do not include <termio.h>; no longer needed
+       now that we're termios-only.
+       (FIONREAD, ASYNC) [BROKEN_FIONREAD]: Do not #undef.
+       * term.c (dissociate_if_controlling_tty): Use #error rather than
+       a run-time error.
+
+       Work around GCC and GNOME bugs when --enable-gcc-warnings.
+       * emacsgtkfixed.c (G_STATIC_ASSERT): Redefine to use 'verify',
+       to work around GNOME bug 683906.
+       * image.c (jpeg_load_body) [HAVE_JPEG && lint]: Pacify gcc -Wclobber.
+       (struct my_jpeg_error_mgr) [HAVE_JPEG && lint]: New member fp.
+       This works around GCC bug 54561.
+
+2012-09-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       More fixes for 'volatile' and setjmp/longjmp.
+       * eval.c (Fdefvar, Fcondition_case): Remove unnecessary 'volatile's.
+       * image.c (struct png_load_context) [HAVE_PNG]: New type.
+       (png_load_body) [HAVE_PNG]:
+       (jpeg_load_body) [HAVE_JPEG]:
+       New function, with most of the old parent function's body.
+       (png_load) [HAVE_PNG]:
+       (jpeg_load) [HAVE_JPEG]:
+       Invoke the new function, to avoid longjmp munging our locals.
+       (struct my_jpeg_error_mgr) [HAVE_JPEG]: New members cinfo, failure_code.
+       (my_error_exit) [HAVE_JPEG]: Don't trust 'setjmp' to return 2 when
+       longjmp is passed 2, as the C standard doesn't guarantee this.
+       Instead, store the failure code into mgr->failure_code.
+
+2012-09-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * keyboard.c (read_char, requeued_events_pending_p, Finput_pending_p)
+       (Fdiscard_input, quit_throw_to_read_char, init_keyboard)
+       (syms_of_keyboard): Remove support for unread-command-char.
+
+2012-09-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32proc.c (sys_kill): If PID is our process ID and the signal is
+       SIGABRT, call emacs_abort.  Avoids silently exiting upon assertion
+       violation.  (Bug#12426)
+
+2012-09-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * image.c (jpeg_memory_src): Don't assume string len fits in unsigned.
+
+2012-09-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c: Add `inhibit-debugger'.
+       (Qinhibit_debugger): New symbol.
+       (call_debugger): Bind it instead of Qdebug_on_error.
+       (maybe_call_debugger): Test Vinhibit_debugger.
+       (syms_of_eval): Define inhibit-debugger.
+       * xdisp.c (set_message): Don't bind Qinhibit_debug_on_message.
+       (syms_of_xdisp): Remove inhibit-debug-on-message.
+
+2012-09-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Avoid _setjmp/_longjmp problems with local nonvolatile variables.
+       If a nonvolatile local variable is written before a _longjmp to
+       the frame containing the variable, and is read after the _longjmp,
+       the value read is indeterminate.  Some local variables of type
+       'struct handler' and 'struct catchtag' are used in this way, so
+       mark each of their slots as volatile if the slot can be set before
+       _longjmp and read afterwards.
+       * lisp.h (struct handler): var and chosen_clause are now volatile.
+       (struct catchtag): val, next, and pdlcount are now volatile.
+
+       * bidi.c (bidi_push_it, bidi_pop_it):
+       * fns.c (copy_hash_table):
+       * image.c (define_image_type):
+       * keyboard.c (kbd_buffer_store_event_hold):
+       * process.c (Fprocess_send_eof):
+       * xfaces.c (x_create_gc) [HAVE_NS]:
+       * xgselect.c (xg_select):
+       Prefer assignment to memcpy when either will do.
+
+       * alloc.c (discard_killed_buffers): Tune and simplify a bit.
+       Use pointer-to-a-pointer to simplify and avoid a NILP check each
+       time an item is removed.  No need to mark this function 'inline';
+       the compiler knows better than we do.
+
+2012-09-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (ns_judge_scroll_bars): Pass NO to updateFrameSize.
+       (updateFrameSize:): Add delay parameter to updateFrameSize, send it
+       to change_frame_size (Bug#12388).
+       (windowDidResize:): Pass YES to updateFrameSize.
+
+       * nsterm.h: Add delay parameter to updateFrameSize.
+
+2012-09-11  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Discard killed buffers from deleted window and frame objects.
+       This reduces an amount of references to killed buffers and
+       helps GC to reclaim them faster.
+       * alloc.c (discard_killed_buffers): New function.
+       (mark_object): Use it for deleted windows and frames.
+       (mark_object): If symbol's value is set up for a killed buffer
+       or deleted frame, restore it's global binding.
+       * data.c (swap_in_global_binding): Add GC notice.
+       (swap_in_symval_forwarding): Use convenient set_blv_where.
+       * window.c (wset_next_buffers, wset_prev_buffers): Move ...
+       * window.h: ... to here.
+
+2012-09-11  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Convenient macro to check whether the buffer is live.
+       * buffer.h (BUFFER_LIVE_P): New macro.
+       * alloc.c, buffer.c, editfns.c, insdel.c, lread.c, marker.c:
+       * minibuf.c, print.c, process.c, window.c, xdisp.c: Use it.
+
 2012-09-11  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
        * xdisp.c (right_overwritten, right_overwriting): Also handle gstring
        (ns_maybe_dumpglyphs_background): Remove fringe/internal border
        adjustment.
        (ns_dumpglyphs_image): Ditto.
-       (ns_dumpglyphs_stretch): Fix coding style. Remove fringe/internal
+       (ns_dumpglyphs_stretch): Fix coding style.  Remove fringe/internal
        border adjustment.
        (ns_set_vertical_scroll_bar): Remove variables barOnVeryLeft/Right and
        their usage.  Add fringe_extended_p and its use as in other terms.
        * conf_post.h [SIGNAL_H_AHB]: Do not include <signal.h>;
        no longer needed here.
        * emacs.c (main): Inspect existing signal handler with sigaction,
-       so that there's no need to block and unblock SIGHUP.
+       so that there's no need to block and unblock SIGHUP.
        * sysdep.c (struct save_signal): New member 'action', replacing
        old member 'handler'.
        (save_signal_handlers, restore_signal_handlers):
 2012-08-28  Jan Djärv  <jan.h.d@swipnet.se>
 
        * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
-       button_values to NULL. Call setStykeMask so dialogs get a close button.
+       button_values to NULL.  Call setStykeMask so dialogs get a close button.
        (windowShouldClose:): Set window_closed.
        (dealloc): New member, free button_values.
-       (process_dialog:): Make member function. Remove window argument,
-       replace window with self. Count buttons and allocate and store values
+       (process_dialog:): Make member function.  Remove window argument,
+       replace window with self.  Count buttons and allocate and store values
        in button_values.
        (addButton:value:row:): value is int with the name tag.  Call setTag
-       with tag. Remove return self, declare return value as void.
+       with tag.  Remove return self, declare return value as void.
        (addString:row:): Remove return self, declare return value as void.
        (addSplit): Remove return self, declare return value as void.
        (clicked:): Remove return self, declare return value as void.
-       Set dialog_return to button_values[seltag]. Code formatting change.
+       Set dialog_return to button_values[seltag].  Code formatting change.
        (initFromContents:isQuestion:): Adjust call to process_dialog.
        Code formatting change.
        (timeout_handler:): Set timer_fired to YES.
 
        * fontset.c (FONTSET_ADD): Return void, not Lisp_Object.
        Otherwise, the compiler complains about (A?B:C) where B is void
-       and C is Lisp_Object.  This fixes an incompatibility with Sun C 5.12.
+       and C is Lisp_Object.  This fixes an incompatibility with Sun C 5.12.
        (fontset_add): Return void, for FONTSET_ADD.
 
 2012-08-21  Paul Eggert  <eggert@cs.ucla.edu>
        Start main loop and wait for application defined event.
        Inform select thread to stop selecting after main loop is exited.
        (ns_term_init): Create selfds pipe and set non-blocking.
-       Initialize select_mutex. Start the select thread (fd_handler).
+       Initialize select_mutex.  Start the select thread (fd_handler).
        (fd_handler:): Loop forever, wait for info from the main thread
        to either start or stop selecting.  When select returns, send
        and appdefined event.
        (xg_create_tool_bar): Allocate and initialize a xg_frame_tb_info
        if not present.
        (update_frame_tool_bar): Return early if data in xg_frame_tb_info
-       is up to date. Otherwise store new data.
+       is up to date.  Otherwise store new data.
        (free_frame_tool_bar): Free xg_frame_tb_info if present.
 
 2012-08-13  Dmitry Antipov  <dmantipov@yandex.ru>
 2012-08-11  Jan Djärv  <jan.h.d@swipnet.se>
 
        * nsterm.m (not_in_argv): New function.
-       (application:openFile,  application:openTempFile:):
+       (application:openFile, application:openTempFile:):
        (application:openFileWithoutUI:, application:openFiles:): Open file
        if not_in_argv returns non-zero (bug#12171).
 
 
 2012-07-21  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134).
+       * nsterm.m (accessibilityAttributeValue): New function.  (Bug#11134).
        (conversationIdentifier): Return value is NSInteger.
        * nsterm.m (accessibilityAttributeValue): Surround with NS_IMPL_COCOA.
 
        * lisp.h (struct vectorlike_header): New field `nbytes',
        adjust comment accordingly.
        * alloc.c (enum mem_type): New type `MEM_TYPE_VECTOR_BLOCK'
-       to denote vector blocks. Adjust users (live_vector_p,
+       to denote vector blocks.  Adjust users (live_vector_p,
        mark_maybe_pointer, valid_lisp_object_p) accordingly.
        (COMMON_MULTIPLE): Move outside #if USE_LSB_TAG.
        (VECTOR_BLOCK_SIZE, vroundup, VECTOR_BLOCK_BYTES),
        (allocate_vector_from_block, init_vectors, allocate_vector_from_block)
        (sweep_vectors): New functions.
        (allocate_vectorlike): Return `zero_vector' as the only vector of
-       0 items. Allocate new vector from block if vector size is less than
+       0 items.  Allocate new vector from block if vector size is less than
        or equal to VBLOCK_BYTES_MAX.
        (Fgarbage_collect): Move all vector sweeping code to sweep_vectors.
        (init_alloc_once): Add call to init_vectors.
        change it's type from Lisp_Object to bitfield.
        Change type of 'force_start', 'optional_new_start',
        'last_had_star', 'update_mode_line' and 'start_at_line_beg'
-       fields from Lisp_Object to bitfield. Adjust users accordingly.
+       fields from Lisp_Object to bitfield.  Adjust users accordingly.
 
 2012-05-31  Paul Eggert  <eggert@cs.ucla.edu>