* lib-src/ntlib.h (mkdir, open): Remove redefinitions. They are
now in nt/inc/ms-w32.h.
* lib-src/ntlib.c (sys_mkdir, sys_open): New functions.
(mkostemp): Remove.
* src/w32.c (mkostemp): Remove.
(sys_mkdir): Accept a second (unused) argument.
* src/fileio.c (Fmake_directory_internal): Remove the WINDOWSNT
specific call to mkdir. (Bug#28023)
* nt/inc/ms-w32.h (mkdir): Remove from "#ifdef emacs" and redefine
to accept 2 arguments.
(open): Remove from "#ifdef emacs".
* nt/mingw-cfg.site (ac_cv_func_mkostemp): Remove.
* nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_mkostemp)
(OMIT_GNULIB_MODULE_tempname): Remove.
* nt/inc/sys/time.h (_TIMEVAL_DEFINED, struct timevat, timerisset)
(timercmp, timerclear): Don't define. Instead, include the system
header sys/time.h, and add only the interval timers stuff. This
avoids compiler warnings about 'gettimeofday's prototype, and also
avoids redefinition of macros from system headers.
* lib-src/ntlib.c (gettimeofday):
* nt/inc/sys/time.h (gettimeofday, struct timezone): Remove unused
function 'gettimeofday' and all of its supporting code.
* nt/inc/ms-w32.h (WIN32_LEAN_AND_MEAN): Define to an empty value,
to be consistent with Gnulib's utimens.c. This is because utimens.c
unconditionally defines WIN32_LEAN_AND_MEAN to an empty value, so the
previous definition here conflicted with that.
* src/w32heap.c (getrlimit, setrlimit): New functions.
Include w32.h.
* src/emacs.c (main): Use 'rlim_t', not 'long', for values that
should be compatible with 'struct rlimit' members.
* nt/inc/sys/resource.h: New header file.
* nt/mingw-cfg.site (ac_cv_func_getrlimit, ac_cv_func_setrlimit):
Set to "yes".
* nt/inc/ms-w32.h (_WIN32_WINNT) [!MINGW_W64]: Undefine before
defining to avoid redefinition warnings.
* nt/inc/sys/stat.h (_SYS_STAT_H, _INC_STAT_H): Define, to avoid
inclusion of sys/stat.h from the system headers, which could then
lead to compilation errors due to redefinition of 'struct stat'
etc. This is needed because latest versions of MinGW runtime
include sys/stat.h from wchar.h.
* src/image.c (__MINGW_MAJOR_VERSION) [WINDOWSNT]: Temporarily
redefine to 4 to avoid conflict between 2 definitions of
MemoryBarrier. (Bug#24613)
* nt/inc/ms-w32.h (_WIN32_WINNT) [!MINGW_W64]: Undefine before
defining to avoid redefinition warnings.
* nt/inc/sys/stat.h (_SYS_STAT_H, _INC_STAT_H): Define, to avoid
inclusion of sys/stat.h from the system headers, which could then
lead to compilation errors due to redefinition of 'struct stat'
etc. This is needed because latest versions of MinGW runtime
include sys/stat.h from wchar.h.
* src/image.c (__MINGW_MAJOR_VERSION) [WINDOWSNT]: Temporarily
redefine to 4 to avoid conflict between 2 definitions of
MemoryBarrier. (Bug#24613)
Do not merge to master!
* nt/inc/ms-w32.h: Include stdint.h.
(_execvp, execve): Provide prototypes.
* lib-src/emacsclient.c [WINDOWSNT]: Remove prototype for execvp,
it is now in nt/inc/ms-w32.h.
* lib-src/ntlib.c (getppid): Avoid compiler warnings due to format
mismatch.
(sys_ctime): Remove, not used.
facb5e2 Update Emacs manual section related to character folding
4efea8e ; * etc/DEBUG: Fix a typo. (Bug#22984)
f8df21b Update admin/notes/unicode
950be68 Add symref-filepattern entries for c?perl-mode
8b8a6ad Don't use XRANDR 1.3 extensions if the server doesn't support them.
985dacf ; NEWS update for the last change in etags
741a6f8 Sync with gnulib
7352c6c Rework C source files to avoid ^(
a589e9a By default, etags produces unqualified Perl tag names
72c7438 Indent methods with keyword names correctly
28532a9 Propertize character literals and special global variables
differently
a7d6f39 ; Fix last change in NEWS
83b2a20 Change how /etc/NEWS presents character folding
b417c5a Revert "Revert "Backport: * lisp/isearch.el: Turn char-folding
off by default""
711ca36 Properly handle lambda as read function (bug 22961)
1b9d616 Propertize operator symbol names with symbol syntax class
9b16bc2 Stop recognizing :#{} as symbol in ruby-mode
366ec77 Allow using the left shift operator without spaces on both sides
02bf7cc Properly handle unquoting in wdired (bug 22938)
16cf469 ; Spelling fix and tighten up comment
f50bc04 Allow splat operator before percent literal
991c801 Don't apply the return value of goto-char as syntax class
6e63b3e Guard against nested percent literals
066f3bc Recognize iuwu-mod after an escaped newline
6f7a57c Fix symbolic mode string conversion for s and t
50b9826 Update 'ucs-names' database
993b2fb Improve doc string of 'shell-command'
b71c717 Make the code in movemail_strftime more general
cc057e4 Speed up redisplay of binary files with long series of nulls
e51b27e Remove the highlighting support for quoting 'like this' inside
Lisp docstrings
b1abce1 Restore leading space in movemail pop output
98b8d44 Fix bidi-paragraph-direction in Rmail view buffer
dc9d837 Don't misindent computed property generator methods
7923112 Fix mbox files produced by movemail on MS-Windows
c45a1ca doc string file descriptor exhaustion fix
265141b Fix Bug#22814
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.
See http://lists.gnu.org/archive/html/emacs-devel/2016-02/msg01602.html
for more details.
* nt/mingw-cfg.site (ac_cv_func_getaddrinfo)
(ac_cv_func_gai_strerror): Set to "yes", as the configure script's
test program is not smart enough to auto-detect these.
* nt/inc/sys/socket.h (getaddrinfo, freeaddrinfo): Redirect to
sys_getaddrinfo and sys_freeaddrinfo. Provide prototypes for
sys_getaddrinfo and sys_freeaddrinfo.
* src/w32.c (init_winsock): Try loading getaddrinfo and
freeaddrinfo from ws2_32.dll.
(sys_getaddrinfo, sys_freeaddrinfo): New functions.
* lib-src/pop.c [WINDOWSNT]: Include winsock2.h, not winsock.h,
and also ws2tcpip.h.
(getaddrinfo, freeaddrinfo) [WINDOWSNT]: Redirect to
sys_getaddrinfo and sys_freeaddrinfo, respectively.
(load_ws2, sys_getaddrinfo, sys_freeaddrinfo) [WINDOWSNT]: New
functions.
* src/w32heap.c (init_heap): Redirect malloc, realloc, and free to
special functions on Windows 9X. Refuse to dump Emacs on Windows 9X.
(malloc_after_dump_9x, realloc_after_dump_9x)
(free_after_dump_9x): New functions. (Bug#22379) See also
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00852.html
for more details about the original problem.
* nt/inc/ms-w32.h (malloc_after_dump_9x, realloc_after_dump_9x)
(free_after_dump_9x): Add prototypes.
Copyright-paperwork-exempt: yes
* src/w32fns.c (w32_reset_stack_overflow_guard)
(stack_overflow_handler): New functions for handling C stack
overflow exceptions.
(my_exception_handler): Handle EXCEPTION_STACK_OVERFLOW exceptions
specially, and zero out except_addr if we do.
(globals_of_w32fns): Initialize dwMainThreadId in non-interactive
mode.
* src/sysdep.c [HAVE_STACK_OVERFLOW_HANDLING]: Add !WINDOWSNT to
the condition, as HAVE_STACK_OVERFLOW_HANDLING is now defined for
the MinGW build, but the code guarded by that is for Posix hosts.
* src/keyboard.c (command_loop) [WINDOWSNT]: Call
w32_reset_stack_overflow_guard.
* nt/inc/ms-w32.h (sigjmp_buf): New typedef.
(sigsetjmp): New macro.
(w32_reset_stack_overflow_guard): Declare the prototype.
* configure.ac (HAVE_STACK_OVERFLOW_HANDLING): Set to 1 for MinGW.
* nt/mingw-cfg.site (ac_cv_header_pthread_h)
(gl_cv_sys_struct_timespec_in_pthread_h): Force to "no", to avoid
picking up 'struct timespec' from pthread.h, if it is installed on
the user's system. We want either the definitions from MinGW
system headers, if available, or the Gnulib replacements if not.
* nt/inc/ms-w32.h <struct timespec>: Don't define, as we now use
lib/time.h.
* lib/time.in.h: Don't let __need_* symbols affect what happens on
MinGW. These symbols are defined by MinGW system headers, but we
don't want that to affect whether Gnulib portions of the header
are or aren't used.
Based on ideas from Kim F. Storm <storm@cua.dk>, see
http://lists.gnu.org/archive/html/emacs-devel/2006-12/msg00873.html.
src/w32proc.c (reader_thread): If the FILE_CONNECT flag is set, call
'_sys_wait_connect'. If it returns STATUS_CONNECT_FAILED, exit
the thread with code 2.
(sys_select): Support 'wfds' in addition to 'rfds'. If a
descriptor in 'wfds' has its bit set, but the corresponding
fd_info member doesn't have its FILE_CONNECT flag set, ignore the
descriptor. Otherwise, acknowledge a successful non-blocking
connect by resetting the FILE_CONNECT flag and setting cp->status
to STATUS_READ_ACKNOWLEDGED.
src/w32.h (STATUS_CONNECT_FAILED): New enumeration value.
(struct _child_process): New member 'errcode'.
(FILE_CONNECT): New flag.
(_sys_wait_connect): Add prototype.
src/w32.c (pfn_WSAEnumNetworkEvents): New function pointer.
(init_winsock): Load WSAEnumNetworkEvents from winsock DLL.
(set_errno): Map WSAEWOULDBLOCK and WSAENOTCONN.
(sys_connect): Support non-blocking 'connect' calls by setting the
FILE_CONNECT flag in the fd_info member and returning EINPROGRESS.
(_sys_read_ahead): Add debug message if this function is called
for a descriptor that waits for a non-blocking connect to complete.
(_sys_wait_connect): New function.
(sys_read): Support STATUS_CONNECT_FAILED. Return the error code
recorded by _sys_wait_connect when the non-blocking connect
failed. Don't call WSAGetLastError before a call to set_errno had
a chance to use its value, since WSAGetLastError clears the last
error.
nt/inc/ms-w32.h (BROKEN_NON_BLOCKING_CONNECT): Don't define.
src/emacs.c <w32_daemon_event> [WINDOWSNT]: New global var.
(main) [WINDOWSNT]: Initialize it to NULL. Create the event to
signal clients we are ready for connections.
(Fdaemon_initialized): Use DAEMON_RUNNING.
[WINDOWSNT]: MS-Windows specific code to signal clients we are
ready for connections.
src/lisp.h (DAEMON_RUNNING): New macro, encapsulates Posix and
MS-Windows conditions for running in daemon mode.
src/minibuf.c (read_minibuf): Use DAEMON_RUNNING.
src/keyboard.c (kbd_buffer_get_event): Use DAEMON_RUNNING.
src/dispnew.c (init_display) [WINDOWSNT]: Initialize frames/terminal
even in daemon mode.
nt/inc/ms-w32.h (W32_DAEMON_EVENT): New macro.
lib-src/emacsclient.c (decode_options) [WINDOWSNT]: Don't reject empty
arguments for --alternate-editor.
(print_help_and_exit) [WINDOWSNT]: Don't refrain from advertising
empty arguments for --alternate-editor.
(start_daemon_and_retry_set_socket) [WINDOWSNT]: MS-Windows
specific code to start Emacs in daemon mode and wait for it to be
ready for client connections.
lisp/server.el (server-process-filter): Force GUI frames on
MS-Windows in daemon mode, even if a TTY frame was requested.
lisp/frameset.el (frameset-keep-original-display-p): Don't assume
windows-nt cannot be in daemon mode.
lisp/frame.el (window-system-for-display): Don't assume windows-nt
cannot be in daemon mode.
... for detecting MinGW-w64. _W64 is not specific of MinGW-w64, it is
defined for compatibility with MS VC++.
* nt/inc/ms-w32.h: Define MINGW_W64.
* admin/CPP-DEFINES: Mention MINGW_W64.
* nt/addpm.c: Use it.
* nt/addsection.c: Use it.
* nt/preprep.c: Use it.
* src/w32.c: Use MINGW_W64 instead of _W64
* src/w32term.c: Likewise.
* nt/inc/ms-w32.h (POLL_FOR_INPUT): Likewise.
* src/keyboard.c, src/process.c: Do not define POLL_FOR_INPUT here
because it will be defined in generated config.h if needed.
src/Makefile.in (C_HEAP_SWITCH): Get the predefined heap size from
configure.
(ADDSECTION, MINGW_TEMACS_POST_LINK): Remove, no longer used.
src/lisp.h (NONPOINTER_BITS): Modify the condition to define to zero
for MinGW, since it no longer uses gmalloc.
src/buffer.c: Do not define mmap allocations functions for Windows.
Remove mmap_find which is unused. Remove mmap_set_vars which does
nothing useful.
[WINDOWSNT]: Include w32heap.h.
(init_buffer): Always allocate new memory for buffers.
src/emacs.c: Remove mmap_set_vars calls.
src/image.c (free_image): Undef free for Windows because it is
redirected to our private version.
src/unexw32.c (COPY_PROC_CHUNK): Use %p format for 64bits
compatibility.
(copy_executable_and_dump_data): Remove dumping the heap section.
(unexec): Restore using_dynamic_heap after dumping.
src/w32heap.c (dumped_data_commit, malloc_after_dump)
(malloc_before_dump, realloc_after_dump, realloc_before_dump)
(free_after_dump, free_before_dump, mmap_alloc, mmap_realloc)
(mmap_free): New functions.
src/w32heap.h: Declare dumped_data and mmap_* function prototypes.
nt/inc/ms-w32.h: Switch to the system heap allocation scheme
instead of GNU malloc and ralloc.
nt/inc/sys/mman.h: New file.
nt/INSTALL: Update for the new build requirements.
etc/NEWS: Mention build changes on MS-Windows.
configure.ac (C_HEAP_SWITCH) define for different values of
dumped heap size depending on 32/64bits arch on Windows.
Don't check for pthreads.h on MinGW32/64, it gets in the way.
Use mmap(2) for buffers and system malloc for MinGW32/64.
configure.ac: Read $srcdir/nt/mingw-cfg.site when $MSYSTEM is
"MINGW64" as well.
nt/inc/ms-w32.h (pthread_sigmask): Undefine if defined, for MinGW64.
src/unexw32.c (_start) [__MINGW64__]: Define to __start.
* mail/unrmail.el (unrmail-mbox-format): Choice is mboxo, not mboxro.
* woman.el (woman-mark-horizontal-position):
Rename from woman-mark-horizonal-position. Use changed.
configure.ac (canonical, C_SWITCH_SYSTEM): Support a 64-bit
MinGW64 build on MS-Windows.
nt/inc/ms-w32.h (sys_kill): Fix prototype.
src/w32term.c (w32_initialize): Use LCID and LOWORD.
src/w32proc.c (create_child): Use pid_t for 5th argument.
(IsValidLocale): Don't provide prototype for MinGW64.
(Fw32_get_valid_keyboard_layouts, Fw32_get_keyboard_layout)
(Fw32_set_keyboard_layout): Use HKL and HIWORD/LOWORD.
src/w32heap.c (allocate_heap) [_WIN64]: Use "ull", not "i64", which
MinGW64 doesn't support.
src/lisp.h (EMACS_INT) [_WIN64]: Define for the MinGW64 build.
nt/inc/mingw_time.h: New file.
nt/inc/ms-w32.h: Include mingw_time.h instead of doing its job.
src/w32proc.c: Include mingw_time.h.
src/w32.c: Include mingw_time.h.
nt/inc/dirent.h (struct dirent) [__MINGW_MAJOR_VERSION >= 4]: Make
the layout of 'struct dirent' be compatible with MinGW32 runtime
versions 4.0 and later.
nt/inc/ms-w32.h (__MINGW_MAJOR_VERSION, __MINGW_MINOR_VERSION)
(__MINGW_PATCHLEVEL) [!__MINGW64_VERSION_MAJOR]: Define, if not
defined, but not for MinGW64.
(_USE_32BIT_TIME_T) [__MINGW64_VERSION_MAJOR]: Define, to force
use of 32-bit time_t type.
src/callproc.c:
src/emacs.c:
src/filelock.c:
src/process.c:
src/sysdep.c:
src/w32.c: Reshuffle Windows-specific headers to avoid errors with
redefinition of fd_set etc.
src/process.c: Don't use num_pending_connects when
NON_BLOCKING_CONNECT is not defined.
src/sysselect.h: Move definitions of FD_* macros and of SELECT_TYPE
here from w32.h.
src/w32proc.c (sys_select): Adjust the argument types to what
thread.h expects.
nt/inc/sys/socket.h: Include stdint.h. Include sysselect.h instead
of w32.h.
nt/mingw-cfg.site (ac_cv_func_mkostemp): New var with value of "yes".
nt/inc/ms-w32.h (mkostemp): Declare prototype.
nt/config.nt (HAVE_MKOSTEMP): Define to 1.
src/w32.c (mkostemp): New function.
(mktemp): Remove, no longer used. Most of the code reused in mkostemp.
Fixes: debbugs:15015