Paul Eggert [Sun, 11 Jun 2017 22:53:09 +0000 (15:53 -0700)]
getopt-posix: port to glibc 2.25.90
Problem reported by Daniel P. Berrange in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00003.html
* lib/getopt-pfx-core.h (_GETOPT_CORE_H):
* lib/getopt-pfx-ext.h (_GETOPT_EXT_H):
#undef if __GETOPT_PREFIX is defined.
Jim Meyering [Sat, 10 Jun 2017 17:11:47 +0000 (10:11 -0700)]
maint: update to work with GCC7's -Werror=implicit-fallthrough=
* lib/savewd.c (FALLTHROUGH): Define.
(savewd_save, savewd_restore): Use this, rather than a comment,
whenever one switch case falls through into the next.
Bruno Haible [Wed, 7 Jun 2017 13:23:38 +0000 (15:23 +0200)]
canonicalize-lgpl: Avoid conflict with gnulib 'getcwd' module on VMS.
Reported by John E. Malmberg <wb8tyw@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00029.html>.
* lib/canonicalize-lgpl.c (__getcwd): On VMS, when using gnulib's getcwd
override, pass 2 arguments to getcwd, not 3.
Paul Eggert [Sun, 4 Jun 2017 21:25:43 +0000 (14:25 -0700)]
same-inode: port better to VMS 8.2 and later
Problem reported by John E. Malmberg in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00005.html
* lib/same-inode.h (SAME_INODE) [__VMS && 80200000 <= __CRTL_VER]:
Use the usual POSIX definition.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Define _USE_STD_STAT.
Paul Eggert [Thu, 1 Jun 2017 21:08:00 +0000 (14:08 -0700)]
error: fix POSIX violation for va_end
Problem reported by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00001.html
* lib/error.c (error_tail): Do not call va_end here.
(error, error_at_line): Call it here instead.
Jim Meyering [Fri, 26 May 2017 04:25:37 +0000 (21:25 -0700)]
quotearg: fix compilation failure due to FALLTHROUGH misuse
* lib/quotearg.c (quotearg_buffer_restyled): Revert one FALLTHROUGH
macro back to /* fall through */ comment. The macro can apply only
to a following case statement. Reported by Assaf Gordon.
Paul Eggert [Thu, 25 May 2017 07:08:09 +0000 (00:08 -0700)]
intprops: port to recent icc
Port to icc (ICC) 17.0.4 20170411, which defines __GNUC__ to be 5
but does not support __builtin_add_overflow etc.
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW) [__ICC]:
Define to 0.
Bruno Haible [Sun, 21 May 2017 23:39:59 +0000 (01:39 +0200)]
gnulib-tool: Add options to create hard links.
* gnulib-tool (func_usage): Document options --hardlink,
--local-hardlink, --more-hardlinks.
(func_symlink): Renamed from func_ln.
(func_symlink_if_changed): Renamed from func_ln_if_changed.
(func_hardlink): New function.
(copymode, lcopymode): New variables.
(symbolic, lsymbolic): Remove variables.
(Options): Implement options --hardlink, --local-hardlink,
--more-hardlinks.
(func_should_link): Renamed from func_should_symlink. Set copyaction.
(func_add_file, func_update_file): Update invocation of
func_should_link. Invoke func_hardlink when appropriate.
(func_import): Update comments.
(func_create_testdir): Update invocation of func_should_link. Invoke
func_hardlink when appropriate.
Finally, invoke 'git update-index --refresh' to mitigate the effects of
the hard links on git.
Jim Meyering [Thu, 18 May 2017 15:36:27 +0000 (08:36 -0700)]
fallthrough: update for GCC 7/8
* lib/quotearg.c (FALLTHROUGH): New macro.
Use it whenever one switch case falls through into the next,
replacing "/* Fall through */" comments. This exposed one
instance of an unwarranted "fall through" comment: unwarranted
because it preceded a "goto" label not a case statement.
* lib/freopen-safer.c (freopen_safer): Likewise.
* lib/fts.c (leaf_optimization_applies): Likewise.
* lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise.
* tests/test-getopt_long.h (getopt_long_loop): Likewise.
* tests/test-tsearch.c (mangle_tree): Likewise. Also include
tests/macros.h for the definition.
* tests/test-argp.c (group1_parser): Likewise.
* tests/test-getopt.h (getopt_loop): Likewise.
Paul Eggert [Fri, 19 May 2017 22:35:24 +0000 (15:35 -0700)]
argp: fix pointer-subtraction bug
* lib/argp-help.c (hol_append): Don’t subtract pointers to
different arrays, as this can run afoul of -fcheck-pointer-bounds.
See the thread containing Bruno Haible’s report in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00171.html
Paul Eggert [Fri, 19 May 2017 15:52:38 +0000 (08:52 -0700)]
closeout: don’t close stderr when sanitizing
* NEWS: Document this.
* lib/closeout.c (__has_feature): New macro, if not already defined.
(SANITIZE_ADDRESS): New constant.
(close_stdout): Don’t close stderr if sanitizing addresses.
Paul Eggert [Tue, 16 May 2017 16:23:52 +0000 (09:23 -0700)]
manywarnings: update for GCC 7
* build-aux/gcc-warning.spec:
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Add GCC 7 warnings, notably -Wimplicit-fallthrough=5, which
requires a non-comment fallthrough attribute. This is a bit
cleaner than the comment versions.
* lib/strftime.c, lib/dfa.c, lib/fnmatch.c, lib/mbrtowc.c:
* lib/vasnprintf.c, tests/macros.h (FALLTHROUGH): New macro.
Use it whenever one switch case falls through into the next.
Bruno Haible [Sun, 14 May 2017 12:20:01 +0000 (14:20 +0200)]
windows-stat-inodes: New module.
* m4/windows-stat-inodes.m4: New file.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Set WINDOWS_STAT_INODES.
* modules/sys_types (Makefile.am): Substitute WINDOWS_STAT_INODES.
* lib/sys_types.in.h [WINDOWS_STAT_INODES]: Override dev_t and ino_t.
(_GL_WINDOWS_STAT_INODES): New macro.
* lib/stat-w32.c: Set _WIN32_WINNT. Include <string.h>, verify.h.
(GetFileInformationByHandleExFunc): New variable.
(initialize): Initialize it.
(_gl_fstat_by_handle) [_GL_WINDOWS_STAT_INODES]: Initialize st_dev and
st_ino appropriately.
* lib/stat.c (rpl_stat): Use the directory entry based approach only as
a fallback, because it does not provide st_dev and st_ino values.
* modules/fstat (Depends-on): Add 'verify'.
* modules/windows-stat-inodes: New file.
* doc/windows-stat-inodes.texi: New file.
* doc/gnulib.texi: Include it.
* doc/posix-headers/sys_stat.texi: Mention the new module.
Bruno Haible [Sun, 14 May 2017 15:37:31 +0000 (17:37 +0200)]
stat-time tests: Workaround for native Windows.
* tests/test-stat-time.c: Include <stdio.h>, <time.h>.
(filename_stamp1, filename_testfile, filename_stamp2, filename_stamp3):
New variables.
(initialize_filenames): New function.
(main): Invoke it.
(cleanup, prepare_test): Update.
Bruno Haible [Sat, 13 May 2017 01:03:07 +0000 (03:03 +0200)]
largefile: Improve and document.
* m4/largefile.m4 (gl_LARGEFILE): Set WINDOWS_64_BIT_ST_SIZE to 0 if
the mingw headers already define 'stat' appropriately.
* modules/largefile (Description): Clarify.
* doc/largefile.texi: New file.
* doc/gnulib.texi: Include it.
* doc/posix-headers/sys_types.texi: Update.
Bruno Haible [Sat, 13 May 2017 00:51:05 +0000 (02:51 +0200)]
windows-stat-timespec: New module.
* modules/windows-stat-timespec: New file.
* m4/windows-stat-timespec.m4: New file.
* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Set WINDOWS_STAT_TIMESPEC.
* modules/sys_stat (Makefile.am): Substitute WINDOWS_STAT_TIMESPEC.
* lib/sys_stat.in.h (struct stat) [WINDOWS_STAT_TIMESPEC]: Declare with
fields st_atim, st_mtim, st_ctim.
(st_atime, st_mtime, st_ctime): Define as macros.
(_GL_WINDOWS_STAT_TIMESPEC): New macro.
* lib/stat-w32.h (_gl_convert_FILETIME_to_timespec)
[_GL_WINDOWS_STAT_TIMESPEC]: New declaration.
* lib/stat-w32.c (_gl_convert_FILETIME_to_timespec)
[_GL_WINDOWS_STAT_TIMESPEC]: New function.
(_gl_convert_FILETIME_to_POSIX): Adjust coding style.
(_gl_fstat_by_handle): If _GL_WINDOWS_STAT_TIMESPEC, convert the
FILETIME to 'struct timespec', not 'time_t'.
* lib/stat.c (rpl_stat): If _GL_WINDOWS_STAT_TIMESPEC, convert the
FILETIME to 'struct timespec', not 'time_t'.
* lib/stat-time.h (STAT_TIMESPEC): Define also if
_GL_WINDOWS_STAT_TIMESPEC.
* doc/windows-stat-timespec.texi: New file.
* doc/gnulib.texi: Include it.
Bruno Haible [Sat, 13 May 2017 00:46:43 +0000 (02:46 +0200)]
windows-stat-override: New module.
* lib/sys_stat.in.h (stat) [GNULIB_OVERRIDES_STRUCT_STAT]: Provide own
definition. Define GNULIB_defined_struct_stat.
(fstat, fstatat, lstat, stat) [GNULIB_OVERRIDES_STRUCT_STAT]: Provoke
link error if this symbol is used and the corresponding module is not
in use.
(_stat64, _stat32i64, _stati64, _stat32, _stat64i32): Don't redefine if
GNULIB_OVERRIDES_STRUCT_STAT.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Initialize
GNULIB_OVERRIDES_STRUCT_STAT.
* modules/sys_stat (Makefile.am): Substitute
GNULIB_OVERRIDES_STRUCT_STAT.
* modules/windows-stat-override: New file.
Paul Eggert [Fri, 12 May 2017 00:59:25 +0000 (17:59 -0700)]
getopt-posix: port to mingw
* lib/getopt.c (flockfile, funlockfile): Define on mingw.
Problem reported by Daniel P. Berrage in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00086.html
Bruno Haible [Thu, 11 May 2017 19:38:28 +0000 (21:38 +0200)]
gettimeofday: Increase precision on mingw.
* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Require AC_CANONICAL_HOST.
Set REPLACE_GETTIMEOFDAY to 1 on mingw.
* lib/gettimeofday.c (gettimeofday): On native Windows, use the
GetSystemTimePreciseAsFileTime based implementation always.
* doc/posix-functions/gettimeofday.texi: Mention precision problem on
mingw.
Bruno Haible [Wed, 10 May 2017 18:30:45 +0000 (20:30 +0200)]
doc: New chapter "Native Windows Support".
* doc/gnulib.texi (Native Windows Support): New chapter.
* doc/windows-libtool.texi: Small wording changes.
* doc/windows-sockets.texi: Small wording and formatting changes.
Paul Eggert [Mon, 8 May 2017 17:37:48 +0000 (10:37 -0700)]
intprops: don’t depend on ‘verify’
Problem reported by Ævar Arnfjörð Bjarmason in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00054.html
* lib/intprops.h: Do not include verify.h, and move compile-time
checks from here ...
* tests/test-intprops.c (main): ... to here, if they’re not here
already. Check widths of other standard integer types.
* modules/intprops (Depends-on): Remove ‘verify’.
Bruno Haible [Sun, 7 May 2017 19:50:30 +0000 (21:50 +0200)]
utimens: On native Windows, support 100ns resolution also if fd < 0.
* lib/utime.in.h: Include <time.h>.
(_gl_utimens_windows): New declaration.
* lib/utime.c (_gl_utimens_windows): New function, based on utime.
(utime): Invoke it.
* lib/utimens.c (fdutimens): On native Windows, call _gl_utimens_windows
instead of utime.
* modules/utime (Depends-on): Add 'time'.
* lib/rijndael-api-fst.c (rijndaelBlockEncrypt): Declare 'block' as a
union.
(rijndaelPadEncrypt, rijndaelBlockDecrypt): Likewise.
(rijndaelPadDecrypt): Likewise. Use local variable 'iv' to cache the
value of cipher->IV.