1. 23 Sep, 2012 2 commits
    • Paul Eggert's avatar
      Do not use SA_NODEFER. · 62a1d661
      Paul Eggert authored
      Problem reported by Dani Moncayo in
      <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00557.html>.
      * alloc.c (die):
      * sysdep.c (emacs_abort): Do not reset signal handler.
      * emacs.c (terminate_due_to_signal): Reset signal handler here.
      * sysdep.c (init_signals): Do not use SA_NODEFER.  It wasn't
      wanted even on POSIXish hosts, and it doesn't work on Windows.
      62a1d661
    • Paul Eggert's avatar
      Simplify and avoid signal-handling races. · 4d7e6e51
      Paul Eggert authored
      * nt/inc/ms-w32.h (emacs_raise): New macro.
      * src/alloc.c (die):
      * src/sysdep.c (emacs_abort) [HAVE_NTGUI]:
      Avoid recursive loop if there's a fatal error in the function itself.
      * src/atimer.c (pending_atimers):
      * src/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.
      * src/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.
      * src/atimer.c (turn_on_atimers):
      * src/dispnew.c (handle_window_change_signal):
      * src/emacs.c (handle_danger_signal):
      * src/keyboard.c (kbd_buffer_get_event):
      Don't reestablish signal handler; not needed with sigaction.
      * src/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.
      * src/data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
      (init_data): Remove.  Necessary stuff now done in init_signal.
      * src/emacs.c, src/xdisp.c: Include "atimer.h", since we invoke atimer functions.
      * src/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
      * src/floatfns.c: Do not include "syssignal.h"; no longer needed.
      * src/gtkutil.c (xg_get_file_name, xg_get_font):
      Remove no-longer-needed signal-mask manipulation.
      * src/keyboard.c, src/process.c (POLL_FOR_INPUT):
      Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
      * src/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.
      * src/keyboard.c (gobble_input, handle_user_signal):
      * src/process.c (wait_reading_process_output):
      Call signal-handling code rather than killing ourselves.
      * src/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.
      * src/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.
      * src/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.
      * src/syssignal.h: Include <stdbool.h>.
      (emacs_raise): New macro.
      * src/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.
      
      Fixes: debbugs:12471
      4d7e6e51
  2. 22 Sep, 2012 2 commits
  3. 17 Sep, 2012 1 commit
    • Glenn Morris's avatar
      Reduce the number of versioned files storing the short copyright string · 78f83752
      Glenn Morris authored
      * configure.ac (copyright): New output variable.
      (COPYRIGHT): New AC_DEFINE.
      
      * admin/admin.el (set-copyright): No more need to set copyrights for
      nextstep, or .c files.  Add configure.ac and config.nt.
      
      * lib-src/ebrowse.c (version):
      * lib-src/etags.c (print_version): Use COPYRIGHT.
      
      * nextstep/templates/Info-gnustep.plist.in:
      * nextstep/templates/InfoPlist.strings.in:
      * nextstep/templates/Info.plist.in: Let configure set copyright.
      
      * nt/config.nt (COPYRIGHT): New.
      
      * src/emacs.c: Use COPYRIGHT.
      78f83752
  4. 16 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Remove configure's --without-sync-input option. · 0caaedb1
      Paul Eggert authored
      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>.
      * configure.ac (SYNC_INPUT, BROKEN_SA_RESTART): Remove.
      * admin/CPP-DEFINES (BROKEN_SA_RESTART, SA_RESTART): Remove.
      * etc/TODO (Make SYNC_INPUT the default): Remove, as the code now
      behaves as if SYNC_INPUT is always true.
      * src/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.
      * src/atimer.c (run_timers, handle_alarm_signal):
      * src/keyboard.c (pending_signal, poll_for_input_1, poll_for_input)
      (handle_async_input, process_pending_signals)
      (handle_input_available_signal, init_keyboard):
      * src/nsterm.m (ns_read_socket):
      * src/process.c (wait_reading_process_output):
      * src/regex.c (immediate_quit, IMMEDIATE_QUIT_CHECK):
      * src/sysdep.c (emacs_sigaction_init) [SA_RESTART]:
      (emacs_write):
      * src/xterm.c (XTread_socket):
      Assume SYNC_INPUT.
      * src/conf_post.h (SA_RESTART) [IRIX6_5]: Do not #undef.
      * src/eval.c (handling_signal): Remove.  All uses removed.
      * src/lisp.h (ELSE_PENDING_SIGNALS): Remove.
      All uses replaced with the SYNC_INPUT version.
      (reset_malloc_hooks, uninterrupt_malloc, handling_signal):
      Remove decls.
      * src/sysdep.c, src/syssignal.h (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
      Now static.
      
      Fixes: debbugs:12450
      0caaedb1
  5. 15 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Port better to POSIX hosts lacking _setjmp. · 0328b6de
      Paul Eggert authored
      * configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols.
      (_setjmp, _longjmp): Remove.
      * src/lisp.h: Include <setjmp.h> here, since we use its symbols here.
      All 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.)
      * src/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.
      
      Fixes: debbugs:12446
      0328b6de
  6. 13 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Simplify SIGIO usage. · 4a4bbad2
      Paul Eggert authored
      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).
      * configure.ac (NO_TERMIO, BROKEN_FIONREAD, BROKEN_SIGAIO)
      (BROKEN_SIGPOLL, BROKEN_SIGPTY): Remove.
      (USABLE_FIONREAD, USABLE_SIGIO): New symbols.  All uses of
      'defined SIGIO' replaced with 'defined USABLE_SIGIO', with no need
      to #undef SIGIO now (which was error-prone).  Likewise, all uses
      of 'defined FIONREAD' replaced with 'defined USABLE_FIONREAD'.
      * src/admin/CPP_DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL)
      (BROKEN_SIGPTY, NO_TERMIO): Remove.
      * src/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.
      * src/dispextern.h (ignore_sigio): New decl.
      * src/emacs.c (shut_down_emacs): Invoke unrequest_sigio
      unconditionally, since it's now a no-op if !USABLE_SIGIO.
      * src/emacs.c (shut_down_emacs):
      * src/keyboard.c (kbd_buffer_store_event_hold):
      Use ignore_sigio rather than invoking 'signal' directly.
      * src/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.
      * src/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.
      * src/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.
      * src/syssignal.h (croak): Remove decl.
      (SIGIO, SIGPOO, SIGAIO, SIGPTY): Do not #undef; that's too fragile.
      * src/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.
      * src/term.c (dissociate_if_controlling_tty): Use #error rather than
      a run-time error.
      
      Fixes: debbugs:12408
      4a4bbad2
  7. 09 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Assume C89 or later for math functions. · f6196b87
      Paul Eggert authored
      This simplifies the code, and makes it a bit smaller and faster,
      and (most important) makes it easier to clean up signal handling
      since we can stop worring about floating-point exceptions in
      library code.  That was a problem before C89, but the problem
      went away many years ago on all practical Emacs targets.
      * configure.ac (frexp, fmod): Remove checks for these functions,
      as we now assume them.
      (FLOAT_CHECK_DOMAIN, HAVE_INVERSE_HYPERBOLIC, NO_MATHERR)
      (HAVE_EXCEPTION):
      Remove; no longer needed.
      * admin/CPP-DEFINES (HAVE_FMOD, HAVE_FREXP, FLOAT_CHECK_DOMAIN)
      (HAVE_INVERSE_HYPERBOLIC, NO_MATHERR): Remove.
      * src/data.c, src/image.c, src/lread.c, src/print.c:
      Don't include <math.h>; no longer needed.
      * src/data.c, src/floatfns.c (IEEE_FLOATING_POINT): Don't worry that it
      might be autoconfigured, as that never happens.
      * src/data.c (fmod):
      * src/doprnt.c (DBL_MAX_10_EXP):
      * src/print.c (DBL_DIG):
      Remove.  C89 or later always defines these.
      * src/floatfns.c (HAVE_MATHERR, FLOAT_CHECK_ERRNO, FLOAT_CHECK_DOMAIN)
      (in_float, float_error_arg, float_error_arg2, float_error_fn_name)
      (arith_error, domain_error, domain_error2):
      Remove all this pre-C89 cruft.  Do not include <errno.h> as that's
      no longer needed -- we simply return what C returns.  All uses removed.
      (IN_FLOAT, IN_FLOAT2): Remove.  All uses replaced with
      the wrapped code.
      (FLOAT_TO_INT, FLOAT_TO_INT2, range_error, range_error2):
      Remove.  All uses expanded, as these macros are no longer used
      more than once and are now more trouble than they're worth.
      (Ftan): Use tan, not sin / cos.
      (Flogb): Assume C89 frexp.
      (fmod_float): Assume C89 fmod.
      (matherr) [HAVE_MATHERR]: Remove; no longer needed.
      (init_floatfns): Remove.  All uses removed.
      f6196b87
  8. 07 Sep, 2012 2 commits
    • Paul Eggert's avatar
      * emacs.c (main): Convert three 'signal' calls to 'sigaction' calls. · eddb36a7
      Paul Eggert authored
      Problem introduced when merging patches.  Noted by Eli Zaretskii in
      <http://bugs.gnu.org/12327#67>.
      eddb36a7
    • Paul Eggert's avatar
      Signal-handler cleanup. · 2fe28299
      Paul Eggert authored
      Emacs's signal handlers were written in the old 4.2BSD style with
      sigblock and sigmask and so forth, and this led to some
      inefficiencies and confusion.  Rewrite these to use
      pthread_sigmask etc. without copying signal sets around.  Also,
      get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and
      'signal', and instead use functions that do not attempt to take
      over the system name space.  This patch causes Emacs's text
      segment to shrink by 0.7% on my platform, Fedora 17 x86-64.
      * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
      Adjust to syssignal.h changes.
      (SIGNAL_H_AB): Remove; no longer needed.
      * src/alloc.c, src/emacsgtkfixed.c, src/nsfns.m, src/widget.c, src/xmenu.c:
      Do not include <signal.h> or "syssignal.h", as these
      modules do not use signals.
      * src/atimer.c, src/callproc.c, src/data.c, src/dispnew.c, src/emacs.c:
      * src/floatfns.c, src/gtkutil.c, src/keyboard.c, src/process.c, src/sound.c:
      * src/sysdep.c, src/term.c, src/xterm.c:
      Do not include <signal.h>, as "syssignal.h" does that for us now.
      * src/atimer.c (sigmask_atimers): New function.
      (block_atimers, unblock_atimers): New functions,
      replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS.
      All uses replaced.
      * src/conf_post.h [SIGNAL_H_AHB]: Do not include <signal.h>;
      no longer needed here.
      * src/emacs.c (main): Inspect existing signal handler with sigaction,
      so that there's	no need to block and unblock SIGHUP.
      * src/sysdep.c (struct save_signal): New member 'action', replacing
      old member 'handler'.
      (save_signal_handlers, restore_signal_handlers):
      Use sigaction instead of 'signal' to save and restore.
      (get_set_sighandler, set_sighandler) [!WINDOWSNT]:
      New function.  All users of 'signal' modified to use set_sighandler
      if they're writeonly, and to use sys_signal if they're read+write.
      (emacs_sigaction_init, forwarded_signal): New functions.
      (sys_signal): Remove.  All uses replaced by calls to sigaction
      and emacs_sigaction_init, or by direct calls to 'signal'.
      (sys_sigmask) [!__GNUC__]: Remove; no longer needed.
      (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove;
      all uses replaced by pthread_sigmask etc. calls.
      * src/syssignal.h: Include <signal.h>.
      (emacs_sigaction_init, forwarded_signal): New decls.
      (SIGMASKTYPE): Remove.  All uses replaced by its definiens, sigset_t.
      (SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask.
      (sigmask, sys_sigmask): Remove; no longer needed.
      (sigpause): Remove.  All uses replaced by its definiens, sigsuspend.
      (sigblock, sigunblock, sigfree):
      (sigsetmask) [!defined sigsetmask]:
      Remove.  All uses replaced by pthread_sigmask.
      (signal): Remove.  Its remaining uses (with SIG_DFL and SIG_IGN)
      no longer need to be replaced, and its typical old uses
      are now done via emacs_sigaction_init and sigaction.
      (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls.
      (sys_sigdel): Remove; unused.
      (NSIG): Remove a FIXME; the code's fine.  Remove an unnecessary ifdef.
      
      Fixes: debbugs:12327
      2fe28299
  9. 05 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Fix race conditions with signal handlers and errno. · 20ef56db
      Paul Eggert authored
      Be more systematic about preserving errno whenever a signal
      handler returns, even if it's not in the main thread.  Do this by
      renaming signal handlers to distinguish between signal delivery
      and signal handling.  All uses changed.
      * atimer.c (deliver_alarm_signal): Rename from alarm_signal_handler.
      * data.c (deliver_arith_signal): Rename from arith_error.
      * dispnew.c (deliver_window_change_signal): Rename from
      window_change_signal.
      * emacs.c (deliver_error_signal): Rename from fatal_error_signal.
      (deliver_danger_signal) [SIGDANGER]: Rename from memory_warning_signal.
      * keyboard.c (deliver_input_available_signal): Rename from
      input_available_signal.
      (deliver_user_signal): Rename from handle_user_signal.
      (deliver_interrupt_signal): Rename from interrupt_signal.
      * process.c (deliver_pipe_signal): Rename from send_process_trap.
      (deliver_child_signal): Rename from sigchld_handler.
      * atimer.c (handle_alarm_signal):
      * data.c (handle_arith_signal):
      * dispnew.c (handle_window_change_signal):
      * emacs.c (handle_fatal_signal, handle_danger_signal):
      * keyboard.c (handle_input_available_signal):
      * keyboard.c (handle_user_signal, handle_interrupt_signal):
      * process.c (handle_pipe_signal, handle_child_signal):
      New functions, with the actual signal-handling code taken from the
      original respective signal handlers, sans the sporadic attempts to
      preserve errno, since that's now done by handle_on_main_thread.
      * atimer.c (alarm_signal_handler): Remove unnecessary decl.
      * emacs.c, floatfns.c, lisp.h: Remove unused FLOAT_CATCH_SIGKILL cruft.
      * emacs.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
      Move to sysdep.c.
      (main) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
      Move initialization of main_thread to sysdep.c's init_signals.
      * process.c (waitpid) [!WNOHANG]: #define to wait; that's good enough for
      our usage, and simplifies the mainline code.
      (record_child_status_change): New static function, as a helper
      for handle_child_signal, and with most of the old child handler's
      contents.
      (CAN_HANDLE_MULTIPLE_CHILDREN): New constant.
      (handle_child_signal): Use the above.
      * sysdep.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
      Moved here from emacs.c.
      (init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it;
      code moved here from emacs.c's main function.
      * sysdep.c, syssignal.h (handle_on_main_thread): New function,
      replacing the old SIGNAL_THREAD_CHECK.  All uses changed.  This
      lets callers save and restore errno properly.
      20ef56db
  10. 04 Sep, 2012 2 commits
    • Paul Eggert's avatar
      Give more-useful info on a fatal error (Bug#12328). · cf29dd84
      Paul Eggert authored
      * doc/emacs/trouble.texi (Crashing): New section, documenting this.
      * etc/NEWS: Document the change.
      * src/alloc.c [ENABLE_CHECKING]: Do not include <execinfo.h>.
      (die) [ENABLE_CHECKING]: Call fatal_error_backtrace instead
      of doing the work ourselves.
      * src/emacs.c (fatal_error_signal): Let fatal_error_backtrace
      do most of the work.
      (fatal_error_backtrace): New function, taken from the guts
      of the old fatal_error_signal, but with a new option to output
      a backtrace.
      (shut_down_emacs) [!DOS_NT]: Use strsignal to give more-useful
      info about the signal than just its number.
      * src/lisp.h (fatal_error_backtrace, emacs_backtrace): New decls.
      * src/sysdep.c: Include <execinfo.h>
      (emacs_backtrace): New function, taken partly from the previous
      code of the 'die' function.
      (emacs_abort): Call fatal_error_backtrace rather than abort.
      cf29dd84
    • Paul Eggert's avatar
      Simplify redefinition of 'abort' (Bug#12316). · 1088b922
      Paul Eggert authored
      Do not try to redefine the 'abort' function.  Instead, redo
      the code so that it calls 'emacs_abort' rather than 'abort'.
      This removes the need for the NO_ABORT configure-time macro
      and makes it easier to change the abort code to do a backtrace.
      * configure.ac (NO_ABRT): Remove.
      * admin/CPP-DEFINES (NO_ABORT): Remove.
      * nt/inc/ms-w32.h (w32_abort) [HAVE_NTGUI]: Remove.
      * src/.gdbinit: Just stop at emacs_abort, not at w32_abort or abort.
      * src/emacs.c (abort) [!DOS_NT && !NO_ABORT]:
      Remove; sysdep.c's emacs_abort now takes its place.
      * src/lisp.h (emacs_abort): New decl.  All calls from Emacs code to
      'abort' changed to use 'emacs_abort'.
      * src/msdos.c (dos_abort) [defined abort]: Remove; not used.
      (abort) [!defined abort]: Rename to ...
      (emacs_abort): ... new name.
      * src/sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking
      the place of the old 'abort' in emacs.c.
      * src/w32.c, src/w32fns.c (abort): Do not #undef.
      * src/w32.c (emacs_abort): Rename from w32_abort.
      1088b922
  11. 02 Sep, 2012 1 commit
    • Paul Eggert's avatar
      * emacs.c, eval.c: Use bool for boolean. · 1882aa38
      Paul Eggert authored
      * emacs.c (initialized, inhibit_window_system, running_asynch_code):
      (malloc_using_checking) [DOUG_LEA_MALLOC]:
      (display_arg) [HAVE_X_WINDOWS || HAVE_NS]:
      (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch)
      (main, decode_env_path, Fdaemon_initialized):
      * eval.c (call_debugger, Finteractive_p, interactive_p):
      (unwind_to_catch, Fsignal, wants_debugger, skip_debugger)
      (maybe_call_debugger, Fbacktrace):
      * process.c (read_process_output, exec_sentinel):
      Use bool for booleans.
      * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X.
      All callers changed.
      * eval.c (interactive_p): Omit always-true boolean argument
      EXCLUDE_SUBRS_P.  All callers changed.
      * dispextern.h, lisp.h: Reflect above API changes.
      * firstfile.c (dummy): Use the address of 'main', whose signature
      won't change, instead of the address of 'initialize', whose
      signature just changed from int to bool.
      * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ...
      * msdos.c (fatal_error_in_progress): ... from here.
      * xdisp.c (redisplaying_p): Now a boolean.  Set it to 1 instead
      of incrementing it.
      (redisplay_internal, unwind_redisplay): Simply clear
      REDISPLAYING_P when unwinding, instead of saving its previous,
      always-false value and then restoring it.
      1882aa38
  12. 01 Sep, 2012 2 commits
    • Daniel Colascione's avatar
      Refactor window-system configuration · 17a2cbbd
      Daniel Colascione authored
      This change streamlines the window system selection code in
      configure.in and moves many common function declarations from
      window-specific headers to frame.h.  It introduces a new TERM_HEADER
      macro in config.h: we set this macro to the right header to use for
      the window system for which we're compiling Emacs and have source
      files include it indirectly.  This way, we don't have to teach every
      file about every window system.
      17a2cbbd
    • Paul Eggert's avatar
      Better seed support for (random). · 0e23ef9d
      Paul Eggert authored
      * doc/lispref/numbers.texi (Random Numbers): Document new behavior of
      the calls (random) and (random STRING).
      * etc/NEWS: Document new behavior of (random), (random "string").
      * lisp/play/5x5.el, lisp/play/animate.el, lisp/play/cookie1.el:
      * lisp/play/dissociate.el, lisp/play/doctor.el, lisp/play/dunnet.el:
      * lisp/play/gomoku.el, lisp/play/landmark.el, lisp/play/mpuz.el:
      * lisp/play/tetris.el, lisp/play/zone.el:
      * lisp/calc/calc-comb.el (math-init-random-base):
      * lisp/play/blackbox.el (bb-init-board):
      * lisp/play/life.el (life):
      * lisp/server.el (server-use-tcp):
      * lisp/type-break.el (type-break):
      Remove unnecessary call to (random t).
      * lisp/net/sasl.el (sasl-unique-id-function):
      Change (random t) to (random), now that the latter is more random.
      * lisp/play/life.el (life-initialized): Remove no-longer-needed var.
      * lisp/gnus/gnus-sync.el (gnus-sync-lesync-setup):
      * lisp/gnus/message.el (message-canlock-generate, message-unique-id):
      Change (random t) to (random), now that the latter is more random.
      * lisp/org/org-id.el (org-id-uuid):
      Change (random t) to (random), now that the latter is more random.
      * src/emacs.c (main): Call init_random.
      * src/fns.c (Frandom): Set the seed from a string argument, if given.
      Remove long-obsolete Gentzel cruft.
      * src/lisp.h, src/sysdep.c (seed_random): Now takes address and size, not long.
      (init_random): New function.
      0e23ef9d
  13. 25 Aug, 2012 1 commit
  14. 19 Aug, 2012 1 commit
    • Paul Eggert's avatar
      Rely on <unistd.h> to declare 'environ', · b69a6d22
      Paul Eggert authored
      as gnulib does this if the system doesn't.
      * lib-src/emacsclient.c (environ): Remove decl.
      * src/callproc.c, src/editfns.c, src/process.c (environ) [!USE_CRT_DLL]:
      * src/emacs.c (environ) [DOUG_LEA_MALLOC]:
      * src/vm-limit.c (environ) [ORDINARY_LINK]: Remove decl.
      * src/vm-limit.c: Include <unistd.h>, for 'environ'.
      b69a6d22
  15. 05 Aug, 2012 2 commits
  16. 04 Aug, 2012 1 commit
    • Eli Zaretskii's avatar
      Fix bug #11959 with startup warnings on MS-Windows about ../site-lisp. · 76151e2c
      Eli Zaretskii authored
       src/w32.c (init_environment): Change the default values of many
       environment variables in dflt_envvars[] to NULL, to avoid pushing
       them into environment when they were not already defined.  Remove
       the code that deletes site-lisp subdirectories from the default
       value of EMACSLOADPATH, as it is no longer needed.
       (check_windows_init_file): Now external, not static.  Use
       Vload_path as is, without adding anything, as this function is now
       called when Vload_path is already set up.
       src/w32.h (check_windows_init_file): Add prototype.
       src/emacs.c (init_cmdargs) [WINDOWSNT]: When running from the build
       directory, ignore the /*/i386/ tail in Vinvocation_directory, for
       compatibility with Posix platforms.
       (main): Move the call to check_windows_init_file to here from
       w32.c.
       (decode_env_path) [WINDOWSNT]: Expand the %emacs_dir%/ prefix, if
       any, in the DEFALT argument into the root of the Emacs build or
       installation tree, as appropriate.
       src/callproc.c (init_callproc_1): Call decode_env_path instead of
       doing its equivalent by hand.
       (init_callproc): Replace DOS_NT condition with MSDOS, thus letting
       the code that sets Vexec_path run on MS-Windows.
       src/lread.c (init_lread): Add comments to #ifdef's.
      
       nt/paths.h (PATH_LOADSEARCH, PATH_SITELOADSEARCH, PATH_EXEC)
       (PATH_DATA, PATH_DOC): Replace dummy directory names with
       directories relative to %emacs_dir%.
       (PATH_EXEC): Add lib-src/oo-spd/i386 and lib-src/oo/i386, to cater
       to the use case of running un-installed Emacs.
      76151e2c
  17. 02 Aug, 2012 1 commit
  18. 31 Jul, 2012 1 commit
  19. 26 Jul, 2012 3 commits
    • Paul Eggert's avatar
      * emacs.c: Do not include <verify.h>; no longer needed. · 562157c8
      Paul Eggert authored
      Fixes: debbugs:12036
      562157c8
    • Paul Eggert's avatar
      Fix export of symbols to GDB. · 5eceb8fb
      Paul Eggert authored
      * alloc.c (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL)
      (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Move these here from
      emacs.c, as this is a more-suitable home.  Had this been done earlier
      the fix for 1995-05-30T23:07:27Z!kwzh@gnu.org would have avoided some of the problems noted in
      <http://bugs.gnu.org/1995-05-30T23:07:27Z!kwzh@gnu.org#13> by Eli Zaretskii, as the scope problems
      would have been more obvious.
      * emacs.c (gdb_CHECK_LISP_OBJECT_TYPE, gdb_DATA_SEG_BITS)
      (gdb_GCTYPEBITS, gdb_USE_LSB_TAG)
      (CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS, GCTYPEBITS, USE_LSB_TAG):
      Remove; now done in lisp.h.
      * lisp.h (PUBLISH_TO_GDB): New macro.
      (GCTYPEBITS, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE, enum pvec_type)
      (DATA_SEG_BITS): Use it.
      (GCTYPEBITS, USE_LSB_TAG): Now also an enum, for GDB.
      (CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS): Now just an enum, for GDB.
      * mem-limits.h (EXCEEDS_LISP_PTR): Redo so that DATA_SEG_BITS need
      not be usable in #if.  This simplifies things.
      5eceb8fb
    • Paul Eggert's avatar
      Simplify export of symbols to GDB; fix related .gdbinit bugs. · 1781b9e9
      Paul Eggert authored
      * etc/emacs-buffer.gdb ($tagmask, $valmask): Remove.
      (ygetptr): Adjust to recent changes in lisp.h and emacs.c,
      by using VALMASK instead of $valmask, CHECK_LISP_OBJECT_TYPE
      instead of gdb_use_union, and DATA_SEG_BITS instead of
      gdb_data_seg_bits.  Also, use $ptr.i rather than $ptr.u.val.
      * src/.gdbinit (xgetptr, xgetint, xgettype): Don't use "set $bugfix =
      $bugfix.i", as this doesn't work (with GDB 7.4.1, anyway).
      (xgetptr, xgetint, xgettype, xcoding, xcharset, xprintbytestr):
      Adjust to changes in lisp.h and emacs.c, by using
      CHECK_LISP_OBJECT_TYPE rather than gdb_use_struct, VALMASK instead
      of $valmask, DATA_SEG_BITS instead of gdb_data_seg_bits,
      INTTYPEBITS instead of gdb_gctypebits - 1, USE_LSB_TAG instead of
      gdb_use_lsb, (1 << GCTYPEBITS) - 1 instead of $tagmask, VALBITS
      instead of gdb_valbits.
      (xvectype, xvector, xpr, xprintstr, xbacktrace): Similarly, use
      PSEUDOVECTOR_FLAG instead of PVEC_FLAG, and ARRAY_MARK_FLAG
      instead of gdb_array_mark_flag.
      (xboolvector): Get size from $->size, not $->header.size.
      Use BOOL_VECTOR_BITS_PER_CHAR rather than mystery constants.
      (xreload, hook-run, hookpost-run): Remove.
      * src/emacs.c: Include <verify.h>.
      (gdb_use_lsb, gdb_use_struct, gdb_valbits, gdb_gctypebits)
      (gdb_data_seg_bits, PVEC_FLAG, gdb_array_mark_flag, gdb_pvec_type):
      Remove.
      (gdb_CHECK_LISP_OBJECT_TYPE, gdb_DATA_SEG_BITS, gdb_GCTYPEBITS)
      (gdb_USE_LSB_TAG): New enum constants.
      (CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS, GCTYPEBITS, USE_LSB_TAG):
      Also define these as enum constants, so they're visible to GDB.
      (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL): New macros.
      (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Also define these
      as constants, so they're visible to GDB.
      * src/lisp.h (VALBITS, INTTYPEBITS, FIXNUM_BITS, PSEUDOVECTOR_SIZE_BITS)
      (PSEUDOVECTOR_SIZE_MASK, PVEC_TYPE_MASK, BOOL_VECTOR_BITS_PER_CHAR):
      Now enum constants, not macros, so they're visible to GDB.
      (CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS): Default to 0, as this is
      more convenient now.  All uses changed.
      (VALMASK) [USE_LSB_TAG]: Also define in this case.
      * src/mem-limits.h (EXCEEDS_LISP_PTR): Adjust to DATA_SEG_BITS change.
      1781b9e9
  20. 16 Jul, 2012 1 commit
    • Dmitry Antipov's avatar
      Remove empty and useless init functions. · 6a0dd1d7
      Dmitry Antipov authored
      * lisp.h (init_character_once, init_fns, init_image)
      (init_filelock, init_sound): Remove prototype.
      * character.c (init_character_once): Remove.
      * filelock.c (init_filelock): Likewise.
      * fns.c (init_fns): Likewise.
      * image.c (init_image): Likewise.
      * sound.c (init_sound): Likewise.
      * emacs.c (main): Adjust accordingly.
      6a0dd1d7
  21. 12 Jul, 2012 1 commit
    • Glenn Morris's avatar
      Rename init_process rather than working around it on Darwin · b82da769
      Glenn Morris authored
      The old name is also the name of a Mach system call.
      
      * src/process.c (init_process_emacs): Rename from init_process.
      
      * src/lisp.h, src/emacs.c: Update for this name change.
      
      * src/nsgui.h, src/sysselect.h, src/s/darwin.h:
      Remove workaround that is no longer needed.
      b82da769
  22. 10 Jul, 2012 1 commit
    • Glenn Morris's avatar
      Stop ns builds setting the EMACSLOADPATH environment variable · 9e059e3f
      Glenn Morris authored
      Ref bugs 4309, 6401, etc.
      This is the last environment variable (ab)used by the ns port in this way.
      
      * src/nsterm.m (ns_load_path): Rename from ns_init_paths.
      Now it does not set EMACSLOADPATH, just returns the load-path string.
      * src/nsterm.h: Update accordingly.
      
      * src/lread.c [HAVE_NS]: Include nsterm.h.
      (init_lread) [HAVE_NS]: Use ns_load_path.
      
      * src/emacs.c (main) [HAVE_NS]: No longer call ns_init_paths.
      9e059e3f
  23. 09 Jul, 2012 1 commit
  24. 05 Jul, 2012 2 commits
    • Paul Eggert's avatar
      More xmalloc and related cleanup. · 38182d90
      Paul Eggert authored
      * alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c:
      * callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c:
      * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c:
      * font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c:
      * gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c:
      * nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c:
      * regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c:
      * sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c:
      * xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c:
      * xterm.c:
      Omit needless casts involving void * pointers and allocation.
      Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))",
      as the former is more robust if P's type is changed.
      Prefer xzalloc to xmalloc + memset 0.
      Simplify malloc-or-realloc to realloc.
      Don't worry about xmalloc returning a null pointer.
      Prefer xstrdup to xmalloc + strcpy.
      * editfns.c (Fmessage_box): Grow message_text by at least 80 when
      growing it.
      * keyboard.c (apply_modifiers_uncached): Prefer local array to
      alloca of a constant.
      38182d90
    • Dmitry Antipov's avatar
      Cleanup xmalloc. · 23f86fce
      Dmitry Antipov authored
      * admin/coccinelle/xzalloc.cocci: Semantic patch to convert
      calls to xmalloc with following memset to xzalloc.
      * src/lisp.h (xzalloc): New prototype.  Omit needless casts.
      * src/alloc.c (xzalloc): New function.  Omit needless casts.
      * src/charset.c: Omit needless casts.  Convert all calls to
      malloc with following memset to xzalloc.
      * src/dispnew.c: Likewise.
      * src/fringe.c: Likewise.
      * src/image.c: Likewise.
      * src/sound.c: Likewise.
      * src/term.c: Likewise.
      * src/w32fns.c: Likewise.
      * src/w32font.c: Likewise.
      * src/w32term.c: Likewise.
      * src/xfaces.c: Likewise.
      * src/xfns.c: Likewise.
      * src/xterm.c: Likewise.
      * src/atimer.c: Omit needless casts.
      * src/buffer.c: Likewise.
      * src/callproc.c: Likewise.
      * src/ccl.c: Likewise.
      * src/coding.c: Likewise.
      * src/composite.c: Likewise.
      * src/doc.c: Likewise.
      * src/doprnt.c: Likewise.
      * src/editfns.c: Likewise.
      * src/emacs.c: Likewise.
      * src/eval.c: Likewise.
      * src/filelock.c: Likewise.
      * src/fns.c: Likewise.
      * src/gtkutil.c: Likewise.
      * src/keyboard.c: Likewise.
      * src/lisp.h: Likewise.
      * src/lread.c: Likewise.
      * src/minibuf.c: Likewise.
      * src/msdos.c: Likewise.
      * src/print.c: Likewise.
      * src/process.c: Likewise.
      * src/region-cache.c: Likewise.
      * src/search.c: Likewise.
      * src/sysdep.c: Likewise.
      * src/termcap.c: Likewise.
      * src/terminal.c: Likewise.
      * src/tparam.c: Likewise.
      * src/w16select.c: Likewise.
      * src/w32.c: Likewise.
      * src/w32reg.c: Likewise.
      * src/w32select.c: Likewise.
      * src/w32uniscribe.c: Likewise.
      * src/widget.c: Likewise.
      * src/xdisp.c: Likewise.
      * src/xmenu.c: Likewise.
      * src/xrdb.c: Likewise.
      * src/xselect.c: Likewise.
      23f86fce
  25. 04 Jul, 2012 2 commits
    • Paul Eggert's avatar
      * emacs.c (gdb_pvec_type): Change it back to enum pvec_type. · 065c9eb4
      Paul Eggert authored
      This variable's comment says Emacs needs at least one GDB-visible
      symbol of type enum pvec_type, to work around GDB problems.
      The symbol's value doesn't matter.
      065c9eb4
    • Stefan Monnier's avatar
      Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE. · ee28be33
      Stefan Monnier authored
      * src/lisp.h (enum pvec_type): Use fewer bits.
      (PSEUDOVECTOR_SIZE_BITS): New constant.
      (PSEUDOVECTOR_SIZE_MASK, PVEC_TYPE_MASK): Use it.
      (XSETPVECTYPESIZE, XSETTYPED_PSEUDOVECTOR, DEFUN): Adapt code to
      change in pvec_type.
      (PSEUDOVECTOR_TYPEP): New macro.
      (TYPED_PSEUDOVECTORP): Use it.
      * src/fns.c (internal_equal): Adapt code to extract pvectype.
      * src/emacs.c (gdb_pvec_type): Update type.
      * src/alloc.c (PSEUDOVECTOR_NBYTES): New macro.
      (VECTOR_FREE_LIST_SIZE_MASK): Remove (=> PSEUDOVECTOR_SIZE_MASK).
      (VECTOR_FREE_LIST_FLAG): Remove (=> PVEC_FREE).
      (SETUP_ON_FREE_LIST): Use XSETPVECTYPESIZE.
      (sweep_vectors): Use it.  Use local var `total_bytes' instead of
      abusing vector->header.next.nbytes.
      (live_vector_p): Use PVEC_TYPE.
      (mark_object): Adapt code to extract pvectype.  Use switch.
      ee28be33
  26. 24 Jun, 2012 1 commit
  27. 16 Jun, 2012 1 commit
    • Andreas Schwab's avatar
      * buffer.h (FETCH_MULTIBYTE_CHAR): Define as inline. · e5560ff7
      Andreas Schwab authored
      (BUF_FETCH_MULTIBYTE_CHAR): Likewise.
      * character.c (_fetch_multibyte_char_p): Remove.
      * alloc.c: Include "character.h" before "buffer.h".
      * bidi.c: Likewise.
      * buffer.c: Likewise.
      * bytecode.c: Likewise.
      * callint.c: Likewise.
      * callproc.c: Likewise.
      * casefiddle.c: Likewise.
      * casetab.c: Likewise.
      * category.c: Likewise.
      * cmds.c: Likewise.
      * coding.c: Likewise.
      * composite.c: Likewise.
      * dired.c: Likewise.
      * dispnew.c: Likewise.
      * doc.c: Likewise.
      * dosfns.c: Likewise.
      * editfns.c: Likewise.
      * emacs.c: Likewise.
      * fileio.c: Likewise.
      * filelock.c: Likewise.
      * font.c: Likewise.
      * fontset.c: Likewise.
      * fringe.c: Likewise.
      * indent.c: Likewise.
      * insdel.c: Likewise.
      * intervals.c: Likewise.
      * keyboard.c: Likewise.
      * keymap.c: Likewise.
      * lread.c: Likewise.
      * macros.c: Likewise.
      * marker.c: Likewise.
      * minibuf.c: Likewise.
      * nsfns.m: Likewise.
      * nsmenu.m: Likewise.
      * print.c: Likewise.
      * process.c: Likewise.
      * regex.c: Likewise.
      * region-cache.c: Likewise.
      * search.c: Likewise.
      * syntax.c: Likewise.
      * term.c: Likewise.
      * textprop.c: Likewise.
      * undo.c: Likewise.
      * unexsol.c: Likewise.
      * w16select.c: Likewise.
      * w32fns.c: Likewise.
      * w32menu.c: Likewise.
      * window.c: Likewise.
      * xdisp.c: Likewise.
      * xfns.c: Likewise.
      * xmenu.c: Likewise.
      * xml.c: Likewise.
      * xselect.c: Likewise.
      e5560ff7
  28. 13 Jun, 2012 2 commits
    • Andreas Schwab's avatar
      Use a simple struct to implement compile time checks for the Lisp_Object type · 646b5f55
      Andreas Schwab authored
      * configure.in: Rename --enable-use-lisp-union-type to
      --enable-check-lisp-object-type and define CHECK_LISP_OBJECT_TYPE
      instead of USE_LISP_UNION_TYPE.
      
      * admin/make-emacs: Rename --union-type to --check-lisp-type.  Define
      CHECK_LISP_OBJECT_TYPE insted of USE_LISP_UNION_TYPE.
      * admin/CPP-DEFINES (DEBUG_LISP_OBJECT_TYPE): Renamed from
      USE_LISP_UNION_TYPE.
      
      * src/lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct
      instead of union.
      (XLI, XIL): Define.
      (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG): Use
      them.
      * src/emacs.c (gdb_use_struct): Renamed from gdb_use_union.
      * src/.gdbinit: Check gdb_use_struct instead of gdb_use_union.
      * src/alloc.c (widen_to_Lisp_Object): Removed.
      (mark_memory): Use XIL instead of widen_to_Lisp_Object.
      * src/frame.c (delete_frame): Remove outdated comment.
      * src/w32fns.c (Fw32_register_hot_key): Use XLI instead of checking
      USE_LISP_UNION_TYPE.
      (Fw32_unregister_hot_key): Likewise.
      (Fw32_toggle_lock_key): Likewise.
      * src/w32menu.c (add_menu_item): Likewise.
      (w32_menu_display_help): Use XIL instead of checking
      USE_LISP_UNION_TYPE.
      * src/w32heap.c (allocate_heap): Don't check USE_LISP_UNION_TYPE.
      (init_heap): Likewise.
      * src/w32term.c (w32_read_socket): Update comment.
      646b5f55
    • Paul Eggert's avatar
      USE_LISP_UNION_TYPE + USE_LSB_TAG cleanup (Bug#11604) · bfe3e0a2
      Paul Eggert authored
      * alloc.c (make_number) [!defined make_number]:
      Remove, as lisp.h always defines this now.
      (mark_maybe_pointer): Simplify since USE_LSB_TAG is always defined now.
      (roundup_size): Verify that it is a power of 2.
      * data.c (Fmake_variable_buffer_local, Fmake_local_variable):
      * ftfont.c (ftfont_driver): Use LISP_INITIALLY_ZERO.
      * lisp.h (USE_LSB_TAG): Allow the builder to compile with
      -DUSE_LSB_TAG=0, to override the automatically-selected default.
      USE_LSB_TAG now is always defined to be either 0 or 1.
      All uses changed.
      (union Lisp_Object): Don't worry about WORDS_BIGENDIAN; the
      code works fine either way, and efficiency is not a concern here,
      as the union type is for debugging, not for production.
      (LISP_MAKE_RVALUE, make_number) [USE_LISP_UNION_TYPE]:
      Use an inline function on all platforms when using the union type,
      since this is simpler and 'static inline' can be used portably
      within Emacs now.
      (LISP_INITIALLY_ZERO): New macro.
      (XFASTINT, XSETFASTINT) [USE_LISP_UNION_TYPE]: Remove.
      (XSET) [USE_LISP_UNION_TYPE]: Don't overparenthesize.
      bfe3e0a2
  29. 30 May, 2012 1 commit
    • Paul Eggert's avatar
      Clean up __executable_start, monstartup when --enable-profiling. · 9e4bf381
      Paul Eggert authored
      The following changes affect the code only when profiling.
      * dispnew.c (__executable_start): Rename from safe_bcopy.
      Define only on platforms that need it.
      * emacs.c: Include <sys/gmon.h> when profiling.
      (_mcleanup): Remove decl, since <sys/gmon.h> does it now.
      (__executable_start): Remove decl, since lisp.h does it now.
      (safe_bcopy): Remove decl; no longer has that name.
      (main): Coalesce #if into single bit of code, for simplicity.
      Cast pointers to uintptr_t, since standard libraries want integers
      and not pointers.
      * lisp.h (__executable_start): New decl.
      9e4bf381