diff options
Diffstat (limited to 'lib')
158 files changed, 630 insertions, 779 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in index 7dba31be711..f2d203564ac 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,6 +1,6 @@ ### @configure_input@ -# Copyright 2017-2018 Free Software Foundation, Inc. +# Copyright 2017-2019 Free Software Foundation, Inc. # This file is part of GNU Emacs. diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h index c44ad89b7c0..7594e4b0c0b 100644 --- a/lib/_Noreturn.h +++ b/lib/_Noreturn.h @@ -1,8 +1,15 @@ -#if !defined _Noreturn && __STDC_VERSION__ < 201112 -# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ - || 0x5110 <= __SUNPRO_C) +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER))) +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) + /* _Noreturn works as-is. */ +# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) -# elif 1200 <= _MSC_VER +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn diff --git a/lib/acl-errno-valid.c b/lib/acl-errno-valid.c index 96577eb5e6b..99ddf3bb0c3 100644 --- a/lib/acl-errno-valid.c +++ b/lib/acl-errno-valid.c @@ -1,6 +1,6 @@ /* Test whether ACLs are well supported on this system. - Copyright 2013-2018 Free Software Foundation, Inc. + Copyright 2013-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/acl-internal.c b/lib/acl-internal.c index 92e7b9bdf58..cc42183f443 100644 --- a/lib/acl-internal.c +++ b/lib/acl-internal.c @@ -1,6 +1,6 @@ /* Test whether a file has a nontrivial ACL. -*- coding: utf-8 -*- - Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/acl-internal.h b/lib/acl-internal.h index 2da7c5a0366..05833efaa89 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h @@ -1,6 +1,6 @@ /* Internal implementation of access control lists. -*- coding: utf-8 -*- - Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/acl.h b/lib/acl.h index d0c122c71c0..904606dfac7 100644 --- a/lib/acl.h +++ b/lib/acl.h @@ -1,6 +1,6 @@ /* acl.c - access control lists - Copyright (C) 2002, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2002, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/acl_entries.c b/lib/acl_entries.c index ce730d466e1..19ac3c3bd9f 100644 --- a/lib/acl_entries.c +++ b/lib/acl_entries.c @@ -1,6 +1,6 @@ /* Return the number of entries in an ACL. - Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/alloca.in.h b/lib/alloca.in.h index 5ad8af8b411..a581d58f834 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h @@ -1,6 +1,6 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2018 Free Software Foundation, + Copyright (C) 1995, 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -36,6 +36,12 @@ #ifndef alloca # ifdef __GNUC__ + /* Some version of mingw have an <alloca.h> that causes trouble when + included after 'alloca' gets defined as a macro. As a workaround, include + this <alloca.h> first and define 'alloca' as a macro afterwards. */ +# if (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@ +# include_next <alloca.h> +# endif # define alloca __builtin_alloca # elif defined _AIX # define alloca __alloca diff --git a/lib/allocator.h b/lib/allocator.h index ab312f514ee..5a632ba6ff3 100644 --- a/lib/allocator.h +++ b/lib/allocator.h @@ -1,6 +1,6 @@ /* Memory allocators such as malloc+free. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/arg-nonnull.h b/lib/arg-nonnull.h index 5f034083129..ad8c26c225e 100644 --- a/lib/arg-nonnull.h +++ b/lib/arg-nonnull.h @@ -1,5 +1,5 @@ /* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/lib/at-func.c b/lib/at-func.c index 55e4b8c0eb0..d2e63191afe 100644 --- a/lib/at-func.c +++ b/lib/at-func.c @@ -1,5 +1,5 @@ /* Define at-style functions like fstatat, unlinkat, fchownat, etc. - Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/binary-io.c b/lib/binary-io.c index f9cc4dd2ec6..01e0bf64765 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c @@ -1,5 +1,5 @@ /* Binary mode I/O. - Copyright 2017-2018 Free Software Foundation, Inc. + Copyright 2017-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/binary-io.h b/lib/binary-io.h index 1f21fc051f6..720b08c7551 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -1,5 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h index 547e384e325..273855dbdeb 100644 --- a/lib/byteswap.in.h +++ b/lib/byteswap.in.h @@ -1,5 +1,5 @@ /* byteswap.h - Byte swapping - Copyright (C) 2005, 2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2019 Free Software Foundation, Inc. Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005. This program is free software: you can redistribute it and/or modify diff --git a/lib/c++defs.h b/lib/c++defs.h index 72ff1ffa519..87d0716723e 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -1,5 +1,5 @@ /* C++ compatible function declaration macros. - Copyright (C) 2010-2018 Free Software Foundation, Inc. + Copyright (C) 2010-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/lib/c-ctype.h b/lib/c-ctype.h index d55d4f64e4f..4d521763843 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -5,7 +5,7 @@ <ctype.h> functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000-2003, 2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/c-strcase.h b/lib/c-strcase.h index 41f439e8de7..b67c9b5da0e 100644 --- a/lib/c-strcase.h +++ b/lib/c-strcase.h @@ -1,5 +1,5 @@ /* Case-insensitive string comparison functions in C locale. - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2018 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c index 2b1ac99bb60..ec50f1abe76 100644 --- a/lib/c-strcasecmp.c +++ b/lib/c-strcasecmp.c @@ -1,5 +1,5 @@ /* c-strcasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index 8151c1a8340..513c353f6c2 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c @@ -1,5 +1,5 @@ /* c-strncasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index b5ae905d2e5..e56d5030856 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -1,6 +1,6 @@ /* Read symbolic links into a buffer without size limitation, relative to fd. - Copyright (C) 2001, 2003-2004, 2007, 2009-2018 Free Software Foundation, + Copyright (C) 2001, 2003-2004, 2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 051d3edea2d..68b69aa8893 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -1,6 +1,6 @@ /* Read symbolic links into a buffer without size limitation, relative to fd. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/cdefs.h b/lib/cdefs.h index 2d620cccaff..96d26164199 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2018 Free Software Foundation, Inc. +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -139,7 +139,7 @@ Headers that should use flexible arrays only if they're "real" (e.g. only if they won't affect sizeof()) should test #if __glibc_c99_flexarr_available. */ -#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc # define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif __GNUC_PREREQ (2,97) @@ -340,7 +340,7 @@ semantics. clang++ identifies itself as gcc-4.2, but has support for GNU inlining - semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and + semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and __GNUC_GNU_INLINE__ macro definitions. */ #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ diff --git a/lib/cloexec.c b/lib/cloexec.c index 238ab188866..db425766a0e 100644 --- a/lib/cloexec.c +++ b/lib/cloexec.c @@ -1,6 +1,6 @@ /* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/cloexec.h b/lib/cloexec.h index 59028058e6d..06ad945d8e2 100644 --- a/lib/cloexec.h +++ b/lib/cloexec.h @@ -1,6 +1,6 @@ /* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/close-stream.c b/lib/close-stream.c index 3d5a52ebd85..5458c4f29f3 100644 --- a/lib/close-stream.c +++ b/lib/close-stream.c @@ -1,6 +1,6 @@ /* Close a stream, with nicer error checking than fclose's. - Copyright (C) 1998-2002, 2004, 2006-2018 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h index efb08517011..e5ac2e12606 100644 --- a/lib/count-leading-zeros.h +++ b/lib/count-leading-zeros.h @@ -1,5 +1,5 @@ /* count-leading-zeros.h -- counts the number of leading 0 bits in a word. - Copyright (C) 2012-2018 Free Software Foundation, Inc. + Copyright (C) 2012-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index ae1872b8d33..00569941885 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -1,5 +1,5 @@ /* count-one-bits.h -- counts the number of 1-bits in a word. - Copyright (C) 2007-2018 Free Software Foundation, Inc. + Copyright (C) 2007-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h index a4c78485c84..3f78696e30f 100644 --- a/lib/count-trailing-zeros.h +++ b/lib/count-trailing-zeros.h @@ -1,5 +1,5 @@ /* count-trailing-zeros.h -- counts the number of trailing 0 bits in a word. - Copyright 2013-2018 Free Software Foundation, Inc. + Copyright 2013-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/diffseq.h b/lib/diffseq.h index 9244729380d..c6aac3d8120 100644 --- a/lib/diffseq.h +++ b/lib/diffseq.h @@ -1,6 +1,6 @@ /* Analyze differences between two vectors. - Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2018 Free Software + Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/dirent.in.h b/lib/dirent.in.h index 2ab25af68f0..a3c8eb341e9 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -1,5 +1,5 @@ /* A GNU-like <dirent.h>. - Copyright (C) 2006-2018 Free Software Foundation, Inc. + Copyright (C) 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/dirfd.c b/lib/dirfd.c index 19c80468bcf..bc858fd09dd 100644 --- a/lib/dirfd.c +++ b/lib/dirfd.c @@ -1,6 +1,6 @@ /* dirfd.c -- return the file descriptor associated with an open DIR* - Copyright (C) 2001, 2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/dosname.h b/lib/dosname.h index fef3b6daa1f..c0ab6848a58 100644 --- a/lib/dosname.h +++ b/lib/dosname.h @@ -1,6 +1,6 @@ /* File names on MS-DOS/Windows systems. - Copyright (C) 2000-2001, 2004-2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c index dcbd28051cf..a8ff04a9859 100644 --- a/lib/dtotimespec.c +++ b/lib/dtotimespec.c @@ -1,6 +1,6 @@ /* Convert double to timespec. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/dup2.c b/lib/dup2.c index c7d176728d4..d3aafa458b5 100644 --- a/lib/dup2.c +++ b/lib/dup2.c @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/errno.in.h b/lib/errno.in.h index b95c4e9ce76..3bd27f1cc9f 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -1,6 +1,6 @@ /* A POSIX-like <errno.h>. - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/euidaccess.c b/lib/euidaccess.c index de5d82b52d5..fece4cfc5e0 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -1,6 +1,6 @@ /* euidaccess -- check if effective user id can access file - Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2018 Free + Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h index 83e1b285528..def124e2e9b 100644 --- a/lib/execinfo.in.h +++ b/lib/execinfo.in.h @@ -1,6 +1,6 @@ /* Information about executables. - Copyright (C) 2012-2018 Free Software Foundation, Inc. + Copyright (C) 2012-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c index 79b7fd66b66..79ef1860fb7 100644 --- a/lib/explicit_bzero.c +++ b/lib/explicit_bzero.c @@ -1,5 +1,5 @@ /* Erasure of sensitive data, generic implementation. - Copyright (C) 2016-2018 Free Software Foundation, Inc. + Copyright (C) 2016-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/faccessat.c b/lib/faccessat.c index 8aab7863cdd..6c63e61d83f 100644 --- a/lib/faccessat.c +++ b/lib/faccessat.c @@ -1,5 +1,5 @@ /* Check the access rights of a file relative to an open directory. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/fcntl.c b/lib/fcntl.c index 74e0f5d3910..51f62ef78a8 100644 --- a/lib/fcntl.c +++ b/lib/fcntl.c @@ -1,6 +1,6 @@ /* Provide file descriptor control. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -545,7 +545,7 @@ rpl_fcntl_DUPFD_CLOEXEC (int fd, int target) #ifdef __KLIBC__ static int -klibc_fcntl (int fd, int action, /* arg */...); +klibc_fcntl (int fd, int action, /* arg */...) { va_list arg_ptr; int arg; diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index a1e7d35c1b9..eb70dc61eca 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -1,6 +1,6 @@ /* Like <fcntl.h>, but with non-working flags defined to 0. - Copyright (C) 2006-2018 Free Software Foundation, Inc. + Copyright (C) 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/fdatasync.c b/lib/fdatasync.c deleted file mode 100644 index c474e3dd36c..00000000000 --- a/lib/fdatasync.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Emulate fdatasync on platforms that lack it. - - Copyright (C) 2011-2018 Free Software Foundation, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -#include <config.h> -#include <unistd.h> - -int -fdatasync (int fd) -{ - /* This does more work than strictly necessary, but is the best we - can do portably. */ - return fsync (fd); -} diff --git a/lib/fdopendir.c b/lib/fdopendir.c index 9adefd210b5..b65588ac97e 100644 --- a/lib/fdopendir.c +++ b/lib/fdopendir.c @@ -1,5 +1,5 @@ /* provide a replacement fdopendir function - Copyright (C) 2004-2018 Free Software Foundation, Inc. + Copyright (C) 2004-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/filemode.c b/lib/filemode.c index 574e9941646..71f2b8237a3 100644 --- a/lib/filemode.c +++ b/lib/filemode.c @@ -1,6 +1,6 @@ /* filemode.c -- make a string describing file modes - Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2018 Free + Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/filemode.h b/lib/filemode.h index f9d1d21990e..5ae9da0ebe3 100644 --- a/lib/filemode.h +++ b/lib/filemode.h @@ -1,6 +1,6 @@ /* Make a string describing file modes. - Copyright (C) 1998-1999, 2003, 2006, 2009-2018 Free Software Foundation, + Copyright (C) 1998-1999, 2003, 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/filevercmp.c b/lib/filevercmp.c index 9e9b4408cdc..aebe08817b2 100644 --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -1,7 +1,7 @@ /* Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk> Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au> - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/filevercmp.h b/lib/filevercmp.h index 5e594568c5b..23766f0ce7c 100644 --- a/lib/filevercmp.h +++ b/lib/filevercmp.h @@ -1,7 +1,7 @@ /* Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk> Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au> - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/flexmember.h b/lib/flexmember.h index 7e3f59837bb..0d65f6da60f 100644 --- a/lib/flexmember.h +++ b/lib/flexmember.h @@ -1,6 +1,6 @@ /* Sizes of structs with flexible array members. - Copyright 2016-2018 Free Software Foundation, Inc. + Copyright 2016-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/fpending.c b/lib/fpending.c index de370d4b10f..3c01285bb83 100644 --- a/lib/fpending.c +++ b/lib/fpending.c @@ -1,5 +1,5 @@ /* fpending.c -- return the number of pending output bytes on a stream - Copyright (C) 2000, 2004, 2006-2007, 2009-2018 Free Software Foundation, + Copyright (C) 2000, 2004, 2006-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/fpending.h b/lib/fpending.h index 2ff26bc6afc..097a3ef0717 100644 --- a/lib/fpending.h +++ b/lib/fpending.h @@ -1,6 +1,6 @@ /* Declare __fpending. - Copyright (C) 2000, 2003, 2005-2006, 2009-2018 Free Software Foundation, + Copyright (C) 2000, 2003, 2005-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/fstatat.c b/lib/fstatat.c index 63ceceb6d86..019d3c61638 100644 --- a/lib/fstatat.c +++ b/lib/fstatat.c @@ -1,6 +1,6 @@ /* Work around an fstatat bug on Solaris 9. - Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,10 +36,14 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) } #endif +#ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -#include "sys/stat.h" +# include "sys/stat.h" +#else +# include <sys/stat.h> +#endif #include "stat-time.h" diff --git a/lib/fsusage.c b/lib/fsusage.c index 6920f8530a1..7ddeb52fc0f 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -1,6 +1,6 @@ /* fsusage.c -- return space usage of mounted file systems - Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2018 Free Software + Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -46,9 +46,6 @@ # if HAVE_SYS_STATFS_H # include <sys/statfs.h> # endif -# if HAVE_DUSTAT_H /* AIX PS/2 */ -# include <sys/dustat.h> -# endif #endif /* Many space usage primitives use all 1 bits to denote a value that is @@ -151,21 +148,6 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) ? PROPAGATE_ALL_ONES (fsd.f_frsize) : PROPAGATE_ALL_ONES (fsd.f_bsize)); -#elif defined STAT_STATFS2_FS_DATA /* Ultrix */ - - struct fs_data fsd; - - if (statfs (file, &fsd) != 1) - return -1; - - fsp->fsu_blocksize = 1024; - fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot); - fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree); - fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.fd_req.bfreen); - fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.fd_req.bfreen) != 0; - fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot); - fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree); - #elif defined STAT_STATFS3_OSF1 /* OSF/1 */ struct statfs fsd; @@ -219,12 +201,7 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); -#elif defined STAT_STATFS4 /* SVR3, Dynix, old Irix, old AIX, \ - Dolphin */ - -# if !_AIX && !defined _SEQUENT_ && !defined DOLPHIN -# define f_bavail f_bfree -# endif +#elif defined STAT_STATFS4 /* SVR3, old Irix */ struct statfs fsd; @@ -234,7 +211,7 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) /* Empirically, the block counts on most SVR3 and SVR3-derived systems seem to always be in terms of 512-byte blocks, no matter what value f_bsize has. */ -# if _AIX || defined _CRAY +# if defined _CRAY fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize); # else fsp->fsu_blocksize = 512; @@ -258,30 +235,3 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) (void) disk; /* avoid argument-unused warning */ return 0; } - -#if defined _AIX && defined _I386 -/* AIX PS/2 does not supply statfs. */ - -int -statfs (char *file, struct statfs *fsb) -{ - struct stat stats; - struct dustat fsd; - - if (stat (file, &stats) != 0) - return -1; - if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd))) - return -1; - fsb->f_type = 0; - fsb->f_bsize = fsd.du_bsize; - fsb->f_blocks = fsd.du_fsize - fsd.du_isize; - fsb->f_bfree = fsd.du_tfree; - fsb->f_bavail = fsd.du_tfree; - fsb->f_files = (fsd.du_isize - 2) * fsd.du_inopb; - fsb->f_ffree = fsd.du_tinode; - fsb->f_fsid.val[0] = fsd.du_site; - fsb->f_fsid.val[1] = fsd.du_pckno; - return 0; -} - -#endif /* _AIX && _I386 */ diff --git a/lib/fsusage.h b/lib/fsusage.h index 65daa736765..1d550bc451a 100644 --- a/lib/fsusage.h +++ b/lib/fsusage.h @@ -1,6 +1,6 @@ /* fsusage.h -- declarations for file system space usage info - Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2018 Free Software + Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/fsync.c b/lib/fsync.c index ecacb0ba25e..bfb6d28a5cf 100644 --- a/lib/fsync.c +++ b/lib/fsync.c @@ -7,7 +7,7 @@ Written by Richard W.M. Jones <rjones.at.redhat.com> - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public diff --git a/lib/ftoastr.c b/lib/ftoastr.c index a6899b2c63c..55f1e02e80f 100644 --- a/lib/ftoastr.c +++ b/lib/ftoastr.c @@ -1,6 +1,6 @@ /* floating point to accurate string - Copyright (C) 2010-2018 Free Software Foundation, Inc. + Copyright (C) 2010-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,9 +40,7 @@ # define FLOAT_PREC_BOUND _GL_LDBL_PREC_BOUND # define FTOASTR ldtoastr # define PROMOTED_FLOAT long double -# if HAVE_C99_STRTOLD -# define STRTOF strtold -# endif +# define STRTOF strtold #elif LENGTH == 2 # define FLOAT double # define FLOAT_DIG DBL_DIG @@ -63,7 +61,7 @@ # endif #endif -/* On pre-C99 hosts, approximate strtof and strtold with strtod. This +/* On pre-C99 hosts, approximate strtof with strtod. This may generate one or two extra digits, but that's better than not working at all. */ #ifndef STRTOF diff --git a/lib/ftoastr.h b/lib/ftoastr.h index 2d783587bd1..752e3c40c54 100644 --- a/lib/ftoastr.h +++ b/lib/ftoastr.h @@ -1,6 +1,6 @@ /* floating point to accurate string - Copyright (C) 2010-2018 Free Software Foundation, Inc. + Copyright (C) 2010-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/get-permissions.c b/lib/get-permissions.c index 3b984510955..99b4664aae7 100644 --- a/lib/get-permissions.c +++ b/lib/get-permissions.c @@ -1,6 +1,6 @@ /* Get permissions of a file. -*- coding: utf-8 -*- - Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c index ac05bc483cc..03a92435f0b 100644 --- a/lib/getdtablesize.c +++ b/lib/getdtablesize.c @@ -1,5 +1,5 @@ /* getdtablesize() function: Return maximum possible file descriptor value + 1. - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify diff --git a/lib/getgroups.c b/lib/getgroups.c index ec137c158a9..d8c77e9a650 100644 --- a/lib/getgroups.c +++ b/lib/getgroups.c @@ -1,6 +1,6 @@ /* provide consistent interface to getgroups for systems that don't allow N==0 - Copyright (C) 1996, 1999, 2003, 2006-2018 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2003, 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,8 +58,8 @@ int posix_getgroups (int, gid_t []) __asm ("_getgroups"); # define getgroups posix_getgroups # endif -/* On at least Ultrix 4.3 and NextStep 3.2, getgroups (0, NULL) always - fails. On other systems, it returns the number of supplemental +/* On at least NeXTstep 3.2, getgroups (0, NULL) always fails. + On other systems, it returns the number of supplemental groups for the process. This function handles that special case and lets the system-provided function handle all others. However, it can fail with ENOMEM if memory is tight. It is unspecified diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 578316e34d8..08c14efcfce 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -1,6 +1,6 @@ /* Get the system load averages. - Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2018 Free Software + Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2019 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with gnulib. @@ -47,29 +47,25 @@ N_NAME_POINTER The nlist n_name element is a pointer, not an array. HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'. - LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing - load averages. + LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File + containing load averages. Specific system predefines this file uses, aside from setting default values if not emacs: apollo BSD Real BSD, not just BSD-like. - convex DGUX eunice UNIX emulator under VMS. hpux __MSDOS__ No-op for MSDOS. NeXT sgi - sequent Sequent Dynix 3.x.x (BSD) - _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV) - sony_news NEWS-OS (works at least for 4.1C) UMAX UMAX4_3 VMS _WIN32 Native Windows (possibly also defined on Cygwin) - __linux__ Linux: assumes /proc file system mounted. + __linux__, __ANDROID__ Linux: assumes /proc file system mounted. Support from Michael K. Johnson. __CYGWIN__ Cygwin emulates linux /proc/loadavg. __NetBSD__ NetBSD: assumes /kern file system mounted. @@ -101,11 +97,6 @@ # define WINDOWS32 # endif -# if !defined (BSD) && defined (ultrix) -/* Ultrix behaves like BSD on Vaxen. */ -# define BSD -# endif - # ifdef NeXT /* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which conflicts with the definition understood in this file, that this @@ -145,10 +136,6 @@ # define MORE_BSD # endif -# if defined (ultrix) && defined (mips) -# define decstation -# endif - # if defined (__SVR4) && !defined (SVR4) # define SVR4 # endif @@ -172,13 +159,6 @@ # include <sys/table.h> # endif -/* UTek's /bin/cc on the 4300 has no architecture specific cpp define by - default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>. Combine - that with a couple of other things and we'll have a unique match. */ -# if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES) -# define tek4300 /* Define by emacs, but not by other users. */ -# endif - /* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */ # ifndef LOAD_AVE_TYPE @@ -191,14 +171,6 @@ # define LOAD_AVE_TYPE long # endif -# ifdef decstation -# define LOAD_AVE_TYPE long -# endif - -# ifdef _SEQUENT_ -# define LOAD_AVE_TYPE long -# endif - # ifdef sgi # define LOAD_AVE_TYPE long # endif @@ -207,41 +179,14 @@ # define LOAD_AVE_TYPE long # endif -# ifdef sony_news -# define LOAD_AVE_TYPE long -# endif - -# ifdef sequent -# define LOAD_AVE_TYPE long -# endif - # ifdef OSF_ALPHA # define LOAD_AVE_TYPE long # endif -# if defined (ardent) && defined (titan) -# define LOAD_AVE_TYPE long -# endif - -# ifdef tek4300 -# define LOAD_AVE_TYPE long -# endif - -# if defined (alliant) && defined (i860) /* Alliant FX/2800 */ -# define LOAD_AVE_TYPE long -# endif - # if defined _AIX && ! defined HAVE_LIBPERFSTAT # define LOAD_AVE_TYPE long # endif -# ifdef convex -# define LOAD_AVE_TYPE double -# ifndef LDAV_CVT -# define LDAV_CVT(n) (n) -# endif -# endif - # endif /* No LOAD_AVE_TYPE. */ # ifdef OSF_ALPHA @@ -251,13 +196,6 @@ # define FSCALE 1024.0 # endif -# if defined (alliant) && defined (i860) /* Alliant FX/2800 */ -/* <sys/param.h> defines an incorrect value for FSCALE on an - Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */ -# undef FSCALE -# define FSCALE 100.0 -# endif - # ifndef FSCALE @@ -267,25 +205,17 @@ # define FSCALE 2048.0 # endif -# if defined (MIPS) || defined (SVR4) || defined (decstation) +# if defined (MIPS) || defined (SVR4) # define FSCALE 256 # endif -# if defined (sgi) || defined (sequent) +# if defined (sgi) /* Sometimes both MIPS and sgi are defined, so FSCALE was just defined above under #ifdef MIPS. But we want the sgi value. */ # undef FSCALE # define FSCALE 1000.0 # endif -# if defined (ardent) && defined (titan) -# define FSCALE 65536.0 -# endif - -# ifdef tek4300 -# define FSCALE 100.0 -# endif - # if defined _AIX && !defined HAVE_LIBPERFSTAT # define FSCALE 65536.0 # endif @@ -307,24 +237,16 @@ # endif -# if !defined (KERNEL_FILE) && defined (sequent) -# define KERNEL_FILE "/dynix" -# endif - # if !defined (KERNEL_FILE) && defined (hpux) # define KERNEL_FILE "/hp-ux" # endif -# if !defined (KERNEL_FILE) && (defined (_SEQUENT_) || defined (MIPS) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && defined (titan))) +# if !defined (KERNEL_FILE) && (defined (MIPS) || defined (SVR4) || defined (ISC) || defined (sgi)) # define KERNEL_FILE "/unix" # endif -# if !defined (LDAV_SYMBOL) && defined (alliant) -# define LDAV_SYMBOL "_Loadavg" -# endif - -# if !defined (LDAV_SYMBOL) && ((defined (hpux) && !defined (hp9000s300)) || defined (_SEQUENT_) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && defined (titan)) || (defined (_AIX) && !defined(HAVE_LIBPERFSTAT))) +# if !defined (LDAV_SYMBOL) && (defined (hpux) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (_AIX) && !defined(HAVE_LIBPERFSTAT))) # define LDAV_SYMBOL "avenrun" # endif @@ -341,7 +263,7 @@ # ifdef LOAD_AVE_TYPE # ifndef __VMS -# ifndef __linux__ +# if !(defined __linux__ || defined __ANDROID__) # ifndef NLIST_STRUCT # include <a.out.h> # else /* NLIST_STRUCT */ @@ -364,7 +286,7 @@ # ifndef LDAV_SYMBOL # define LDAV_SYMBOL "_avenrun" # endif /* LDAV_SYMBOL */ -# endif /* __linux__ */ +# endif /* __linux__ || __ANDROID__ */ # else /* __VMS */ @@ -437,7 +359,8 @@ # include <sys/dg_sys_info.h> # endif -# if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5 \ +# if (defined __linux__ || defined __ANDROID__ \ + || defined __CYGWIN__ || defined SUNOS_5 \ || (defined LOAD_AVE_TYPE && ! defined __VMS)) # include <fcntl.h> # endif @@ -466,7 +389,7 @@ static bool getloadavg_initialized; /* Offset in kmem to seek to read load average, or 0 means invalid. */ static long offset; -# if ! defined __VMS && ! defined sgi && ! defined __linux__ +# if ! defined __VMS && ! defined sgi && ! (defined __linux__ || defined __ANDROID__) static struct nlist name_list[2]; # endif @@ -501,17 +424,17 @@ getloadavg (double loadavg[], int nelem) int saved_errno; kc = kstat_open (); - if (kc == 0) + if (kc == NULL) return -1; ksp = kstat_lookup (kc, "unix", 0, "system_misc"); - if (ksp == 0) + if (ksp == NULL) return -1; if (kstat_read (kc, ksp, 0) == -1) return -1; kn = kstat_data_lookup (ksp, "avenrun_1min"); - if (kn == 0) + if (kn == NULL) { /* Return -1 if no load average information is available. */ nelem = 0; @@ -524,14 +447,14 @@ getloadavg (double loadavg[], int nelem) if (nelem >= 2) { kn = kstat_data_lookup (ksp, "avenrun_5min"); - if (kn != 0) + if (kn != NULL) { loadavg[elem++] = (double) kn->value.ul / FSCALE; if (nelem >= 3) { kn = kstat_data_lookup (ksp, "avenrun_15min"); - if (kn != 0) + if (kn != NULL) loadavg[elem++] = (double) kn->value.ul / FSCALE; } } @@ -576,8 +499,8 @@ getloadavg (double loadavg[], int nelem) } # endif -# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__)) - /* Linux without glibc, Cygwin */ +# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__) + /* Linux without glibc, Android, Cygwin */ # define LDAV_DONE # undef LOAD_AVE_TYPE @@ -632,7 +555,7 @@ getloadavg (double loadavg[], int nelem) return elem; -# endif /* __linux__ || __CYGWIN__ */ +# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */ # if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ # define LDAV_DONE @@ -921,7 +844,7 @@ getloadavg (double loadavg[], int nelem) # ifndef SUNOS_5 if ( -# if !(defined (_AIX) && !defined (ps2)) +# if !defined (_AIX) nlist (KERNEL_FILE, name_list) # else /* _AIX */ knlist (name_list, 1, sizeof (name_list[0])) @@ -972,7 +895,7 @@ getloadavg (double loadavg[], int nelem) /* We pass 0 for the kernel, corefile, and swapfile names to use the currently running kernel. */ kd = kvm_open (0, 0, 0, O_RDONLY, 0); - if (kd != 0) + if (kd != NULL) { /* nlist the currently running kernel. */ kvm_nlist (kd, name_list); diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h index 12b5a877c2f..049145b3869 100644 --- a/lib/getopt-cdefs.in.h +++ b/lib/getopt-cdefs.in.h @@ -1,5 +1,5 @@ /* getopt-on-non-glibc compatibility macros. - Copyright (C) 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. diff --git a/lib/getopt-core.h b/lib/getopt-core.h index e51b6c78e72..6360ad6942e 100644 --- a/lib/getopt-core.h +++ b/lib/getopt-core.h @@ -1,5 +1,5 @@ /* Declarations for getopt (basic, portable features only). - Copyright (C) 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. diff --git a/lib/getopt-ext.h b/lib/getopt-ext.h index cb41206ff3a..13cb0077bef 100644 --- a/lib/getopt-ext.h +++ b/lib/getopt-ext.h @@ -1,5 +1,5 @@ /* Declarations for getopt (GNU extensions). - Copyright (C) 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h index c62f9e266d0..8fac2691e85 100644 --- a/lib/getopt-pfx-core.h +++ b/lib/getopt-pfx-core.h @@ -1,5 +1,5 @@ /* getopt (basic, portable features) gnulib wrapper header. - Copyright (C) 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h index 753f1290867..0e21aefb0b7 100644 --- a/lib/getopt-pfx-ext.h +++ b/lib/getopt-pfx-ext.h @@ -1,5 +1,5 @@ /* getopt (GNU extensions) gnulib wrapper header. - Copyright (C) 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. diff --git a/lib/getopt.c b/lib/getopt.c index 11e36eef815..8ee075a8091 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -1,5 +1,5 @@ /* Getopt for GNU. - Copyright (C) 1987-2018 Free Software Foundation, Inc. + Copyright (C) 1987-2019 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 5fb58ddb0f9..c77f34ce587 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library, which supplies a different version of diff --git a/lib/getopt1.c b/lib/getopt1.c index 9c7fff4c73d..883aa6bbc91 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -1,5 +1,5 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-2018 Free Software Foundation, Inc. + Copyright (C) 1987-2019 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. diff --git a/lib/getopt_int.h b/lib/getopt_int.h index b0e9a6d0126..e63706f60ea 100644 --- a/lib/getopt_int.h +++ b/lib/getopt_int.h @@ -1,5 +1,5 @@ /* Internal declarations for getopt. - Copyright (C) 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. diff --git a/lib/gettext.h b/lib/gettext.h index f2d7458f4a8..c7c0fdb5311 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2018 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -184,9 +184,16 @@ npgettext_aux (const char *domain, #include <string.h> -#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ - /* || __STDC_VERSION__ == 199901L - || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ) +/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. + This relates to the -Wvla and -Wvla-larger-than warnings, enabled in + the default GCC many warnings set. This allows programs to disable use + of VLAs, which may be unintended, or may be awkward to support portably, + or may have security implications due to non-deterministic stack usage. */ + +#if (!defined GNULIB_NO_VLA \ + && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ + /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) + || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )) # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 #else # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 diff --git a/lib/gettime.c b/lib/gettime.c index bb59c44ff0e..1fd153f6dce 100644 --- a/lib/gettime.c +++ b/lib/gettime.c @@ -1,6 +1,6 @@ /* gettime -- get the system clock - Copyright (C) 2002, 2004-2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2002, 2004-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index 1bd50fa3d36..e728bf47355 100644 --- a/lib/gettimeofday.c +++ b/lib/gettimeofday.c @@ -1,6 +1,6 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -72,10 +72,10 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) /* On native Windows, there are two ways to get the current time: GetSystemTimeAsFileTime - <https://msdn.microsoft.com/en-us/library/ms724397.aspx> + <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime> or GetSystemTimePreciseAsFileTime - <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. + <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>. GetSystemTimeAsFileTime produces values that jump by increments of 15.627 milliseconds (!) on average. Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2 @@ -92,7 +92,7 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) GetSystemTimeAsFileTime (¤t_time); /* Convert from FILETIME to 'struct timeval'. */ - /* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ + /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */ ULONGLONG since_1601 = ((ULONGLONG) current_time.dwHighDateTime << 32) | (ULONGLONG) current_time.dwLowDateTime; diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 982d3c5c297..0d9a885be3d 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -1,5 +1,5 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2019 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -82,6 +82,7 @@ # crypto/sha512-buffer \ # d-type \ # diffseq \ +# dosname \ # dtoastr \ # dtotimespec \ # dup2 \ @@ -91,7 +92,6 @@ # faccessat \ # fcntl \ # fcntl-h \ -# fdatasync \ # fdopendir \ # filemode \ # filevercmp \ @@ -176,7 +176,6 @@ BUILD_DETAILS = @BUILD_DETAILS@ BYTESWAP_H = @BYTESWAP_H@ CAIRO_CFLAGS = @CAIRO_CFLAGS@ CAIRO_LIBS = @CAIRO_LIBS@ -CANNOT_DUMP = @CANNOT_DUMP@ CC = @CC@ CFLAGS = @CFLAGS@ CFLAGS_SOUND = @CFLAGS_SOUND@ @@ -197,6 +196,7 @@ DBUS_OBJ = @DBUS_OBJ@ DEFS = @DEFS@ DESLIB = @DESLIB@ DOCMISC_W32 = @DOCMISC_W32@ +DUMPING = @DUMPING@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -431,6 +431,7 @@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOD = @GNULIB_STRTOD@ GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLD = @GNULIB_STRTOLD@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ @@ -478,6 +479,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_OBJ = @GTK_OBJ@ GZIP_PROG = @GZIP_PROG@ +HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ @@ -556,6 +558,7 @@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ +HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ @@ -566,6 +569,7 @@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAKEINFO = @HAVE_MAKEINFO@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ +HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ @@ -613,6 +617,7 @@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ +HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ @@ -630,6 +635,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ @@ -730,7 +736,6 @@ LIB_ACL = @LIB_ACL@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ LIB_EACCESS = @LIB_EACCESS@ LIB_EXECINFO = @LIB_EXECINFO@ -LIB_FDATASYNC = @LIB_FDATASYNC@ LIB_MATH = @LIB_MATH@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ @@ -860,6 +865,7 @@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ +REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ @@ -895,6 +901,7 @@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ +REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ @@ -907,6 +914,7 @@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ +REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ @@ -928,6 +936,7 @@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ @@ -1010,6 +1019,7 @@ XMKMF = @XMKMF@ XOBJ = @XOBJ@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_LIBS = @XRENDER_LIBS@ XWIDGETS_OBJ = @XWIDGETS_OBJ@ X_TOOLKIT_TYPE = @X_TOOLKIT_TYPE@ ac_ct_CC = @ac_ct_CC@ @@ -1050,7 +1060,6 @@ gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1 = @gl_GNULIB_ENABLED_a9786850 gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36 = @gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36@ gl_GNULIB_ENABLED_cloexec = @gl_GNULIB_ENABLED_cloexec@ gl_GNULIB_ENABLED_dirfd = @gl_GNULIB_ENABLED_dirfd@ -gl_GNULIB_ENABLED_dosname = @gl_GNULIB_ENABLED_dosname@ gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@ gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@ gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@ @@ -1141,7 +1150,7 @@ ifneq (,$(GL_GENERATE_ALLOCA_H)) alloca.h: alloca.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/alloca.in.h; \ + sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \ } > $@-t && \ mv -f $@-t $@ else @@ -1403,9 +1412,7 @@ endif ## begin gnulib module dosname ifeq (,$(OMIT_GNULIB_MODULE_dosname)) -ifneq (,$(gl_GNULIB_ENABLED_dosname)) -endif EXTRA_DIST += dosname.h endif @@ -1588,17 +1595,6 @@ EXTRA_DIST += fcntl.in.h endif ## end gnulib module fcntl-h -## begin gnulib module fdatasync -ifeq (,$(OMIT_GNULIB_MODULE_fdatasync)) - - -EXTRA_DIST += fdatasync.c - -EXTRA_libgnu_a_SOURCES += fdatasync.c - -endif -## end gnulib module fdatasync - ## begin gnulib module fdopendir ifeq (,$(OMIT_GNULIB_MODULE_fdopendir)) @@ -2554,6 +2550,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \ -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ @@ -2567,7 +2564,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ + -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ @@ -2585,8 +2584,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ @@ -2595,6 +2596,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ @@ -2602,11 +2604,14 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ + -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ + -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ diff --git a/lib/group-member.c b/lib/group-member.c index 3747dfe785b..ad61cf0b630 100644 --- a/lib/group-member.c +++ b/lib/group-member.c @@ -1,6 +1,6 @@ /* group-member.c -- determine whether group id is in calling user's group list - Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2018 Free Software + Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/ieee754.in.h b/lib/ieee754.in.h index 316ac039afe..a079e59d791 100644 --- a/lib/ieee754.in.h +++ b/lib/ieee754.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2018 Free Software Foundation, Inc. +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/ignore-value.h b/lib/ignore-value.h index 95eac1cae72..7e3b4c1f0f7 100644 --- a/lib/ignore-value.h +++ b/lib/ignore-value.h @@ -1,6 +1,6 @@ /* ignore a function return without a compiler warning. -*- coding: utf-8 -*- - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/intprops.h b/lib/intprops.h index cdaf6586cb6..1a44ae55653 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -1,6 +1,6 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001-2018 Free Software Foundation, Inc. + Copyright (C) 2001-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index c7d7968e6e9..d3c735c12ce 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2018 Free Software Foundation, Inc. +/* Copyright (C) 2006-2019 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Derek Price. This file is part of gnulib. diff --git a/lib/libc-config.h b/lib/libc-config.h index d7b40935cd4..57c69661d2f 100644 --- a/lib/libc-config.h +++ b/lib/libc-config.h @@ -1,6 +1,6 @@ /* System definitions for code taken from the GNU C Library - Copyright 2017-2018 Free Software Foundation, Inc. + Copyright 2017-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public diff --git a/lib/limits.in.h b/lib/limits.in.h index 89d7195488a..39750b38d1a 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -1,6 +1,6 @@ /* A GNU-like <limits.h>. - Copyright 2016-2018 Free Software Foundation, Inc. + Copyright 2016-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/lib/localtime-buffer.c b/lib/localtime-buffer.c index df11f4321db..b65ea45af20 100644 --- a/lib/localtime-buffer.c +++ b/lib/localtime-buffer.c @@ -1,6 +1,6 @@ /* Provide access to the last buffer returned by localtime() or gmtime(). - Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,6 +34,7 @@ struct tm *localtime_buffer_addr = &tm_zero_buffer; struct tm * rpl_localtime (time_t const *timep) +#undef localtime { struct tm *tm = localtime (timep); @@ -46,6 +47,7 @@ rpl_localtime (time_t const *timep) /* Same as above, since gmtime and localtime use the same buffer. */ struct tm * rpl_gmtime (time_t const *timep) +#undef gmtime { struct tm *tm = gmtime (timep); diff --git a/lib/localtime-buffer.h b/lib/localtime-buffer.h index f381ff0e6de..031111a752f 100644 --- a/lib/localtime-buffer.h +++ b/lib/localtime-buffer.h @@ -1,6 +1,6 @@ /* Provide access to the last buffer returned by localtime() or gmtime(). - Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/lstat.c b/lib/lstat.c index 5873bbd67c9..a3e40d826f0 100644 --- a/lib/lstat.c +++ b/lib/lstat.c @@ -1,6 +1,6 @@ /* Work around a bug of lstat on some systems - Copyright (C) 1997-2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 1997-2006, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,10 +42,14 @@ orig_lstat (const char *filename, struct stat *buf) } /* Specification. */ +# ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -# include "sys/stat.h" +# include "sys/stat.h" +# else +# include <sys/stat.h> +# endif # include "stat-time.h" diff --git a/lib/md5.c b/lib/md5.c index 554d421c7bf..5c8bcf91e48 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -1,6 +1,6 @@ /* Functions to compute MD5 message digest of files or memory blocks. according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2018 Free Software + Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/md5.h b/lib/md5.h index db031aac04c..478a27bc518 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -1,6 +1,6 @@ /* Declaration of functions and data types used for MD5 sum computing library functions. - Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2018 Free Software + Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/memrchr.c b/lib/memrchr.c index 99acfd9c56d..96022835cef 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -1,6 +1,6 @@ /* memrchr -- find the last occurrence of a byte in a memory block - Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2018 Free Software + Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2019 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -68,7 +68,7 @@ __memrchr (void const *s, int c_in, size_t n) if (*--char_ptr == c) return (void *) char_ptr; - longword_ptr = (const longword *) char_ptr; + longword_ptr = (const void *) char_ptr; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to any size longwords. */ diff --git a/lib/minmax.h b/lib/minmax.h index 33a5305f429..d7f6bea0619 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -1,5 +1,5 @@ /* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2018 Free Software + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/lib/mkostemp.c b/lib/mkostemp.c index df9ecf8c4ef..bbfe9dbc08f 100644 --- a/lib/mkostemp.c +++ b/lib/mkostemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2018 Free Software +/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2019 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h index 31cf3a4dab2..d13d89cfae7 100644 --- a/lib/mktime-internal.h +++ b/lib/mktime-internal.h @@ -1,6 +1,6 @@ /* mktime variant that also uses an offset guess - Copyright 2016-2018 Free Software Foundation, Inc. + Copyright 2016-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public diff --git a/lib/mktime.c b/lib/mktime.c index 557712fdaa4..e3783d7a95e 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -1,5 +1,5 @@ /* Convert a 'struct tm' to a time_t value. - Copyright (C) 1993-2018 Free Software Foundation, Inc. + Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Eggert <eggert@twinsun.com>. @@ -17,12 +17,6 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -/* Define this to 1 to have a standalone program to test this implementation of - mktime. */ -#ifndef DEBUG_MKTIME -# define DEBUG_MKTIME 0 -#endif - /* The following macros influence what gets defined when this file is compiled: Macro/expression Which gnulib module This compilation unit @@ -34,12 +28,10 @@ || NEED_MKTIME_WINDOWS NEED_MKTIME_INTERNAL mktime-internal mktime_internal - - DEBUG_MKTIME (defined manually) my_mktime, main */ -#if !defined _LIBC && !DEBUG_MKTIME -# include <config.h> +#ifndef _LIBC +# include <libc-config.h> #endif /* Assume that leap seconds are possible, unless told otherwise. @@ -51,6 +43,7 @@ #include <time.h> +#include <errno.h> #include <limits.h> #include <stdbool.h> #include <stdlib.h> @@ -59,13 +52,6 @@ #include <intprops.h> #include <verify.h> -#if DEBUG_MKTIME -# include <stdio.h> -/* Make it work even if the system's libc has its own mktime routine. */ -# undef mktime -# define mktime my_mktime -#endif /* DEBUG_MKTIME */ - #ifndef NEED_MKTIME_INTERNAL # define NEED_MKTIME_INTERNAL 0 #endif @@ -73,7 +59,7 @@ # define NEED_MKTIME_WINDOWS 0 #endif #ifndef NEED_MKTIME_WORKING -# define NEED_MKTIME_WORKING DEBUG_MKTIME +# define NEED_MKTIME_WORKING 0 #endif #include "mktime-internal.h" @@ -86,7 +72,7 @@ my_tzset (void) /* Rectify the value of the environment variable TZ. There are four possible kinds of such values: - Traditional US time zone names, e.g. "PST8PDT". Syntax: see - <https://msdn.microsoft.com/en-us/library/90s5c885.aspx> + <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset> - Time zone names based on geography, that contain one or more slashes, e.g. "Europe/Moscow". - Time zone names based on geography, without slashes, e.g. @@ -119,11 +105,12 @@ my_tzset (void) #if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL /* A signed type that can represent an integer number of years - multiplied by three times the number of seconds in a year. It is + multiplied by four times the number of seconds in a year. It is needed when converting a tm_year value times the number of seconds - in a year. The factor of three comes because these products need + in a year. The factor of four comes because these products need to be subtracted from each other, and sometimes with an offset - added to them, without worrying about overflow. + added to them, and then with another timestamp added, without + worrying about overflow. Much of the code uses long_int to represent time_t values, to lessen the hassle of dealing with platforms where time_t is @@ -131,12 +118,12 @@ my_tzset (void) time_t values that mktime can generate even on platforms where time_t is excessively wide. */ -#if INT_MAX <= LONG_MAX / 3 / 366 / 24 / 60 / 60 +#if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60 typedef long int long_int; #else typedef long long int long_int; #endif -verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 3 / 366 / 24 / 60 / 60); +verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60); /* Shift A right by B bits portably, by dividing A by 2**B and truncating towards minus infinity. B should be in the range 0 <= B @@ -210,9 +197,10 @@ isdst_differ (int a, int b) were not adjusted between the timestamps. The YEAR values uses the same numbering as TP->tm_year. Values - need not be in the usual range. However, YEAR1 must not overflow - when multiplied by three times the number of seconds in a year, and - likewise for YDAY1 and three times the number of seconds in a day. */ + need not be in the usual range. However, YEAR1 - YEAR0 must not + overflow even when multiplied by three times the number of seconds + in a year, and likewise for YDAY1 - YDAY0 and three times the + number of seconds in a day. */ static long_int ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1, @@ -247,43 +235,25 @@ long_int_avg (long_int a, long_int b) return shr (a, 1) + shr (b, 1) + ((a | b) & 1); } -/* Return a time_t value corresponding to (YEAR-YDAY HOUR:MIN:SEC), - assuming that T corresponds to *TP and that no clock adjustments - occurred between *TP and the desired time. - Although T and the returned value are of type long_int, - they represent time_t values and must be in time_t range. - If TP is null, return a value not equal to T; this avoids false matches. +/* Return a long_int value corresponding to (YEAR-YDAY HOUR:MIN:SEC) + minus *TP seconds, assuming no clock adjustments occurred between + the two timestamps. + YEAR and YDAY must not be so large that multiplying them by three times the number of seconds in a year (or day, respectively) would overflow long_int. - If the returned value would be out of range, yield the minimal or - maximal in-range value, except do not yield a value equal to T. */ + *TP should be in the usual range. */ static long_int -guess_time_tm (long_int year, long_int yday, int hour, int min, int sec, - long_int t, const struct tm *tp) +tm_diff (long_int year, long_int yday, int hour, int min, int sec, + struct tm const *tp) { - if (tp) - { - long_int result; - long_int d = ydhms_diff (year, yday, hour, min, sec, - tp->tm_year, tp->tm_yday, - tp->tm_hour, tp->tm_min, tp->tm_sec); - if (! INT_ADD_WRAPV (t, d, &result)) - return result; - } - - /* Overflow occurred one way or another. Return the nearest result - that is actually in range, except don't report a zero difference - if the actual difference is nonzero, as that would cause a false - match; and don't oscillate between two values, as that would - confuse the spring-forward gap detector. */ - return (t < long_int_avg (mktime_min, mktime_max) - ? (t <= mktime_min + 1 ? t + 1 : mktime_min) - : (mktime_max - 1 <= t ? t - 1 : mktime_max)); + return ydhms_diff (year, yday, hour, min, sec, + tp->tm_year, tp->tm_yday, + tp->tm_hour, tp->tm_min, tp->tm_sec); } /* Use CONVERT to convert T to a struct tm value in *TM. T must be in - range for time_t. Return TM if successful, NULL if T is out of - range for CONVERT. */ + range for time_t. Return TM if successful, NULL (setting errno) on + failure. */ static struct tm * convert_time (struct tm *(*convert) (const time_t *, struct tm *), long_int t, struct tm *tm) @@ -295,47 +265,48 @@ convert_time (struct tm *(*convert) (const time_t *, struct tm *), /* Use CONVERT to convert *T to a broken down time in *TP. If *T is out of range for conversion, adjust it so that it is the nearest in-range value and then convert that. - A value is in range if it fits in both time_t and long_int. */ + A value is in range if it fits in both time_t and long_int. + Return TP on success, NULL (setting errno) on failure. */ static struct tm * ranged_convert (struct tm *(*convert) (const time_t *, struct tm *), long_int *t, struct tm *tp) { - struct tm *r; - if (*t < mktime_min) - *t = mktime_min; - else if (mktime_max < *t) - *t = mktime_max; - r = convert_time (convert, *t, tp); - - if (!r && *t) + long_int t1 = (*t < mktime_min ? mktime_min + : *t <= mktime_max ? *t : mktime_max); + struct tm *r = convert_time (convert, t1, tp); + if (r) { - long_int bad = *t; - long_int ok = 0; + *t = t1; + return r; + } + if (errno != EOVERFLOW) + return NULL; - /* BAD is a known unconvertible value, and OK is a known good one. - Use binary search to narrow the range between BAD and OK until - they differ by 1. */ - while (true) - { - long_int mid = long_int_avg (ok, bad); - if (mid != ok && mid != bad) - break; - r = convert_time (convert, mid, tp); - if (r) - ok = mid; - else - bad = mid; - } + long_int bad = t1; + long_int ok = 0; + struct tm oktm; oktm.tm_sec = -1; - if (!r && ok) - { - /* The last conversion attempt failed; - revert to the most recent successful attempt. */ - r = convert_time (convert, ok, tp); - } + /* BAD is a known out-of-range value, and OK is a known in-range one. + Use binary search to narrow the range between BAD and OK until + they differ by 1. */ + while (true) + { + long_int mid = long_int_avg (ok, bad); + if (mid == ok || mid == bad) + break; + if (convert_time (convert, mid, tp)) + ok = mid, oktm = *tp; + else if (errno != EOVERFLOW) + return NULL; + else + bad = mid; } - return r; + if (oktm.tm_sec < 0) + return NULL; + *t = ok; + *tp = oktm; + return tp; } @@ -344,13 +315,14 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *), Use *OFFSET to keep track of a guess at the offset of the result, compared to what the result would be for UTC without leap seconds. If *OFFSET's guess is correct, only one CONVERT call is needed. + If successful, set *TP to the canonicalized struct tm; + otherwise leave *TP alone, return ((time_t) -1) and set errno. This function is external because it is used also by timegm.c. */ time_t __mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *), mktime_offset_t *offset) { - long_int t, gt, t0, t1, t2, dt; struct tm tm; /* The maximum number of probes (calls to CONVERT) should be enough @@ -370,7 +342,7 @@ __mktime_internal (struct tm *tp, int isdst = tp->tm_isdst; /* 1 if the previous probe was DST. */ - int dst2; + int dst2 = 0; /* Ensure that mon is in range, and set year accordingly. */ int mon_remainder = mon % 12; @@ -398,7 +370,7 @@ __mktime_internal (struct tm *tp, if (LEAP_SECONDS_POSSIBLE) { /* Handle out-of-range seconds specially, - since ydhms_tm_diff assumes every minute has 60 seconds. */ + since ydhms_diff assumes every minute has 60 seconds. */ if (sec < 0) sec = 0; if (59 < sec) @@ -409,33 +381,46 @@ __mktime_internal (struct tm *tp, time. */ INT_SUBTRACT_WRAPV (0, off, &negative_offset_guess); - t0 = ydhms_diff (year, yday, hour, min, sec, - EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, negative_offset_guess); + long_int t0 = ydhms_diff (year, yday, hour, min, sec, + EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, + negative_offset_guess); + long_int t = t0, t1 = t0, t2 = t0; /* Repeatedly use the error to improve the guess. */ - for (t = t1 = t2 = t0, dst2 = 0; - (gt = guess_time_tm (year, yday, hour, min, sec, t, - ranged_convert (convert, &t, &tm)), - t != gt); - t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0) - if (t == t1 && t != t2 - && (tm.tm_isdst < 0 - || (isdst < 0 - ? dst2 <= (tm.tm_isdst != 0) - : (isdst != 0) != (tm.tm_isdst != 0)))) - /* We can't possibly find a match, as we are oscillating - between two values. The requested time probably falls - within a spring-forward gap of size GT - T. Follow the common - practice in this case, which is to return a time that is GT - T - away from the requested time, preferring a time whose - tm_isdst differs from the requested value. (If no tm_isdst - was requested and only one of the two values has a nonzero - tm_isdst, prefer that value.) In practice, this is more - useful than returning -1. */ - goto offset_found; - else if (--remaining_probes == 0) - return -1; + while (true) + { + if (! ranged_convert (convert, &t, &tm)) + return -1; + long_int dt = tm_diff (year, yday, hour, min, sec, &tm); + if (dt == 0) + break; + + if (t == t1 && t != t2 + && (tm.tm_isdst < 0 + || (isdst < 0 + ? dst2 <= (tm.tm_isdst != 0) + : (isdst != 0) != (tm.tm_isdst != 0)))) + /* We can't possibly find a match, as we are oscillating + between two values. The requested time probably falls + within a spring-forward gap of size DT. Follow the common + practice in this case, which is to return a time that is DT + away from the requested time, preferring a time whose + tm_isdst differs from the requested value. (If no tm_isdst + was requested and only one of the two values has a nonzero + tm_isdst, prefer that value.) In practice, this is more + useful than returning -1. */ + goto offset_found; + + remaining_probes--; + if (remaining_probes == 0) + { + __set_errno (EOVERFLOW); + return -1; + } + + t1 = t2, t2 = t, t += dt, dst2 = tm.tm_isdst != 0; + } /* We have a match. Check whether tm.tm_isdst has the requested value, if any. */ @@ -477,25 +462,38 @@ __mktime_internal (struct tm *tp, if (! INT_ADD_WRAPV (t, delta * direction, &ot)) { struct tm otm; - ranged_convert (convert, &ot, &otm); + if (! ranged_convert (convert, &ot, &otm)) + return -1; if (! isdst_differ (isdst, otm.tm_isdst)) { /* We found the desired tm_isdst. Extrapolate back to the desired time. */ - t = guess_time_tm (year, yday, hour, min, sec, ot, &otm); - ranged_convert (convert, &t, &tm); - goto offset_found; + long_int gt = ot + tm_diff (year, yday, hour, min, sec, + &otm); + if (mktime_min <= gt && gt <= mktime_max) + { + if (convert_time (convert, gt, &tm)) + { + t = gt; + goto offset_found; + } + if (errno != EOVERFLOW) + return -1; + } } } } + + __set_errno (EOVERFLOW); + return -1; } offset_found: /* Set *OFFSET to the low-order bits of T - T0 - NEGATIVE_OFFSET_GUESS. This is just a heuristic to speed up the next mktime call, and correctness is unaffected if integer overflow occurs here. */ - INT_SUBTRACT_WRAPV (t, t0, &dt); - INT_SUBTRACT_WRAPV (dt, negative_offset_guess, offset); + INT_SUBTRACT_WRAPV (t, t0, offset); + INT_SUBTRACT_WRAPV (*offset, negative_offset_guess, offset); if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec) { @@ -505,8 +503,12 @@ __mktime_internal (struct tm *tp, sec_adjustment -= sec; sec_adjustment += sec_requested; if (INT_ADD_WRAPV (t, sec_adjustment, &t) - || ! (mktime_min <= t && t <= mktime_max) - || ! convert_time (convert, t, &tm)) + || ! (mktime_min <= t && t <= mktime_max)) + { + __set_errno (EOVERFLOW); + return -1; + } + if (! convert_time (convert, t, &tm)) return -1; } @@ -545,146 +547,3 @@ weak_alias (mktime, timelocal) libc_hidden_def (mktime) libc_hidden_weak (timelocal) #endif - -#if DEBUG_MKTIME - -static int -not_equal_tm (const struct tm *a, const struct tm *b) -{ - return ((a->tm_sec ^ b->tm_sec) - | (a->tm_min ^ b->tm_min) - | (a->tm_hour ^ b->tm_hour) - | (a->tm_mday ^ b->tm_mday) - | (a->tm_mon ^ b->tm_mon) - | (a->tm_year ^ b->tm_year) - | (a->tm_yday ^ b->tm_yday) - | isdst_differ (a->tm_isdst, b->tm_isdst)); -} - -static void -print_tm (const struct tm *tp) -{ - if (tp) - printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d", - tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday, - tp->tm_hour, tp->tm_min, tp->tm_sec, - tp->tm_yday, tp->tm_wday, tp->tm_isdst); - else - printf ("0"); -} - -static int -check_result (time_t tk, struct tm tmk, time_t tl, const struct tm *lt) -{ - if (tk != tl || !lt || not_equal_tm (&tmk, lt)) - { - printf ("mktime ("); - print_tm (lt); - printf (")\nyields ("); - print_tm (&tmk); - printf (") == %ld, should be %ld\n", (long int) tk, (long int) tl); - return 1; - } - - return 0; -} - -int -main (int argc, char **argv) -{ - int status = 0; - struct tm tm, tmk, tml; - struct tm *lt; - time_t tk, tl, tl1; - char trailer; - - /* Sanity check, plus call tzset. */ - tl = 0; - if (! localtime (&tl)) - { - printf ("localtime (0) fails\n"); - status = 1; - } - - if ((argc == 3 || argc == 4) - && (sscanf (argv[1], "%d-%d-%d%c", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer) - == 3) - && (sscanf (argv[2], "%d:%d:%d%c", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer) - == 3)) - { - tm.tm_year -= TM_YEAR_BASE; - tm.tm_mon--; - tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]); - tmk = tm; - tl = mktime (&tmk); - lt = localtime_r (&tl, &tml); - printf ("mktime returns %ld == ", (long int) tl); - print_tm (&tmk); - printf ("\n"); - status = check_result (tl, tmk, tl, lt); - } - else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0)) - { - time_t from = atol (argv[1]); - time_t by = atol (argv[2]); - time_t to = atol (argv[3]); - - if (argc == 4) - for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1) - { - lt = localtime_r (&tl, &tml); - if (lt) - { - tmk = tml; - tk = mktime (&tmk); - status |= check_result (tk, tmk, tl, &tml); - } - else - { - printf ("localtime_r (%ld) yields 0\n", (long int) tl); - status = 1; - } - tl1 = tl + by; - if ((tl1 < tl) != (by < 0)) - break; - } - else - for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1) - { - /* Null benchmark. */ - lt = localtime_r (&tl, &tml); - if (lt) - { - tmk = tml; - tk = tl; - status |= check_result (tk, tmk, tl, &tml); - } - else - { - printf ("localtime_r (%ld) yields 0\n", (long int) tl); - status = 1; - } - tl1 = tl + by; - if ((tl1 < tl) != (by < 0)) - break; - } - } - else - printf ("Usage:\ -\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\ -\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\ -\t%s FROM BY TO - # Do not test those values (for benchmark).\n", - argv[0], argv[0], argv[0]); - - return status; -} - -#endif /* DEBUG_MKTIME */ - -/* -Local Variables: -compile-command: "gcc -DDEBUG_MKTIME -I. -Wall -W -O2 -g mktime.c -o mktime" -End: -*/ diff --git a/lib/nstrftime.c b/lib/nstrftime.c index 46e806e6049..bc84da5a0cb 100644 --- a/lib/nstrftime.c +++ b/lib/nstrftime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -180,7 +180,7 @@ extern char *tzname[]; if (digits == 0 && _n < _w) \ { \ size_t _delta = width - _n; \ - if (pad == L_('0')) \ + if (pad == L_('0') || pad == L_('+')) \ memset_zero (p, _delta); \ else \ memset_space (p, _delta); \ @@ -418,7 +418,7 @@ iso_week_days (int yday, int wday) static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t) const CHAR_T *, const struct tm *, - bool, bool * + bool, int, int, bool * extra_args_spec LOCALE_PARAM); /* Write information from TP into S according to the format @@ -433,8 +433,8 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) const struct tm *tp extra_args_spec LOCALE_PARAM) { bool tzset_called = false; - return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, - false, &tzset_called extra_args LOCALE_ARG); + return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false, + 0, -1, &tzset_called extra_args LOCALE_ARG); } #if defined _LIBC && ! FPRINTFTIME libc_hidden_def (my_strftime) @@ -446,7 +446,8 @@ libc_hidden_def (my_strftime) static size_t __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) const CHAR_T *format, - const struct tm *tp, bool upcase, bool *tzset_called + const struct tm *tp, bool upcase, + int yr_spec, int width, bool *tzset_called extra_args_spec LOCALE_PARAM) { #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL @@ -558,7 +559,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) if (hour12 == 0) hour12 = 12; - for (f = format; *f != '\0'; ++f) + for (f = format; *f != '\0'; width = -1, f++) { int pad = 0; /* Padding for number ('-', '_', or 0). */ int modifier; /* Field modifier ('E', 'O', or 0). */ @@ -576,12 +577,12 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) + (sizeof (int) < sizeof (time_t) ? INT_STRLEN_BOUND (time_t) : INT_STRLEN_BOUND (int))]; - int width = -1; bool to_lowcase = false; bool to_uppcase = upcase; size_t colons; bool change_case = false; int format_char; + int subwidth; #if DO_MULTIBYTE && !defined COMPILE_WIDE switch (*f) @@ -679,6 +680,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) /* This influences the number formats. */ case L_('_'): case L_('-'): + case L_('+'): case L_('0'): pad = *f; continue; @@ -697,7 +699,6 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) break; } - /* As a GNU extension we allow the field width to be specified. */ if (ISDIGIT (*f)) { width = 0; @@ -743,12 +744,16 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) } \ while (0) #define DO_SIGNED_NUMBER(d, negative, v) \ + DO_MAYBE_SIGNED_NUMBER (d, negative, v, do_signed_number) +#define DO_YEARISH(d, negative, v) \ + DO_MAYBE_SIGNED_NUMBER (d, negative, v, do_yearish) +#define DO_MAYBE_SIGNED_NUMBER(d, negative, v, label) \ do \ { \ digits = d; \ negative_number = negative; \ u_number_value = v; \ - goto do_signed_number; \ + goto label; \ } \ while (0) @@ -850,7 +855,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) if (modifier == L_('O')) goto bad_format; #ifdef _NL_CURRENT - if (! (modifier == 'E' + if (! (modifier == L_('E') && (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_D_T_FMT))) @@ -861,15 +866,17 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) #endif subformat: + subwidth = -1; + subformat_width: { size_t len = __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1) - subfmt, - tp, to_uppcase, tzset_called + subfmt, tp, to_uppcase, + pad, subwidth, tzset_called extra_args LOCALE_ARG); add (len, __strftime_internal (p, STRFTIME_ARG (maxsize - i) - subfmt, - tp, to_uppcase, tzset_called + subfmt, tp, to_uppcase, + pad, subwidth, tzset_called extra_args LOCALE_ARG)); } break; @@ -930,7 +937,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) { int century = tp->tm_year / 100 + TM_YEAR_BASE / 100; century -= tp->tm_year % 100 < 0 && 0 < century; - DO_SIGNED_NUMBER (2, tp->tm_year < - TM_YEAR_BASE, century); + DO_YEARISH (2, tp->tm_year < - TM_YEAR_BASE, century); } case L_('x'): @@ -939,7 +946,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) #ifdef _NL_CURRENT if (! (modifier == L_('E') && (*(subfmt = - (const CHAR_T *)_NL_CURRENT (LC_TIME, NLW(ERA_D_FMT))) + (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_D_FMT))) != L_('\0')))) subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT)); goto subformat; @@ -971,9 +978,17 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) always_output_a_sign = true; goto do_number_body; + do_yearish: + if (pad == 0) + pad = yr_spec; + always_output_a_sign + = (pad == L_('+') + && ((digits == 2 ? 99 : 9999) < u_number_value + || digits < width)); + goto do_maybe_signed_number; + do_number_spacepad: - /* Force '_' flag unless overridden by '0' or '-' flag. */ - if (pad != L_('0') && pad != L_('-')) + if (pad == 0) pad = L_('_'); do_number: @@ -983,6 +998,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) do_signed_number: always_output_a_sign = false; + + do_maybe_signed_number: tz_colon_mask = 0; do_number_body: @@ -1087,8 +1104,19 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) case L_('F'): if (modifier != 0) goto bad_format; + if (pad == 0 && width < 0) + { + pad = L_('+'); + subwidth = 4; + } + else + { + subwidth = width - 6; + if (subwidth < 0) + subwidth = 0; + } subfmt = L_("%Y-%m-%d"); - goto subformat; + goto subformat_width; case L_('H'): if (modifier == L_('E')) @@ -1297,17 +1325,18 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) case L_('g'): { int yy = (tp->tm_year % 100 + year_adjust) % 100; - DO_NUMBER (2, (0 <= yy - ? yy - : tp->tm_year < -TM_YEAR_BASE - year_adjust - ? -yy - : yy + 100)); + DO_YEARISH (2, false, + (0 <= yy + ? yy + : tp->tm_year < -TM_YEAR_BASE - year_adjust + ? -yy + : yy + 100)); } case L_('G'): - DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE - year_adjust, - (tp->tm_year + (unsigned int) TM_YEAR_BASE - + year_adjust)); + DO_YEARISH (4, tp->tm_year < -TM_YEAR_BASE - year_adjust, + (tp->tm_year + (unsigned int) TM_YEAR_BASE + + year_adjust)); default: DO_NUMBER (2, days / 7 + 1); @@ -1327,7 +1356,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) DO_NUMBER (1, tp->tm_wday); case L_('Y'): - if (modifier == 'E') + if (modifier == L_('E')) { #if HAVE_STRUCT_ERA_ENTRY struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG); @@ -1338,6 +1367,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) # else subfmt = era->era_format; # endif + if (pad == 0) + pad = yr_spec; goto subformat; } #else @@ -1347,8 +1378,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) if (modifier == L_('O')) goto bad_format; - DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE, - tp->tm_year + (unsigned int) TM_YEAR_BASE); + DO_YEARISH (4, tp->tm_year < -TM_YEAR_BASE, + tp->tm_year + (unsigned int) TM_YEAR_BASE); case L_('y'): if (modifier == L_('E')) @@ -1358,7 +1389,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) if (era) { int delta = tp->tm_year - era->start_date[0]; - DO_NUMBER (1, (era->offset + if (pad == 0) + pad = yr_spec; + DO_NUMBER (2, (era->offset + delta * era->absolute_direction)); } #else @@ -1370,7 +1403,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) int yy = tp->tm_year % 100; if (yy < 0) yy = tp->tm_year < - TM_YEAR_BASE ? -yy : yy + 100; - DO_NUMBER (2, yy); + DO_YEARISH (2, false, yy); } case L_('Z'): @@ -1438,28 +1471,10 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) # endif ltm = *tp; + ltm.tm_wday = -1; lt = mktime_z (tz, <m); - - if (lt == (time_t) -1) - { - /* mktime returns -1 for errors, but -1 is also a - valid time_t value. Check whether an error really - occurred. */ - struct tm tm; - - if (! localtime_rz (tz, <, &tm) - || ((ltm.tm_sec ^ tm.tm_sec) - | (ltm.tm_min ^ tm.tm_min) - | (ltm.tm_hour ^ tm.tm_hour) - | (ltm.tm_mday ^ tm.tm_mday) - | (ltm.tm_mon ^ tm.tm_mon) - | (ltm.tm_year ^ tm.tm_year))) - break; - } - - if (! localtime_rz (0, <, >m)) + if (ltm.tm_wday < 0 || ! localtime_rz (0, <, >m)) break; - diff = tm_diff (<m, >m); } #endif diff --git a/lib/open.c b/lib/open.c index 792e258ba0b..655260572d4 100644 --- a/lib/open.c +++ b/lib/open.c @@ -1,5 +1,5 @@ /* Open a descriptor to a file. - Copyright (C) 2007-2018 Free Software Foundation, Inc. + Copyright (C) 2007-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/openat-priv.h b/lib/openat-priv.h index 5d53df12018..7b90eefa488 100644 --- a/lib/openat-priv.h +++ b/lib/openat-priv.h @@ -1,6 +1,6 @@ /* Internals for openat-like functions. - Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/openat-proc.c b/lib/openat-proc.c index 87137eec538..da76e2b393e 100644 --- a/lib/openat-proc.c +++ b/lib/openat-proc.c @@ -1,6 +1,6 @@ /* Create /proc/self/fd-related names for subfiles of open directories. - Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/openat.h b/lib/openat.h index 945e032836b..f23b371c437 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -1,5 +1,5 @@ /* provide a replacement openat function - Copyright (C) 2004-2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2004-2006, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/pipe2.c b/lib/pipe2.c index c16d9351ec8..15a5dec9852 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -1,5 +1,5 @@ /* Create a pipe, with specific opening flags. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/pselect.c b/lib/pselect.c index 33b2719561f..ae010aa02e4 100644 --- a/lib/pselect.c +++ b/lib/pselect.c @@ -1,6 +1,6 @@ /* pselect - synchronous I/O multiplexing - Copyright 2011-2018 Free Software Foundation, Inc. + Copyright 2011-2019 Free Software Foundation, Inc. This file is part of gnulib. diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c index 3bb92ca8ef7..3e40cfcd393 100644 --- a/lib/pthread_sigmask.c +++ b/lib/pthread_sigmask.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking for threads. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/putenv.c b/lib/putenv.c index 801e372c329..81085e9d80a 100644 --- a/lib/putenv.c +++ b/lib/putenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2018 Free Software +/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2019 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c index ee482ef4552..cf7508016f9 100644 --- a/lib/qcopy-acl.c +++ b/lib/qcopy-acl.c @@ -1,6 +1,6 @@ /* Copy access control list from one file to another. -*- coding: utf-8 -*- - Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/readlink.c b/lib/readlink.c index 924e00d234a..bf711093502 100644 --- a/lib/readlink.c +++ b/lib/readlink.c @@ -1,5 +1,5 @@ /* Stub for readlink(). - Copyright (C) 2003-2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/readlinkat.c b/lib/readlinkat.c index 35179e2a380..c0f3e59f6ce 100644 --- a/lib/readlinkat.c +++ b/lib/readlinkat.c @@ -1,5 +1,5 @@ /* Read a symlink relative to an open directory. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/regcomp.c b/lib/regcomp.c index 0b05a63b632..892139a02af 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -233,9 +233,7 @@ re_compile_pattern (const char *pattern, size_t length, return NULL; return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]); } -#ifdef _LIBC weak_alias (__re_compile_pattern, re_compile_pattern) -#endif /* Set by 're_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own @@ -260,9 +258,7 @@ re_set_syntax (reg_syntax_t syntax) re_syntax_options = syntax; return ret; } -#ifdef _LIBC weak_alias (__re_set_syntax, re_set_syntax) -#endif int re_compile_fastmap (struct re_pattern_buffer *bufp) @@ -281,9 +277,7 @@ re_compile_fastmap (struct re_pattern_buffer *bufp) bufp->fastmap_accurate = 1; return 0; } -#ifdef _LIBC weak_alias (__re_compile_fastmap, re_compile_fastmap) -#endif static inline void __attribute__ ((always_inline)) @@ -464,7 +458,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, the return codes and their meanings.) */ int -regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags) +regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags) { reg_errcode_t ret; reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED @@ -515,16 +509,14 @@ regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags) return (int) ret; } -#ifdef _LIBC libc_hidden_def (__regcomp) weak_alias (__regcomp, regcomp) -#endif /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ size_t -regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf, +regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, size_t errbuf_size) { const char *msg; @@ -555,9 +547,7 @@ regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf, return msg_size; } -#ifdef _LIBC weak_alias (__regerror, regerror) -#endif #ifdef RE_ENABLE_I18N @@ -657,10 +647,8 @@ regfree (regex_t *preg) re_free (preg->translate); preg->translate = NULL; } -#ifdef _LIBC libc_hidden_def (__regfree) weak_alias (__regfree, regfree) -#endif /* Entry points compatible with 4.2 BSD regex library. We don't define them unless specifically requested. */ @@ -1812,8 +1800,8 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax) token->word_char = 0; #ifdef RE_ENABLE_I18N token->mb_partial = 0; - if (input->mb_cur_max > 1 && - !re_string_first_byte (input, re_string_cur_idx (input))) + if (input->mb_cur_max > 1 + && !re_string_first_byte (input, re_string_cur_idx (input))) { token->type = CHARACTER; token->mb_partial = 1; @@ -2000,8 +1988,8 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax) token->type = OP_PERIOD; break; case '^': - if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) && - re_string_cur_idx (input) != 0) + if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) + && re_string_cur_idx (input) != 0) { char prev = re_string_peek_byte (input, -1); if (!(syntax & RE_NEWLINE_ALT) || prev != '\n') @@ -2011,8 +1999,8 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax) token->opr.ctx_type = LINE_FIRST; break; case '$': - if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) && - re_string_cur_idx (input) + 1 != re_string_length (input)) + if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) + && re_string_cur_idx (input) + 1 != re_string_length (input)) { re_token_t next; re_string_skip_bytes (input, 1); @@ -2046,8 +2034,8 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax) token->opr.c = c; #ifdef RE_ENABLE_I18N - if (input->mb_cur_max > 1 && - !re_string_first_byte (input, re_string_cur_idx (input))) + if (input->mb_cur_max > 1 + && !re_string_first_byte (input, re_string_cur_idx (input))) { token->type = CHARACTER; return 1; @@ -2345,8 +2333,8 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, } FALLTHROUGH; case OP_CLOSE_SUBEXP: - if ((token->type == OP_CLOSE_SUBEXP) && - !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)) + if ((token->type == OP_CLOSE_SUBEXP) + && !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)) { *err = REG_ERPAREN; return NULL; diff --git a/lib/regex.c b/lib/regex.c index 2a86e107039..eab7a48b240 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -20,10 +20,10 @@ #ifndef _LIBC # include <libc-config.h> -# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ +# if __GNUC_PREREQ (4, 6) # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" # endif -# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ +# if __GNUC_PREREQ (4, 3) # pragma GCC diagnostic ignored "-Wold-style-definition" # pragma GCC diagnostic ignored "-Wtype-limits" # endif diff --git a/lib/regex.h b/lib/regex.h index f2ac9507adb..77ac1a559c4 100644 --- a/lib/regex.h +++ b/lib/regex.h @@ -1,6 +1,6 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989-2018 Free Software Foundation, Inc. + Copyright (C) 1985, 1989-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/regex_internal.c b/lib/regex_internal.c index f13def37bf6..b592f06725c 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. diff --git a/lib/regex_internal.h b/lib/regex_internal.h index b0e49cd828f..a3aedda8915 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -144,13 +144,8 @@ # define __mbrtowc mbrtowc # define __wcrtomb wcrtomb # define __regfree regfree -# define attribute_hidden #endif /* not _LIBC */ -#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1) -# define __attribute__(arg) -#endif - #ifndef SSIZE_MAX # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif @@ -868,23 +863,6 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) } #endif /* RE_ENABLE_I18N */ -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif - -#if __GNUC_PREREQ (3,4) -# undef __attribute_warn_unused_result__ -# define __attribute_warn_unused_result__ \ - __attribute__ ((__warn_unused_result__)) -#else -# define __attribute_warn_unused_result__ /* empty */ -#endif - #ifndef FALLTHROUGH # if __GNUC__ < 7 # define FALLTHROUGH ((void) 0) diff --git a/lib/regexec.c b/lib/regexec.c index 8b82ea50d44..f464869fb03 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -189,7 +189,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len); We return 0 if we find a match and REG_NOMATCH if not. */ int -regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string, +regexec (const regex_t *__restrict preg, const char *__restrict string, size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; @@ -232,8 +232,8 @@ __typeof__ (__regexec) __compat_regexec; int attribute_compat_text_section -__compat_regexec (const regex_t *_Restrict_ preg, - const char *_Restrict_ string, size_t nmatch, +__compat_regexec (const regex_t *__restrict preg, + const char *__restrict string, size_t nmatch, regmatch_t pmatch[], int eflags) { return regexec (preg, string, nmatch, pmatch, @@ -1293,8 +1293,10 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, else if (naccepted) { char *buf = (char *) re_string_get_buffer (&mctx->input); - if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, - naccepted) != 0) + if (mctx->input.valid_len - *pidx < naccepted + || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, + naccepted) + != 0)) return -1; } } @@ -2202,12 +2204,12 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, int naccepted; /* Check the node can accept "multi byte". */ naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx); - if (naccepted > 0 && str_idx + naccepted <= max_str_idx && - !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted], - dfa->nexts[node_idx])) + if (naccepted > 0 && str_idx + naccepted <= max_str_idx + && !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted], + dfa->nexts[node_idx])) /* The node can't accept the "multi byte", or the destination was already thrown away, then the node - could't accept the current input "multi byte". */ + couldn't accept the current input "multi byte". */ naccepted = 0; /* Otherwise, it is sure that the node could accept 'naccepted' bytes input. */ @@ -2783,8 +2785,11 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) return REG_ESPACE; err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str_idx); + buf = (const char *) re_string_get_buffer (&mctx->input); if (err == REG_NOMATCH) continue; + if (__glibc_unlikely (err != REG_NOERROR)) + return err; } } return REG_NOERROR; @@ -3777,10 +3782,10 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, /* FIXME: I don't think this if is needed, as both '\n' and '\0' are char_len == 1. */ /* '.' accepts any one character except the following two cases. */ - if ((!(dfa->syntax & RE_DOT_NEWLINE) && - re_string_byte_at (input, str_idx) == '\n') || - ((dfa->syntax & RE_DOT_NOT_NULL) && - re_string_byte_at (input, str_idx) == '\0')) + if ((!(dfa->syntax & RE_DOT_NEWLINE) + && re_string_byte_at (input, str_idx) == '\n') + || ((dfa->syntax & RE_DOT_NOT_NULL) + && re_string_byte_at (input, str_idx) == '\0')) return 0; return char_len; } diff --git a/lib/root-uid.h b/lib/root-uid.h index 4af7d95aba4..eebfa943c45 100644 --- a/lib/root-uid.h +++ b/lib/root-uid.h @@ -1,6 +1,6 @@ /* The user ID that always has appropriate privileges in the POSIX sense. - Copyright 2012-2018 Free Software Foundation, Inc. + Copyright 2012-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 5020facbb4e..a7c4745b61f 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -1,6 +1,6 @@ /* save-cwd.c -- Save and restore current working directory. - Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2018 Free Software + Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/save-cwd.h b/lib/save-cwd.h index 88c85052265..2fa6e75cc0a 100644 --- a/lib/save-cwd.h +++ b/lib/save-cwd.h @@ -1,6 +1,6 @@ /* Save and restore current working directory. - Copyright (C) 1995, 1997-1998, 2003, 2009-2018 Free Software + Copyright (C) 1995, 1997-1998, 2003, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/set-permissions.c b/lib/set-permissions.c index a415e133ac7..38cd30a5a1c 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c @@ -1,6 +1,6 @@ /* Set permissions of a file. -*- coding: utf-8 -*- - Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sha1.c b/lib/sha1.c index cd79dfa8770..d94c4373a55 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -1,7 +1,7 @@ /* sha1.c - Functions to compute SHA1 message digest of files or memory blocks according to the NIST specification FIPS-180-1. - Copyright (C) 2000-2001, 2003-2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2003-2006, 2008-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/lib/sha1.h b/lib/sha1.h index 9419750f485..617f7b0169a 100644 --- a/lib/sha1.h +++ b/lib/sha1.h @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for SHA1 sum library functions. - Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2018 Free Software + Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it diff --git a/lib/sha256.c b/lib/sha256.c index c518517077c..721e944a79f 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -1,7 +1,7 @@ /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or memory blocks according to the NIST specification FIPS-180-2. - Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sha256.h b/lib/sha256.h index 19ed3ccd4d0..b1ccb2aeb6b 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for SHA256 and SHA224 sum library functions. - Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sha512.c b/lib/sha512.c index e854951eb31..e7f5bd5a159 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -1,7 +1,7 @@ /* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or memory blocks according to the NIST specification FIPS-180-2. - Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sha512.h b/lib/sha512.h index 2c39ab195cf..7e8cc2852aa 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for SHA512 and SHA384 sum library functions. - Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sig2str.c b/lib/sig2str.c index 72b075e7818..cd5bd4d70c7 100644 --- a/lib/sig2str.c +++ b/lib/sig2str.c @@ -1,6 +1,6 @@ /* sig2str.c -- convert between signal names and numbers - Copyright (C) 2002, 2004, 2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sig2str.h b/lib/sig2str.h index 69887d4632d..32e0d26ff0f 100644 --- a/lib/sig2str.h +++ b/lib/sig2str.h @@ -1,6 +1,6 @@ /* sig2str.h -- convert between signal names and numbers - Copyright (C) 2002, 2005, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/signal.in.h b/lib/signal.in.h index 7d4927b828e..a6960a252d9 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -1,6 +1,6 @@ /* A GNU-like <signal.h>. - Copyright (C) 2006-2018 Free Software Foundation, Inc. + Copyright (C) 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/stat-time.h b/lib/stat-time.h index 69ebe85df1d..38a1f55a6cf 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -1,6 +1,6 @@ /* stat-related time functions. - Copyright (C) 2005, 2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -171,7 +171,7 @@ get_stat_birthtime (struct stat const *st _GL_UNUSED) #elif defined _WIN32 && ! defined __CYGWIN__ /* Native Windows platforms (but not Cygwin) put the "file creation time" in st_ctime (!). See - <https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */ + <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions>. */ # if _GL_WINDOWS_STAT_TIMESPEC t = st->st_ctim; # else diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index bbfa9ac3d15..d988d7c19bf 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C11 <stdalign.h>. - Copyright 2011-2018 Free Software Foundation, Inc. + Copyright 2011-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 8329a9bf8d3..5aad1210df0 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 94e7c81cef3..21dd8d23e3c 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2018 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2019 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 393ef0cf58d..4260468b612 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -1,5 +1,5 @@ /* Implementation details of FILE streams. - Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -61,6 +61,11 @@ # define _r pub._r # define _w pub._w # elif defined __ANDROID__ /* Android */ +# ifdef __LP64__ +# define _gl_flags_file_t int +# else +# define _gl_flags_file_t short +# endif /* Up to this commit from 2015-10-12 <https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a> the innards of FILE were public, and fp_ub could be defined like for OpenBSD, @@ -70,8 +75,8 @@ # define fp_ ((struct { unsigned char *_p; \ int _r; \ int _w; \ - int _flags; \ - int _file; \ + _gl_flags_file_t _flags; \ + _gl_flags_file_t _file; \ struct { unsigned char *_base; size_t _size; } _bf; \ int _lbfsize; \ void *_cookie; \ diff --git a/lib/stdio.in.h b/lib/stdio.in.h index ff7c9c831ac..4a8aa55528b 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdio.h>. - Copyright (C) 2004, 2007-2018 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -118,6 +118,13 @@ # include <unistd.h> #endif +/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && ! defined __GLIBC__ +# include <sys/stat.h> +#endif + /* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include it before we #define perror rpl_perror. */ /* But in any case avoid namespace pollution on glibc systems. */ diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 441c018ec18..f829525c104 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdlib.h>. - Copyright (C) 1995, 2001-2004, 2006-2018 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -306,9 +306,18 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); # else +# if !@HAVE_MBTOWC@ +_GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# endif _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); # endif _GL_CXXALIASWARN (mbtowc); +#elif defined GNULIB_POSIXCHECK +# undef mbtowc +# if HAVE_RAW_DECL_MBTOWC +_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " + "use gnulib module mbtowc for portability"); +# endif #endif #if @GNULIB_MKDTEMP@ @@ -573,10 +582,19 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random +# define random rpl_random +# endif +_GL_FUNCDECL_RPL (random, long, (void)); +_GL_CXXALIAS_RPL (random, long, (void)); +# else +# if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (random, long, (void)); -# endif +# endif _GL_CXXALIAS_SYS (random, long, (void)); +# endif _GL_CXXALIASWARN (random); #elif defined GNULIB_POSIXCHECK # undef random @@ -587,10 +605,19 @@ _GL_WARN_ON_USE (random, "random is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom +# define srandom rpl_srandom +# endif +_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); +_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); +# else +# if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); -# endif +# endif _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); +# endif _GL_CXXALIASWARN (srandom); #elif defined GNULIB_POSIXCHECK # undef srandom @@ -601,31 +628,52 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ || !@HAVE_DECL_INITSTATE@ +# if @REPLACE_INITSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate +# define initstate rpl_initstate +# endif +_GL_FUNCDECL_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +# else +# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ _GL_FUNCDECL_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size)); +# endif _GL_CXXALIASWARN (initstate); #elif defined GNULIB_POSIXCHECK # undef initstate -# if HAVE_RAW_DECL_INITSTATE_R +# if HAVE_RAW_DECL_INITSTATE _GL_WARN_ON_USE (initstate, "initstate is unportable - " "use gnulib module random for portability"); # endif #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ || !@HAVE_DECL_SETSTATE@ +# if @REPLACE_SETSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate +# define setstate rpl_setstate +# endif +_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); +# else +# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); +# endif _GL_CXXALIASWARN (setstate); #elif defined GNULIB_POSIXCHECK # undef setstate -# if HAVE_RAW_DECL_SETSTATE_R +# if HAVE_RAW_DECL_SETSTATE _GL_WARN_ON_USE (setstate, "setstate is unportable - " "use gnulib module random for portability"); # endif @@ -881,6 +929,7 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtod rpl_strtod # endif +# define GNULIB_defined_strtod_function 1 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); @@ -900,6 +949,32 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " # endif #endif +#if @GNULIB_STRTOLD@ + /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ +# if @REPLACE_STRTOLD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtold rpl_strtold +# endif +# define GNULIB_defined_strtold_function 1 +_GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp)); +# else +# if !@HAVE_STRTOLD@ +_GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp)); +# endif +_GL_CXXALIASWARN (strtold); +#elif defined GNULIB_POSIXCHECK +# undef strtold +# if HAVE_RAW_DECL_STRTOLD +_GL_WARN_ON_USE (strtold, "strtold is unportable - " + "use gnulib module strtold for portability"); +# endif +#endif + #if @GNULIB_STRTOLL@ /* Parse a signed integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, diff --git a/lib/stpcpy.c b/lib/stpcpy.c index 61239e9f1d7..a1d32fdaf81 100644 --- a/lib/stpcpy.c +++ b/lib/stpcpy.c @@ -1,5 +1,5 @@ /* stpcpy.c -- copy a string and return pointer to end of new string - Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2018 Free Software + Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2019 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. diff --git a/lib/strftime.h b/lib/strftime.h index af73767f5e7..e4a720b016b 100644 --- a/lib/strftime.h +++ b/lib/strftime.h @@ -1,6 +1,6 @@ /* declarations for strftime.c - Copyright (C) 2002, 2004, 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2008-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/string.in.h b/lib/string.in.h index 29f4ba6b1e1..4a9292f74ad 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like <string.h>. - Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/strtoimax.c b/lib/strtoimax.c index 69e3a99ce17..87b080c4f35 100644 --- a/lib/strtoimax.c +++ b/lib/strtoimax.c @@ -1,6 +1,6 @@ /* Convert string representation of a number into an intmax_t value. - Copyright (C) 1999, 2001-2004, 2006, 2009-2018 Free Software Foundation, + Copyright (C) 1999, 2001-2004, 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/strtol.c b/lib/strtol.c index f6f5c3268de..1d920aff544 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -1,6 +1,6 @@ /* Convert string representation of a number into an integer value. - Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2018 Free Software + Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C diff --git a/lib/strtoll.c b/lib/strtoll.c index 8aa10f48f7b..038362a308b 100644 --- a/lib/strtoll.c +++ b/lib/strtoll.c @@ -1,5 +1,5 @@ /* Function to parse a 'long long int' from text. - Copyright (C) 1995-1997, 1999, 2001, 2009-2018 Free Software Foundation, + Copyright (C) 1995-1997, 1999, 2001, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/symlink.c b/lib/symlink.c index c1c4b405cea..16432ee3275 100644 --- a/lib/symlink.c +++ b/lib/symlink.c @@ -1,5 +1,5 @@ /* Stub for symlink(). - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 154e570f023..4cf7cfc8e18 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -1,5 +1,5 @@ /* Substitute for <sys/select.h>. - Copyright (C) 2007-2018 Free Software Foundation, Inc. + Copyright (C) 2007-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 6ae6ac5fbdc..9ddd1a8d004 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -1,5 +1,5 @@ /* Provide a more complete sys/stat.h header file. - Copyright (C) 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,9 +54,16 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Before doing "#define mknod rpl_mknod" below, we need to include all + headers that may declare mknod(). OS/2 kLIBC declares mknod() in + <unistd.h>, not in <sys/stat.h>. */ +#ifdef __KLIBC__ +# include <unistd.h> +#endif + /* Before doing "#define mkdir rpl_mkdir" below, we need to include all headers that may declare mkdir(). Native Windows platforms declare mkdir - in <io.h> and/or <direct.h>, not in <unistd.h>. */ + in <io.h> and/or <direct.h>, not in <sys/stat.h>. */ #if defined _WIN32 && ! defined __CYGWIN__ # include <io.h> /* mingw32, mingw64 */ # include <direct.h> /* mingw64, MSVC 9 */ diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index b4a0e49c508..539768889d0 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/time.h. - Copyright (C) 2007-2018 Free Software Foundation, Inc. + Copyright (C) 2007-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 7f8c1c42117..237e2068cf8 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/types.h. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/tempname.c b/lib/tempname.c index da81263b8c0..be62ed9513c 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -1,6 +1,6 @@ /* tempname.c - generate the name of a temporary file. - Copyright (C) 1991-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/tempname.h b/lib/tempname.h index 4020c734c57..fb203d3a10f 100644 --- a/lib/tempname.h +++ b/lib/tempname.h @@ -1,6 +1,6 @@ /* Create a temporary file or directory. - Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/time-internal.h b/lib/time-internal.h index 3a836239120..57f2e7890b2 100644 --- a/lib/time-internal.h +++ b/lib/time-internal.h @@ -1,6 +1,6 @@ /* Time internal interface - Copyright 2015-2018 Free Software Foundation, Inc. + Copyright 2015-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/time.in.h b/lib/time.in.h index cda16c69d2c..dd3b21273c9 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -1,6 +1,6 @@ /* A more-standard <time.h>. - Copyright (C) 2007-2018 Free Software Foundation, Inc. + Copyright (C) 2007-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ -/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). +/* Some systems don't define struct timespec (e.g., AIX 4.1). Or they define it with the wrong member names or define it in <sys/time.h> (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, but the pthreads-win32 library defines it in <pthread.h>. */ diff --git a/lib/time_r.c b/lib/time_r.c index 302978077d0..a701ccc5b82 100644 --- a/lib/time_r.c +++ b/lib/time_r.c @@ -1,6 +1,6 @@ /* Reentrant time functions like localtime_r. - Copyright (C) 2003, 2006-2007, 2010-2018 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2010-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/time_rz.c b/lib/time_rz.c index 5293c7cf8dc..42ae3d3649f 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -1,6 +1,6 @@ /* Time zone functions such as tzalloc and localtime_rz - Copyright 2015-2018 Free Software Foundation, Inc. + Copyright 2015-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/timegm.c b/lib/timegm.c index 9d9ab111251..2ca57444d43 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -1,6 +1,6 @@ /* Convert UTC calendar time to simple time. Like mktime but assumes UTC. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/timespec-add.c b/lib/timespec-add.c index 1913b979edd..e0a9f12e14c 100644 --- a/lib/timespec-add.c +++ b/lib/timespec-add.c @@ -1,6 +1,6 @@ /* Add two struct timespec values. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c index 9eac36e51ac..48434e81506 100644 --- a/lib/timespec-sub.c +++ b/lib/timespec-sub.c @@ -1,6 +1,6 @@ /* Subtract two struct timespec values. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/timespec.h b/lib/timespec.h index cc49668f42a..26f1bc1a4c7 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -1,6 +1,6 @@ /* timespec -- System time interface - Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2018 Free Software + Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/u64.h b/lib/u64.h index 498b7f9c4b6..bb2f6edc3d0 100644 --- a/lib/u64.h +++ b/lib/u64.h @@ -1,6 +1,6 @@ /* uint64_t-like operations that work even on hosts lacking uint64_t - Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 66f254d60f5..7778d25dc7e 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2003-2018 Free Software Foundation, Inc. + Copyright (C) 2003-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,9 +68,11 @@ # include <stdio.h> #endif -/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ +/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in + <unistd.h>. */ /* But avoid namespace pollution on glibc systems. */ -#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ +#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ + && (defined __CYGWIN__ || defined __ANDROID__) \ && ! defined __GLIBC__ # include <fcntl.h> #endif @@ -113,6 +115,13 @@ # include <netdb.h> #endif +/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && !defined __GLIBC__ +# include <sys/stat.h> +#endif + /* MSVC defines off_t in <sys/types.h>. May also define off_t to a 64-bit type on native Windows. */ #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@ diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h index e3f0fcfed4a..ee1c06268fe 100644 --- a/lib/unlocked-io.h +++ b/lib/unlocked-io.h @@ -1,6 +1,6 @@ /* Prefer faster, non-thread-safe stdio functions if available. - Copyright (C) 2001-2004, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/utimens.c b/lib/utimens.c index f6c4fe34c7c..c9b65ef4c20 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -1,6 +1,6 @@ /* Set file access and modification times. - Copyright (C) 2003-2018 Free Software Foundation, Inc. + Copyright (C) 2003-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -288,8 +288,8 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) #ifdef USE_SETFILETIME /* On native Windows, use SetFileTime(). See - <https://msdn.microsoft.com/en-us/library/ms724933.aspx> - <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfiletime> + <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */ if (0 <= fd) { HANDLE handle; @@ -307,10 +307,10 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) if (ts == NULL || ts[0].tv_nsec == UTIME_NOW || ts[1].tv_nsec == UTIME_NOW) { /* GetSystemTimeAsFileTime - <https://msdn.microsoft.com/en-us/library/ms724397.aspx>. + <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>. It would be overkill to use GetSystemTimePreciseAsFileTime - <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. */ + <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>. */ GetSystemTimeAsFileTime (¤t_time); } diff --git a/lib/utimens.h b/lib/utimens.h index a24e62cb174..b1740960361 100644 --- a/lib/utimens.h +++ b/lib/utimens.h @@ -1,6 +1,6 @@ /* Set file access and modification times. - Copyright 2012-2018 Free Software Foundation, Inc. + Copyright 2012-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/lib/verify.h b/lib/verify.h index 3b57ddee0ac..6930645a350 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ here generates easier-to-read diagnostics when verify (R) fails. Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11. - This will likely be supported by future GCC versions, in C++ mode. + This is supported by GCC 6.1.0 and later, in C++ mode. Use this only with GCC. If we were willing to slow 'configure' down we could also use it with other compilers, but since this @@ -36,9 +36,7 @@ && !defined __cplusplus) # define _GL_HAVE__STATIC_ASSERT 1 #endif -/* The condition (99 < __GNUC__) is temporary, until we know about the - first G++ release that supports static_assert. */ -#if (99 < __GNUC__) && defined __cplusplus +#if (6 <= __GNUC__) && defined __cplusplus # define _GL_HAVE_STATIC_ASSERT 1 #endif diff --git a/lib/vla.h b/lib/vla.h index 5c9735fc9b1..8f5dea76f61 100644 --- a/lib/vla.h +++ b/lib/vla.h @@ -1,6 +1,6 @@ /* vla.h - variable length arrays - Copyright 2014-2018 Free Software Foundation, Inc. + Copyright 2014-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,20 @@ Written by Paul Eggert. */ +/* The VLA_ELEMS macro does not allocate variable-length arrays (VLAs), + so it does not have the security or performance issues commonly + associated with VLAs. VLA_ELEMS is for exploiting a C11 feature + where a function can start like this: + + double scan_array (int n, double v[static n]) + + to require a caller to pass a vector V with at least N elements; + this allows better static checking and performance in some cases. + In C11 this feature means that V is a VLA, so the feature is + supported only if __STDC_NO_VLA__ is defined, and for compatibility + to platforms that do not support VLAs, VLA_ELEMS (n) expands to + nothing when __STDC_NO_VLA__ is not defined. */ + /* A function's argument must point to an array with at least N elements. Example: 'int main (int argc, char *argv[VLA_ELEMS (argc)]);'. */ @@ -25,3 +39,15 @@ #else # define VLA_ELEMS(n) static n #endif + +/* Although C99 requires support for variable-length arrays (VLAs), + some C compilers never supported VLAs and VLAs are optional in C11. + VLAs are controversial because their allocation may be unintended + or awkward to support, and large VLAs might cause security or + performance problems. GCC can diagnose the use of VLAs via the + -Wvla and -Wvla-larger-than warnings options, and defining the + macro GNULIB_NO_VLA disables the allocation of VLAs in Gnulib code. + + The VLA_ELEMS macro is unaffected by GNULIB_NO_VLA, since it does + not allocate VLAs. Programs that use VLA_ELEMS should be compiled + with 'gcc -Wvla-larger-than' instead of with 'gcc -Wvla'. */ diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h index 72d67cc2348..7d11a156911 100644 --- a/lib/warn-on-use.h +++ b/lib/warn-on-use.h @@ -1,5 +1,5 @@ /* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2018 Free Software Foundation, Inc. + Copyright (C) 2010-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index 3426e10f4d2..e3068c83c48 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h @@ -1,6 +1,6 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2018 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |