1. 04 Dec, 2011 1 commit
    • Andreas Schwab's avatar
      Don't call Lisp in signal handler · 6c07aac2
      Andreas Schwab authored
      * emacs.c (Qkill_emacs): Define.
      (syms_of_emacs): Initialize it.
      * keyboard.c (interrupt_signal): Don't call Fkill_emacs here, set
      Qquit_flag to `kill-emacs' instead.
      (quit_throw_to_read_char): Add parameter `from_signal'.  All
      callers changed.  Call Fkill_emacs if requested and safe.
      * lisp.h (QUIT): Call Fkill_emacs if requested.
      6c07aac2
  2. 28 Nov, 2011 1 commit
  3. 27 Nov, 2011 2 commits
    • Eli Zaretskii's avatar
      Fix MS-Windows build with MSVC compiler. · 8c9afb46
      Eli Zaretskii authored
      Parts of the changes by Fabrice Popineau  <fabrice.popineau@supelec.fr>.
      
       lib-src/makefile.w32-in (LOCAL_FLAGS): Add $(EMACS_EXTRA_C_FLAGS).
       lib-src/emacsclient.c (main) <environ>: Remove declaration, already
       pulled in by unistd.h on Posix hosts and stdlib.h on MS-Windows.
       nt/inc/stdint.h (uint32_t, uint64_t) [_WIN64]: New typedefs.
       (UINT64_MAX) [_WIN64]: Fix definition.
       (uintmax_t, intmax_t): Fix definitions.
       nt/inc/inttypes.h (strtoumax, strtoimax) [!__MINGW32__]: Provide
       correct definitions.
       nt/config.nt (HAVE_DECL_STRTOLL): Define.
       (va_copy) [_WIN64]: Provide a better definition.
       src/s/ms-w32.h (utimbuf) [_MSC_VER]: Don't define.
       (snprintf) [_MSC_VER]: Redirect to _snprintf.
       (strtoll) [_MSC_VER]: Redirect to _strtoi64.
       (malloc, free, realloc, calloc): Redirect to e_* only when
       compiling Emacs.
       src/lisp.h (GCTYPEBITS): Move before first use.
       (ALIGN_GCTYPEBITS) [_MSC_VER]: Define.
       (DECL_ALIGN) [_MSC_VER]: Use it, as MSVC doesn't like bit ops in
       this macro definition.
       (tzname): Redirect to _tzname for all values of _MSC_VER.
      
      Fixes: debbugs:9960
      8c9afb46
    • Paul Eggert's avatar
      Spelling fixes. · e4769531
      Paul Eggert authored
      e4769531
  4. 19 Nov, 2011 1 commit
  5. 10 Nov, 2011 1 commit
    • Paul Eggert's avatar
      Standardize on VIRT_ADDR_VARIES behavior; otherwise, valgrind · 6a0bf43d
      Paul Eggert authored
      does not work on some platforms.  Problem reported by Andreas Schwab in
      <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00081.html>.
      * puresize.h (pure, PURE_P): Always behave as if VIRT_ADDR_VARIES
      is set, removing the need for VIRT_ADDRESS_VARIES.
      (PURE_P): Use a more-efficient implementation that needs just one
      comparison, not two: on x86-64 with GCC 4.6.2, this cut down the
      number of instructions from 6 (xorl, cmpq, jge, xorl, cmpq, setge)
      to 4 (xorl, subq, cmpq, setbe).
      * alloc.c (pure): Always extern now, since that's the
      VIRT_ADDR_VARIES behavior.
      (PURE_POINTER_P): Use a single comparison, not two, for
      consistency with the new puresize.h.
      * lisp.h (PNTR_COMPARISON_TYPE): Remove; no longer needed.
      * m/ibms390.h, m/intel386.h, m/template.h, s/cygwin.h, s/hpux10-20.h:
      Remove VIRT_ADDR_VARIES no longer needed.
      6a0bf43d
  6. 07 Nov, 2011 1 commit
  7. 05 Nov, 2011 1 commit
    • Eli Zaretskii's avatar
      Support MSVC build with newer versions of Visual Studio. · a6fc3b5c
      Eli Zaretskii authored
      Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>.
      
       src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as
       Nmake barfs on that.  Use $(OBJ*_c) variables instead, defined on
       nt/gmake.defs.
       src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields,
       which are not supported by MSVC.
       (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay)
       (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in
       bitfields.
       (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated
       types in bitfields.
       (DEFUN) [_MSC_VER]: Define in a different way for MSVC.
       src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version.
       src/w32.c: Don't include w32api.h for MSVC.
       (init_environment) [_MSC_VER]: Call sys_access, not _access.
       src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC.
       [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h.
       (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins.
       (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the
       e_* cousins.
       (alloca) [_MSC_VER]: Define to _alloca.
       src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC.
       src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC.
       nt/makefile.w32-in (clean-other-dirs-nmake)
       (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake):
       Update for current structure of doc/ subdirectories.
       nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables.
       nt/INSTALL: Update for newer versions of MSVC.
       lib/makefile.w32-in (FRC): New dummy target.
       (TAGS): Depend on FRC.
      
      Fixes: debbugs:9960
      a6fc3b5c
  8. 28 Oct, 2011 1 commit
  9. 11 Oct, 2011 1 commit
  10. 30 Sep, 2011 2 commits
    • Paul Eggert's avatar
      Remove dependency on glibc malloc internals. · f701dc2a
      Paul Eggert authored
      * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
      Move back here from lisp.h, but with their new implementations.
      (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
      (XMALLOC_OVERRUN_SIZE_SIZE): Move these new lisp.h macros here.
      * charset.c (charset_table_init): New static var.
      (syms_of_charset): Use it instead of xmalloc.  This removes a
      dependency on glibc malloc internals.  See Eli Zaretskii's comment in
      <http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00815.html>.
      * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
      Move back to alloc.c.
      (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
      (XMALLOC_OVERRUN_SIZE_SIZE): Move to alloc.c.
      f701dc2a
    • Paul Eggert's avatar
      Port --enable-checking=all to Fedora 14 x86. · cb993c58
      Paul Eggert authored
      * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
      Move to lisp.h.
      (xmalloc_put_size, xmalloc_get_size, overrun_check_malloc)
      (overrun_check_realloc, overrun_check_free):
      Use XMALLOC_OVERRUN_SIZE_SIZE, not sizeof (size_t).
      That way, xmalloc returns a properly-aligned pointer even if
      XMALLOC_OVERRUN_CHECK is defined.  The old debugging code happened
      to align OK on typical 64-bit hosts, but not on Fedora 14 x86.
      * charset.c (syms_of_charset): Take XMALLOC_OVERRUN_CHECK_OVERHEAD
      into account when calculating the initial malloc maximum.
      * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
      Move here from alloc.c, so that charset.c can use it too.
      Properly align; the old code wasn't right for common 32-bit hosts
      when configured with --enable-checking=all.
      (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
      (XMALLOC_OVERRUN_SIZE_SIZE): New macros.
      cb993c58
  11. 11 Sep, 2011 1 commit
  12. 09 Sep, 2011 1 commit
  13. 01 Sep, 2011 1 commit
  14. 29 Aug, 2011 1 commit
    • Paul Eggert's avatar
      sprintf-related integer and memory overflow issues. · 62f19c19
      Paul Eggert authored
      * doprnt.c (doprnt): Support printing ptrdiff_t and intmax_t values.
      (esprintf, esnprintf, exprintf, evxprintf): New functions.
      * keyboard.c (command_loop_level): Now EMACS_INT, not int.
      (cmd_error): kbd macro iterations count is now EMACS_INT, not int.
      (modify_event_symbol): Do not assume that the length of
      name_alist_or_stem is safe to alloca and fits in int.
      (Fexecute_extended_command): Likewise for function name and binding.
      (Frecursion_depth): Wrap around reliably on integer overflow.
      * keymap.c (push_key_description): First arg is now EMACS_INT, not int,
      since some callers pass EMACS_INT values.
      (Fsingle_key_description): Don't crash if symbol name contains more
      than MAX_ALLOCA bytes.
      * minibuf.c (minibuf_level): Now EMACS_INT, not int.
      (get_minibuffer): Arg is now EMACS_INT, not int.
      * lisp.h (get_minibuffer, push_key_description): Reflect API changes.
      (esprintf, esnprintf, exprintf, evxprintf): New decls.
      * window.h (command_loop_level, minibuf_level): Reflect API changes.
      62f19c19
  15. 05 Aug, 2011 1 commit
  16. 03 Aug, 2011 1 commit
  17. 02 Aug, 2011 1 commit
  18. 28 Jul, 2011 1 commit
    • Paul Eggert's avatar
      Integer and memory overflow fixes for display code. · ca9ce8f2
      Paul Eggert authored
      * dispextern.h (struct glyph_pool.nglyphs): Now ptrdiff_t, not int.
      * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool, scrolling_window):
      Check for overflow in size calculations.
      (line_draw_cost, realloc_glyph_pool, add_row_entry):
      Don't assume glyph table len fits in int.
      (struct row_entry.bucket, row_entry_pool_size, row_entry_idx)
      (row_table_size): Now ptrdiff_t, not int.
      (scrolling_window): Avoid overflow in size calculations.
      Don't update size until allocation succeeds.
      * fns.c (concat): Check for overflow in size calculations.
      (next_almost_prime): Verify NEXT_ALMOST_PRIME_LIMIT.
      * lisp.h (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
      (NEXT_ALMOST_PRIME_LIMIT): New constant.
      ca9ce8f2
  19. 19 Jul, 2011 1 commit
    • Paul Eggert's avatar
      Use ptrdiff_t for hash table indexes. · d3411f89
      Paul Eggert authored
      * category.c (hash_get_category_set):
      * ccl.c (ccl_driver):
      * charset.h (struct charset.hash_index, CHECK_CHARSET_GET_ID):
      * coding.c (coding_system_charset_list, detect_coding_system):
      * coding.h (struct coding_system.id):
      * composite.c (get_composition_id, gstring_lookup_cache):
      * fns.c (hash_lookup, hash_put, Fgethash, Fputhash):
      * image.c (xpm_get_color_table_h):
      * lisp.h (hash_lookup, hash_put):
      * minibuf.c (Ftest_completion):
      Use ptrdiff_t for hash table indexes, not int (which is too
      narrow, on 64-bit hosts) or EMACS_INT (which is too wide, on
      32-bit --with-wide-int hosts).
      d3411f89
  20. 08 Jul, 2011 1 commit
    • Paul Eggert's avatar
      Improve hashing quality when configured --with-wide-int. · 3cc5a532
      Paul Eggert authored
      * fns.c (hash_string): New function, taken from sxhash_string.
      Do not discard information about ASCII character case; this
      discarding is no longer needed.
      (sxhash-string): Use it.  Change sig to match it.  Caller changed.
      * lisp.h: Declare it.
      * lread.c (hash_string): Remove, since we now use fns.c's version.
      The fns.c version returns a wider integer if --with-wide-int is
      specified, so this should help the quality of the hashing a bit.
      3cc5a532
  21. 07 Jul, 2011 2 commits
    • Paul Eggert's avatar
      * editfns.c (pWIDE, pWIDElen, signed_wide, unsigned_wide): · a81d11a3
      Paul Eggert authored
      Remove, replacing with the new symbols in lisp.h.  All uses changed.
      * fileio.c (make_temp_name):
      * filelock.c (lock_file_1, lock_file):
      * xdisp.c (message_dolog):
      Don't assume PRIdMAX etc. works; this isn't portable to pre-C99 hosts.
      Use pMd etc. instead.
      * lisp.h (printmax_t, uprintmax_t, pMd, pMu): New types and macros,
      replacing the pWIDE etc. symbols removed from editfns.c.
      a81d11a3
    • Paul Eggert's avatar
      * doprnt.c: Prefer signed to unsigned when either works. · c2d1e36d
      Paul Eggert authored
      * eval.c (verror):
      * doprnt.c (doprnt):
      * lisp.h (doprnt):
      * xdisp.c (vmessage):
      Use ptrdiff_t, not size_t, when using or implementing doprnt,
      since the sizes cannot exceed ptrdiff_t bounds anyway, and we
      prefer signed arithmetic to avoid comparison confusion.
      * doprnt.c (doprnt): Avoid a "+ 1" that can't overflow,
      but is a bit tricky.
      c2d1e36d
  22. 05 Jul, 2011 2 commits
    • Paul Eggert's avatar
      [ChangeLog] · 9cfdb3ec
      Paul Eggert authored
      Assume support for memcmp, memcpy, memmove, memset.
      This simplifies the code a bit.  All current platforms have these,
      as they are required for C89.  If this turns into a problem we
      can add the gnulib modules for these (a 1-line change to Makefile.in).
      * configure.in: Don't check for memcmp, memcpy, memmove, memset.
      [lib-src/ChangeLog]
      Assume support for memcmp, memcpy, memmove, memset.
      * etags.c (absolute_filename): Assume memmove exists.
      [src/ChangeLog]
      Assume support for memcmp, memcpy, memmove, memset.
      * lisp.h, sysdep.c (memcmp, memcpy, memmove, memset):
      * regex.c (memcmp, memcpy):
      Remove; we assume C89 now.
      
      * gmalloc.c (memcpy, memset, memmove): Remove; we assume C89 now.
      (__malloc_safe_bcopy): Remove; no longer needed.
      9cfdb3ec
    • Paul Eggert's avatar
      * lisp.h (struct vectorlike_header, struct Lisp_Subr): Signed sizes. · 6089c567
      Paul Eggert authored
      Use EMACS_INT, not EMACS_UINT, for sizes.  The code works equally
      well either way, and we prefer signed to unsigned.
      6089c567
  23. 24 Jun, 2011 1 commit
  24. 23 Jun, 2011 1 commit
  25. 22 Jun, 2011 1 commit
    • Paul Eggert's avatar
      * dispextern.h (struct face.stipple): · 0766b489
      Paul Eggert authored
      * image.c (x_bitmap_height, x_bitmap_width, x_bitmap_pixmap)
      (x_bitmap_mask, x_allocate_bitmap_record)
      (x_create_bitmap_from_data, x_create_bitmap_from_file)
      (x_destroy_bitmap, x_destroy_all_bitmaps, x_create_bitmap_mask)
      (x_create_bitmap_from_xpm_data):
      * nsterm.h (struct ns_display_info.bitmaps_size, .bitmaps_last):
      * w32term.h (struct w32_display_info.icon_bitmap_id, .bitmaps_size)
      (.bitmaps_last):
      * xfaces.c (load_pixmap):
      * xterm.c (x_bitmap_icon, x_wm_set_icon_pixmap):
      * xterm.h (struct x_display_info.icon_bitmap_id, .bitmaps_size)
      (.bitmaps_last, struct x_output.icon_bitmap):
      Use ptrdiff_t, not int, for bitmap indexes.
      (x_allocate_bitmap_record): Check for size overflow.
      * dispextern.h, lisp.h: Adjust to API changes elsewhere.
      0766b489
  26. 19 Jun, 2011 3 commits
  27. 18 Jun, 2011 4 commits
  28. 16 Jun, 2011 2 commits
  29. 14 Jun, 2011 1 commit
    • Paul Eggert's avatar
      Variadic C functions now count arguments with ptrdiff_t. · f66c7cf8
      Paul Eggert authored
      This partly undoes my 2011-03-30 change, which replaced int with size_t.
      Back then I didn't know that the Emacs coding style prefers signed int.
      Also, in the meantime I found a few more instances where arguments
      were being counted with int, which may truncate counts on 64-bit
      machines, or EMACS_INT, which may be unnecessarily wide.
      * lisp.h (struct Lisp_Subr.function.aMANY)
      (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
      Arg counts are now ptrdiff_t, not size_t.
      All variadic functions and their callers changed accordingly.
      (struct gcpro.nvars): Now size_t, not size_t.  All uses changed.
      * bytecode.c (exec_byte_code): Check maxdepth for overflow,
      to avoid potential buffer overrun.  Don't assume arg counts fit in 'int'.
      * callint.c (Fcall_interactively): Check arg count for overflow,
      to avoid potential buffer overrun.  Use signed char, not 'int',
      for 'varies' array, so that we needn't bother to check its size
      calculation for overflow.
      * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
      * eval.c (apply_lambda):
      * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
      (struct textprop_rec.argnum): Now ptrdiff_t, not int.  All uses changed.
      (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
      f66c7cf8
  30. 13 Jun, 2011 1 commit