summaryrefslogtreecommitdiff
path: root/src/dbusbind.c
Commit message (Collapse)AuthorAgeFilesLines
* Pacify GCC 12 in default developer buildPaul Eggert2022-05-121-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets ‘./configure; make’ work on Fedora 36 x86-64 from a Git checkout without generating false-alarm warnings. * lib-src/etags.c (main): There appeared to be false alarm with GCC 12. However, the code was wrong anyway, as it mishandled file names containing "'" so fix that bug. This pacifies GCC. (mercury_decl): Omit tests ‘s + pos != NULL’ that were apparently intended to be ‘s[pos] != '\0'’ but which were miscoded to always be true and which were mostly not needed anyway. In one place, though, a test was needed, so fix that by using strchr instead. * src/alloc.c (lisp_free) [!GC_MALLOC_CHECK]: * src/term.c (Fsuspend_tty): Don’t look at a pointer after freeing it, even just to test it for equality with some other pointer, as this has undefined behavior in C and GCC 12 diagnoses this. * src/dbusbind.c (xd_read_message_1): Rework the code a bit so that it has fewer tests. This pacifies GCC 12 which was complaining incorrectly about dereferencing a null pointer. * src/intervals.c (copy_properties): Remove an eassume that should no longer be needed even to pacify older GCCs, due to ... * src/intervals.h (split_interval_left): ... this addition of ATTRIBUTE_RETURNS_NONNULL to pacify a GCC 12 warning about dereferencing a null pointer. * src/regex-emacs.c (EXTEND_BUFFER): Use negative values rather than auxiliary booleans to indicate null pointers. This pacifies GCC 12 false alarms about using uninitialized variables. * src/xdisp.c (clear_position): New function. (append_space_for_newline, extend_face_to_end_of_line): Use it to work around false alarms from GCC 12. (display_and_set_cursor): Add an UNINIT to pacify GCC 12. * src/xterm.c (x_draw_glyphless_glyph_string_foreground): Defend against hypothetical bad code elsewhere; this also pacifies GCC 12. (x_term_init): Use fixed-size auto array rather than alloca, as the array is small; this also pacifies GCC 12.
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* * src/dbusbind.c (XD_BASIC_DBUS_TYPE): Fix error in declaration.Michael Albinus2020-12-301-15/+28
|
* Handle several children of PATH in dbus-managed-objects-handlerMichael Albinus2020-10-291-6/+12
| | | | | | | | | | * lisp/net/dbus.el (dbus-managed-objects-handler): Handle several children of PATH. (Bug#44298) * src/dbusbind.c (xd_signature, xd_append_arg): Check object path. * test/lisp/net/dbus-tests.el (dbus-test09-get-managed-objects): Tag it :expensive-test. Remove superfluous check.
* * src/dbusbind.c (xd_signature): Better type check for array elements.Michael Albinus2020-10-051-2/+8
| | | | * test/lisp/net/dbus-tests.el (dbus-test01-compound-types): Extend test.
* Make dbus-unregister-object work for monitorsMichael Albinus2020-10-041-8/+10
| | | | | | | | | | | | | | | | | * doc/misc/dbus.texi (Monitoring Messages): Rename from "Monitoring Events". (Register Objects, Monitoring Messages): Mention returned object. * lisp/net/dbus.el (dbus-unregister-object): Adapt docstring. (dbus-unregister-object): Delete monitor if needed. (dbus-register-monitor): Return proper object. * src/dbusbind.c (dbus-registered-objects-table): Adapt docstring. * test/lisp/net/dbus-tests.el (dbus--test-signal-handler): Adapt docstring. (dbus-test08-register-monitor): New test.
* Use Fkeywordp in dbusbind.c, againMichael Albinus2020-10-011-3/+6
| | | | | * src/dbusbind.c (XD_KEYWORDP): New macro. (XD_DBUS_TYPE_P, Fdbus__init_bus, xd_read_queued_messages): Use it.
* Revert last change in dbusbind.cMichael Albinus2020-10-011-3/+3
| | | | | * src/dbusbind.c (XD_DBUS_TYPE_P, Fdbus__init_bus) (xd_read_queued_messages): Revert last change. (Bug#43724)
* Stricter checks for D-Bus compound types.Michael Albinus2020-09-301-5/+9
| | | | | | | | * src/dbusbind.c (XD_DBUS_TYPE_P, Fdbus__init_bus) (xd_read_queued_messages): Use Fkeywordp instead of SYMBOLP. (xd_signature): Stricter checks for compound types. * test/lisp/net/dbus-tests.el (dbus-test01-compound-types): Extend test.
* More strict D-Bus type checkingMichael Albinus2020-09-291-7/+15
| | | | | | | | | | * lisp/net/dbus.el (dbus-register-monitor): Register proper key. (dbus-monitor-handler): Adapt docstring. Use grave text-quoting-style. * src/dbusbind.c (xd_signature, xd_append_arg): More strict tests. (syms_of_dbusbind): Adapt docstring. * test/lisp/net/dbus-tests.el (dbus-test01-basic-types): Extend test.
* Add D-Bus monitorMichael Albinus2020-09-261-32/+107
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/net/dbus.el (dbus-interface-monitoring): New defconst. (dbus-call-method, dbus-call-method-asynchronously) (dbus-send-signal, dbus-method-return-internal) (dbus-method-error-internal, dbus-check-arguments): Accept also :system-private and :session-private. (dbus-check-event, dbus-event-path-name) (dbus-event-interface-name) (dbus-event-member-name, dbus-property-handler) (dbus-handle-bus-disconnect): Adapt according to new structure. (dbus-handle-event): Handle also monitor events. (dbus-event-destination-name, dbus-event-handler) (dbus-event-arguments, dbus-register-monitor, dbus-monitor-handler): New defuns. * src/dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS, xd_remove_watch) (Fdbus__init_bus): Accept also :system-private and :session-private. (xd_read_message_1): Add destination and error_name to dbus-event. Handle monitor events. (syms_of_dbusbind): Declare QCsystem_private, QCsession_private and QCmonitor. (dbus-registered-objects-table): Fix docstring.
* Add D-Bus testsMichael Albinus2020-09-211-2/+2
| | | | | | | | | | | | * doc/misc/dbus.texi (Type Conversion): Precise basic type values. * lisp/net/dbus.el (dbus-register-property): Send signal directly. * src/dbusbind.c (xd_signature): Accept non-nil objects for DBUS_TYPE_BOOLEAN. * test/lisp/net/dbus-tests.el (dbus-test01-basic-types) (dbus-test01-compound-types): New tests.
* Make D-Bus properties type safeMichael Albinus2020-09-201-14/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/dbus.texi (Properties and Annotations): Precise dbus-get-property and dbus-set-property. (Type Conversion): Explain :byte and :boolean type conversion. (Errors and Events): dbus-ignore-errors returns nil when there is a D-Bus error. Remove dbus-show-dbus-errors. * etc/NEWS: Some D-Bus relevant changes. * lisp/net/dbus.el (dbus-show-dbus-errors): Remove. (dbus-ignore-errors): Replay implamentation without that variable. (dbus-check-arguments): New defun. (dbus-list-activatable-names, dbus-list-names) (dbus-list-queued-owners, dbus-get-name-owner, dbus-introspect) (dbus-get-all-properties, dbus-get-all-managed-objects): Don't debug. (dbus-get-property, dbus-set-property): Propagate errors. (dbus-register-property): Check for valid VALUE. (dbus-property-handler): Simplify. * src/dbusbind.c (Fdbus_message_internal): Adapt docstring. Handle DBUS_MESSAGE_TYPE_INVALID. * test/lisp/net/dbus-tests.el (dbus-show-dbus-errors): Don't declare. (dbus-test06-register-property) (dbus-test06-register-property-emits-signal): Adapt tests.
* D-Bus: keep type information in D-Bus eventsMichael Albinus2020-09-161-44/+60
| | | | | | | | | | | | | | | | | * doc/misc/dbus.texi (Errors and Events): * etc/NEWS: D-Bus events keep the type information of their arguments. * lisp/net/dbus.el (dbus-check-event): Fix docstring. (dbus-delete-types, dbus-flatten-types): New defuns. (dbus-handle-event, dbus-register-property, dbus-property-handler): Handle type information. (dbus-set-property): Fix thinko. * src/dbusbind.c (XD_BASIC_DBUS_TYPE): Simplify. (xd_dbus_type_to_symbol): New function. (xd_retrieve_arg): Return type information for the arguments. (xd_read_message_1): Return type information for the error name. (dbus-registered-objects-table): Fix docstring.
* Implement D-Bus properties with compound type.Michael Albinus2020-09-101-4/+5
| | | | | | | | | | | | | * lisp/net/dbus.el (dbus-set-property): Fix thinko. (dbus-register-property, dbus-property-handler): Support compound properties. * src/dbusbind.c (dbus-registered-objects-table): Fix docstring. * test/lisp/net/dbus-tests.el (dbus--test-interface): Make it different to `dbus--test-service'. (dbus-test05-register-property) (dbus-test05-register-property-several-paths): Adapt tests.
* Implement typed D-Bus properties (Bug#43252)Michael Albinus2020-09-081-8/+8
| | | | | | | | | | | | | | | | | | | | | | | * doc/misc/dbus.texi (Properties and Annotations) (Receiving Method Call): Document optional type symbol in `dbus-set-property' and `dbus-register-property'. * lisp/net/dbus.el (dbus-error-unknown-interface) (dbus-error-unknown-method, dbus-error-unknown-object) (dbus-error-unknown-property): New defconsts. (dbus-peer-handler): Improve error handling. (dbus-introspect-get-signature): Handle also properties. (dbus-set-property, dbus-register-property): Allow optional TYPE symbol for VALUE. (Bug#43252) (dbus-property-handler): Implement property types. Improve error handling. * src/dbusbind.c (dbus-message-internal, dbus-registered-objects-table): Fix docstring. * test/lisp/net/dbus-tests.el (dbus-test05-register-property): Extend test. (dbus-test05-register-property-several-paths): New test.
* More work on D-Bus error messagesMichael Albinus2020-09-061-4/+8
| | | | | | | | | | | | | | | | | | | * lisp/net/dbus.el (dbus-get-property): Adapt docstring. (dbus-set-property): Handle case of `:write' access type. (dbus-get-other-registered-properties): Rename from `dbus-get-other-registered-property'. (dbus-property-handler): Fix thinkos. * src/dbusbind.c (xd_read_message_1): Add error_name to event args in case of DBUS_MESSAGE_TYPE_ERROR. * test/lisp/net/dbus-tests.el (dbus--test-enabled-session-bus) (dbus--test-enabled-system-bus): Make them defconst. (dbus--test-service, dbus--test-path, dbus--test-interface): New defconst. Replace all occurences of `dbus-service-emacs' by `dbus--test-service'. (dbus--test-method-handler): New defun. (dbus-test04-register-method, dbus-test05-register-property): New tests.
* Extend dbus.el by error messages, and :write access typeMichael Albinus2020-09-041-3/+15
| | | | | | | | | | | | | | | | | | | | | * doc/misc/dbus.texi (Receiving Method Calls): Describe how to produce D-Bus error messages. (Receiving Method Calls): Support :write access type. * lisp/net/dbus.el (dbus-error-dbus, dbus-error-failed) (dbus-error-access-denied, dbus-error-invalid-args) (dbus-error-property-read-only): New defconsts. (dbus-method-error-internal): Add arg ERROR-NAME. (dbus-register-method): Adapt docstring. (dbus-handle-event): Handle error messages returned from the handler. (dbus-get-this-registered-property) (dbus-get-other-registered-property): New defuns. (dbus-register-property): Support :write access type. (dbus-property-handler): Submit proper D-Bus error messages. Handle several paths at the same interface. * src/dbusbind.c (Fdbus_message_internal): Improve handling of DBUS_MESSAGE_TYPE_ERROR.
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Reset dbus registered buses on dump loadPaul Eggert2019-09-111-4/+8
| | | | | | | | Problem reported by Leonard Lausen (Bug#37331). * src/dbusbind.c: Include pdumper.h. (syms_of_dbusbind_for_pdumper): New function, to reset the registered buses. (syms_of_dbusbind): Use it, fixing a TODO.
* Tweak xd_append_arg to pacify -Wnull-dereferencePaul Eggert2019-09-041-16/+21
| | | | | | * src/dbusbind.c (xd_append_arg): Redo to pacify gcc -Wnull-dereference. Also, check that the Lisp string won’t overrun the C signature buffer.
* Remove printmax_t etc.Paul Eggert2019-07-071-10/+8
| | | | | | | | | | | | printmax_t etc. were needed only for platforms that lacked support for printing intmax_t. These platforms are now so obsolete that they are no longer practical porting targets. * src/image.c (gs_load): Fix unlikely buffer overrun discovered while making these changes. It was introduced in 2011-07-17T00:34:43!eggert@cs.ucla.edu. * src/lisp.h (printmax_t, uprintmax_t, pMd, pMu, pMx): Remove. All uses replaced by their standard counterparts intmax_t, uintmax_t, PRIdMAX, PRIuMAX, PRIxMAX.
* Simplify xd_signature to pacify GCC 9Paul Eggert2019-05-031-5/+3
| | | | | * src/dbusbind.c (xd_signature): Use simpler way to set up the subsignature. This also pacifies GCC 9 on Fedora 30 x86-64.
* 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)'.
| * Fix core dump in dbus-message-internalPaul Eggert2018-11-301-1/+1
| | | | | | | | | | | | Backport from master. * src/dbusbind.c (Fdbus_message_internal): Don’t go past array end (Bug#33530).
* | Fix core dump in dbus-message-internalPaul Eggert2018-11-271-1/+1
| | | | | | | | | | * src/dbusbind.c (Fdbus_message_internal): Don’t go past array end (Bug#33530).
* | Simplify bignum->intmax conversionPaul Eggert2018-09-041-20/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h (integer_to_intmax, integer_to_uintmax): New functions. * src/data.c (cons_to_unsigned, cons_to_signed) (arith_driver): * src/dbusbind.c (xd_extract_signed, xd_extract_unsigned): * src/dispnew.c (sit_for): * src/editfns.c (styled_format): * src/emacs-module.c (module_extract_integer): * src/fileio.c (file_offset): * src/font.c (font_unparse_xlfd, Fopen_font): * src/xdisp.c (calc_line_height_property): * src/process.c (handle_child_signal):
* | Improve bignum support for system typesPaul Eggert2018-08-271-16/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use bignums when Emacs converts to and from system types like off_t for file sizes whose values can exceed fixnum range. Formerly, Emacs sometimes generted floats and sometimes ad-hoc conses of integers. Emacs still accepts floats and conses for these system types, in case some stray Lisp code is generating them, though this usage is obsolescent. * doc/lispref/files.texi (File Attributes): * doc/lispref/hash.texi (Defining Hash): * doc/lispref/nonascii.texi (Character Sets): * doc/lispref/os.texi (User Identification): * doc/lispref/processes.texi (System Processes): * etc/NEWS: Document changes. * src/bignum.c (mpz_set_uintmax, make_biguint) (mpz_set_uintmax_slow, bignum_to_intmax, bignum_to_uintmax): New functions. (mpz_set_intmax_slow): Implement via mpz_limbs_write, to avoid the need for an extra pass through a negative number. * src/charset.c (Fencode_char): * src/composite.h (LGLYPH_SET_CODE): * src/dired.c (file_attributes): * src/dosfns.c, src/w32.c (list_system_processes) (system_process_attributes): * src/editfns.c (init_editfns, Fuser_uid, Fuser_real_uid) (Fgroup_gid, Fgroup_real_gid, Femacs_pid): * src/emacs-module.c (check_vec_index): * src/fns.c (Fsafe_length): * src/process.c (record_deleted_pid, Fprocess_id): * src/sysdep.c (list_system_processes, system_process_attributes): * src/xselect.c (x_own_selection, selection_data_to_lisp_data): * src/xterm.c (set_wm_state): * src/inotify.c (inotifyevent_to_event, add_watch) (inotify_callback): If an integer is out of fixnum range, use a bignum instead of converting it to a float or a cons of integers. * src/coding.c (Fdefine_coding_system_internal): * src/frame.c (frame_windows_min_size) (x_set_frame_parameters): * src/fringe.c (Fdefine_fringe_bitmap): * src/nsterm.m (mouseDown:): * src/syntax.c (find_defun_start): * src/w32fns.c (x_set_undecorated, w32_createwindow) (w32_wnd_proc, Fx_create_frame, Fx_show_tip) (w32_console_toggle_lock_key): * src/w32inevt.c (key_event): * src/w32proc.c (Fw32_get_locale_info): Do not mishandle floats by treating their addresses as their values. * src/data.c (store_symval_forwarding): * src/gnutls.c (Fgnutls_error_fatalp, Fgnutls_error_string): * src/keyboard.c (command_loop_1, make_lispy_event): * src/lread.c (read_filtered_event, read1) (substitute_object_recurse): * src/window.c (Fcoordinates_in_window_p, Fwindow_at) (window_resize_apply, Fset_window_vscroll): * src/xdisp.c (handle_single_display_spec, try_scrolling) (redisplay_window, calc_pixel_width_or_height) (calc_line_height_property, on_hot_spot_p): * src/xfaces.c (check_lface_attrs): * src/xselect.c (x_get_local_selection, cons_to_x_long) (lisp_data_to_selection_data, clean_local_selection_data) (x_check_property_data, x_fill_property_data): (x_send_client_event): Do not reject bignums. * src/data.c (INTBIG_TO_LISP, intbig_to_lisp) (uintbig_to_lisp): Remove. All uses removed. * src/data.c (cons_to_unsigned, cons_to_signed): * src/dbusbind.c (xd_signature, xd_extract_signed) (xd_extract_unsigned): * src/dispnew.c (sit_for): * src/dosfns.c, src/w32.c (system_process_attributes): * src/editfns.c (Fuser_full_name): * src/fileio.c (file_offset): * src/fileio.c (write_region): * src/font.c (font_unparse_xlfd, font_open_for_lface, Fopen_font): * src/frame.c (x_set_screen_gamma): * src/frame.h (NUMVAL, FRAME_PIXEL_X_FROM_CANON_X) (FRAME_PIXEL_Y_FROM_CANON_Y): * src/image.c (parse_image_spec, x_edge_detection) (compute_image_size): * src/json.c (json_to_lisp): * src/lcms.c (PARSE_LAB_LIST_FIELD, Flcms_cie_de2000) (PARSE_XYZ_LIST_FIELD, PARSE_JCH_LIST_FIELD) (PARSE_JAB_LIST_FIELD, PARSE_VIEW_CONDITION_FLOAT) (Flcms_temp_to_white_point): * src/nsimage.m (ns_load_image, setSizeFromSpec): * src/process.c (Fsignal_process, handle_child_signal): * src/sysdep.c (system_process_attributes): * src/xdisp.c (calc_line_height_property): Handle bignums. * src/data.c (Fnumber_to_string): Use proper predicate name in signal if the argument is not a number. * src/lisp.h (make_uint): New function. (INT_TO_INTEGER): New macro. (FIXED_OR_FLOATP, CHECK_FIXNUM_OR_FLOAT) (CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER, INTEGER_TO_CONS) (make_fixnum_or_float): Remove; no longer used. * src/nsfns.m, src/w32fns.c, src/xfns.c (Fx_create_frame): Reject floating-point min-width or min-height. * src/process.c (handle_child_signal): Do not worry about floating-point pids, as they are no longer generated.
* | Merge remote-tracking branch 'origin/master' into feature/bignumTom Tromey2018-08-091-2/+2
|\ \
| * | Prefer NILP (x) to EQ (x, Qnil)Paul Eggert2018-07-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies the code a bit, and also simplifies some potential future changes slightly (e.g., altering eq vs eql). * src/alloc.c (mark_object): * src/callint.c (fix_command): * src/chartab.c (Fchar_table_range, Fset_char_table_range): * src/dbusbind.c (XD_OBJECT_TO_DBUS_TYPE, xd_signature): * src/dired.c (Fsystem_users): * src/fileio.c (Fdo_auto_save): * src/fns.c (concat): * src/frame.c (get_frame_param, frame_inhibit_resize) (store_in_alist, store_frame_param, x_set_autoraise) (x_set_autolower, x_get_arg): * src/image.c (Fclear_image_cache): * src/intervals.c (intervals_equal): * src/intervals.h (DEFAULT_INTERVAL_P): * src/lread.c (substitute_object_recurse): * src/menu.c (digest_single_submenu) (find_and_call_menu_selection) (find_and_return_menu_selection): * src/nsfns.m (x_set_icon_name, Fx_create_frame): * src/nsmenu.m (ns_menu_show): * src/nsselect.m (ns_string_to_pasteboard_internal) (Fns_selection_exists_p, Fns_selection_owner_p): * src/process.c (Faccept_process_output) (wait_reading_process_output): * src/terminal.c (store_terminal_param): * src/textprop.c (verify_interval_modification): * src/xdisp.c (next_element_from_buffer): * src/xfaces.c (Finternal_set_lisp_face_attribute): * src/xfns.c (x_set_icon_type, Fx_synchronize): * src/xmenu.c (x_menu_show): * src/xselect.c (Fx_selection_owner_p) (Fx_selection_exists_p): * src/xwidget.c (xwidget_view_lookup): Prefer NILP (x) to EQ (x, Qnil).
* | | More macro renamings for bignumTom Tromey2018-08-071-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c, src/bidi.c, src/buffer.c, src/buffer.h, src/bytecode.c, src/callint.c, src/callproc.c, src/casefiddle.c, src/casetab.c, src/category.c, src/ccl.c, src/character.c, src/character.h, src/charset.c, src/charset.h, src/chartab.c, src/cmds.c, src/coding.c, src/composite.c, src/composite.h, src/data.c, src/dbusbind.c, src/decompress.c, src/dired.c, src/dispextern.h, src/dispnew.c, src/disptab.h, src/doc.c, src/dosfns.c, src/editfns.c, src/emacs-module.c, src/emacs.c, src/eval.c, src/fileio.c, src/floatfns.c, src/fns.c, src/font.c, src/font.h, src/fontset.c, src/frame.c, src/frame.h, src/fringe.c, src/ftcrfont.c, src/ftfont.c, src/gfilenotify.c, src/gnutls.c, src/gtkutil.c, src/image.c, src/indent.c, src/insdel.c, src/intervals.c, src/json.c, src/keyboard.c, 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/syntax.h, src/sysdep.c, src/term.c, src/termhooks.h, src/textprop.c, src/undo.c, src/w32.c, src/w32console.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32term.h, src/w32uniscribe.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xml.c, src/xrdb.c, src/xselect.c, src/xsettings.c, src/xterm.c, src/xwidget.c Rename XINT->XFIXNUM, XFASTINT->XFIXNAT, XUINT->XUFIXNUM.
* | | Rename integerp->fixnum, etc, in preparation for bignumsTom Tromey2018-07-121-28/+28
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | New mint_ptr representation for C pointersPaul Eggert2018-06-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h (make_mint_ptr, mint_ptrp, xmint_pointer): New functions. * src/dbusbind.c (xd_lisp_dbus_to_dbus, Fdbus__init_bus): * src/emacs-module.c (module_free_global_ref, Fmodule_load) (module_assert_runtime, module_assert_env, value_to_lisp) (lisp_to_value, initialize_environment) (finalize_environment, finalize_runtime_unwind) (mark_modules): * src/font.c (otf_open, font_put_frame_data) (font_get_frame_data): * src/macfont.m (macfont_invalidate_family_cache) (macfont_get_family_cache_if_present) (macfont_set_family_cache): * src/nsterm.h (XNS_SCROLL_BAR): * src/nsterm.m (ns_set_vertical_scroll_bar) (ns_set_horizontal_scroll_bar): * src/w32fns.c (w32_monitor_enum) (w32_display_monitor_attributes_list): * src/xterm.c (x_cr_destroy, x_cr_export_frames): * src/xwidget.c (webkit_javascript_finished_cb) (save_script_callback, Fxwidget_webkit_execute_script) (kill_buffer_xwidgets): Use mint pointers instead of merely save pointers.
* | Use native alignment to access Lisp object dataPaul Eggert2018-06-101-8/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* ; Fix doc typos related to indefinite articlesGlenn Morris2018-02-161-1/+1
|
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Speed up (format "%s" STRING) and the likePaul Eggert2017-10-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | Although the Lisp manual said that ‘format’ returns a newly-allocated string, this was not true for a few cases like (format "%s" ""), and fixing the documentation to allow reuse of arguments lets us improve performance in common cases like (format "foo") and (format "%s" "foo") (Bug#28625). * doc/lispref/strings.texi (Formatting Strings): * etc/NEWS: Say that the result of ‘format’ might not be newly allocated. * src/callint.c (Fcall_interactively): * src/dbusbind.c (XD_OBJECT_TO_STRING): * src/editfns.c (Fmessage, Fmessage_box): * src/xdisp.c (vadd_to_log, Ftrace_to_stderr): Just use Fformat or Fformat_message, as that’s simpler and no longer makes unnecessary copies. * src/editfns.c (styled_format): Remove last argument, as it is no longer needed: all callers now want it to behave as if it were true. All remaining callers changed. Make this function static again. Simplify the function now that we no longer need to worry about whether the optimization is allowed.
* Avoid some unnecessary copying in Fformat etc.Paul Eggert2017-09-261-1/+2
| | | | | | | | | | | | | | | | | This patch is just for performance; it should not affect behavior. On my platform, it made the microbenchmark (format "%S" load-path) run about 45% faster. It should also speed up calls like (message "%s" STRING). * src/callint.c (Fcall_interactively): * src/dbusbind.c (XD_OBJECT_TO_STRING): * src/editfns.c (Fmessage, Fmessage_box): * src/xdisp.c (vadd_to_log, Ftrace_to_stderr): Use styled_format instead of Fformat or Fformat_message, to avoid unnecessary copying. * src/editfns.c (styled_format): New arg NEW_RESULT. All uses changed. Reuse an input string if it has the right value and if !NEW_RESULT. * src/lisp.h (style_format): New decl.
* 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.
* Add an optional testfn parameter to assocNicolas Petton2017-07-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | * src/fns.c (assoc): New optional testfn parameter used for comparison when provided. * test/src/fns-tests.el (test-assoc-testfn): Add tests for the new 'testfn' parameter. * src/buffer.c: * src/coding.c: * src/dbusbind.c: * src/font.c: * src/fontset.c: * src/gfilenotify.c: * src/image.c: * src/keymap.c: * src/process.c: * src/w32fns.c: * src/w32font.c: * src/w32notify.c: * src/w32term.c: * src/xdisp.c: * src/xfont.c: Add a third argument to Fassoc calls. * etc/NEWS: * doc/lispref/lists.texi: Document the new 'testfn' parameter.
* Compare and round more carefullyPaul Eggert2017-03-041-2/+2
| | | | | | | | | | | | | | | | * etc/NEWS: Document this. * src/data.c (store_symval_forwarding): * src/sound.c (parse_sound): Do not botch NaN comparison. * src/data.c (cons_to_unsigned, cons_to_signed): Signal an error if a floating-point arg is not integral. * src/data.c (cons_to_unsigned, cons_to_signed): * src/fileio.c (file_offset): Use simpler overflow check. * src/dbusbind.c (xd_extract_signed, xd_extract_unsigned): Avoid rounding error in overflow check. (Fcar_less_than_car): Use arithcompare directly. * test/src/charset-tests.el: New file.
* Use 'char *FOO' instead of 'char* FOO'Paul Eggert2017-02-181-1/+1
|
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | | | | | Run admin/update-copyright.
* | Fix --enable-gcc-warnings --with-ns on FedoraPaul Eggert2016-12-071-1/+1
| | | | | | | | | | | | | | * src/Makefile.in (NON_OBJC_CFLAGS): New macro. (ALL_OBJC_CFLAGS): Use it. (EMACS_CFLAGS): New macro, with most of the old ALL_CFLAGS. (ALL_CFLAGS, ALL_OBJC_FLAGS): Use it.
* | Simplify FUNCTIONP implementationPaul Eggert2016-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | * src/bytecode.c (exec_byte_code): * src/image.c (parse_image_spec): Prefer FUNCTIONP (x) to !NILP (Ffunctionp (x)). * src/eval.c (FUNCTIONP): Move here ... * src/lisp.h: ... from here. No longer inline, as that bloats the text and does not help speed (at least on my platform). (functionp): Remove this name, since callers use FUNCTIONP.
* | Limit <config.h>’s includesPaul Eggert2016-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.