1. 01 Jan, 2020 1 commit
  2. 12 Jul, 2019 2 commits
  3. 18 Apr, 2019 1 commit
    • Paul Eggert's avatar
      Mark _Noreturn error functions as cold · 6d6c55db
      Paul Eggert authored
      On my platform this made ‘make compile-always’ 1.3% faster.
      Suggested by Alex Gramiak in:
      https://lists.gnu.org/r/emacs-devel/2019-04/msg00684.html
      * configure.ac (nw): Don’t use -Wsuggest-attribute=cold.
      * lib-src/make-docfile.c (write_globals):
      Mark noreturn functions as cold.
      * src/callproc.c (exec_failed):
      * src/data.c (wrong_length_argument, wrong_type_argument):
      * src/emacs-module.c (module_abort):
      * src/emacs.c (terminate_due_to_signal):
      * src/eval.c (unwind_to_catch):
      * src/image.c (my_png_error, my_error_exit):
      * src/json.c (json_out_of_memory, json_parse_error):
      * src/keyboard.c (quit_throw_to_read_char, user_error):
      * src/lisp.h (die, wrong_type_argument, wrong_choice)
      (args_out_of_range, args_out_of_range_3, circular_list)
      (buffer_overflow, memory_full, buffer_memory_full)
      (string_overflow, xsignal, xsignal0, xsignal1, xsignal2)
      (xsignal3, signal_error, overflow_error, error, verror)
      (nsberror, report_file_errno, report_file_error)
      (report_file_notify_error, terminate_due_to_signal)
      (emacs_abort, fatal):
      * src/lread.c (load_error_old_style_backquotes)
      (end_of_file_error, invalid_syntax):
      * src/pdumper.c (error_unsupported_dump_object):
      * src/puresize.h (pure_write_error):
      * src/search.c (matcher_overflow):
      * src/sound.c (sound_perror, alsa_sound_perror):
      * src/sysdep.c (handle_arith_signal):
      * src/systime.h (time_overflow):
      * src/term.c (maybe_fatal, vfatal):
      * src/textprop.c (text_read_only):
      * src/timefns.c (invalid_time_zone_specification)
      (time_error, invalid_hz):
      * src/xterm.c (x_connection_closed):
      Use AVOID instead of _Noreturn void, so that it’s marked cold.
      * src/conf_post.h (__has_attribute_cold) [!__has_attribute]:
      New macro.
      (ATTRIBUTE_COLD): New macro.
      * src/frame.h (WINDOW_SYSTEM_RETURN): Add ATTRIBUTE_COLD.
      * src/lisp.h (AVOID): New macro.
      * src/xterm.c: Omit unnecessary static decls, so that we needn’t
      worry about which functions should be marked cold.
      (x_io_error_quitter): Mark as cold.
      6d6c55db
  4. 01 Mar, 2019 1 commit
    • Paul Eggert's avatar
      Suppress GC stats when obviously not needed · 7e29eae0
      Paul Eggert authored
      This should help future improvements where these stats can be
      bignums that do not fit into intmax_t.
      * src/alloc.c (struct gcstat, gcstat): New type and static var,
      to package up GC statistics into one C object.  It replaces ...
      (total_free_intervals, total_intervals, total_strings)
      (total_free_strings, total_string_bytes, total_vectors)
      (total_vector_slots, total_free_vector_slots): ... these
      removed static vars.  All uses changed.
      (garbage_collect_1): Accept a struct gcstat *, not a void *
      which was not used anymore anyway.  Return a bool indicating
      success, instead of a Lisp object.  All callers changed.
      (garbage_collect): New function.  All C callers of
      Fgarbage_collect changed to use it, since none of them use the
      return value.  Now, only Lisp code uses Fgarbage_collect.
      (Fgarbage_collect): No longer noinline.  Cons up the return
      value here, not in garbage_collect_1.
      7e29eae0
  5. 27 Feb, 2019 1 commit
    • Paul Eggert's avatar
      DEFVAR_INT variables are now intmax_t · e828765d
      Paul Eggert authored
      Formerly they were fixnums, which led to problems when dealing
      with values that might not fit on 32-bit platforms, such as
      string-chars-consed or floats_consed.  64-bit counters should
      be good enough for these (for a while, anyway...).
      While we’re at it, fix some unlikely integer overflow bugs
      that have been in the code for a while.
      * lib-src/make-docfile.c (write_globals):
      * src/data.c (do_symval_forwarding, store_symval_forwarding):
      * src/eval.c (restore_stack_limits, call_debugger):
      * src/frame.h (struct frame.cost_calculation_baud_rate):
      * src/keyboard.c (last_auto_save, bind_polling_period, read_char):
      * src/lisp.h (struct Lisp_Intfwd.intvar):
      * src/lread.c (defvar_int):
      * src/pdumper.c (dump_fwd_int):
      * src/thread.h (struct thread_state.m_lisp_eval_depth):
      * src/undo.c (truncate_undo_list):
      * src/xselect.c (wait_for_property_change)
      (x_get_foreign_selection):
      * src/xterm.c (x_emacs_to_x_modifiers):
      DEFVAR_INT variables now have the C type intmax_t, not EMACS_INT.
      * src/data.c (store_symval_forwarding):
      * src/gnutls.c (Fgnutls_boot):
      * src/keyboard.c (bind_polling_period):
      * src/macros.c (pop_kbd_macro, Fexecute_kbd_macro):
      * src/undo.c (truncate_undo_list):
      Allow any integer that fits into intmax_t, instead of
      requiring it to be a Lisp fixnum.
      * src/dispnew.c (update_window):
      * src/frame.c (x_figure_window_size):
      * src/gnutls.c (init_gnutls_functions)
      (emacs_gnutls_handle_error):
      * src/keyboard.c (make_lisp_event):
      * src/nsterm.m (ns_dumpglyphs_image):
      * src/profiler.c (make_log):
      * src/scroll.c (calculate_scrolling)
      (calculate_direct_scrolling):
      * src/termcap.c (tputs):
      * src/xterm.c (x_draw_image_relief):
      Avoid implementation-defined behavior on conversion of
      out-of-range integers.
      * src/eval.c (when_entered_debugger): Now intmax_t.
      (max_ensure_room): New function, that avoids signed integer overflow.
      (call_debugger, signal_or_quit): Use it.
      * src/fileio.c (Fdo_auto_save):
      * src/keyboard.c (make_lisp_event):
      * src/term.c (calculate_costs):
      * src/xdisp.c (build_desired_tool_bar_string)
      (hscroll_window_tree, try_scrolling, decode_mode_spec)
      (x_produce_glyphs):
      Avoid signed integer overflow.
      * src/lisp.h (clip_to_bounds): Generalize to intmax_t.
      * src/pdumper.c (dump_emacs_reloc_immediate_emacs_int): Remove, ...
      (dump_emacs_reloc_immediate_intmax_t): ... replacing with this
      function.  All uses changed.
      * src/profiler.c (make_log): Omit args.  All callers changed.
      * src/termcap.c: Include stdlib.h, for atoi.
      Include intprops.h.
      * src/window.c (sanitize_next_screen_context_lines): New function.
      (window_scroll_pixel_based, window_scroll_line_based):
      Use it to avoid signed integer overflow.
      e828765d
  6. 01 Jan, 2019 1 commit
  7. 28 Apr, 2018 1 commit
    • Paul Eggert's avatar
      Port --enable-gcc-warnings to GCC 8 · 8c3215e7
      Paul Eggert authored
      * configure.ac: Do not use GCC 8’s new -Wcast-align flag.
      * lib-src/ebrowse.c (xmalloc):
      * lib-src/emacsclient.c (xmalloc, xstrdup):
      * lib-src/etags.c (xmalloc):
      * lib-src/make-docfile.c (xmalloc):
      * lib-src/movemail.c (xmalloc):
      * src/dispnew.c (new_glyph_pool):
      * src/regex.c (xmalloc):
      * src/term.c (tty_menu_create):
      * src/tparam.h (tparam):
      Use ATTRIBUTE_MALLOC.  Also see GCC bug 85562.
      * lib-src/emacsclient.c (fail):
      Do not dereference a null pointer.
      * src/frame.c (delete_frame):
      Add a decl with UNINIT to work around GCC bug 85563.
      * src/menu.h (finish_menu_items):
      Do not use attribute const.
      * src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
      8c3215e7
  8. 02 Mar, 2018 1 commit
    • Paul Eggert's avatar
      make-docfile: minor fixes and cleanups · 2038b6a1
      Paul Eggert authored
      * lib-src/make-docfile.c: Include c-ctype.h.
      (read_c_string_or_comment, write_c_args, scan_c_stream, skip_white)
      (read_lisp_symbol, scan_lisp_file):
      Prefer c_isspace etc. to listing characters by hand.
      (read_c_string_or_comment): Simplify.
      (scan_c_stream, read_lisp_symbol): Use true for boolean 1.
      (scan_c_stream): Fix typo (c >= 'Z' && c <= 'Z').
      Minor rewrites to avoid duplicate code.
      (scan_c_stream, read_lisp_symbol, scan_lisp_file):
      Avoid infloop if at EOF.
      (skip_white, read_lisp_symbol): Don’t stuff getc result into
      ‘char’, as this mishandles EOF.
      2038b6a1
  9. 01 Jan, 2018 1 commit
  10. 13 Nov, 2017 1 commit
    • Paul Eggert's avatar
      Use alignas to fix GCALIGN-related bugs · b1573a97
      Paul Eggert authored
      Use alignas and unions to specify alignments of objects needing
      addresses that are at least a multiple of GCALIGNMENT.  Using
      these standard C facilities should be safer than relying on ad hoc
      and poorly-understood features like GCC’s __attribute__
      ((aligned (N))), the root cause for recent porting bugs like
      Bug#29040.  The alignas macro was standardized by C11 and Gnulib
      supports alignas for pre-C11 platforms.  I have tested this on Sun
      Studio 12 sparc (2007) and GCC 4.4.7 x86-64 (2012) as well as on
      more recent platforms like GCC 7.2.1 (2017) on Fedora 26 (both
      x86-64 and x86).
      * lib-src/make-docfile.c (close_emacs_globals): lispsym is now
      just an array of struct Lisp_Symbol, since struct Lisp_Symbol is
      now properly aligned.  All uses changed.
      * src/alloc.c (NEXT_FREE_LISP_STRING): Just use the new u.next
      member; this is simpler and safer than casting a pointer that
      might not be aligned properly.
      (aligned_Lisp_Symbol): Remove.  No longer needed, now that struct
      Lisp_Symbol is aligned properly.  All uses replaced with struct
      Lisp_Symbol.
      * src/lisp.h (GCALIGNED): Remove, as it does not work as expected:
      it can cause the natural alignment to be ignored.  All uses
      replaced by unions with a ‘char alignas (GCALIGNMENT)’ member as
      described below.
      (struct Lisp_Symbol, struct Lisp_Cons, struct Lisp_String):
      Change definition from ‘struct TAG { MEMBERS };’ to
      ‘struct TAG { union { struct { MEMBERS } s; char alignas
      (GCALIGNMENT) gcaligned; } u; };’.  This guarantees ‘struct TAG’
      to have an alignment that at least max (GCALIGNMENT, N) where N is
      its old alignment.  All uses like ‘PTR->MEMBER’ changed to
      ‘PTR->u.s.MEMBER’; these uses were supposed to be mostly private
      anyway.  Verify that the resulting ‘struct TAG’ is properly
      aligned for Emacs.
      (union vectorlike_header): New member ‘gcaligned’ to guarantee
      that this type, and its containing types like ‘struct Lisp_Subr’,
      ‘struct buffer’ and ‘struct thread_state’, are all properly
      aligned for Emacs.
      (struct Lisp_String): New union member ‘next’, for the benefit
      of NEXT_FREE_LISP_STRING.
      (union Aligned_Cons, union Aligned_String): Remove.  All uses
      replaced by struct Lisp_Cons and struct Lisp_String, since they
      are now properly aligned.
      (USE_STACK_CONS, USE_STACK_STRING): Simplify now that we can
      assume struct Lisp_Cons and struct Lisp_String are properly
      aligned.
      b1573a97
  11. 09 Nov, 2017 1 commit
    • Paul Eggert's avatar
      Use GCALIGNED properly for GCC · 9e59de94
      Paul Eggert authored
      Apparently GCC requires that ‘__attribute__ ((aligned (8)))’ must
      immediately follow the ‘struct’ keyword when aligning a structure.
      The attribute silently does not work if it follows a tag after the
      ‘struct’ keyword.  Who knew?  Anyway, this patch is designed to
      fix a SIGSEGV problem reported by John Mastro (Bug#29183).
      * lib-src/make-docfile.c (close_emacs_globals):
      * src/buffer.c (buffer_defaults, buffer_local_symbols):
      * src/lisp.h (DEFUN):
      * src/thread.c (main_thread):
      Put 'GCALIGNED' immediately after 'struct'.
      9e59de94
  12. 02 Nov, 2017 1 commit
    • Paul Eggert's avatar
      Fix alignment portability problems · 6b08ad52
      Paul Eggert authored
      Do not assume that the natural alignment of Lisp objects is a
      multiple of GCALIGNMENT.  This improves on the portability of the
      recent fix for Bug#29040.
      * lib-src/make-docfile.c (close_emacs_globals):
      * src/buffer.c (buffer_defaults, buffer_local_symbols):
      * src/lisp.h (DEFUN):
      * src/thread.c (main_thread):
      Use GCALIGNED, not alignas (GCALIGNMENT).
      * src/alloc.c (COMMON_MULTIPLE):
      Move back here from lisp.h, since it is no longer used elsewhere.
      * src/lisp.h (GCALIGNMENT): No longer a macro, since we need not
      worry about MSVC.  Omit no-longer-needed consistency check.
      * src/thread.c (THREAD_ALIGNMENT): Remove.
      6b08ad52
  13. 13 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to FTP and HTTP in documentation · bc511a64
      Paul Eggert authored
      Most of this change is to boilerplate commentary such as license URLs.
      This change was prompted by ftp://ftp.gnu.org's going-away party,
      planned for November.  Change these FTP URLs to https://ftp.gnu.org
      instead.  Make similar changes for URLs to other organizations moving
      away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
      fsf.org when this works, as this will further help defend against
      man-in-the-middle attacks (for this part I omitted the MS-DOS and
      MS-Windows sources and the test tarballs to keep the workload down).
      HTTPS is not fully working to lists.gnu.org so I left those URLs alone
      for now.
      bc511a64
  14. 29 Aug, 2017 1 commit
    • Paul Eggert's avatar
      Improve stack-top heuristic · 9baeed35
      Paul Eggert authored
      This is needed for gcc -Os -flto on x86-64; otherwise, GC misses part
      of the stack when scanning for heap roots, causing Emacs to crash
      later (Bug#28213).  The problem is that Emacs's hack for getting an
      address near the stack top does not work when link-time optimization
      moves stack variables around.
      * configure.ac (HAVE___BUILTIN_FRAME_ADDRESS): New macro.
      * lib-src/make-docfile.c (DEFUN_noinline): New constant.
      (write_globals, scan_c_stream): Support noinline.
      * src/alloc.c (NEAR_STACK_TOP): New macro.
      (SET_STACK_TOP_ADDRESS): Use it.
      (flush_stack_call_func, Fgarbage_collect): Now noinline.
      9baeed35
  15. 24 Jul, 2017 1 commit
    • Andreas Schwab's avatar
      Properly align global lispsym · 7a4d9f63
      Andreas Schwab authored
      * lib-src/make-docfile.c (close_emacs_globals): Wrap struct
      Lisp_Symbols inside struct.
      * src/alloc.c (sweep_symbols): Update use of lispsym.
      * src/lisp.h (builtin_lisp_symbol): Likewise.
      7a4d9f63
  16. 22 Jun, 2017 1 commit
    • Paul Eggert's avatar
      Use unlocked stdio more systematically · f6ef15cf
      Paul Eggert authored
      This can improve performance significantly on stdio-bottlenecked code.
      E.g., make-docfile is 3x faster on my Fedora 25 x86-64 desktop.
      * admin/merge-gnulib (GNULIB_MODULES): Add unlocked-io.
      * lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c:
      * lib-src/hexl.c, lib-src/make-docfile.c, lib-src/movemail.c:
      * lib-src/profile.c, lib-src/update-game-score.c:
      Include unlocked-io.h instead of stdio.h, since these programs are
      single-threaded.
      * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
      * lib/unlocked-io.h, m4/unlocked-io.m4: New files, copied from Gnulib.
      * src/charset.c, src/cm.c, src/emacs.c, src/image.c, src/keyboard.c:
      * src/lread.c, src/term.c:
      Include sysstdio.h, possibly instead of stdio.h, to define
      the unlocked functions if the system does not provide them.
      * src/charset.c, src/lread.c (getc_unlocked):
      Remove, since sysstdio.h now defines it if needed.
      * src/cm.c (cmputc, cmcheckmagic):
      * src/dispnew.c (update_frame, update_frame_with_menu)
      (update_frame_1, Fsend_string_to_terminal, Fding, bitch_at_user):
      * src/emacs.c (main, Fdump_emacs):
      * src/fileio.c (Fdo_auto_save, Fset_binary_mode):
      * src/image.c (slurp_file, png_read_from_file, png_load_body)
      (our_stdio_fill_input_buffer):
      * src/keyboard.c (record_char, kbd_buffer_get_event, handle_interrupt):
      * src/lread.c (readbyte_from_file):
      * src/minibuf.c (read_minibuf_noninteractive):
      * src/print.c (printchar_to_stream, strout)
      (Fredirect_debugging_output):
      * src/sysdep.c (reset_sys_modes, procfs_ttyname)
      (procfs_get_total_memory):
      * src/term.c (tty_ring_bell, tty_send_additional_strings)
      (tty_set_terminal_modes, tty_reset_terminal_modes)
      (tty_update_end, tty_clear_end_of_line, tty_write_glyphs)
      (tty_write_glyphs_with_face, tty_insert_glyphs)
      (tty_menu_activate):
      * src/xfaces.c (Fx_load_color_file):
      Use unlocked stdio when it should be safe.
      * src/sysstdio.h (clearerr_unlocked, feof_unlocked, ferror_unlocked)
      (fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked)
      (fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked)
      (putc_unlocked, putchar_unloced): Provide substitutes if not declared.
      f6ef15cf
  17. 15 Jun, 2017 1 commit
    • Paul Eggert's avatar
      No need to complicate make-docfile.c for Clang · 2b9620e6
      Paul Eggert authored
      * lib-src/make-docfile.c (put_filename): Undo recent change.
      The Clang false alarm occurs only with CFLAGS=-save-temps and
      we needn’t worry about pacifying unusual compiler configurations.
      2b9620e6
  18. 13 Jun, 2017 1 commit
  19. 30 Apr, 2017 1 commit
    • Paul Eggert's avatar
      Fix buffer overflow in make-docfile · a3f3fea1
      Paul Eggert authored
      * lib-src/make-docfile.c (scan_c_stream): Check for buffer
      overflow when reading an identifier.  Use a static buffer for NAME
      rather than a small dynamically-allocated buffer.
      a3f3fea1
  20. 01 Jan, 2017 1 commit
  21. 30 Sep, 2016 1 commit
    • Paul Eggert's avatar
      Limit <config.h>’s includes · f4eb8900
      Paul Eggert authored
      This follows up on recent problems with the fact that config.h
      includes stdlib.h etc.; some files need to include stdlib.h later.
      config.h generally should limit itself to includes that are
      universally safe; outside of MS-Windows, only stdbool.h makes
      the cut among the files currently included.  So, move the
      other includes to just the files that need them (Bug#24506).
      * configure.ac (config_opsysfile): Remove, as this generic hook
      is no longer needed.
      * lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c:
      * src/w32proc.c (_GNU_SOURCE):
      Remove, as it’s OK for config.h to do this now.
      * src/conf_post.h: Include <ms-w32.h>, instead of the generic
      config_opsysfile, for simplicity as this old way of configuring is
      now done only for the MS-Windows port.  Do not include <ms-w32.h>
      if DEFER_MS_W32_H, for the benefit of the few files that want its
      effects later.  Do not include <alloca.h>, <string.h>, or
      <stdlib.h>.  Other files modified to include these headers as
      needed, or to not include headers that are no longer needed.
      * src/lisp.h: Include <alloca.h> and <string.h> here, since
      some of the inline functions need them.
      * src/regex.c: Include <alloca.h> if not emacs.  (If emacs,
      we can rely on SAFE_ALLOCA.)  There is no longer any need to
      worry about HAVE_ALLOCA_H.
      * src/unexmacosx.c: Rely on config.h not including stdlib.h.
      * src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H):
      Define before including <config.h> first, and include <ms-w32.h>
      after the troublesome headers.
      f4eb8900
  22. 08 Jun, 2016 1 commit
  23. 10 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Rework C source files to avoid ^( · 7352c6c6
      Paul Eggert authored
      Work around Bug#22884 by rewording comments and strings to avoid ‘(’
      at the start of a line unless it starts a function.  This change
      is a short-term hack; in the longer run we plan to fix cc-mode’s
      performance for C files that have ‘(’ at the start of a line in a
      comment or string.
      7352c6c6
  24. 11 Feb, 2016 1 commit
  25. 10 Feb, 2016 2 commits
    • Paul Eggert's avatar
      make-docfile cleanup for I/O, etc. · 456c0a31
      Paul Eggert authored
      * lib-src/make-docfile.c (progname, generate_globals, num_globals)
      (num_globals_allocated, globals): Now static.
      (generate_globals, struct rcsoc_state, read_c_string_or_comment):
      (write_c_args, scan_c_stream, search_lisp_doc_at_eol, scan_lisp_file):
      Use bool for boolean.
      (verror): New function.
      (fatal, error): Use it.  API is now like printf.  All callers changed.
      (main): Remove err_count local that was always 0.
      (main, scan_c_stream, scan_lisp_file): Check for I/O error.
      (scan_file, scan_c_file, scan_c_stream, scan_lisp_file):
      Return void, not 0.
      (put_char, scan_keyword_or_put_char, scan_c_file): Use char for byte.
      (scan_keyword_or_put_char): Check for missing ( and unexpected EOF.
      (close_emacs_globals): Use ptrdiff_t for index, not int.
      (scan_c_file, scan_lisp_file): Exit with failure if file cannot be
      opened, rather than diagnosing but exiting with status 0.
      (search_lisp_doc_at_eol): Don't worry about ungetc of EOF; it's
      portable now.
      456c0a31
    • Paul Eggert's avatar
      Memory-management cleanup in make-docfile · 25ec995c
      Paul Eggert authored
      I compiled it with -fsanitize=address and fixed the leaks it detected.
      Also, I changed it to prefer signed to unsigned integer types,
      and to check for integer overflow.
      * lib-src/make-docfile.c:
      Include <stddef.h>, <stdint.h>, <intprops.h>, <min-max.h>.
      (memory_exhausted): New function.
      (xmalloc, xrealloc): Use it.
      (xmalloc, xrealloc, scan_file, struct rcsoc_state, write_c_args)
      (uncompiled, scan_lisp_file):
      Prefer signed integer types to unsigned.
      (xstrdup): Remove.  All uses removed.
      (num_globals, num_globals_allocated, write_globals, scan_c_stream):
      Use ptrdiff_t, not int, for indexes that in theory could exceed INT_MAX.
      (add_global): Use const to pacify --enable-gcc-warnings.
      Make a copy here, rather than relying on strdup calls later.
      (add_global, write_globals, scan_c_stream):
      Avoid integer overflow when calculating sizes.
      (write_globals, scan_c_stream, scan_lisp_file): Avoid memory leak.
      (scan_c_stream): Check for add_global failure.
      25ec995c
  26. 01 Jan, 2016 1 commit
  27. 27 Aug, 2015 1 commit
    • Paul Eggert's avatar
      Use straight quotes in lib-src diagnostics · 2934c21f
      Paul Eggert authored
      These auxiliary programs can’t use Emacs’s text-quoting-style,
      and it’s too much trouble to redo that mechanism by hand.
      So just use straight quotes for now.
      * lib-src/ebrowse.c (main):
      * lib-src/emacsclient.c (decode_options, main):
      * lib-src/etags.c (Ada_help, default_C_help, Cplusplus_help)
      (Forth_help, HTML_help, Lisp_help, Makefile_help, Objc_help)
      (Perl_help, PHP_help, Python_help, Scheme_help, TeX_help, auto_help)
      (none_help, print_language_names, print_help, add_regex)
      (suggest_asking_for_help):
      * lib-src/make-docfile.c (write_c_args, scan_c_stream):
      Use straight quotes in diagnostics.
      2934c21f
  28. 22 Feb, 2015 1 commit
    • Paul Eggert's avatar
      Spelling fixes · 14b4e657
      Paul Eggert authored
      * lisp/cedet/semantic/doc.el (semantic-documentation-comment-preceding-tag):
      Rename from semantic-documentation-comment-preceeding-tag.  All
      uses changed.  Leave an obsolete alias behind.
      * src/lisp.h (DEFINE_NON_NIL_Q_SYMBOL_MACROS):
      Rename from DEFINE_NONNIL_Q_SYMBOL_MACROS.  All uses changed.
      14b4e657
  29. 13 Feb, 2015 1 commit
    • Paul Eggert's avatar
      Better support for future plugins · 65563fd7
      Paul Eggert authored
      See the thread containing:
      http://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00720.html
      * lib-src/make-docfile.c (write_globals): Generate code that #defines
      Qxxx macros other than Qnil only if DEFINE_NONNIL_Q_SYMBOL_MACROS.
      Qnil is safe to define even in plugins, since it must be zero for
      other reasons.
      * src/lisp.h (DEFINE_LISP_SYMBOL): New macro, replacing and simplifying
      DEFINE_LISP_SYMBOL_BEGIN / DEFINE_LISP_SYMBOL_END.  All uses changed.
      (DEFINE_NONNIL_Q_SYMBOL_MACROS): New macro, defaulting to true.
      65563fd7
  30. 16 Jan, 2015 1 commit
    • Paul Eggert's avatar
      Give up on -Wsuggest-attribute=const · 0adc75af
      Paul Eggert authored
      The attribute doesn't help performance significantly, and the
      warning seems to be more trouble than it's worth.  See the thread at:
      http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00361.html
      * configure.ac (WERROR_CFLAGS): Don't use -Wsuggest-attribute=const.
      * lib-src/make-docfile.c (write_globals):
      Remove special hack for Fnext_read_file_uses_dialog_p.
      * src/decompress.c (Fzlib_available_p):
      * src/gnutls.c (Fgnutls_available_p):
      * src/gtkutil.h (xg_uses_old_file_dialog):
      * src/xdisp.c (Ftool_bar_height):
      * src/xmenu.c (popup_activated):
      No longer const, since it's not const on at lest some
      configurations, and we shouldn't lie to the compiler.
      0adc75af
  31. 13 Jan, 2015 2 commits
    • Paul Eggert's avatar
      Don't say Fnext_read_file_uses_dialog_p is const · 785adfcc
      Paul Eggert authored
      It's const only if a windowing system is not used; don't say it's
      const otherwise.  See:
      http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00310.html
      * lib-src/make-docfile.c (write_globals):
      Add a special hack for Fnext_read_file_uses_dialog_p.
      * src/fileio.c (next_read_file_uses_dialog_p): Remove.
      Move guts back to ...
      (Fnext_read_file_uses_dialog_p): ... here.
      Don't declare as const, as make-docfile.c now has a special case
      for this function.  This is an ugly hack, but it's better than
      lying to the compiler.
      785adfcc
    • Dmitry Antipov's avatar
      Support const and noreturn DEFUN attributes. · ad9c4a40
      Dmitry Antipov authored
      * lib-src/make-docfile.c (struct global): New field 'flags'.
      (DEFUN_noreturn, DEFUN_const): New enum bitfields.
      (add_global): Now return pointer to global.
      (write_globals): Add _Noreturn and ATTRIBUTE_CONST attributes
      if requested by global's flags.
      (stream_match): New function.
      (scan_c_stream): Recognize 'attributes:' of DEFUN.
      
      * src/callint.c (Finteractive):
      * src/character.c (Fcharacterp, Fmax_char):
      * src.data.c (Feq, Fnull, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp)
      (Fstringp, Fchar_or_string_p, Fintegerp, Fnatnump, Fnumberp)
      (Ffloatp, Fbyteorder):
      * src/decompress.c (Fzlib_available_p):
      * src/fns.c (Fidentity):
      * src/frame.c (Fframe_windows_min_size):
      * src/gnutls.c (Fgnutls_error_p, Fgnutls_available_p):
      * src/window.c (Fwindow__sanitize_window_sizes):
      * src/xdisp.c (Ftool_bar_height):
      * src/xfaces.c (Fface_attribute_relative_p): Add const attribute.
      * src/emacs.c (Fkill_emacs):
      * src/eval.c (Fthrow):
      * src/keyboard.c (Ftop_level, Fexit_recursive_edit)
      (Fabor_recursive_edit): Add noreturn attribute.
      ad9c4a40
  32. 10 Jan, 2015 2 commits
    • Paul Eggert's avatar
      Port to 32-bit --with-wide-int · 6a37ecee
      Paul Eggert authored
      Prefer symbol indexes to struct Lisp_Symbol * casted and then
      widened, as the latter had trouble with GCC on Fedora 21 when
      configured --with-wide-int and when used in static initializers.
      * lib-src/make-docfile.c (write_globals): Define and use symbols like
      iQnil (a small integer, like 0) rather than aQnil (an address
      constant).
      * src/alloc.c (garbage_collect_1, which_symbols):
      * src/lread.c (init_obarray):
      Prefer builtin_lisp_symbol when it can be used.
      * src/dispextern.h (struct image_type.type):
      * src/font.c (font_property_table.key):
      * src/frame.c (struct frame_parm_table.sym):
      * src/keyboard.c (scroll_bar_parts, struct event_head):
      * src/xdisp.c (struct props.name):
      Use the index of a builtin symbol rather than its address.
      All uses changed.
      * src/lisp.h (TAG_SYMPTR, XSYMBOL_INIT): Remove, replacing with ...
      (TAG_SYMOFFSET, SYMBOL_INDEX): ... new macros that deal with
      symbol indexes rather than pointers, and which work better on MSB
      hosts because they shift right before tagging.  All uses changed.
      (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END):
      No longer noops on wide-int hosts, since they work now.
      (builtin_lisp_symbol): New function.
      6a37ecee
    • Paul Eggert's avatar
      Port to 32-bit Sun C 5.12 sparc · 288e1fd7
      Paul Eggert authored
      * make-docfile.c (close_emacs_globals): Align lispsym to GCALIGNMENT.
      The alignment is required on all platforms; it just happens to have
      been properly aligned on the previous platforms we tested.
      288e1fd7
  33. 05 Jan, 2015 2 commits
    • Paul Eggert's avatar
      Use 0 for Qnil · bc78ff26
      Paul Eggert authored
      Fixes Bug#15880.
      If USE_LSB_TAG, arrange for the representation of Qnil to be zero so
      that NILP (x) is equivalent to testing whether x is 0 at the
      machine level.  The overall effects of this and the previous patch
      shrink the size of the text segment by 2.3% and speeds up
      compilation of all the .elc files by about 0.5% on my platform,
      which is Fedora 20 x86-64.
      * lib-src/make-docfile.c (compare_globals):
      * src/lisp.h (lisp_h_XPNTR, lisp_h_XSYMBOL, lisp_h_XUNTAG)
      (make_lisp_symbol) [USE_LSB_TAG]:
      Symbols now tag the difference from lispsym, not the pointer.
      (lisp_h_XUNTAGBASE, TAG_SYMPTR): New macros.
      (Lisp_Int0, Lisp_Int1, Lisp_Symbol, Lisp_Misc, Lisp_String, Lisp_Cons):
      Renumber so that Lisp_Symbol is 0, so that Qnil is zero.
      (XSYMBOL): New forward decl.
      (XUNTAGBASE): New function.
      (XUNTAG): Use it.
      bc78ff26
    • Paul Eggert's avatar
      Compute C decls for DEFSYMs automatically · 58f2d6ef
      Paul Eggert authored
      Fixes Bug#15880.
      This patch also makes Q constants (e.g., Qnil) constant addresses
      from the C point of view.
      * make-docfile.c: Revamp to generate table of symbols, too.
      Include <stdbool.h>.
      (xstrdup): New function.
      (main): Don't process the same file twice.
      (SYMBOL): New constant in enum global_type.
      (struct symbol): Turn 'value' member into a union, either v.value
      for int or v.svalue for string.  All uses changed.
      (add_global): New arg svalue, which overrides value, so that globals
      can have a string value.
      (close_emacs_global): New arg num_symbols; all uses changed.
      Output lispsym decl.
      (write_globals): Output symbol globals too.  Output more
      ATTRIBUTE_CONST, now that Qnil etc. are C constants.
      Output defsym_name table.
      (scan_c_file): Move most of guts into ...
      (scan_c_stream): ... new function.  Scan for DEFSYMs and
      record symbols found.  Don't read past EOF if file doesn't
      end in newline.
      * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle:
      * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c:
      * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c:
      * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c:
      * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c:
      * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c:
      * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m:
      * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c:
      * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c:
      * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c:
      * xselect.c, xsettings.c, xterm.c:
      Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs).
      These names are now defined automatically by make-docfile.
      * alloc.c (init_symbol): New function.
      (Fmake_symbol): Use it.
      (c_symbol_p): New function.
      (valid_lisp_object_p, purecopy): Use it.
      * alloc.c (marked_pinned_symbols):
      Use make_lisp_symbol instead of make_lisp_ptr.
      (garbage_collect_1): Mark lispsym symbols.
      (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro.
      (mark_object): Use it.
      (sweep_symbols): Sweep lispsym symbols.
      (symbol_uses_obj): New function.
      (which_symbols): Use it.  Work for lispsym symbols, too.
      (init_alloc_once): Initialize Vpurify_flag here; no need to wait,
      since Qt's address is already known now.
      (syms_of_alloc): Add lispsym count to symbols_consed.
      * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0),
      when testing whether storage is all bits zero.
      * dispextern (struct image_type):
      * font.c (font_property_table):
      * frame.c (struct frame_parm_table, frame_parms):
      * keyboard.c (scroll_bar_parts, struct event_head):
      * xdisp.c (struct props):
      Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and
      Lisp_Object *, since Qfoo is no longer an object whose address can be
      taken.  All uses changed.
      * eval.c (run_hook): New function.  Most uses of Frun_hooks changed to
      use it, so that they no longer need to take the address of a Lisp sym.
      (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable.
      * frame.c (syms_of_frame): Add defsyms for the frame_parms table.
      * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here.
      DEFSYM Qdeactivate_mark before the corresponding var.
      * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line
      instead of interning their symbols; this avoids duplicates.
      (LISP_INITIALLY, TAG_PTR)
      (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT):
      New macros.
      (LISP_INITIALLY_ZERO): Use it.
      (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol)
      (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*):
      Move decls up, to avoid forward uses.  Include globals.h earlier, too.
      (make_lisp_symbol): New function.
      (XSETSYMBOL): Use it.
      (DEFSYM): Now just a placeholder for make-docfile.
      * lread.c (DEFINE_SYMBOLS): Define, for globals.h.
      (intern_sym): New function, with body taken from old intern_driver.
      (intern_driver): Use it.  Last arg is now Lisp integer, not ptrdiff_t.
      All uses changed.
      (define_symbol): New function.
      (init_obarray): Define the C symbols taken from lispsym.
      Use plain DEFSYM for Qt and Qnil.
      * syntax.c (init_syntax_once): No need to worry about
      Qchar_table_extra_slots.
      58f2d6ef
  34. 04 Jan, 2015 1 commit
    • Paul Eggert's avatar
      'temacs -nw' should not call missing functions · bf90e9ac
      Paul Eggert authored
      Without this patch, "temacs -nw" fails with the diagnostic
      "emacs: Symbol's function definition is void: frame-windows-min-size"
      and messes up the tty's state.
      * lib-src/make-docfile.c (write_globals):
      Declare Fframe_windows_min_size with ATTRIBUTE_CONST, too.  Sort.
      * src/frame.c (Fframe_windows_min_size): New placeholder function.
      (syms_of_frame): Define it.
      * src/window.c (Fwindow__sanitize_window_sizes): New placeholder.
      (syms_of_window): Define it.
      bf90e9ac
  35. 01 Jan, 2015 1 commit