summaryrefslogtreecommitdiff
path: root/src/conf_post.h
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* ; Fix typosStefan Kangas2023-12-031-1/+1
|
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* Port better to C23 bool+true+false keywordsPaul Eggert2022-09-281-5/+1
| | | | | | | | | | | | | | | | | | | | C23 is adding the C++ keywords bool, true, and false; prefer them to <stdbool.h> if they are available. * admin/merge-gnulib (GNULIB_MODULES): Add stdbool, which emulates C23 on pre-C23 platforms. (AVOIDED_MODULES): Remove stdbool; Gnulib has renamed this module to stdbool-c99 and nobody uses it so it does not need to be avoided. * m4/c-bool.m4: New file, from Gnulib stdbool module. * lib-src/seccomp-filter.c, src/conf_post.h, src/dynlib.h: * src/emacs-module.c, src/nsterm.m, src/systhread.h: * test/src/emacs-module-resources/mod-test.c: Use the C23 style and use bool without including <stdbool.h>. The Gnulib stdbool module causes config.h to include stdbool.h on pre-C23 platforms. * src/emacs-module.h.in: Don’t include <stdbool.h> if C23 or later, or if it has already been included.
* Use BASE_EQ instead of EQ where obviously safeMattias Engdegård2022-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (deadp): * src/buffer.c (reset_buffer_local_variables, candidate_buffer) (Fkill_buffer, Fbuffer_swap_text, Fmake_overlay, Fmove_overlay): * src/callint.c (Fcall_interactively): * src/coding.c (decode_coding_object, encode_coding_object) (code_convert_region, Ffind_operation_coding_system): * src/comp.c (Fcomp_el_to_eln_rel_filename): * src/conf_post.h (RE_TRANSLATE_P): * src/data.c (Fkill_local_variable, Fash, expt_integer): * src/dired.c (file_name_completion): * src/dispnew.c (set_window_cursor_after_update, update_frame_1) (Fframe_or_buffer_changed_p): * src/doc.c (Fdocumentation, Fdocumentation_property) (default_to_grave_quoting_style): * src/editfns.c (Fconstrain_to_field, save_excursion_save) (save_excursion_restore, Fngettext): * src/eval.c (Fautoload, un_autoload, specbind): * src/fileio.c (Fmake_temp_file_internal): * src/fns.c (string_char_to_byte, string_byte_to_char) (Fnthcdr, Fnreverse): * src/indent.c (vmotion): * src/inotify.c (add_watch): * src/keyboard.c (command_loop_1, read_char) (read_char_minibuf_menu_prompt): * src/lread.c (oblookup): * src/macfont.m (macfont_descriptor_entity, macfont_open): * src/minibuf.c (Finnermost_minibuffer_p, Ftry_completion) (Ftest_completion): * src/nsfns.m (ns_set_icon_name): * src/pdumper.c (dump_queue_dequeue): * src/pgtkfns.c (pgtk_set_icon_type, pgtk_set_icon_name): * src/process.c (Faccept_process_output): * src/textprop.c (set_text_properties): * src/w32fns.c (w32_set_icon_type, w32_set_icon_name): * src/w32select.c (validate_coding_system): * src/window.c (decode_next_window_args, window_loop) (save_window_save): * src/xdisp.c (wset_redisplay): * src/xfaces.c (Fx_family_fonts, resolve_face_name) (gui_supports_face_attributes_p): * src/xfns.c (x_set_icon_type, x_set_icon_name): * src/xselect.c (clean_local_selection_data): Use BASE_EQ instead of EQ where it is obvious that neither argument can be a symbol with properties or at least one argument is a non-symbol.
* Do not include <attribute.h> from <config.h>Paul Eggert2022-03-081-10/+9
| | | | | | | | | | | | This is because mod-test.c shouldn’t use source code from lib, but it does need to include <config.h>. * lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c: * lib-src/make-docfile.c, lib-src/movemail.c: * lib-src/seccomp-filter.c, src/dynlib.h, src/lisp.h: * src/syssignal.h, src/sysstdio.h, src/systhread.h, src/tparam.h: Include <attribute.h>. * src/conf_post.h: Do not include <attribute.h>. All uses of attribute.h macros replaced with their _GL_ equivalents.
* Fix the MS-DOS portPo Lu2022-02-241-0/+6
| | | | | * msdos/sedlibmk.inp: * src/conf_post.h [MSDOS]: Update for recent gnulib.
* Fix the DJGPP portPo Lu2022-02-111-0/+14
| | | | | | | | | | * config.bat: * msdos/sed1v2.inp: * msdos/sedlibmk.inp: Update for present Emacs. * src/Makefile.in (MAKE_PDUMPER_FINGERPRINT): Fix indentation to not confuse sed*.inp. * src/conf_post.h [MSDOS]: Define some things gnulib wants.
* Silence macOS vfork deprecation warningsMattias Engdegård2022-02-101-0/+13
| | | | | | | | | | | The vfork system call exists and works in macOS 11.6 but the compiler gives a deprecation message; silence it, because the performance is still better than that of plain fork. See discussion at https://lists.gnu.org/archive/html/emacs-devel/2022-02/msg00260.html * src/conf_post.h (VFORK): New #define. * src/callproc.c (emacs_spawn): * src/sysdep.c (sys_subshell): Use it.
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Port unused decls to C2xPaul Eggert2021-10-031-1/+0
| | | | | * src/conf_post.h (ATTRIBUTE_UNUSED): Remove. All uses replaced by MAYBE_UNUSED, and moved to start as needed for C2x.
* Clean up the fix for unexec build on GNU/LinuxEli Zaretskii2021-05-201-1/+30
| | | | | | | | | | | | | | | * src/conf_post.h [HYBRID_MALLOC || DARWIN_OS && HAVE_UNEXEC]: Include <stdlib.h> here, before redirecting 'malloc' and friends to their hybrid_* and unexec_* equivalents. #undef malloc and friends before redefining. Provide prototypes for the replacements. Suggested by Paul Eggert <eggert@cs.ucla.edu>. * src/gmalloc.c [HYBRID_MALLOC]: Remove declarations of 'malloc' and friends, as they are now redundant: we include <stdlib.h> in conf_post.h before redefining 'malloc' etc., and that provides prototypes from system headers. * configure.ac (HYBRID_MALLOC): Remove kludge to avoid replacement of 'free' by Gnulib. (Bug#36649)
* Work around __has_attribute bug in clang 3.4Paul Eggert2021-01-221-1/+3
| | | | | | * src/conf_post.h (HAS_ATTRIBUTE): * src/emacs-module.h.in (EMACS_ATTRIBUTE_NONNULL): Port to clang 3.4 and earlier.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Fix typos in recent attribute.h simplificationPaul Eggert2020-05-051-4/+5
| | | | | | | | | Problem reported by Andreas Schwab in: https://lists.gnu.org/r/emacs-devel/2020-05/msg00650.html * src/conf_post.h (HAS_ATTR_no_sanitize): Define to false in case cpp is picky, fixing a longstanding glitch here. (ATTRIBUTE_NO_SANITIZE_ADDRESS, ATTRIBUTE_NO_SANITIZE_UNDEFINED): Use HAS_ATTRIBUTE, not __has_attribute.
* Simplify by using attribute.h macrosPaul Eggert2020-05-031-75/+25
| | | | | | | | | | | | | | | | | | attribute.h is partly designed for C2X forward compatibility, since C2X will add some standard attributes. Using its macros should help insulate Emacs from C2X teething problems. * src/conf_post.h: Include attribute.h. (HAS_ATTRIBUTE, HAS_FEATURE): Rename from __has_attribute and __has_feature, to avoid polluting the builtin namespace. All uses changed. (ATTRIBUTE_COLD, ATTRIBUTE_FORMAT, FALLTHROUGH, ATTRIBUTE_CONST) (ATTRIBUTE_PURE, ATTRIBUTE_UNUSED, ATTRIBUTE_MAY_ALIAS) (ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE) (ATTRIBUTE_RETURNS_NONNULL): Remove, as attribute.h does this now. (NO_INLINE, EXTERNALLY_VISIBLE, ARG_NONNULL, ATTRIBUTE_UNUSED): Simplify by defining in terms of attribute.h macros. * src/systhread.h (ATTRIBUTE_WARN_UNUSED_RESULT): Remove. All uses replaced by attribute.h’s NODISCARD.
* Prefer inline functions in character.hPaul Eggert2020-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In character.h, replace macros with inline functions or enums when this is easy. This improves maintainability and on my platform (Fedora 31 x86-64, gcc -O2) improved CPU performance very slightly (0.3%) on ‘make compile-always’. * src/buffer.h (SANE_TAB_WIDTH, CHARACTER_WIDTH): Move here from character.h, and make them inline functions. Tune CHARACTER_WIDTH so that ASCII_CHAR_WIDTH is no longer needed. (sanitize_tab_width, sanitize_char_width): Move here from character.h. * src/character.h (MAX_CHAR, MAX_UNICODE_CHAR, MAX_1_BYTE_CHAR) (MAX_2_BYTE_CHAR, MAX_3_BYTE_CHAR, MAX_4_BYTE_CHAR) (MAX_5_BYTE_CHAR, MIN_MULTIBYTE_LEADING_CODE) (MAX_MULTIBYTE_LEADING_CODE, MAX_MULTIBYTE_LENGTH): Now enum constants instead of macros. * src/character.h (CHAR_BYTES): Redo to avoid conditional branches. (CHAR_BYTE8_P, BYTE8_TO_CHAR, UNIBYTE_TO_CHAR, CHAR_TO_BYTE8) (CHAR_TO_BYTE_SAFE, CHAR_BYTE8_HEAD_P, CHARACTERP) (CHECK_CHARACTER, CHECK_CHARACTER_CAR, CHECK_CHARACTER_CDR) (CHAR_PRINTABLE_P, CHAR_BYTES, CHAR_LEADING_CODE, BYTE8_STRING) (LEADING_CODE_P, TRAILING_CODE_P, CHAR_HEAD_P) (BYTES_BY_CHAR_HEAD): Now inline functions instead of macros. (ASCII_CHAR_WIDTH): Remove; no longer used. * src/conf_post.h (ATTRIBUTE_PURE): New macro. * src/lisp.h (char_table_ref): Use it, for better inlining. * src/fns.c (base64_decode_1): Add now-necessary casts.
* Improve inlining when compiling with -OgPaul Eggert2020-04-071-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/conf_post.h (EXTERN_INLINE) [!EMACS_EXTERN_INLINE]: Make it static inline, not merely static. This is a worthwhile performance improvement on my two platforms A and B (see below). On my platform A this change improves user+system CPU performance of ‘make compile-always’ by 52% on an -Og build, and by 1.4% on the default -O2 build. On my platform B this improves the same benchmark by 41% on an -Og build, and by -0.8% on the default -O2 build. That "-0.8%" is a small negative for this change, and I recall that it is why I didn't make this change earlier. However, Platform B uses an older GCC so we needn't worry overmuch about this small negative. With this change the performance advantage of -O2 over -Og has dropped on platform A; formerly -O2 was 87% faster than -Og, and now it is only 25% faster. On platform B the performance advantage of -O2 over -Og has dropped from being 62% faster to being 14% faster. Platform A is GCC 9.3.1 20200317 (Red Hat 9.3.1-1) on Fedora 31 x86-64 (AMD Phenom II X4 910e, circa 2010). Platform B is GCC (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 on Ubuntu 18.04.4 (Intel Xeon E3-1225 V2, circa 2012). This patch was inspired by a suggestion by Andrea Corallo in: https://lists.gnu.org/r/emacs-devel/2020-04/msg00263.html
* Pacify GCC 9.2.1 20190927 -O3Paul Eggert2020-03-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Original problem report by N. Jackson in: https://lists.gnu.org/r/emacs-devel/2020-03/msg00047.html I found some other warnings when I used gcc, and fixed them with this patch. * lib-src/etags.c: Include verify.h. (xnmalloc, xnrealloc): Tell the compiler that NITEMS is nononnegative and ITEM_SIZE is positive. * src/conf_post.h (__has_attribute_returns_nonnull) (ATTRIBUTE_RETURNS_NONNULL): New macros. * src/editfns.c (Fuser_full_name): Don’t assume Fuser_login_name returns non-nil. * src/intervals.c (rotate_right, rotate_left, update_interval): * src/intervals.h (LENGTH, LEFT_TOTAL_LENGTH, RIGHT_TOTAL_LENGTH): Use TOTAL_LENGTH0 or equivalent on intervals that might be null. * src/intervals.h (TOTAL_LENGTH): Assume arg is nonnull. (TOTAL_LENGTH0): New macro, with the old TOTAL_LENGTH meaning. (make_interval, split_interval_right): Add ATTRIBUTE_RETURNS_NONNULL. * src/pdumper.c (dump_check_dump_off): Now returns void, since no caller uses the return value. Redo assert to pacify GCC. (decode_emacs_reloc): Add a seemingly-random eassume to pacify GCC. Ugly, and I suspect due to a bug in GCC.
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Use plain ‘static’ for Emacs C inline functionsPaul Eggert2019-09-041-9/+34
| | | | | | | This improved performance of ‘make compile-always’ by 8.2% on my platform (AMD Phenom II X4 910e, Fedora 30 x86-64). * src/conf_post.h (INLINE, EXTERN_INLINE, INLINE_HEADER_BEGIN) (INLINE_HEADER_END) [!EMACS_EXTERN_INLINE]: Use plain ‘static’.
* Disable __attribute__ ((cold)) on MinGWPaul Eggert2019-04-291-2/+4
| | | | | * src/conf_post.h (ATTRIBUTE_COLD) [__MINGW32__]: Define to empty on this platform.
* Improve wur coverage on older GCCsPaul Eggert2019-04-221-0/+1
| | | | | | | * src/conf_post.h (__has_attribute_warn_unused_result): New macro for compilers lacking __has_attribute. * src/systhread.h (__has_attribute): Remove ineffective define. (ATTRIBUTE_WARN_UNUSED_RESULT): Work better on GCC 3.4 thru 4.
* Mark _Noreturn error functions as coldPaul Eggert2019-04-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Rename CANNOT_DUMP to HAVE_UNEXECPaul Eggert2019-02-011-6/+4
| | | | | | | * configure.ac (CANNOT_DUMP): Remove. All uses removed, or changed to the negative of with_unexec. (HAVE_UNEXEC): New macro. All uses of CANNOT_DUMP changed to the negative of this macro.
* Add portable dumperDaniel Colascione2019-01-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new portable dumper as an alternative to unexec. Use it by default. * src/dmpstruct.awk: New file. * src/doc.c (get_doc_string): use will_dump_p(). * src/editfns.c (styled_format): silence compiler warning with UNINIT. * src/emacs-module.c (syms_of_module): staticpro ltv_mark. * src/emacs.c (gflags): new variable. (init_cmdargs): unwrap (string_starts_with_p, find_argument, dump_error_to_string) (load_pdump): new functions. (main): detect pdumper and --temacs invocation; actually load portable dump when detected; set gflags as appropriate; changes to init functions throughout to avoid passing explicit 'initialized' argument. * src/eval.c (inhibit_lisp_code): remove unused variable. (init_eval_once_for_pdumper): new function. (init_eval_once): call it. * src/filelock.c: CANNOT_DUMP -> will_dump_p() * src/fingerprint-dummy.c: new file * src/fingerprint.h: new file * src/fns.c: CANNOT_DUMP -> will_dump_p(), etc. (weak_hash_tables): remove (hashfn_equal, hashfn_eql): un-staticify (make_hash_table): set new 'next_weak' hash table field; drop global weak_hash_tables logic. (copy_hash_table): drop global weak_hash_tables logic. (hash_table_rehash): new function. (hash_lookup, hash_put, hash_remove_from_table, hash_clear): rehash if needed. (sweep_weak_table): un-staticify; explain logic; bool-ify. (sweep_weak_hash_tables): remove function. * src/font.c (syms_of_font): remember pdumper stuff. * src/fontset.c (syms_of_fontset): remember pdumper stuff. * src/frame.c (make_initial_frame): don't reset Vframe_list. (init_frame_once_for_pdumper, init_frame_once): new functions. (syms_of_frame): remove redundant staticpro. * src/fringe.c (init_fringe_once_for_pdumper): new functin. (init_fringe_once): call it. * src/ftcrfont.c (syms_of_ftcrfont_for_pdumper): new function. (syms_of_ftcrfont): call it. * src/ftfont.c (syms_of_ftfont_for_pdumper): new function. (syms_of_ftfont): call it. * src/ftxont.c (syms_of_ftxfont_for_pdumper): new function. (syms_of_ftxfont): call it. * src/gmalloc.c: adjust for pdumper througout (DUMPED): remove weird custom dumped indicator. * src/gnutls.c (syms_of_gnutls): pdumper note for gnutls_global_initialized. * src/image.c (syms_of_image): add pdumper comment, initializer note. * src/insdel.c (prepare_to_modify_buffer_1): account for buffer contents possibly being in dump image. * src/keyboard.c (syms_of_keyboard_for_pdumper): new function. (syms_of_keyboard): staticpro more; call pdumper syms function. * src/lisp.h: add comments throughout (gflags): declare. (will_dump_p, will_bootstrap_p, will_dump_with_pdumper_p) (dumped_with_pdumper_p, will_dump_with_unexec_p) (dumped_with_unexec_p, definitely_will_not_unexec_p): new functions. (POWER_OF_2, ROUNDUP): move macros. (PSEUDOVECTOR_TYPE, PSEUDOVECTOR_TYPEP): take vectorlike header pointer instead of vector; constify. (Lisp_Hash_Table): add comment about need to rehash on access; add comment for next_weak. (HASH_KEY, HASH_VALUE, HASH_HASH, HASH_TABLE_SIZE): const-ify. (hash_table_rehash): declare. (hash_rehash_needed_p, hash_rehash_if_needed): new functions. (finalizers, doomed_finalizers): declare extern. (SUBR_SECTION_ATTRIBUTE): new macro. (staticvec, staticidx): un-static-ify. (sweep_weak_hash_tables): remove declaration. (sweep_weak_table): declare. (hashfn_eql, hashfn_equal): declare. (number_finalizers_run): new variable. (Vdead): externify when ENABLE_CHECKING. (gc_root_type): new enumeration. (gc_root_visitor): new struct. (visit_static_gc_roots): declare. (vectorlike_nbytes): declare. (vector_nbytes): define as trivial inline function wrapper for vectorlike_nbytes. (init_obarray_once): change signature. (primary_thread): extern-ify. (init_buffer): change signature. (init_frame_once): declare. * src/lread.c (readevalloop): adjust for new dumped predicates. (init_obarray_once): new function. (ndefsubr): new variable. (defsubr): increment it. (load_path_check): adjust for pdumper. (load_path_default): use pdumper functions; adjust for dump search. * src/macfont.m (macfont_init_font_change_handler): avoid shadowing global. (syms_of_macfont_for_pdumper): new function. (syms_of_macfont): call it. * src/menu.c (syms_of_menu): staticpro more stuff. * src/minibuf.c (Ftry_completion): rehash if needed. (init_minibuf_once_for_pdumper): new function. (init_minibuf_once): call it. * src/nsfont.m (syms_of_nsfns): staticpro more. * src/nsfont.m (syms_of_nsfont_for_pdumper): new function. (syms_of_nsfont): call it. * src/nsterm.m (syms_of_nsfont): remember pdumper stuff. * src/pdumper.c: new file. * src/pdumper.h: new file. * src/process.c (init_process_emacs): use new pdumper functions instead of CANNOT_DUMP. * src/profiler.c (syms_of_profiler_for_pdumper): new function. (syms_of_profiler_for_pdumper): call it. * src/search.c (syms_of_search_for_pdumper): new function. (syms_of_search_for_pdumper): call it. * src/sheap.c (bss_sbrk_did_unexec): remove. * src/sheap.h (bss_sbrk_did_unexec): remove. * src/syntax.c (syms_of_syntax): don't redundantly staticpro re_match_object. * src/sysdep.c: use will_dump_with_unexec_p() instead of bss hack thing. * src/syssignals.h (init_sigsegv): declare. * src/systime.h (init_timefns): remove bool from signature. * src/textprop.c (syms_of_textprop): move staticpro. * src/thread.c (main_thread_p): constify. * src/thread.h (main_thread_p): constify. * src/timefns.c (init_timefns): remove bool from signature. (syms_of_timefns_for_pdumper): new function. (syms_of_timefns): call it. * src/w32.c: rearrange code. * src/w32.h (w32_relocate): declare. * src/w32fns.c (syms_of_w32fns): add pdumper note. * src/w32font.c (syms_of_w32font_for_pdumper): new function. (syms_of_w32font): call it. * src/w32heap.c (using_dynamic_heap): new variable. (init_heap): use it. * src/w32menu.c (syms_of_w32menu): add pdumper note. * src/w32proc.c (ctrl_c_handler, mainCRTStartup, _start, open_input_file) (rva_to_section, close_file_data): move here. * src/w32uniscribe.c (syms_of_w32uniscribe_for_pdumper): new function. (syms_of_w32uniscribe): call it. * src/window.c (init_window_once_for_pdumper): new function. (init_window_once): call it; staticpro more stuff. * src/xfont.c (syms_of_xfont_for_pdumper): new function. (syms_of_xfont): call it. * src/xftfont.c (syms_of_xftfont_for_pdumper): new function. (syms_of_xftfont): call it. * src/xmenu.c (syms_of_xmenu_for_pdumper): new function. (syms_of_xmenu): call it. * src/xselect.c (syms_of_xselect_for_pdumper): new function. (syms_of_xselect): call it. * src/xsettings.c (syms_of_xsettings): add more pdumper notes. * src/term.c (syms_of_xterm): add pdumper note. * src/dispnew.c (init_faces_initial): new function. (init_display_interactive): rename from init_display; use will_dump_p instead of !initialized. Initialize faces early for pdumper if needed. (init_display): new function. (syms_of_display_for_pdumper): new function. (syms_of_display): call it. * src/dbusbind.c (syms_of_dbusbind): Add TODO for bus reset on pdumper load. * src/data.c (Fdefalias): Use will_dump_p instead of Vpurify_flag. (Fmake_variable_buffer_local): silence compiler warning with -Og by making valcontents UNINIT. (arith_driver): silence compiler warning with UNINIT. * src/conf_post.h (ATTRIBUTE_SECTION): new macro. * src/composite.c (composition_gstring_put_cache): rehash hash table if needed. * src/coding.c (init_coding_once, syms_of_coding): remember pdumper stuff. * src/charset.h (charset_table_size, charset_table_user): declare. * src/charset.c (charset_table_used, charset_table_size): un-static. (init_charset_oncem, syms_of_charset): remember pdumper stuff. * src/category.c (category_table_version): remove obsolete variable. * src/callint.c (syms_of_callint): staticpro 'preserved_fns' (init_callproc): use will_dump_p instead of !CANNOT_DUMP. * src/bytecode.c (exec_byte_code): rehash table tables if needed * src/buffer.c (alloc_buffer_text, free_buffer_text): account for pdumper (init_buffer_once): add TODO; remember stuff for pdumper. (init_buffer): don't take initialized argument; adjust for pdumper. * src/atimer.c (init_atimer): initialize subr only if !initialized. * src/alloc.c: (vector_marked_p, set_vector_marked) (vectorlike_marked_p, set_vectorlike_marked, cons_marked_p) (set_cons_marked, string_marked_p, set_string_marked) (symbol_marked_p, set_symbol_marked, interval_marked_p) (set_interval_marked): new accessor routines. Use them instead of raw GC access throughout. (Vdead): make non-static when ENABLE_CHECKING. (vectorlike_nbytes): rename of 'vector_nbytes'; take a vectorlike header as input instead of a vector. (number_finalizers_run): new internal C variable. (mark_maybe_object): check for pdumper objects. (valid_pointer_p): don't be gratuitously inefficient under rr(1). (make_pure_c_string): add support for size_byte = -2 mode indicating that string data points into Emacs image rodata. (visit_vectorlike_root): visits GC roots embedded in vectorlike objects. (visit_buffer_root): visits GC roots embedded in our totally-not-a-buffer buffer global objects. (visit_static_gc_roots): visit GC roots in the Emacs data section. (mark_object_root_visitor): root callback used for conventional GC marking (weak_hash_tables): new internal variable for tracking found weak hash tables during GC. (mark_and_sweep_weak_table_contents): new weak hash table marking. (garbage_collect_1): use new GC root visitor machinery. (mark_vectorlike): accept a vectorlike_header instead of a Lisp_Vector. (mark_frame, mark_window, mark_hash_table): new functions. (mark_object): initialize 'm'; check for pdumper objects and use new mark-bit accessors throughout. Remove some object-specific marking code and move to helper functions above. (survives_gc_p): check for pdumper objects. (gc-sweep): clear pdumper mark bits. (init_alloc_once_for_pdumper): new helper function for early init called both during normal init and pdumper load. (init_alloc_once): pdumper integration. * src/Makefile.in: Rewrite dumping for pdumper; add pdumper.o; invoke temacs with --temacs command line option; build dmpstruct.h from dmpstruct.awk; stop relying on CANNOT_DUMP; clean up pdumper intermediate files during build. * nextstep/Makefile.in: build emacs.pdmp into NS packages * lisp/startup.el: account for new '--temacs' and '--dump-file' command line option. * lisp/loadup.el: rewrite early init to account for pdumper; use injected 'dump-mode' variable (set via the new '--temacs' option) instead of parsing command line. * lisp/cus-start.el: Check 'dump-mode' instead of 'purify-flag', since the new 'dump-mode' * lib-src/make-fingerprint.c: new program * lib-src/Makefile.in: built make-fingerprint utility program * configure.ac: Add --with-pdumper toggle to control pdumper support; add --with-unexec toggle to control unexec support. Add --with-dumping option to control which dumping strategy we use by default. Adjust for pdumper throughout. Check for posix_madvise. * Makefile.in: Add @DUMPING@ substitution; add pdumper mode. * .gitignore: Add make-fingerprint, temacs.in, fingerprint.c, dmpstruct.h, and pdumper dump files.
* Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Merge from origin/emacs-26Glenn Morris2018-10-161-3/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 73babba (origin/emacs-26) Clarify documentation of fractional vertica... b20c51d * lisp/isearch.el (isearch-cmds): Recall absent isearch--stat... 700acbd doc/lispref/edebug.texi (Specification List) Remove obstrusiv... 1902450 Fix wording in module API documentation e724a8f Fix redisplay of glyphless characters 8fc892d Update --without-toolkit-scroll-bars doc 80e0bfa Call GTK functions only on GTK scrollbars 91c4c46 Update the description of startup in ELisp manual 18b42c6 Use the 'line-number' face for line-number fields past EOB a6ab8db Ensure NS frame is redrawn correctly after scroll Conflicts: lisp/isearch.el
| * Fix redisplay of glyphless charactersEli Zaretskii2018-10-131-3/+5
| | | | | | | | | | | | | | * src/conf_post.h (bool_bf): Use 'unsigned int' in the MinGW builds. Suggested by Tom Tromey <tom@tromey.com>. (Bug#33017) * src/dispnew.c (scrolling_window): Update commentary regarding xwidget builds.
* | Modularize bignums betterPaul Eggert2018-08-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/bignum.c, src/bignum.h: New files. Only modules that need to know how bignums are implemented should include bignum.h. Currently these are alloc.c, bignum.c (of course), data.c, emacs.c, emacs-module.c, floatfns.c, fns.c, print.c. * src/Makefile.in (base_obj): Add bignum.o. * src/alloc.c (make_bignum_str): Move to bignum.c. (make_number): Remove; replaced by bignum.c’s make_integer. All callers changed. * src/conf_post.h (ARG_NONNULL): New macro. * src/json.c (json_to_lisp): Use it. * src/data.c (Fnatnump): Move NATNUMP’s implementation here from lisp.h. * src/data.c (Fnumber_to_string): * src/editfns.c (styled_format): Move conversion of string to bignum to bignum_to_string, and call it here. * src/emacs-module.c (module_make_integer): * src/floatfns.c (Fabs): Simplify by using make_int. * src/emacs.c: Include bignum.h, to expand its inline fns. * src/floatfns.c (Ffloat): Simplify by using XFLOATINT. (rounding_driver): Simplify by using double_to_bignum. (rounddiv_q): Clarify use of temporaries. * src/lisp.h: Move decls that need to know bignum internals to bignum.h. Do not include gmp.h or mini-gmp.h; that is now bignum.h’s job. (GMP_NUM_BITS, struct Lisp_Bignum, XBIGNUM, mpz_set_intmax): Move to bignum.h. (make_int): New function. (NATNUMP): Remove; all callers changed to use Fnatnump. (XFLOATINT): If arg is a bignum, use bignum_to_double, so that bignum internals are not exposed here. * src/print.c (print_vectorlike): Use SAFE_ALLOCA to avoid the need for a record_unwind_protect_ptr.
* | Make mini-gmp safe for --enable-gcc-warningsPaul Eggert2018-08-121-2/+9
| | | | | | | | | | | | | | | | | | | | * configure.ac (GMP_OBJ): When building mini-gmp, compile mini-gmp-emacs.c, not mini-gmp.c. * lib-src/etags.c (NDEBUG): Don't attempt to redefine, in case the builder compiles with -DNDEBUG. * src/conf_post.h (NDEBUG) [!ENABLE_CHECKING && !NDEBUG]: Define. This avoids bloat in mini-gmp-emacs.o. * src/mini-gmp-emacs.c: New file, which pacifies --enable-gcc-warnings.
* | Rename integerp->fixnum, etc, in preparation for bignumsTom Tromey2018-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/json.c, src/keyboard.c, src/keyboard.h, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/sysdep.c, src/term.c, src/terminal.c, src/textprop.c, src/undo.c, src/w16select.c, src/w32.c, src/w32console.c, src/w32cygwinx.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32uniscribe.c, src/widget.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xrdb.c, src/xselect.c, src/xterm.c, src/xwidget.c: Rename INTEGERP->FIXNUM, make_number->make_fixnum, CHECK_NUMBER->CHECK_FIXNUM, make_natnum->make_fixed_natum, NUMBERP->FIXED_OR_FLOATP, NATNUMP->FIXNATP, CHECK_NATNUM->CHECK_FIXNAT.
* | Use native alignment to access Lisp object dataPaul Eggert2018-06-101-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using __builtin_assume_aligned (P, GCALIGNMENT) to tell GCC that P has alignment 8, use (T *) P where T is the type of the pointed-to object, to tell GCC that P has native alignment. This is simpler, matches the intent better, and should help simplify future improvements. Some of these changes are to pacify gcc -Wnull-dereference, since GCC is smarter about pointers now that Emacs no longer uses __builtin_assume_aligned; these minor changes should improve code efficiency slightly. On Fedora 28 x86-64 with default optimization this patch shrinks the size of the Emacs text segment by 0.36%. * src/conf_post.h (__has_builtin, __builtin_assume_aligned): Remove; no longer used. * src/dbusbind.c (XD_OBJECT_TO_DBUS_TYPE): Pacify -Wnull-dereference by using XCAR instead of CAR_SAFE and XCDR instead of CDR_SAFE when this is safe. * src/fileio.c (Fexpand_file_name): * src/font.c (clear_font_cache): Pacify -Wnull-dereference by removing unnecessary NILP test. * src/keyboard.c (xevent_start): New function. (read_char, read_key_sequence): Pacify -Wnull-dereference by using xevent_start instead of EVENT_START. * src/lisp.h (lisp_h_XUNTAG): Remove; XUNTAG is always a macro now, since it can no longer be implemented as a function. (XUNTAG): New third argument CTYPE. All uses changed. Cast result to CTYPE * instead of using __builtin_assume_aligned. Simplify by using LISP_WORD_TAG. (LISP_WORD_TAG): New macro. (TAG_PTR): Use it. * src/menu.c (x_popup_menu_1): Pacify -Wnull-dereference by using XCAR instead of Fcar and XCDR instead of Fcdr where this is safe.
* | Remove AddressSanitizer bug workaroundPaul Eggert2018-06-081-1/+2
| | | | | | | | | | | | | | | | | | This workaround no longer appears to be needed. * src/alloc.c (USE_ALIGNED_ALLOC): Don’t leave undefined merely because ADDRESS_SANITIZER is defined, as that bug in -fsanitize=address appears to have been fixed. See: https://github.com/google/sanitizers/issues/337 * src/conf_post.h (vfork): Improve comment.
* | Port to GCC 8 -fsanitize=undefinedPaul Eggert2018-05-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In GCC 8, gcc -fsanitize=undefined flags the undefined behavior that Emacs relies on in its XPNTR and XSYMBOL low-level functions. Disable undefined sanitization in these functions. Although this disabling doesn’t suffice if DEFINE_KEY_OPS_AS_MACROS is true, it works for -fsanitize=undefined -DINLINING=0, which is good enough. * src/alloc.c (macro_PNTR_ADD): New macro. (PNTR_ADD): New function and macro. The function disables -fsanitize=undefined. (macro_XPNTR): Use it. * src/conf_post.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro. * src/lisp.h (XSYMBOL): Disable -fsanitize=undefined.
* | Pacify GCC when --enable-profilingPaul Eggert2018-04-031-0/+4
|/ | | | | | | * src/conf_post.h (PROFILING): Undef if not on a platform that supports it. Simplify uses accordingly. * src/emacs.c (etext) [PROFILING]: Declare at top level to avoid GCC warning.
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Fix the MSDOS build.Eli Zaretskii2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * msdos/sed1v2.inp (GETADDRINFO_A_LIBS, LIBLCMS2, XDBE_LIBS) (XDBE_FLAGS, HYBRID_MALLOC, LIBSYSTEMD_CFLAGS) (LIBSYSTEMD_LIBS): Edit to empty. (LIBRESOLV, DEPFLAGS, MKDEPDIR, YMF_PASS_LDFLAGS) (PRE_EDIT_LDFLAGS, POST_EDIT_LDFLAGS): Remove editing. Remove editing of lines that are no longer present in src/Makefile.in. * msdos/sed2v2.inp (NEED_MKTIME_INTERNAL) (NEED_MKTIME_WORKING): Define to 1. (HAVE_STRUCT_DIRENT_D_TYPE): Define to 1 for DJGPP >= 2.05. (HAVE_STRUCT_ATTRIBUTE_ALIGNED): Define to 1. Define PACKAGE_VERSION, not VERSION. (FLEXIBLE_ARRAY_MEMBER): Define to empty. (HAVE_DECL_*_UNLOCKED): Define to 0. (HAVE___BUILTIN_FRAME_ADDRESS): Define to 1. (PENDING_*): Don't define, as Gnulib no longer supports that. Instead, define _IOERR as it is in libc/file.h. * msdos/sed3v2.inp: Use $(CURDIR) instead of $(shell cd) to determine the current directory. (UPDATE_MANIFEST, UTILITIES): Don't edit. * msdos/sedlisp.inp (FIND_DELETE): Edit to "-delete". * msdos/sedlibmk.inp (AUTO_DEPEND): Define to yes. (HYBRID_MALLOC): Edit to empty. (am__cd): Don't edit. (../config.status): Replaces $(top_builddir)/config.status. Define OMIT_GNULIB_MODULE_foo = true for modules not built for MS-DOS. Convert GL_GENERATE_xxx_H_TRUE and GL_GENERATE_xxx_H_FALSE into values of GL_GENERATE_xxx_H. * msdos/mainmake.v2 (src): Use 'compile-one-process', and make the command line shorter to fit into 126-char limit of command.com. * config.bat: Generate src/deps/*.d files. Rename more files like djtar on plain DOS would. Don't rename src/dir.h: it is long gone. Edit lib/gnulib.mk.in using the same scripts as for lib/Makefile.in. * msdos/depfiles.bat: Create *.d files, not *.Po. * src/thread.c (Fmake_thread) [!THREADS_ENABLED]: Improve the error message. * src/thread.h [MSDOS]: Include <signal.h>. * src/sysselect.h (select) [MSDOS]: Undefine, to avoid compilation errors. * src/sysdep.c (block_interrupt_signal, restore_signal_mask): Expose to MSDOS build. * src/process.c (update_processes_for_thread_death) [!subprocess]: No-op implementation. [HAVE_SETRLIMIT]: Move inclusion of sys/resource.h and declaration of nofile_limit outside "#ifdef subprocesses", as it's needed for MSDOS. * src/msdos.c (faccessat): Declare fullname[]. * src/msdos.h (ENOTSUP): Define to be identical to ENOSYS. Include termhooks.h. * src/conf_post.h [WINDOWSNT]: Include ms-w32.h only on WINDOWSNT, not DOS_NT. * admin/admin.el (set-version): Set version on PACKAGE_VERSION.
* Fix warnings about formats in printf-like functions on MS-WindowsEli Zaretskii2017-09-141-1/+21
| | | | | | | | | | | * src/lisp.h (pI) [__MINGW32__]: Provide definition that will hopefully DTRT with both MinGW64 and mingw.org's MinGW. See http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00171.html for the details. * src/conf_post.h (PRINTF_ARCHETYPE) [MINGW_W64]: Separate definition specific to MinGW64. (PRINTF_ARCHETYPE) [__MINGW32__]: For mingw.org's MinGW, use __mingw_printf__ in ANSI-compatible mode.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | 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.
* Port cleanup check to Oracle Studio 12.5Paul Eggert2017-06-141-1/+4
| | | | | | * src/conf_post.h (__has_attribute_cleanup): Resurrect. * src/emacs-module.c: Verify __has_attribute (cleanup), but in an #if this time.
* Port cleanup attribute to Oracle Studio 12.5Paul Eggert2017-06-131-1/+0
| | | | | | | | | | | * INSTALL (--with-modules): List cleanup attribute as prereq. * src/conf_post.h (__has_attribute_cleanup): Remove; no longer needed. * src/emacs-module.c (MODULE_SETJMP_1): Don’t attempt to verify (__has_attribute (cleanup)), as Oracle Studio 12.5 supports __has_attribute only inside preprocessor expressions. The C compiler should check the cleanup attribute in the next line anyway. (module_reset_handlerlist): Remove an unnecessary ‘const’ that causes Oracle Studio 12.5 to refuse to compile.
* Port ATTRIBUTE_MAY_ALIAS to recent iccPaul Eggert2017-05-251-1/+1
| | | | | | | | | * src/conf_post.h (ATTRIBUTE_MAY_ALIAS) [__ICC]: Define to empty. Otherwise, icc (ICC) 17.0.4 20170411 says “warning #2621: attribute "__may_alias__" does not apply here” for constructs like ‘struct sockaddr *sa = (whatever); struct sockaddr_in __attribute__ ((__may_alias__)) *sin = (struct sockaddr_in *) sa;’.
* Avoid undefined behavior in struct sockaddrPaul Eggert2017-05-171-0/+14
| | | | | | | | | | Problem noted by Philipp Stephani in: http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00391.html * src/conf_post.h (ATTRIBUTE_MAY_ALIAS, DECLARE_POINTER_ALIAS): New macros. * src/process.c (conv_sockaddr_to_lisp, conv_lisp_to_sockaddr) (connect_network_socket, network_interface_info) (server_accept_connection): Use it when aliasing non-char objects.
* Work around AddressSanitizer bug with vforkPaul Eggert2017-05-171-0/+6
| | | | | | | | | | Problem reported by Jim Meyering in: http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00246.html * src/conf_post.h (vfork) [ADDRESS_SANITIZER]: Define to fork. Unfortunately with the AddressSanitizer in Fedora 25 x86-64, the vforked child messes up the parent’s shadow memory. This is too bad, as we’d rather have AddressSanitizer catch memory-access bugs related to vfork.
* Merge with gnulib, pacifying GCC 7Paul Eggert2017-05-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | This incorporates: 2017-05-16 manywarnings: update for GCC 7 2017-05-15 sys_select: Avoid "was expanded before it was required" * configure.ac (nw): Suppress GCC 7’s new -Wduplicated-branches and -Wformat-overflow=2 options, due to too many false alarms. * doc/misc/texinfo.tex, lib/strftime.c, m4/manywarnings.m4: Copy from gnulib. * m4/gnulib-comp.m4: Regenerate. * src/coding.c (decode_coding_iso_2022): Fix bug uncovered by -Wimplicit-fallthrough. * src/conf_post.h (FALLTHROUGH): New macro. Use it to mark all switch cases that fall through. * src/editfns.c (styled_format): Use !, not ~, on bool. * src/gtkutil.c (xg_check_special_colors): When using sprintf, don’t trust Gtk to output colors in [0, 1] range. (xg_update_scrollbar_pos): Avoid use of possibly-uninitialized bool; this bug was actually caught by Clang. * src/search.c (boyer_moore): Tell GCC that CHAR_BASE, if nonzero, must be a non-ASCII character. * src/xterm.c (x_draw_glyphless_glyph_string_foreground): Tell GCC that glyph->u.glyphless.ch must be a character.
* Use vfork if possible on Darwin (bug#26397)Alan Third2017-04-181-6/+0
| | | | | | | | | | | Co-authored-by: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> * src/conf_post.h (HAVE_WORKING_VFORK): Don't undef. (vfork): Don't define. * src/process.c (create_process) [DARWIN_OS]: Use fork if pty_flag is set, otherwise vfork. * src/callproc.c (call_process) [DARWIN_OS]: Use TIOCNOTTY to detach the controlling terminal instead of setsid.
* Fix CANNOT_DUMP build on Darwin/macOS.Ken Raeburn2017-04-061-1/+1
| | | | | | * src/conf_post.h (malloc, realloc, free) [DARWIN_OS && emacs && CANNOT_DUMP]: Don't define as unexec_malloc, etc. * src/emacs.c (main): Don't call unexec_init_emacs_zone.
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017