1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

235 Commits

Author SHA1 Message Date
Paul Eggert
758bed52af Merge from gnulib.
This incorporates:
2013-10-14 acl: allow cross-compilation to Gentoo
2013-10-18 extern-inline: make safe for -Wundef usage
2013-09-30 fpending: use pure+const function attrs
* lib/fpending.h, m4/acl.m4, m4/extern-inline.m4: Update from gnulib.
2013-10-22 21:01:46 -07:00
Paul Eggert
46e5e833d9 Merge from gnulib.
This incorporates:
2013-10-10 strtoumax: port to Solaris 8
2013-10-09 strtoimax, strtoumax: port to HP-UX 11.11
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/inttypes.in.h, lib/strtoimax.c, m4/inttypes.m4, m4/strtoimax.m4:
* m4/strtoumax.m4:
Update from gnulib.
2013-10-12 13:00:38 -07:00
Paul Eggert
595e113b15 Improve support for popcount and counting trailing zeros.
Do this by using the Gnulib modules for this.
This should generate faster code on non-GCC, non-MSC platforms,
and make the code a bit more portable, at least in theory.
* admin/merge-gnulib (GNULIB_MODULES): Add count-one-bits
and count-trailing-zeros.
* lib/count-one-bits.c, lib/count-one-bits.h:
* lib/count-trailing-zeros.c, lib/count-trailing-zeros.h:
* m4/count-one-bits.m4, m4/count-trailing-zeros.m4:
New files, copied from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Merge changes from lib/gnulib.mk.
* src/data.c: Include <count-one-bits.h>, <count-trailing-zeros.h>.
(USE_MSC_POPCOUNT, POPCOUNT_STATIC_INLINE)
(NEED_GENERIC_POPCOUNT, popcount_size_t_generic)
(popcount_size_t_msc, popcount_size_t_gcc):
Remove; now done by Gnulib.
(popcount_size_t): Now a macro that defers to Gnulib.
(count_trailing_zero_bits): Return int, for consistency with
Gnulib and because Emacs prefers signed to unsigned int.
Don't assume that size_t is either unsigned int or unsigned long
or unsigned long long.
(size_t_to_host_endian): Do not assume that size_t is either
exactly 32 or exactly 64 bits wide.
* src/lisp.h (BITS_PER_SIZE_T): Define consistently with BITS_PER_LONG
etc., so that it's now an enum constant, not a macro.
No need to assume that it's either 32 or 64.

Fixes: debbugs:15550
2013-10-07 14:37:19 -07:00
Paul Eggert
4eed315732 Use hardware support for byteswapping on glibc x86 etc.
On Fedora 19 x86-64, the new bswap_64 needs 1 instruction,
whereas the old swap64 needed 30.
* admin/merge-gnulib (GNULIB_MODULES): Add byteswap.
* lib/byteswap.in.h, m4/byteswap.m4: New files, copied from Gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* src/fringe.c (init_fringe_bitmap) [WORDS_BIGENDIAN]:
* src/sound.c (le2hl, le2hs, be2hl) [!WINDOWSNT]:
Use byteswap.h's macros to swap bytes.
* src/lisp.h (swap16, swap32, swap64): Remove.
All uses replaced by bswap_16, bswap_32, bswap_64.
2013-10-04 00:36:22 -07:00
Paul Eggert
0a858ebfc5 Merge from gnulib.
* src/conf_post.h (__has_builtin, assume): Remove; gnulib now does these.
* src/lisp.h: Include <verify.h>, for 'assume'.

This also incorpoprates:
2013-10-02 verify: new macro 'assume'
2013-09-26 dup2, dup3: work around another cygwin crasher
2013-09-26 getdtablesize: work around cygwin issue
2013-10-03 00:06:52 -07:00
Paul Eggert
959c3d24a7 Merge from gnulib.
This incorporates:
2013-09-24 manywarnings: enable nicer gcc warning messages
2013-09-23 warnings: port --enable-gcc-warnings to Solaris Studio 12.3
2013-09-21 timespec: use the new TIMESPEC_RESOLUTION elsewhere
* configure.ac (WERROR_CFLAGS): Omit -fdiagnostics-show-option
and -funit-at-a-time, since manywarnings does that for us now.
2013-09-24 20:44:34 -07:00
Paul Eggert
230fe2a5a1 Merge from gnulib.
This incorporates the following changes:
2013-09-19 stdio: OS X port of putc_unlocked + extern inline
2013-09-19 signal: OS X port of sigaddset etc. + extern inline
2013-09-19 extern-inline: do not always suppress extern inline on OS X
2013-09-17 getgroups: statement without effect
2013-08-28 headers: check that _GL_INLINE_HEADER_BEGIN is defined
2013-09-19 14:40:08 -07:00
Paul Eggert
12c4970d70 Minor merge from gnulib (mostly just for texinfo.tex). 2013-08-26 15:17:31 -07:00
Paul Eggert
51632863c2 Merge from gnulib.
This incorporates:
2013-08-15 warnings: minor optimization
2013-08-15 warnings: check -Wfoo rather than -Wno-foo
2013-08-18 22:23:05 -07:00
Paul Eggert
eaca0446e7 Merge from gnulib.
This incorporates:
2013-08-11 fpending: port to recent Cygwin change to stdio_ext.h
2013-08-10 sys_time: port to OpenBSD
2013-08-11 17:52:17 -07:00
Paul Eggert
e0fdb69430 Fix some minor races in hosts lacking mkostemp.
Gnulib's emulation of mkostemp doesn't have races that Emacs's does.
* configure.ac (mkostemp): Remove check for this function;
gnulib does the check now.
(mkstemp): Remove check for this no-longer-used function.
* lib/mkostemp.c, lib/secure_getenv.c, lib/tempname.c, lib/tempname.h:
* m4/mkostemp.m4, m4/secure_getenv.m4, m4/tempname.m4:
New files, copied from Gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Add mkostemp.
* lib-src/movemail.c (main):
* lib-src/update-game-score.c (write_scores):
Use mkostemp (which now works on all platforms, due to changes
in the portability layer) rather than mktemp (which has a race)
or mkstemp (which we no longer bother with).
* src/callproc.c (create_temp_file):
* src/filelock.c (create_lock_file):
Assume mkostemp, since it's now provided by Gnulib.

Fixes: debbugs:15015
2013-08-04 09:56:56 -07:00
Paul Eggert
7b154deff5 Port recent close-on-exec changes to Cygwin.
* lib/binary-io.c, lib/binary-io.h: New files.
Merge from gnulib, incorporating:
2013-07-09 accept4, dup3, pipe2: port to Cygwin
* lib/pipe2.c: Update from gnulib, as part of this merge.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.

Fixes: debbugs:14821
2013-07-09 10:16:21 -07:00
Paul Eggert
4ebbdd6712 Handle errno and exit status a bit more carefully.
* lib/ignore-value.h: Remove this gnulib-imported file.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Remove ignore-value.
* src/callproc.c (child_setup) [!DOS_NT]: Don't try to stuff an error
number into an exit status.  Instead, use EXIT_CANCELED.
(child_setup) [!MSDOS]: Avoid possible deadlock with vfork.
* src/callproc.c (relocate_fd):
* src/emacs.c (close_output_streams, main):
* src/process.c (create_process):
* src/sysdep.c (sys_subshell) [!DOS_NT || !WINDOWSNT]:
Use emacs_perror for simplicity.
* src/callproc.c (relocate_fd, main):
* src/sysdep.c (sys_subshell):
Exit with EXIT_CANCELED etc., not 1, when exec setup fails.
(shut_down_emacs): Use emacs_write, not write.
* src/emacs.c, src/sysdep.c: Don't include <ignore-value.h>.
* src/fileio.c (Fcopy_file, e_write):
* src/nsterm.m (ns_select):
* src/process.c (send_process):
* src/sound.c (vox_write):
Use emacs_write_sig, not emacs_write.
* src/lisp.h (emacs_write_sig, emacs_perror): New decls.
* src/process.h (EXIT_CANCELED), EXIT_CANNOT_INVOKE, EXIT_ENOENT):
New constants.
* src/sysdep.c (emacs_backtrace): Use emacs_write, not ignore_value
of write.
(emacs_full_write): New function.
(emacs_write): Rewrite to use it.
(emacswrite_sig, emacs_perror): New functions.
* src/xrdb.c (fatal): Don't invoke perror, since errno might be garbage.
2013-07-09 00:04:48 -07:00
Paul Eggert
2a74a90a03 Try to fix FreeBSD 9.1 porting problem.
This incorporates the following merge from gnulib:
2013-07-07 stdalign, verify: port to FreeBSD 9.1, to C11, and to C++11

Fixes: debbugs:14812
2013-07-07 23:15:38 -07:00
Paul Eggert
067428c171 Make file descriptors close-on-exec when possible.
This simplifies Emacs a bit, since it no longer needs to worry
about closing file descriptors by hand in some cases.
It also fixes some unlikely races.  Not all such races, as
libraries often open files internally without setting
close-on-exec, but it's an improvement.
* admin/merge-gnulib (GNULIB_MODULES): Add fcntl, pipe2.
(GNULIB_TOOL_FLAGS): Avoid binary-io, close.  Do not avoid fcntl.
* configure.ac (mkostemp): New function to check for.
(PTY_OPEN): Pass O_CLOEXEC to posix_openpt.
* lib/fcntl.c, lib/getdtablesize.c, lib/pipe2.c, m4/fcntl.m4:
* m4/getdtablesize.m4, m4/pipe2.m4: New files, taken from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Remove empty gl_GNULIB_ENABLED_verify section;
otherwise, gnulib-tool complains given close-on-exec changes.
* nt/inc/ms-w32.h (pipe): Remove.
* nt/mingw-cfg.site (ac_cv_func_fcntl, gl_cv_func_fcntl_f_dupfd_cloexec)
(gl_cv_func_fcntl_f_dupfd_works, ac_cv_func_pipe2): New vars.
* src/alloc.c (valid_pointer_p) [!WINDOWSNT]:
* src/callproc.c (Fcall_process) [!MSDOS]:
* src/emacs.c (main) [!DOS_NT]:
* src/nsterm.m (ns_term_init):
* src/process.c (create_process):
Use 'pipe2' with O_CLOEXEC instead of 'pipe'.
* src/emacs.c (Fcall_process_region) [HAVE_MKOSTEMP]:
* src/filelock.c (create_lock_file) [HAVE_MKOSTEMP]:
Prefer mkostemp with O_CLOEXEC to mkstemp.
* src/callproc.c (relocate_fd) [!WINDOWSNT]:
* src/emacs.c (main): Use F_DUPFD_CLOEXEC, not plain F_DUPFD.
No need to use fcntl (..., F_SETFD, FD_CLOEXEC), since we're
now using pipe2.
* src/filelock.c (create_lock_file) [! HAVE_MKOSTEMP]:
Make the resulting file descriptor close-on-exec.
* src/lisp.h, src/lread.c, src/process.c (close_load_descs, close_process_descs):
* src/lread.c (load_descriptor_list, load_descriptor_unwind):
Remove; no longer needed.  All uses removed.
* src/process.c (SOCK_CLOEXEC): Define to 0 if not supplied by system.
(close_on_exec, accept4, process_socket) [!SOCK_CLOEXEC]:
New functions.
(socket) [!SOCK_CLOEXEC]: Supply a substitute.
(Fmake_network_process, Fnetwork_interface_list):
(Fnetwork_interface_info, server_accept_connection):
Make newly-created socket close-on-exec.
* src/sysdep.c (emacs_open, emacs_fopen):
Make new-created descriptor close-on-exec.
* src/w32.c (fcntl): Support F_DUPFD_CLOEXEC well enough for Emacs.
* src/w32.c, src/w32.h (pipe2): Rename from 'pipe', with new flags arg.

Fixes: debbugs:14803
2013-07-07 11:00:14 -07:00
Paul Eggert
aaea749595 Merge from gnulib.
This incorporates:
2013-06-23 ignore-value: port to gcc -pedantic
2013-06-21 extern-inline: port to gcc -std=c89
2013-07-01 16:43:19 -07:00
Paul Eggert
ec9295aeaa Merge from gnulib (comment fixes only). 2013-06-18 14:31:00 -07:00
Paul Eggert
cdd0de4b05 Merge from gnulib.
2013-05-15 manywarnings: update for GCC 4.8.0
2013-05-15 stdio: use __REDIRECT for fwrite, fwrite_unlocked
2013-05-15 sig2str, stdio, warnings: port to clang
2013-05-16 00:10:39 -07:00
Paul Eggert
ffdc270a76 Use Gnulib ACL implementation, for benefit of Solaris etc.
* configure.ac: Remove -with-acl option, since Gnulib does that for
us now.
(LIBACL_LIBS): Remove; no longer needed.
* lib/Makefile.am (CLEANFILES, SUFFIXES): New (empty) macros,
for the benefit of the new ACL implementation.
* lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/acl-errno-valid.$(O).
($(BLD)/acl-errno-valid.$(O)): New rule.
* lib/acl-errno-valid.c, lib/acl-internal.h, lib/acl.h:
* lib/acl_entries.c, lib/errno.in.h, lib/file-has-acl.c:
* lib/qcopy-acl.c, lib/qset-acl.c, m4/acl.m4, m4/errno_h.m4:
New files, taken from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Add qacl.
(GNULIB_TOOL_FLAGS): Do not avoid errno.
* etc/NEWS: Emacs is no longer limited to POSIX ACLs.  --disable-acl,
not --without-acl, since we're now using Gnulib's implementation.
* nt/config.nt (HAVE_ACL_SET_FILE): Rename from HAVE_POSIX_ACL.
* nt/inc/ms-w32.h (EOPNOTSUPP): New macro.
* src/Makefile.in (LIB_ACL): New macro.
(LIBACL_LIBS): Remove.
(LIBES): Use LIB_ACL, not LIBACL_LIBS.
* src/fileio.c: Include <acl.h>.
Use HAVE_ACL_SET_FILE rather than HAVE_POSIX_ACL.
(ACL_NOT_WELL_SUPPORTED): Remove.  All uses replaced by
!acl_errno_valid.
(Fcopy_file) [!WINDOWSNT]: Use qcopy_acl instead of rolling
it ourselves.

Fixes: debbugs:14295
2013-05-07 14:34:03 -07:00
Paul Eggert
ad64371062 Comment fix, to match Gnulib upstream copy. 2013-05-07 14:04:51 -07:00
Paul Eggert
d9774ea487 Merge from gnulib.
This incorporates:
2013-04-28 extern-inline: work around bug in Sun c99
2013-04-28 21:48:30 -07:00
Paul Eggert
119b2d43cc Merge from gnulib
This incorporates:
2013-03-29 stdalign: port to stricter ISO C11
This helps to run 'configure' on MS-Windows; see Eli Zaretskii in
<http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00999.html>.
2013-03-30 10:30:06 -07:00
Paul Eggert
47d7532e09 File synchronization fixes.
* admin/CPP-DEFINES (BSD_SYSTEM, HAVE_FSYNC): Remove.
* admin/merge-gnulib (GNULIB_MODULES): Add fsync, fdatasync.
* configure.ac (BSD_SYSTEM, BSD_SYSTEM_AHB): Remove; no longer needed.
(fsync): Remove check; now done by gnulib.
* lib/fdatasync.c, lib/fsync.c, m4/fdatasync.m4, m4/fsync.m4:
New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib-src/Makefile.in (LIB_FDATASYNC): New macro.
(emacsclient${EXEEXT}): Use it.
* lib-src/emacsclient.c (main): Use fdatasync, not fsync, since we don't
care about metadata.  Keep trying if interrupted.
* lib-src/movemail.c (main, popmail): Don't worry about BSD_SYSTEM, since
fsync is available everywhere (or there is a substitute).  Don't
report an error if fsync returns EINVAL.
* nt/inc/ms-w32.h (fdatasync): New macro, suggested by Eli Zaretskii.
* src/Makefile.in (LIB_FDATASYNC): New macro.
(LIBES): Use it.
* src/conf_post.h (BSD_SYSTEM, BSD_SYSTEM_AHB): Remove; no longer needed.
* src/fileio.c (Fwrite_region, write_region_inhibit_fsync):
Don't worry about HAVE_FSYNC, since a substitute fsync is
available if the system lacks one.
(Fwrite_regin): Retry fsync if interrupted.

Fixes: debbugs:13944
2013-03-13 11:42:22 -07:00
Paul Eggert
2c3f72f4b5 Merge from gnulib: putenv: port to Solaris 10. 2013-03-13 00:15:17 -07:00
Paul Eggert
5615c9a9af Merge from gnulib.
This incorporates:
2013-03-12 mktime: fix configure typo
2013-03-11 regex: port to mingw's recent addition of undeclared alarm
2013-03-11 putenv: avoid compilation warning on mingw
2013-03-11 unistd: don't prevent Tru64 Unix from using gnulib strtod.
2013-03-12 17:38:42 -07:00
Paul Eggert
89bd9d3685 Merge from gnulib.
2013-02-21 putenv: port better to native Windows
2013-02-18 extern-inline: avoid compilation error with HP-UX cc
2013-02-14 putenv: fix heap corruption with mixed putenv/_putenv
2013-03-01 07:16:43 -08:00
Paul Eggert
a84b7c5334 Tune by using memchr and memrchr.
* .bzrignore: Add string.h.
* admin/merge-gnulib (GNULIB_MODULES): Add memrchr.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/memrchr.c, lib/string.in.h, m4/memrchr.m4, m4/string_h.m4:
New files, from gnulib.
* src/doc.c (Fsnarf_documentation):
* src/fileio.c (Fsubstitute_in_file_name):
* src/search.c (find_newline, scan_newline):
* src/xdisp.c (pos_visible_p, display_count_lines):
Use memchr and memrchr rather than scanning byte-by-byte.
* src/search.c (find_newline): Rename from scan_buffer.
Omit first arg TARGET, as it's always '\n'.  All callers changed.
2013-02-11 15:37:18 -08:00
Paul Eggert
8376d87efc Merge from gnulib. 2013-02-08 15:37:17 -08:00
Paul Eggert
8654f9d7d6 Use fdopendir, fstatat and readlinkat, for efficiency.
On my host, this speeds up directory-files-and-attributes by a
factor of 3, when applied to Emacs's src directory.
These functions are standardized by POSIX and are common these
days; fall back on a (slower) gnulib implementation if the host
is too old to supply them.
* .bzrignore: Add lib/dirent.h.
* lib/Makefile.am (libgnu_a_SOURCES): Add openat-die.c, save-cwd.c.
* lib/careadlinkat.c, lib/careadlinkat.h: Merge from gnulib,
incorporating: 2013-01-29 careadlinkat: do not provide careadlinkatcwd.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/dirent.in.h, lib/fdopendir.c, lib/fstatat.c, lib/openat-priv.h:
* lib/openat-proc.c, lib/openat.h, m4/dirent_h.m4, m4/fdopendir.m4:
* m4/fstatat.m4: New files, from gnulib.
* lib/openat-die.c, lib/save-cwd.c, lib/save-cwd.h: New files.
These last three are specific to Emacs and are not copied from gnulib.
They are simpler than the gnulib versions and are tuned for Emacs.
* admin/merge-gnulib (GNULIB_MODULES): Add fdopendir, fstatat, readlinkat.
(GNULIB_TOOL_FLAGS): Do not avoid at-internal, openat-h.
Avoid dup, open, opendir.
* nt/inc/sys/stat.h (fstatat):
* nt/inc/unistd.h (readlinkat): New decls.
* src/conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): Remove.
* src/dired.c: Include <fcntl.h>.
(open_directory): New function, which uses open and fdopendir
rather than opendir.  DOS_NT platforms still use opendir, though.
(directory_files_internal, file_name_completion): Use it.
(file_attributes): New function, with most of the old Ffile_attributes.
(directory_files_internal, Ffile_attributes): Use it.
(file_attributes, file_name_completion_stat): First arg is now fd,
not dir name.  All uses changed.  Use fstatat rather than lstat +
stat.
(file_attributes): Use emacs_readlinkat rather than Ffile_symlink_p.
* src/fileio.c: Include <allocator.h>, <careadlinkat.h>.
(emacs_readlinkat): New function, with much of the old
Ffile_symlink_p, but with an fd argument for speed.
It uses readlinkat rather than careadlinkatcwd, so that it
need not assume the working directory.
(Ffile_symlink_p): Use it.
* src/filelock.c (current_lock_owner): Use emacs_readlinkat
rather than emacs_readlink.
* src/lisp.h (emacs_readlinkat): New decl.
(READLINK_BUFSIZE, emacs_readlink): Remove.
* src/sysdep.c: Do not include <allocator.h>, <careadlinkat.h>.
(emacs_norealloc_allocator, emacs_readlink): Remove.
This stuff is moved to fileio.c.
* src/w32.c (fstatat, readlinkat): New functions.
(careadlinkat): Don't check that fd == AT_FDCWD.
(careadlinkatcwd): Remove; no longer needed.

Fixes: debbugs:13539
2013-01-31 22:30:51 -08:00
Paul Eggert
ffe04adc88 Merge from gnulib. 2013-01-16 09:45:39 -08:00
Paul Eggert
ee0d39381a Merge from gnulib.
This incorporates:
2013-01-04 stdio: remove now-unnecessary stdio.c
2013-01-04 fprintftime: depend on stdio, not ignore-value
2013-01-04 fwrite: silence __wur only for older glibc versions
2013-01-04 fwrite: silence __wur without using inline
* lib/stdio.c: Remove.
* lib/stdio.in.h, lib/strftime.c: Update from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
2013-01-03 18:17:49 -08:00
Paul Eggert
9ff99d22a0 Merge from gnulib. 2013-01-02 08:37:04 -08:00
Paul Eggert
0877d0dc24 Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca 2013-01-02 08:13:04 -08:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Paul Eggert
219023c434 Merge from gnulib. 2012-12-23 22:24:08 -08:00
Paul Eggert
904dd565a0 Merge from gnulib for 'inline', incorporating:
2012-12-11 extern-inline: avoid incompatibility with Darwin Libc
* m4/extern-inline.m4: Update from gnulib.

Fixes: debbugs:13040
2012-12-11 10:18:13 -08:00
Paul Eggert
5745a7df2b Use putenv+unsetenv instead of modifying environ directly.
* admin/merge-gnulib (GNULIB_MODULES): Add putenv, unsetenv.
* lib/putenv.c, lib/unsetenv.c, m4/putenv.m4, m4/setenv.m4:
New files, copied automatically from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* src/alloc.c (xputenv): New function.
* src/dbusbind.c (Fdbus_init_bus):
* src/emacs.c (main):
* src/xterm.c (x_term_init):
Use xputenv instead of setenv or putenv, to detect memory exhaustion.
* src/editfns.c (initial_tz): Move static var decl up.
(tzvalbuf_in_environ): New static var.
(init_editfns):	Initialize these two static vars.
(Fencode_time): Don't assume arbitrary limit on EMACS_INT width.
Save old TZ value on stack, if it's small.
(Fencode_time, set_time_zone_rule): Don't modify 'environ' directly;
instead, use xputenv+unsetenv to set and restore TZ.
(environbuf): Remove static var.  All uses removed.
(Fset_time_zone_rule): Do not save TZ and environ;
no longer needed here.
(set_time_zone_rule_tz1, set_time_zone_rule_tz2) [LOCALTIME_CACHE]:
Move to inside set_time_zone_rule; they don't need file scope any more.
(set_time_zone_rule): Maintain the TZ=value string separately.
(syms_of_editfns): Don't initialize initial_tz;
init_editfns now does it.
* src/emacs.c (dump_tz) [HAVE_TZSET]: Now const.
* src/lisp.h (xputenv): New decl.

Fixes: debbugs:13070
2012-12-08 09:19:51 -08:00
Paul Eggert
d983a10b9a Assume POSIX 1003.1-1988 or later for signal.h.
Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN,
SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these.
* admin/CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT):
Remove.
(SIGTRAP): Remove this one too, as config.h no longer defines it.
* admin/merge-gnulib (GNULIB_MODULES): Add sig2str.
* configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
Use SIGCHLD rather than SIGCLD.
* lib/sig2str.c, lib/sig2str.h, m4/sig2str.m4: New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/makefile.w32-in (GNULIBOBJS): Add $(BUILD)/sig2str.$(O).
* src/process.c [subprocesses]: Include <c-ctype.h>, <sig2str.h>.
(deleted_pid_list, Fdelete_process, create_process)
(record_child_status_change, handle_child_signal, deliver_child_signal)
(init_process_emacs, syms_of_process):
Assume SIGCHLD is defined.
(parse_signal): Remove.  All uses removed.
(abbr_to_signal): New static function.
(Fsignal_process): Use it to convert signal names to ints.
* src/sysdep.c (sys_suspend) [!DOS_NT]: Use kill (0, ...) rather than
kill (getpgrp (), ...).
(emacs_sigaction_init): Assume SIGCHLD is defined.
(init_signals): Assume SIGALRM, SIGCHLD, SIGHUP, SIGKILL,
SIGPIPE, and SIGQUIT are defined.  Do not worry about SIGCLD any more.
* src/syssignal.h (EMACS_KILLPG): Remove.
All uses replaced by 'kill' with a negative pid.
(SIGCHLD): Remove definition, as we now assume SIGCHLD.
* src/w32proc.c (sys_kill): Support negative pids compatibly with POSIX.

Fixes: debbugs:13026
2012-12-07 18:30:51 -08:00
Paul Eggert
f64898abf4 Merge from gnulib for 'inline'.
2012-11-29 snippet/warn-on-use: no 'static inline'
2012-11-29 ftruncate, fts, lstat, openat, raise: no 'static inline'
2012-11-29 arctwo, md4, md5, sha1, sha256, sha512: no 'static inline'
2012-11-29 fflush, stat: no 'static inline'
2012-11-29 stdio: better 'inline'
2012-11-29 sys_stat: no 'static inline'
2012-11-29 unistd: better 'inline'
2012-11-29 c-strtod, memcoll, readutmp: no 'static inline'
2012-11-29 extern-inline: no 'static inline'
2012-11-29 sys_socket: better 'inline'
* lib/stdio.c, lib/unistd.c: New files, from gnulib.
* build-aux/snippet/warn-on-use.h, lib/gnulib.mk, lib/lstat.c:
* lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c, lib/stat.c:
* lib/stdio.in.h, lib/sys_stat.in.h, lib/unistd.in.h, m4/c-strtod.m4:
* m4/extern-inline.m4, m4/gnulib-comp.m4, m4/lstat.m4, m4/md5.m4:
* m4/sha1.m4, m4/sha256.m4, m4/sha512.m4, m4/stat.m4, m4/stdio_h.m4:
* m4/sys_socket_h.m4, m4/sys_stat_h.m4, m4/unistd_h.m4:
Update from gnulib.

Fixes: debbugs:13040
2012-11-30 10:25:59 -08:00
Paul Eggert
73dcdb9f30 Use faccessat, not access, when checking file permissions.
This fixes a bug that has been present in Emacs since its creation.
It was reported by Chris Torek in 1983 even before GNU Emacs existed,
which must set some sort of record.  (Torek's bug report was against
a predecessor of GNU Emacs, but GNU Emacs happened to have the
same common flaw.)  See Torek's Usenet posting
"setuid/setgid programs & Emacs" Article-I.D.: sri-arpa.858
Posted: Fri Apr  8 14:18:56 1983.
* .bzrignore: Add lib/fcntl.h.
* configure.ac (euidaccess): Remove check; gnulib does this for us now.
(gl_FCNTL_O_FLAGS): Define a dummy version.
* lib/at-func.c, lib/euidaccess.c, lib/faccessat.c, lib/fcntl.in.h:
* lib/getgroups.c, lib/group-member.c, lib/root-uid.h:
* lib/xalloc-oversized.h, m4/euidaccess.m4, m4/faccessat.m4:
* m4/fcntl_h.m4, m4/getgroups.m4, m4/group-member.m4:
New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Add faccessat.
(GNULIB_TOOL_FLAGS): Avoid at-internal, fchdir, malloc-posix,
openat-die, openat-h, save-cwd.  Do not avoid fcntl-h.
Omit gnulib's m4/fcntl-o.m4.
* nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS): New symbols.
(access): Remove.
(faccessat): New macro.
* src/Makefile.in (LIB_EACCESS): New macro.
(LIBES): Use it.
* src/callproc.c (init_callproc):
* src/charset.c (init_charset):
* src/fileio.c (check_existing, check_executable, check_writable)
(Ffile_readable_p):
* src/lread.c (openp, load_path_check):
* src/process.c (allocate_pty):
* src/xrdb.c (file_p):
Use effective UID when checking permissions, not real UID.
* src/callproc.c (init_callproc):
* src/charset.c (init_charset):
* src/lread.c (load_path_check, init_lread):
Test whether directories are accessible, not merely whether they exist.
* src/conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): New macro.
* src/fileio.c (check_existing, check_executable, check_writable)
(Ffile_readable_p):
Use symbolic names instead of integers for the flags, as they're
portable now.
(check_writable): New arg AMODE.  All uses changed.
Set errno on failure.
(Ffile_readable_p): Use faccessat, not stat + open + close.
(Ffile_writable_p): No need to call check_existing + check_writable.
Just call check_writable and then look at errno.  This saves a syscall.
dir should never be nil; replace an unnecessary runtime check
with an eassert.  When checking the parent directory of a nonexistent
file, check that the directory is searchable as well as writable, as
we can't create files in unsearchable directories.
(file_directory_p): New function, which uses 'stat' on most platforms
but faccessat with D_OK (for efficiency) if WINDOWSNT.
(Ffile_directory_p, Fset_file_times): Use it.
(file_accessible_directory_p): New function, which uses a single
syscall for efficiency.
(Ffile_accessible_directory_p): Use it.
* src/xrdb.c (file_p): Use file_directory_p.
* src/lisp.h (file_directory_p, file_accessible_directory_p): New decls.
* src/lread.c (openp): When opening a file, use fstat rather than
stat, as that avoids a permissions race.  When not opening a file,
use file_directory_p rather than stat.
(dir_warning): First arg is now a usage string, not a format.
Use errno.  All uses changed.
* src/nsterm.m (ns_term_init): Remove unnecessary call to file-readable
that merely introduced a race.
* src/process.c, src/sysdep.c, src/term.c: All uses of '#ifdef O_NONBLOCK'
changed to '#if O_NONBLOCK', to accommodate gnulib O_* style,
and similarly for the other O_* flags.
* src/w32.c (sys_faccessat): Rename from sys_access and switch to
faccessat's API.  All uses changed.
* src/xrdb.c: Do not include <sys/stat.h>; no longer needed.
(magic_db): Rename from magic_file_p.
(magic_db, search_magic_path): Return an XrmDatabase rather than a
char *, so that we don't have to test for file existence
separately from opening the file for reading.  This removes a race
fixes a permission-checking problem, and simplifies the code.
All uses changed.
(file_p): Remove; no longer needed.

Fixes: debbugs:12632
2012-11-13 20:55:41 -08:00
Paul Eggert
7ccfb720b4 Fix data-loss with --batch.
* admin/merge-gnulib (GNULIB_MODULES): Add close-stream.
* lib/close-stream.c, lib/close-stream.h, lib/fpending.c
* lib/fpending.h, m4/close-stream.m4, m4/fpending.m4:
New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* src/emacs.c: Include <close-stream.h>.
(close_output_streams): New function.
(main): Pass it to atexit, so that Emacs closes stdout and stderr
and handles errors appropriately.
(Fkill_emacs): Don't worry about flushing, as close_output_stream
does that now.

Fixes: debbugs:9574
2012-11-03 11:54:17 -07:00
Paul Eggert
bb1dfdadd5 Merge from gnulib. 2012-10-04 00:15:42 -07:00
Paul Eggert
65788e2e93 Merge from gnulib. 2012-09-29 21:19:32 -07:00
Paul Eggert
a615a3aeef Check more robustly for timer_settime.
This should fix an OS X build problem reported by Ivan Andrus in
<http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00671.html>.
* admin/merge-gnulib (GNULIB_MODULES): Add timer-time.
* configure.ac (gl_THREADLIB): Define to empty, since Emacs
does threads its own way.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* m4/timer_time.m4: New file, from gnulib.
* src/atimer.c (alarm_timer, alarm_timer_ok, set_alarm, init_atimer):
Use HAVE_TIMER_SETTIME, not SIGEV_SIGNAL, to decide whether to
call timer_settime.
2012-09-26 18:06:23 -07:00
Paul Eggert
e41c05e55d Merge from gnulib. 2012-09-22 02:46:20 -07:00
Paul Eggert
7f50777729 Merge from gnulib.
This incorporates:
2012-08-29 stdbool: be more compatible with mixed C/C++ compiles
2011-11-30 manywarnings: update the list of "all" warnings
2012-09-03 02:26:56 -07:00
Paul Eggert
7d896ca9f3 * lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4: New files. 2012-08-24 21:27:32 -07:00
Paul Eggert
f4a681b077 On assertion failure, print backtrace if available.
Merge from gnulib, incorporating:
2012-08-24 execinfo: port to FreeBSD
2012-08-22 execinfo: new module
* admin/merge-gnulib (GNULIB_MODULES): Add execinfo.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4: New files.
* src/alloc.c [ENABLE_CHECKING]: Include <execinfo.h>.
(die) [ENABLE_CHECKING]: Print a backtrace if available.
* src/Makefile.in (LIB_EXECINFO): New macro.
(LIBES): Use it.
2012-08-24 21:04:08 -07:00
Paul Eggert
01b13eb7fa Merge from gnulib. 2012-08-21 07:37:56 -07:00
Paul Eggert
562d4436bc Merge from gnulib.
2012-08-19 ignore-value, stat-time, timespec: omit AC_C_INLINE
2012-08-19 mktime, sys_select: avoid 'static inline'
2012-08-19 gnulib-tool: Fix indentation.
2012-08-19 16:31:24 -07:00
Paul Eggert
51e6d6b2f5 * lib/sigprocmask.c, m4/signalblocking.m4: Remove.
These files have been unused since the 2012-06-22 patch that
introduced high-resolution time stamps.
2012-08-18 14:36:13 -07:00
Paul Eggert
76d0e68f8d Merge from gnulib.
This incorporates:
2012-08-05 extern-inline: also ignore -Wmissing-declarations
2012-08-13 20:15:52 -07:00
Paul Eggert
a0d4efe9c3 Merge from gnulib, for extern-inline.
2012-08-01 extern-inline: new module
2012-08-01 stat-time, timespec, u64, utimens: use extern-inline
* lib/stat-time.c, lib/utimespec.c, lib/u64.c, m4/extern-inline.m4:
New files.  The new .c files are for instantiating extern inline
functions.

Fixes: debbugs:12116
2012-08-01 21:46:10 -07:00
Paul Eggert
e32a579975 Use Gnulib stdalign and environ modules (Bug#9772, Bug#9960).
* .bzrignore: Add lib/stdalign.h.
* config.bat: Do not set NO_DECL_ALIGN; no longer needed.
Copy lib/stdalign.in.h to lib/stdalign.in-h as needed.
* configure.ac (HAVE_ATTRIBUTE_ALIGNED): Remove the code that
fiddles with this, as gnulib now does this for us.
* admin/merge-gnulib: Add environ, stdalign.
* m4/environ.m4: New file, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stdalign.in.h, m4/stdalign.m4: New files, from gnulib.
* sed2v2.inp (HAVE_ATTRIBUTE_ALIGNED): Remove edit.
* sedlibmk.inp (STDALIGN_H, @GL_GENERATE_STDALIGN_H_TRUE@)
(GL_GENERATE_STDALIGN_H_FALSE): New edits.
* nt/config.nt (HAVE_ATTRIBUTE_ALIGNED): Remove.
* src/alloc.c (XMALLOC_BASE_ALIGNMENT, GC_POINTER_ALIGNMENT, pure_alloc):
Simplify by using alignof.
(pure_alloc) [! USE_LSB_TAG]: Don't over-align EMACS_INT values.
* src/lisp.h: Include <stdalign.h>.
(GCALIGNMENT): New macro and constant.
(DECL_ALIGN): Remove.  All uses replaced by alignas (GCALIGNMENT).
(USE_LSB_TAG): ifdef on alignas, not on DECL_ALIGN.
(stdalign): New macro, if not already defined.
2012-07-28 16:05:32 -07:00
Paul Eggert
22ffb97351 Remove "#define unix" that is no longer needed (Bug#11905).
Merge from gnulib to make "#define unix" unnecessary, incorporating:
2012-07-10 getloadavg: clean out old Emacs and Autoconf cruft
2012-07-09 getopt: Simplify after Emacs changed.
* src/s/aix4-2.h (unix): Remove; no longer needed.
2012-07-10 17:01:21 -07:00
Paul Eggert
2f93ecceb9 Merge from gnulib. 2012-07-09 01:34:39 -07:00
Paul Eggert
fee5959dd8 Use c_strcasecmp for ASCII case-insensitive comparison.
Fixes: debbugs:11786
2012-07-06 14:07:46 -07:00
Paul Eggert
7dca65a4b4 Port to OpenBSD 5.1 amd64. 2012-07-06 03:08:57 +00:00
Paul Eggert
059e4fb5ed Merge from gnulib.
* m4/getopt.m4: Copy new version from gnulib, incorporating:
getopt-posix: No longer guarantee that option processing is resettable.
2012-06-27 17:07:33 -07:00
Paul Eggert
a35e580cbc Merge from gnulib (comment-only change). 2012-06-25 07:49:15 -07:00
Paul Eggert
47d0c0118b Merge from gnulib.
* m4/getopt.m4: Copy new version from gnulib, incorporating:
getopt-gnu: Handle suboptimal getopt_long's abbreviation handling.
2012-06-23 10:25:56 -07:00
Paul Eggert
c8fff86301 Add gnulib files to support higher-resolution time stamps.
Fixes: debbugs:9000
2012-06-22 14:26:37 -07:00
Paul Eggert
d35af63cd6 Support higher-resolution time stamps.
Fixes: debbugs:9000
2012-06-22 14:17:42 -07:00
Paul Eggert
057306483c Merge from gnulib.
* lib/filemode.h, lib/signal.in.h, lib/stat.c, lib/stdint.in.h:
* lib/stdlib.in.h, lib/unistd.in.h, m4/extensions.m4, m4/getloadavg.m4:
* m4/getopt.m4, m4/gnulib-common.m4, m4/largefile.m4, m4/mktime.m4:
* m4/multiarch.m4, m4/nocrash.m4, m4/stdio_h.m4, m4/time_r.m4:
Copy new versions from gnulib, incorporating the following changes:
2012-06-22 time_r: fix typo that always overrode localtime_r decl
2012-06-22 Write "Mac OS X" instead of "MacOS X".
2012-06-21 mktime: fix integer overflow in 'configure'-time test
2012-06-21 nonblocking: Avoid compilation error on mingw64.
2012-06-19 stat, fstat: Avoid warnings on mingw64.
2012-06-19 getopt-gnu: Fix exit code overflow in autoconf test.
2012-06-22 10:20:00 -07:00
Paul Eggert
0e7a053e6d Make 'configure' a bit smaller and faster.
* configure.in (INSTALL_INFO): Set it with one call to
AC_PATH_PROG, not three.
(PKG_CONFIG): Hoist this out of PKG_CHECK_MODULES, since it's
so likely that it'll be needed.
(AC_CHECK_HEADERS_ONCE): Prefer to AC_CHECK_HEADERS where either works.
(AC_PROG_MAKE_SET): Remove; Automake does this.
(sysinfo): Do not check for this function, as it's never used.
(tzset): Check for this function just once.
* admin/CPP-DEFINES: Remove HAVE_SYSINFO.
* m4/manywarnings.m4: Sync from gnulib, incorporating the following:
2012-05-27 manywarnings: remove duplicate -Wmultichar entry
2012-05-27 17:46:33 -07:00
Paul Eggert
caf8a9b2b3 Merge from gnulib.
Fixes: debbugs:11527
2012-05-26 16:14:36 -07:00
Paul Eggert
fb77d37e48 Use full name for m4/gnulib-comp.m4. (Bug#11529)
Previously the file was named m4/gl-comp.m4 due to DOS 8+3 restrictions,
even though the file's name in gnulib is m4/gnulib-comp.m4.
This had a problem when merging from gnulib, as the code temporarily
renamed it to the full name, causing problems when interrupted.
Now the file has its full name, with the idea that we will find
a solution for MS-DOS that does not affect the rest of Emacs.
* m4/gnulib-comp.m4: Rename from m4/gl-comp.m4.
* admin/merge-gnulib: Leave m4/gnulib-comp.m4's name alone.
2012-05-21 12:04:11 -07:00
Paul Eggert
9ee7d8b93c Sync from gnulib version 4f11d6bebc3098c64ffde27079ab0d0cecfd0cdc
dated 2011-10-07.  Regenerating from current gnulib would be a
pervasive change, and currently the trunk isn't open to such changes.
* configure.in (WARN_CFLAGS): Remove; no longer needed now
that gnulib does it.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
2012-04-21 10:15:03 -07:00
Andreas Schwab
5e6ab4e675 Fixes: debbugs:11285
* m4/gl-comp.m4: Update.
2012-04-21 10:03:41 +02:00
Paul Eggert
b8df54ffbe configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy
of Emacs, and have used it to find several bugs.  It's mature
enough to publish now.
* Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
* configure.in: Support --enable-gcc-warnings, in the style of
other GNU packages such as coreutils.
(C_WARNINGS_SWITCH): Remove, replacing with...
(WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
(PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
when including system files with GCC.
* etc/NEWS: Mention --enable-gcc-warnings.
* lib/Makefile.am (AM_CFLAGS): New macro.
* m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
* lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(BASE_CFLAGS): Use new macros rather than old.
* lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/Makefile.in (C_WARNINGS_SWITCH): Remove.
(WARN_CFLAGS, WERROR_CFLAGS): New macros.
(ALL_CFLAGS): Use new macros rather than old.
* src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
* src/regex.c: Ignore -Wstrict-overflow.  If !emacs, also ignore
-Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
-Wunused-result, -Wunused-variable.  This should go away once
the Emacs and Gnulib regex code is merged.
(xmalloc, xrealloc): Now static.
2012-04-09 00:45:59 -07:00
Paul Eggert
6df372680c Port to older Solaris 10 versions (Bug#10677).
Bug reported by Chong Yidong for SunOS 5.10 Generic_127111-11 sparc.
I cannot reproduce it on SunOS 5.10 Generic_141444-09 sparc but
possibly this is because Sun fixed the 'stat' bug in my version.
* Makefile.in (GNULIB_TOOL_FLAGS): Do not avoid the pathmax module.
* lib/pathmax.h, m4/pathmax.m4: New files, from gnulib.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
These changes are based on gnulib version
4f11d6bebc3098c64ffde27079ab0d0cecfd0cdc dated 2011-10-07 20:59:10,
because Emacs is in feature freeze and we do not want to merge any
more-recent changes from gnulib.
2012-01-31 22:04:34 -08:00
Paul Eggert
d47439a333 Merge from gnulib, fixing some 'configure' typos (Bug#9696).
* lib/signal.in.h, lib/sigprocmask.c, m4/gl-comp.m4:
* m4/gnulib-common.m4: Merge from gnulib.
Without this, 'configure' would say "func_gl_gnulib_m4code_pathmax:
command not found" on powerpc-apple-darwin9.8.0.
2011-10-07 14:15:00 -07:00
Paul Eggert
316f8af009 Merge from gnulib, improving some licensing wording.
This clarifies and fixes some licensing issues raised by Glenn Morris
<http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00397.html>.
It also merges the latest version of texinfo.tex and has some
MSVC-related changes that don't affect Emacs.
* Makefile.in (GNULIB_TOOL_FLAGS): Avoid msvc-inval, msvc-nothrow,
pathmax, and raise, since these are needed only to address
MSVC-related issues that Emacs doesn't have.
* doc/misc/texinfo.tex, lib/dup2.c, lib/gnulib.mk, lib/signal.in.h:
* lib/sigprocmask.c, lib/stat.c, lib/stdio.in.h, lib/sys_stat.in.h:
* lib/unistd.in.h, m4/dup2.m4, m4/getloadavg.m4, m4/gl-comp.m4:
* m4/include_next.m4, m4/signal_h.m4, m4/signalblocking.m4:
* m4/stdint.m4, m4/stdio_h.m4, m4/sys_stat_h.m4, m4/time_h.m4:
* m4/unistd_h.m4: Merge from gnulib.
2011-09-26 14:30:18 -07:00
Paul Eggert
3f44249e19 Merge from gnulib, porting to Tru64.
* lib/lstat.c, lib/stat.c, m4/include_next.m4, m4/nocrash.m4:
* m4/signal_h.m4, m4/time_h.m4, m4/unistd_h.m4:
Merge from gnulib.  This fixes a compilation error on Tru64 UNIX
aka OSF/1 5.1 DTK cc.  There is also some mingw stuff here that
doesn't affect Emacs.
2011-09-11 09:52:58 -07:00
Paul Eggert
7f59d9c856 Merge from gnulib. 2011-09-03 16:08:32 -07:00
Paul Eggert
5402029425 Merge from gnulib. 2011-07-28 09:35:19 -07:00
Paul Eggert
24e0f6b1dc Merge from gnulib, using build-aux to remove clutter.
* m4/largefile.m4: New file, so that Emacs does not mess up when
accessing files with large inode numbers in MacOS X 10.5 and later.
* m4/nocrash.m4: New file, to avoid triggering background debugger
and/or create core dumps during 'configure'.
* build-aux/move-if-change: Renamed from move-if-change.
* build-aux/snippet/arg-nonnull.h: Renamed from arg-nonnull.h.
* build-aux/snippet/c++defs.h: Renamed from c++defs.h.
* build-aux/snippet/warn-on-use.h: Renamed from warn-on-use.h.
* build-aux/snippet/_Noreturn.h: New file, for draft C1X _Noreturn.
* .bzrignore: The autogenerated files compile, config.guess,
config.sub, depcomp, install-sh, and missing are now in build-aux.
* Makefile.in (epaths-force, sync-from-gnulib):
move-if-change is now in build-aux.
(GNULIB_TOOL_FLAGS): Avoid threadlib; this is now a prerequisite
of gnulib's pthread_sigmask module, but Emacs doesn't need it.
(mkdir): install-sh is now in build-aux.
* config.bat: c++defs.h is now in build-aux/snippets.
* configure.in: Specify AC_CONFIG_AUX_DIR with build-aux (the
usual parameter).
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
* lib/makefile.w32-in (ARG_NONNULL_H): arg-nonnull.h moved
to build-aux/snippet.
* lib/pthread_sigmask.c, lib/stdlib.in.h, m4/extensions.m4:
* m4/getopt.m4, m4/gnulib-common.m4, m4/pthread_sigmask.m4:
Merge from gnuilib.  This fixes porting bugs on Cygwin, Irix, and
Solaris, enables MacOS extensions, and enables nocrash during
'configure'.
* make-dist: Adjust to new build-aux and build-aux/snippit dirs.
* admin/notes/copyright: The files compile, config.guess, config.sub,
depcomp, install-sh, missing, and move-if-change are now in the
new build-aux subdirectory.  The files arg-nonnull.h, c++defs.h,
and warn-on-use.h are now in build-aux/snippets.  New file
build-aux/snippets/_Noreturn.h.
* leim/Makefile.in (install): install-sh is now in build-aux.
* lib-src/Makefile.in ($(DESTDIR)${archlibdir}): install-sh moved
to build-aux.
* msdos/sedlibmk.inp (CONFIG_CLEAN_VPATH_FILES): Adjust to snippet moves
from top level to build-aux/snippet.
* src/Makefile.in (gl-stamp): move-if-change is now in build-aux.
2011-07-24 15:15:47 -07:00
Paul Eggert
d9706d9f11 * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Omit gl_THREADLIB
test, which runs afoul of Automake installations where, for example,
/usr/share/aclocal contains a copy of gl_THREADLIB.
Problem reported by Sven Joachim in
<http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00529.html>.
This is just a quick temporary fix, specific to Emacs; I'll work
with the other gnulib maintainers to get a more-permanent fix.
2011-07-09 01:56:25 -07:00
Paul Eggert
f6ce9b9aba Add strtoimax module, needed for Solaris 8 port.
* Makefile.in (GNULIB_MODULES): Add strtoimax.
* lib/strtoll.c, m4/strtoimax.m4, m4/strtoll.m4: New files,
automatically imported from gnulib.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
2011-07-08 17:18:49 -07:00
Paul Eggert
2a84b02da8 Simplify Emacs part of pthread_sigmask support.
* Makefile.in (GNULIB_TOOL_FLAGS): Do not avoid sigprocmask.
* configure.in (AC_TYPE_UID_T): New dummy macro.
Configure gnulib after adjusting LIBS,
so that gnulib can assume the libraries in LIBS.
* lib/pthread_sigmask.c, lib/sigprocmask.c, m4/signalblocking.m4:
New files, automatically imported from gnulib.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
* src/Makefile.in (LIB_PTHREAD_SIGMASK): New macro.
(LIBES): Use it.
2011-07-08 13:20:19 -07:00
Paul Eggert
6db30f8344 Add gnulib support for pthread_sigmask.
* Makefile.in (GNULIB_MODULES): Add pthread_sigmask.
(GNULIB_TOOL_FLAGS): Avoid sigprocmask.  Emacs does its own
implementation of 'sigprocmask' on Windows, and it assumes
'sigprocmask' on non-Windows hosts, so it doesn't need the
sigprocmask module.
* lib/signal.in.h, m4/pthread_sigmask.m4, m4/signal_h.m4:
New files, automatically imported from gnulib.
* lib/gnulib.mk, m4/gl-comp.m4: Automatically-imported update
due to the above changes.
* .bzrignore: Add lib/signal.h.
2011-07-06 10:58:37 -07:00
Paul Eggert
596a09585f * m4/alloca.m4: Merge whitespace changes from gnulib. 2011-07-06 09:19:38 -07:00
Paul Eggert
7a7ef42918 Use gnulib's dup2 module instead of rolling our own.
* Makefile.in (GNULIB_MODULES): Add dup2.
* configure.in: Do not check for dup2; gnulib does that now.
* lib/dup2.c, m4/dup2.m4: New files, from gnulib.
* src/sysdep.c (dup2) [!HAVE_DUP2]: Remove; gnulib now does this.
2011-06-25 01:40:38 -07:00
Paul Eggert
6dd7e40073 * lib/getopt.c, lib/stat.c, m4/gl-comp.m4: Merge from gnulib. 2011-06-23 01:10:57 -07:00
Paul Eggert
fa23e171f4 Use gnulib's alloca-opt module.
* .bzrignore: Add lib/alloca.h.
* Makefile.in (GNULIB_MODULES): Add alloca-opt.
* configure.in (AC_FUNC_ALLOCA): Remove almost all the alloca stuff,
as gnulib now does that for us.  Put alloca check after gl_INIT.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
* lib/alloca.in.h, m4/alloca.m4: New files, from gnulib.
2011-06-21 09:15:07 -07:00
Leo Liu
3ce9d0d41b Add crypto/sha256 and crypto/sha512 modules from gnulib 2011-06-21 16:45:39 +08:00
Paul Eggert
add3f04996 * lib/unistd.in.h, m4/getloadavg.m4: Merge from gnulib. 2011-06-19 11:22:16 -07:00
Paul Eggert
bf4846e712 * m4/lstat.m4: Merge from gnulib (Bug#8878). 2011-06-16 16:10:17 -07:00
Paul Eggert
8aeb5be96a Merge from gnulib: lib/gnulib.mk, m4/*.m4. 2011-06-15 15:27:54 -07:00
Paul Eggert
7e2aa385ad * lib/gnulib.mk, m4/gnulib-common.m4: Merge from gnulib. 2011-06-08 09:26:45 -07:00
Paul Eggert
9afafefb1b Merge from gnulib.
* lib/careadlinkat.c, lib/careadlinkat.h, m4/gnulib-common.m4: Merge.
2011-06-06 12:53:44 -07:00
Paul Eggert
6a3e57bb54 Adjust to recent gnulib change for @GUARD_PREFIX@. 2011-05-29 14:52:18 -07:00
Leo Liu
13c3daa4ae Add crypto/sha1 module from gnulib 2011-05-24 16:12:52 +08:00
Paul Eggert
f518ae90a6 Merge from gnulib. 2011-05-22 14:02:48 -07:00
Paul Eggert
3870d303a4 Merge from gnulib. 2011-05-17 17:35:01 -07:00
Paul Eggert
c378da0b47 Use C99's va_copy to avoid undefined behavior on x86-64 GNU/Linux. 2011-05-04 00:19:21 -07:00
Paul Eggert
19548d0861 * Makefile.in (GNULIB_TOOL_FLAG): Add --conditional-dependencies.
This new gnulib-tool option saves 'configure' the trouble of
checking for strtoull when strtoumax exists.
2011-05-03 23:11:49 -07:00
Paul Eggert
b6f5355a9e Update from gnulib. 2011-04-26 12:29:47 -07:00
Paul Eggert
c38918db05 Merge from gnulib. 2011-04-22 16:53:21 -07:00
Paul Eggert
03eb7af576 Merge from gnulib. 2011-04-22 02:31:24 -07:00
Paul Eggert
aaa9355917 Simpler version of strtoumax module. 2011-04-22 00:33:37 -07:00
Paul Eggert
a8a2bb29e2 * Makefile.in (GNULIB_MODULES): Add strtoumax. 2011-04-21 12:12:13 -07:00
Paul Eggert
cc2e7b46b8 Merge from gnulib. 2011-04-17 21:03:18 -07:00
Paul Eggert
7ec98caf77 Update from gnulib. 2011-04-08 14:53:30 -07:00
Paul Eggert
54fc1789b3 * lib/gnulib.mk, m4/stdbool.m4, m4/stddef_h.m4, m4/stdint.m4: Merge from gnulib. 2011-04-06 00:04:53 -07:00
Paul Eggert
d1fdcab742 Replace two copies of readlink code with single gnulib version. 2011-03-31 23:28:48 -07:00
Paul Eggert
63139bfa89 lib/stdio.in.h, m4/gnulib-common.m4: Regenerate from latest gnulib. 2011-03-31 23:07:33 -07:00
Paul Eggert
6e5fa6bfce Merge from trunk and from gnulib stdio. 2011-03-20 22:34:48 -07:00
Paul Eggert
77185bdf91 Autogenerate. 2011-03-20 22:06:47 -07:00
Paul Eggert
d5cad867ec [ChangeLog]
fakemail: Remove dependency on ignore-value.
* Makefile.in (GNULIB_MODULES): Add stdio.
* lib/stdio.in.h, m4/stdio_h.m4: New files, automatically
imported from gnulib.
[lib-src/ChangeLog]
fakemail: Remove dependency on ignore-value.
This undoes some of the recent fakemail-related changes.
It is made possible due to recent changes to gnulib's stdio module.
* Makefile.in (fakemail${EXEEXT}): Do not depend on ignore-value.h.
* fakemail.c: Do not include ignore-value.h.
(put_line): Do not use ignore_value.
2011-03-20 22:04:41 -07:00
Paul Eggert
6a90a4f198 Merge from gnulib, for socklen_t. 2011-03-20 09:28:22 -07:00
Paul Eggert
401bf9b470 process.c: Use socklen_t, not int, for socket lengths. 2011-03-17 20:30:24 -07:00
Paul Eggert
36f13e1667 Simplify symlink portability workaround. 2011-02-25 12:05:36 -08:00
Paul Eggert
ae0d725005 [ChangeLog]
Work around some portability problems with symlinks.
* Makefile.in (GNULIB_MODULES): Add lstat, readlink, symlink.
* configure.in (lstat, HAVE_LSTAT): Remove special hack.
* lib/lstat.c, lib/readlink.c, lib/stat.c, lib/symlink.c:
* m4/dos.m4, m4/lstat.m4, m4/readlink.m4, m4/stat.m4, m4/symlink.m4:
New files, automatically generated from gnulib.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk:
* lib/stdlib.in.h, m4/gl-comp.m4, m4/stdlib_h.m4: Regenerate.

2011-02-22  Paul Eggert  <eggert@cs.ucla.edu>
[src/ChangeLog]
Work around some portability problems with symlinks.
* fileio.c (Frename_file, Fmake_symbolic_link, Ffile_symlink_p):
Simplify the code by assuming that the readlink and symlink calls
exist, even if they always fail on this host.
(Ffile_readable_p): Likewise, for fifos.
* config.in: Regenerate.
2011-02-22 11:30:07 -08:00
Paul Eggert
5fa4ac767c Import filemode module from gnulib.
* .bzrignore: Add lib/sys/.
* Makefile.in (GNULIB_MODULES): Add filemode.
* lib/Makefile.am (MOSTLYCLEANDIRS): New macro.
* lib/filemode.c: Renamed from src/filemode.c and regenerated
from gnulib.  This adds support for some more file types, e.g.,
Cray DMF migrated files.
* lisp/emacs-lisp/find-gc.el (find-gc-source-files): Remove filemode.c.
* lib/filemode.h, lib/sys_stat.in.h, m4/filemode.m4, m4/st_dm_mode.m4:
* m4/sys_stat_h.m4: New files, generated from gnulib.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
Regenerate.

2011-02-20  Paul Eggert  <eggert@cs.ucla.edu>
2011-02-20 02:51:50 -08:00
Paul Eggert
5f90be1bb7 Import simpler crypto/md5 module from gnulib, plus stdint module.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
* src/config.in: Regenerate.
* lib/md5.c, lib/md5.h: Regenerate with simpler version, which
assumes C99-style <stdint.h>, supplied by the stdint module.
* lib/stdint.in.h, m4/longlong.m4, m4/stdint.m4: New files,
generated from gnulib.
* src/deps.mk (fns.o): Do not depend on md5.h, fixing a typo in
the earlier patch.
2011-02-18 23:28:29 -08:00
Paul Eggert
942f733fd1 Import crypto/md5 module from gnulib.
* Makefile.in (MAKEFILE_MODULES): Add crypto/md5.
* admin/notes/copyright: Remove src/md5.c and src/md5.h as
special cases.
* src/Makefile.in (base_obj): Remove md5.o, since this file
is in lib now.
* src/deps.mk (md5.o): Remove.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
Regenerate.
* lib/md5.c: Regenerate.  This renames the file from src/md5.c,
and adds some porting improvements from gnulib.
* lib/md5.h: Regenerate, likwise; rename from src/md5.h.
* m4/md5.m4: New file, from gnulib.

2011-02-18  Paul Eggert  <eggert@cs.ucla.edu>
2011-02-18 00:07:03 -08:00
Paul Eggert
7d315eb678 Import IRIX 6.5 getloadavg fixes from gnulib.
* configure, lib/getloadavg.c, m4/getloadavg.m4: Regenerate.
2011-02-17 23:41:43 -08:00
Paul Eggert
1f5d53eb53 Import getloadavg module from gnulib. 2011-02-15 16:33:44 -08:00
Paul Eggert
d67985d3f9 sync from gnulib to remove HAVE_STDBOOL_H 2011-02-04 21:07:22 -08:00
Paul Eggert
67342916c9 allow C code to suppress warnings about ignored return values 2011-02-03 11:29:35 -08:00
Paul Eggert
16c3e636a6 strftime: import from gnulib 2011-01-30 15:34:18 -08:00
Paul Eggert
3de84ad9c4 gnulib: import mktime and move-if-change fixes from gnulib
* configure: Regenerate from the following.

2011-01-30  Paul Eggert  <eggert@cs.ucla.edu>

mktime: clarify long_int width checking
* lib/mktime.c (long_int_is_wide_enough): Move this assertion to
the top level, to make it clearer that the assumption about
long_int width is being checked.  See
<http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00554.html>.

2011-01-29  Paul Eggert  <eggert@cs.ucla.edu>

TYPE_MAXIMUM: avoid theoretically undefined behavior
* lib/intprops.h (TYPE_MINIMUM, TYPE_MAXIMUM): Do not shift a
negative number, which the C Standard says has undefined behavior.
In practice this is not a problem, but might as well do it by the book.
Reported by Rich Felker and Eric Blake; see
<http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00493.html>.
* m4/mktime.m4 (AC_FUNC_MKTIME): Likewise.
* lib/mktime.c (TYPE_MAXIMUM): Redo slightly to match the others.

mktime: #undef mktime before #defining it
* lib/mktime.c (mktime) [DEBUG]: #undef mktime before #defining it.

mktime: systematically normalize tm_isdst comparisons
* lib/mktime.c (isdst_differ): New function.
(__mktime_internal): Use it systematically for all isdst comparisons.
This completes the fix for libc BZ #6723, and removes the need for
normalizing tm_isdst.  See
<http://sourceware.org/bugzilla/show_bug.cgi?id=6723>
(not_equal_tm) [DEBUG]: Use isdst_differ here, too.

mktime: fix some integer overflow issues and sidestep the rest

This was prompted by a bug report by Benjamin Lindner for MinGW
<http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00472.html>.
His bug is due to signed integer overflow (0 - INT_MIN), and I
I scanned through mktime.c looking for other integer overflow
problems, fixing all the bugs I found.

Although the C Standard says the resulting code is still not safe
in the presence of integer overflow, in practice it should be good
enough for all real-world two's-complement implementations, except
for debugging environments that deliberately trap on integer
overflow (e.g., gcc -ftrapv).

* lib/mktime.c (WRAPV): New macro.
(SHR): Also check that long_int and time_t shift right in the
usual way, before using the fast-but-unportable method.
(TYPE_ONES_COMPLEMENT, TYPE_SIGNED_MAGNITUDE): Remove, no longer
used.  The code already assumed two's complement, so there's
no need to test for alternatives.  All uses removed.
(TYPE_MAXIMUM): Don't rely here on overflow behavior not defined by
the C standard.  Problem reported by Rich Felker in
<http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00488.html>.
(twos_complement_arithmetic): Also check long_int and time_t.
(time_t_avg, time_t_add_ok, time_t_int_add_ok): New functions.
(guess_time_tm, ranged_convert, __mktime_internal): Use them.
(__mktime_internal): Avoid integer overflow with unary subtraction
in two instances where -1 - X is an adequate replacement for -X,
since the calculations are approximate.

2011-01-29  Eric Blake  <eblake@redhat.com>

mktime: avoid infinite loop
* m4/mktime.m4 (AC_FUNC_MKTIME): Avoid overflow on possibly-signed
type; behavior is still undefined but portable to all known targets.
Reported by Rich Felker.

2011-01-28  Paul Eggert  <eggert@cs.ucla.edu>

mktime: avoid problems on NetBSD 5 / i386
* lib/mktime.c (long_int): New type.  This works around a problem
on NetBSD 5 / i386, where 'long int' and 'int' are both 32 bits
but time_t is 64 bits, and where I expect the existing code is
wrong in some cases.
(leapyear, ydhms_diff, guess_time_tm, __mktime_internal): Use it.
(ydhms_diff): Bring back the compile-time check for wide-enough
year and yday.

mktime: fix misspelling in comment
* lib/mktime.c (__mktime_internal): Fix misspelling in comment.
This merges all recent glibc changes of importance.

2011-01-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

move-if-change: cope with concurrent mv of identical file.
* move-if-change (CMPPROG): Accept environment
variable as an override for `cmp'.
(usage): Document CMPPROG.
Adjust comparison to drop stdout.  Cope with failure of mv if
the target file exists and is identical to the source, for
parallel builds.
Report from H.J. Lu against binutils in PR binutils/12283.
2011-01-30 11:22:02 -08:00
Paul Eggert
125c3718c2 fix two m4/gnulib-*.m4 file names that clashed under MS-DOS 2011-01-26 23:24:57 -08:00
Paul Eggert
d6974efa70 Remove HAVE_RAW_DECL_CHOWN etc. from config.h 2011-01-23 20:53:39 -08:00
Paul Eggert
b06b1098fc src/config.in: shrink slightly
* configure.in: Invoke the new gnulib macro gl_ASSERT_NO_GNULIB_TESTS.
This makes src/config.in a bit smaller, by removing identifiers
like GNULIB_TEST_MKTIME that Emacs does not need.
* m4/getopt.m4, m4/gnulib-common.m4, m4/include_next.m4:
* m4/multiarch.m4, m4/stddef_h.m4, m4/time_h.m4, m4/unistd_h.m4:
Sync from gnulib.  This removes a few more unnecessary symbols from
src/config.in, such as AA_APPLE_UNIVERSAL_BUILD and HAVE_STDDEF_H.
* configure, src/config.in: Regenerate.
2011-01-21 16:12:10 -08:00
Paul Eggert
f737437b23 Regenerate. 2011-01-11 22:13:06 -08:00
Paul Eggert
e275c824b0 Regenerate. 2011-01-08 23:33:50 -08:00
Paul Eggert
1fd182f018 Regenerate. 2011-01-08 22:57:07 -08:00
Paul Eggert
a451f14b09 Regenerate. 2011-01-08 17:20:28 -08:00
Paul Eggert
743c80a725 Regenerate.
* aclocal.m4, compile, depcomp, lib/Makefile.in, lib/dummy.c:
* lib/gnulib.mk, m4/00gnulib.m4, m4/gnulib-cache.m4:
* m4/gnulib-common.m4, m4/gnulib-comp.m4, m4/gnulib-tool.m4, missing:
New files, generated automatically, with 'make sync-from-gnulib'
followed by 'make'.
* configure, lisp/dired.el, src/config.in: Regenerate.
2011-01-08 13:19:44 -08:00
Glenn Morris
62eda0e2b1 Update copyright for years from Emacs 21 to present (mainly adding
2001).
2007-01-16 02:38:27 +00:00
Thien-Thi Nguyen
8d99e09d78 Update years in copyright notice; nfc. 2006-02-05 22:41:31 +00:00
Miles Bader
d7b7f3c485 Add arch tagline 2005-07-27 01:31:21 +00:00
Paul Eggert
9eff9fe3e8 Merge gnulib getopt implementation into Emacs.
* Makefile.in (AUTOCONF_INPUTS): New macro.
($(srcdir)/configure, $(srcdir)/src/stamp-h.in): Depend on it,
so that these files also depend on m4/getopt.m4.
* configure.in: Configure getopt by including m4/getopt.m4,
and configuring a getopt replacement if necessary.
* make-dist: Add m4 subdirectory.  Unlink lib-src/getopt.h.
* m4/getopt.m4: New file.

* lib-src/Makefile.in (mostlyclean): Remove getopt.h, getopt.h-t.
(GETOPT_H): New macro, from gnulib.
(getopt.h): New rule, from gnulib.
(GETOPTOBJS): Now autoconfigured.
(GETOPTDEPS): getopt.h is now autoconfigured.
(getopt.o, getopt1.o): Depend on $(GETOPT_H), not ${srcdir}/getopt.h.
(getopt.o): Depend on ${srcdir}/gettext.h.
(movemail.o): Depend on $(GETOPT_H).
* lib-src/getopt.c, lib-src/getopt1.c: Sync from gnulib.
* lib-src/getopt_.h, lib-src/getopt_int.h, lib-src/gettext.h:
New files, from gnulib.
* lib-src/getopt.h: Removed (now is getopt_.h).

* nt/inc/gettext.h: Remove; no longer needed now that
lib-src/gettext.h exists.

* src/s/cygwin.h (C_SWITCH_SYSTEM): Remove, since gettext.h is
now part of lib-src.
2005-07-26 21:43:13 +00:00