diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-10-20 14:48:12 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-10-20 15:00:29 +0300 |
commit | b6f802fe434163ffe6f81843780906ae25ac4755 (patch) | |
tree | e63ee2665b40183135d1e04756f2fe091f031209 | |
parent | 694f58a5c020bfe1028af0fd2d4947d07e2a7080 (diff) | |
download | ydb-b6f802fe434163ffe6f81843780906ae25ac4755.tar.gz |
Update contrib/tools/m4 to 1.4.18
commit_hash:dab43d0051ce5656201a6f031d378c04dceefa2c
212 files changed, 5271 insertions, 3224 deletions
diff --git a/contrib/tools/m4/.yandex_meta/__init__.py b/contrib/tools/m4/.yandex_meta/__init__.py index 30774a6ae0..1c2fd5e7b1 100644 --- a/contrib/tools/m4/.yandex_meta/__init__.py +++ b/contrib/tools/m4/.yandex_meta/__init__.py @@ -55,6 +55,7 @@ EXCESSIVE_SRCS = [ "fseek.c", "freading.c", "langinfo.h", + "limits.h", "locale.h", "math.h", "signal.h", @@ -112,6 +113,7 @@ m4 = NixProject( # fmt: off copy_sources=[ # these are included from regex.c and should not be added into SRCS + "lib/intprops.h", "lib/regcomp.c", "lib/regex_internal.c", "lib/regex_internal.h", @@ -141,6 +143,7 @@ m4 = NixProject( "bits/libc-lock.h", "gettextP.h", "lc-charset-dispatch.h", + "libc-lock.h", "localename-table.h", "../locale/localeinfo.h", "OS.h", diff --git a/contrib/tools/m4/.yandex_meta/devtools.copyrights.report b/contrib/tools/m4/.yandex_meta/devtools.copyrights.report index 079a03da06..036eb41b8c 100644 --- a/contrib/tools/m4/.yandex_meta/devtools.copyrights.report +++ b/contrib/tools/m4/.yandex_meta/devtools.copyrights.report @@ -33,308 +33,333 @@ # FILE_INCLUDE - include all file data into licenses text file # ======================= -KEEP COPYRIGHT_SERVICE_LABEL 00c986dd4ba920668d906f7bffbf6c5f +KEEP COPYRIGHT_SERVICE_LABEL 020c22af0ed4f90d8ef06d21bbc68edd BELONGS lib/ya.make License text: - Copyright (C) 2001, 2003, 2005, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/binary-io.h [2:2] + lib/intprops.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 058f1c652a23a2496bbf854dbca10300 +KEEP COPYRIGHT_SERVICE_LABEL 021f9ce4929c908703b3306db4f67824 BELONGS lib/ya.make License text: - Copyright (C) 2001, 2003, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/stdio-safer.h [3:3] + lib/regcomp.c [2:4] + lib/regex.c [2:4] + lib/regex_internal.c [2:4] + lib/regex_internal.h [2:4] + lib/regexec.c [2:4] -KEEP COPYRIGHT_SERVICE_LABEL 0702da6758f2577f59e5bd336aa87866 +KEEP COPYRIGHT_SERVICE_LABEL 02520a034d838e17b3fd20ba4a95721b BELONGS lib/ya.make License text: - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation, + Inc. + This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/printf-args.c [2:3] + lib/error.h [2:4] -KEEP COPYRIGHT_SERVICE_LABEL 07467591c00eacc34d6d64e47366b9d4 -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL 02abc590ff5099797174410087e28901 +BELONGS lib/ya.make License text: - Copyright (C) 1989-1994, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - src/format.c [3:3] - src/freeze.c [3:3] + lib/malloca.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 0a0dfef456f909f45e6f264305db10b5 -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL 03d99e84ae3a1e2c827d9a3a281bd250 +BELONGS lib/ya.make License text: - Copyright (C) 1989-1993, 2004, 2006-2013 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - src/path.c [3:4] + lib/stripslash.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 0d14cff7e7175319fa36210084ee76a5 -BELONGS lib/ya.make +KEEP COPYRIGHT_SERVICE_LABEL 041f89aaa62da971c690568f502564ff +BELONGS ya.make License text: - Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 2000, 2006, 2009-2014, 2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/regex.h [3:5] + BACKLOG [53:53] -KEEP COPYRIGHT_SERVICE_LABEL 120581a5d502bc366df71ac0f1e21603 +KEEP COPYRIGHT_SERVICE_LABEL 0684cf2aa3d8f91098f64fa84d2a3b9f BELONGS lib/ya.make License text: - Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/raise.c [3:3] + lib/cloexec.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 1229ae41ea00ec7cef49fc6db333e618 -BELONGS lib/ya.make +KEEP COPYRIGHT_SERVICE_LABEL 09837f4dd01bb3c38252ba2bee2c6aa9 +BELONGS ya.make License text: - Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2001. + Copyright (C) 1989-1993, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/progname.h [2:3] + src/path.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 129b8cfbebfaa719b20c12a6fb0a1c86 -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL 0a30301ae6b19b7f7ba66e418a1880ea +BELONGS lib/ya.make License text: - Copyright (C) 2000, 2005-2013 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - README [69:69] + lib/c-strcase.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 15e124024eb2c86926816fb98a7bec11 +KEEP COPYRIGHT_SERVICE_LABEL 0b2cd38daefcd34e306aa0ea05722f29 BELONGS lib/ya.make License text: - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/gettext.h [2:3] + lib/tempname.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 19badf1ab4d109ed57f0d52c5242ce53 +KEEP COPYRIGHT_SERVICE_LABEL 0d25f0c1b8534fc36757270479e9990f BELONGS lib/ya.make License text: - /* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/mkdtemp.c [1:3] + lib/progname.c [2:3] + lib/wait-process.c [2:3] + lib/waitpid.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 19c356d0dffd4901e70e9450940a07c8 +KEEP COPYRIGHT_SERVICE_LABEL 0d52a61588a7a579449724b3b2b10256 BELONGS lib/ya.make License text: - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2001, 2003, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/filenamecat-lgpl.c [3:3] - lib/filenamecat.c [3:3] + lib/quote.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 1d3aa15befc9a920b6fac9f78e6f4aec +KEEP COPYRIGHT_SERVICE_LABEL 0ebf532497f0b229da5a112a036973fd BELONGS lib/ya.make License text: - /* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013 - Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/memchr2.c [1:2] + lib/dosname.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 1e7f599a240efccbda3ab4c9efc32120 +KEEP COPYRIGHT_SERVICE_LABEL 11ad23ee3922f2bc54d6a0de07a04a6c BELONGS lib/ya.make License text: - Copyright (C) 2001, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/unistd-safer.h [3:3] + lib/stdlib-safer.h [3:3] + lib/unistd--.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 232de1f77bbafd80547ce6228d7649f5 +KEEP COPYRIGHT_SERVICE_LABEL 16ab19de40b3769149d9792fb62fc9bf BELONGS lib/ya.make License text: - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software - Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/printf-parse.h [2:3] + lib/exitfail.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 23301b45ba80435162a9b78237254a09 +KEEP COPYRIGHT_SERVICE_LABEL 1c23eeb45a8056e937ad3e12a697c2d0 BELONGS lib/ya.make License text: - /* Copyright (C) 1999, 2001-2002, 2006, 2009-2013 Free Software Foundation, - Inc. - This file is part of the GNU C Library. + Copyright (C) 2001, 2003, 2005, 2008-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/tmpdir.c [1:3] + lib/binary-io.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 2611d35278bba7eb43f0271b9dc3af0d +KEEP COPYRIGHT_SERVICE_LABEL 1fad0189682f14ce1bb5adcd85e5bfa1 BELONGS ya.make License text: - Copyright (C) 1989-1994, 2003, 2006-2013 Free Software Foundation, + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - src/symtab.c [3:4] + src/format.c [3:4] + src/freeze.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 2a95c5c93500406da275ace71c40beb9 +KEEP COPYRIGHT_SERVICE_LABEL 24fd791125179b6005d4844027da88d6 BELONGS lib/ya.make License text: - Copyright (C) 1991, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2004, 2006, 2009-2016 Free Software Foundation, + Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/cloexec.c [3:3] + lib/xasprintf.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 2dbefb710287caf60ae462785dc52fde +KEEP COPYRIGHT_SERVICE_LABEL 27384c90fe0ea5b31626e24ce0332bdd BELONGS lib/ya.make License text: - Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/vasnprintf.h [2:2] + lib/fcntl.h [4:4] + lib/gl_anylinked_list2.h [1:3] + lib/gl_list.h [2:3] + lib/sigprocmask.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 2e065ae9c67a2e73da331941c7e27dcb +KEEP COPYRIGHT_SERVICE_LABEL 2a068c57e32ec1b4926bba8d17eb6677 BELONGS lib/ya.make License text: - Copyright (C) 2003, 2005, 2007, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2003. + /* Sequential list data type implemented by a hash table with another list. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmalloca.h [2:3] + lib/gl_anyhash_list1.h [1:3] + lib/gl_anyhash_list2.h [1:3] + lib/gl_anylinked_list1.h [1:3] + lib/gl_avltree_oset.h [1:3] + lib/gl_linkedhash_list.h [1:3] + lib/tempname.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 2e182f93884b2a3949c39e8591b0e31e +KEEP COPYRIGHT_SERVICE_LABEL 2b284e7e16ee23f2ef721b06e27cd6f7 BELONGS lib/ya.make License text: - /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/gl_anytree_oset.h [1:3] - lib/gl_avltree_oset.c [1:3] - lib/gl_oset.h [2:3] - lib/verror.c [2:2] - lib/verror.h [2:2] + lib/getopt_int.h [2:4] -KEEP COPYRIGHT_SERVICE_LABEL 2e732ac9f6b74dbcc834df9e53324a9f +KEEP COPYRIGHT_SERVICE_LABEL 2ceea3ddee6a7331a901d09a11fbceed BELONGS lib/ya.make License text: - Copyright (C) 2001-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/unlocked-io.h [3:3] + lib/fatal-signal.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 3101335adcc4584165cd82c0de43552b +KEEP COPYRIGHT_SERVICE_LABEL 2d578c9695bb520e0b7b7ae303ef017c BELONGS lib/ya.make License text: - Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. + /* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xvasprintf.h [2:2] + lib/mkdtemp.c [1:3] -KEEP COPYRIGHT_SERVICE_LABEL 3289f2428f1bde15c29edfb025786a00 +KEEP COPYRIGHT_SERVICE_LABEL 2fd604d3359a5e4fc8c95bc70cbab925 BELONGS lib/ya.make License text: - Copyright (C) 1990, 2001, 2003-2006, 2009-2013 Free Software Foundation, - Inc. + Copyright (C) 1999, 2002-2004, 2006-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/stripslash.c [3:4] + lib/xvasprintf.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 30e632b67c665d5739d3b12965a9ffd7 +BELONGS ya.make + License text: + Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + AUTHORS [35:36] + TODO [40:41] -KEEP COPYRIGHT_SERVICE_LABEL 33c3435ef2e7b730a5779285e67c4d37 +KEEP COPYRIGHT_SERVICE_LABEL 35b81b855f3d5c5afcc195c2a86eaa5c BELONGS lib/ya.make License text: - Copyright (C) 1999, 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, + Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xvasprintf.c [2:2] + lib/dirname.h [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 372539316e62c1ce62c57f38df8eb67e +KEEP COPYRIGHT_SERVICE_LABEL 39da4b42a1a7628ed8407c5d7b557b2f BELONGS lib/ya.make License text: - Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 @@ -343,10 +368,10 @@ BELONGS lib/ya.make lib/xalloc-oversized.h [3:3] lib/xalloc.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 3b643fb3a489e9de6c5ea29048b94696 +KEEP COPYRIGHT_SERVICE_LABEL 3b8fb448593f43892e2f5da542804dde BELONGS lib/ya.make License text: - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Scancode info: @@ -354,18 +379,29 @@ BELONGS lib/ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/getopt.c [5:7] + lib/getopt1.c [2:4] -KEEP COPYRIGHT_SERVICE_LABEL 3d1c5160866e31c4478a17530dbde5f0 +KEEP COPYRIGHT_SERVICE_LABEL 400a1e7179fd6f7b44ea3b5de1cef23c BELONGS lib/ya.make License text: - Copyright (C) 2000-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/c-ctype.h [8:8] + lib/unistd-safer.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 40115c44b23b766f3c982bffae358fa0 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002, 2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/asnprintf.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 4184562b88c3624de8cdb446d894c390 BELONGS lib/ya.make @@ -376,14 +412,21 @@ BELONGS lib/ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/close.c [2:2] - lib/fclose.c [2:2] - lib/getdtablesize.c [2:3] - lib/ignore-value.h [3:3] - lib/memchr2.h [2:2] lib/platform/win64/sched.h [3:3] - lib/sig-handler.h [3:3] - lib/sigaction.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 4185034d68efcf01cec5200570ec123a +BELONGS lib/ya.make + License text: + Copyright (C) 2005-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/glthread/lock.c [2:2] + lib/glthread/lock.h [2:2] + lib/glthread/threadlib.c [2:2] + lib/glthread/tls.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 422bc90acb59e21340f7fcc1acb0ae3a BELONGS lib/ya.make @@ -397,63 +440,75 @@ BELONGS lib/ya.make Files with this license: lib/fpending.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 44bb9314fc9057479455541413d51520 +KEEP COPYRIGHT_SERVICE_LABEL 43c041991a7120a2ddcfaea16fa37a08 BELONGS lib/ya.make License text: - Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. + /* Variable with FSF copyright information, for version-etc. + Copyright (C) 1999-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/glthread/tls.h [2:2] + lib/version-etc-fsf.c [1:2] -KEEP COPYRIGHT_SERVICE_LABEL 4603473a112e29f3e9315a949a3ddaf8 +KEEP COPYRIGHT_SERVICE_LABEL 4797f888ce3ee0eba403813fd36d2dda BELONGS lib/ya.make License text: - Copyright (C) 1999, 2002, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, + Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/vasprintf.c [2:2] + lib/closeout.c [3:4] + lib/quotearg.h [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 465e04de07b2e95f8a448170f20d31b8 +KEEP COPYRIGHT_SERVICE_LABEL 47f0ed3adff29b0888b6fd0d294d1d26 BELONGS lib/ya.make License text: - Copyright 2013 Free Software Foundation, Inc. + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/secure_getenv.c [3:3] + lib/minmax.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 4854918d3ca04b7f4687772c04e78711 +KEEP COPYRIGHT_SERVICE_LABEL 4c2eab8b162059a7c70f33b0340ff5a7 BELONGS lib/ya.make License text: - Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 1999, 2004-2007, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/error.c [2:3] + lib/dup2.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 48710321da010f086d88a01ba02f43f8 +KEEP COPYRIGHT_SERVICE_LABEL 4c930b3f752e2731aff53a1f82279c68 BELONGS lib/ya.make License text: - /* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. + Copyright (C) 2002, 2004, 2008-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/gl_linkedhash_list.c [1:3] + lib/c-stack.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 4cc350b9b8dcb19df9faba89002e8b55 +BELONGS lib/ya.make + License text: + Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/exitfail.h [3:3] KEEP COPYRIGHT_SERVICE_LABEL 4d6253f33abc179952f327ee3b1f4e15 BELONGS lib/ya.make @@ -476,36 +531,30 @@ BELONGS lib/ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/fcntl.c [3:3] - lib/fd-hook.c [2:3] - lib/fd-hook.h [2:2] - lib/gl_xlist.h [2:3] - lib/gl_xoset.h [2:3] - lib/pipe2.c [2:2] lib/platform/win64/langinfo.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 4f9492fc0e89e312df497f4fcaeab044 -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL 50373a25681bbf4d374eacce30fb00b9 +BELONGS lib/ya.make License text: - Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, - Inc. + Copyright (C) 2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - INSTALL [4:5] + lib/getprogname.c [2:2] + lib/getprogname.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 5321d65e6ca662e722b1d7cf5c99dcdd -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL 52db3eb649b1559aa9113ce26e039ec6 +BELONGS lib/ya.make License text: - Copyright (C) 2000, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - BACKLOG [53:53] + lib/xstrndup.h [3:3] KEEP COPYRIGHT_SERVICE_LABEL 53b19367c4cfc77fe8351516a21ff332 BELONGS lib/ya.make @@ -532,103 +581,107 @@ BELONGS lib/ya.make Files with this license: lib/platform/win64/getopt.h [3:5] -KEEP COPYRIGHT_SERVICE_LABEL 57f755a70896c04eff0d8aa077c79db4 +KEEP COPYRIGHT_SERVICE_LABEL 5885bad6fee13bce0f660d6f0cdf4bd9 BELONGS lib/ya.make License text: - Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2003. + Copyright (C) 2005, 2007-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/malloca.h [2:3] + lib/glthread/tls.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 5ccfd3fc29d53e79100f45ae23b3ce40 +KEEP COPYRIGHT_SERVICE_LABEL 59510767896cb7dcd25bee3ef41a4a44 BELONGS lib/ya.make License text: - Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation, - Inc. + Copyright (C) 2002-2004, 2007-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/closeout.c [3:4] - lib/quotearg.h [3:4] + lib/vasnprintf.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 5d1667bf16257cb8c0eddfec1ef63a4f +KEEP COPYRIGHT_SERVICE_LABEL 5ac728804304ac476150a2d894ad7108 BELONGS lib/ya.make License text: - Copyright (C) 2003-2013 Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/platform/win64/unistd.h [3:3] + lib/hard-locale.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 605c920eb2434c3b95d6aa972321ec57 +KEEP COPYRIGHT_SERVICE_LABEL 5cdd46d5dff8232bc46b8f81525dd67f BELONGS lib/ya.make License text: - Copyright 2000-2003, 2006, 2009-2013 Free Software Foundation, Inc. + /* Ordered set data type implemented by a binary tree. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/c-ctype.c [3:3] + lib/gl_anytree_oset.h [1:3] + lib/gl_avltree_oset.c [1:3] + lib/gl_oset.h [2:3] + lib/verror.c [2:2] + lib/verror.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 64f4044ab5e89b15adc1b10141e80bf8 +KEEP COPYRIGHT_SERVICE_LABEL 5d1667bf16257cb8c0eddfec1ef63a4f BELONGS lib/ya.make License text: - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 2003-2013 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/c-strcase.h [2:3] + lib/platform/win64/unistd.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 66d9e77c3f2d7507f9842af6cd5bb6ff -BELONGS lib/ya.make +KEEP COPYRIGHT_SERVICE_LABEL 62ae9b7756c80545eff63b4bc99bfe9d +BELONGS ya.make License text: - Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/asnprintf.c [2:2] + src/eval.c [3:4] + src/macro.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 6de66b010a0194aab3aa38e295986d51 +KEEP COPYRIGHT_SERVICE_LABEL 63f13d55f12018114a7583ad4326977e BELONGS lib/ya.make License text: - Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. + Copyright 2013-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/exitfail.h [3:3] + lib/secure_getenv.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 6ef288fe470b028ed9393f0f9cdb0d5e +KEEP COPYRIGHT_SERVICE_LABEL 66b86f65358bc5039267f11499c62afd BELONGS lib/ya.make License text: - /* Variable with FSF copyright information, for version-etc. - Copyright (C) 1999-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/version-etc-fsf.c [1:2] + lib/printf-parse.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 6f2ef572ed987bb1f02a38b932cdfedf +KEEP COPYRIGHT_SERVICE_LABEL 68267df6c0f167cba826473b5c9e4aba BELONGS lib/ya.make License text: - Copyright (C) 1996-1999, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1996-1999, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL @@ -637,6 +690,30 @@ BELONGS lib/ya.make Files with this license: lib/siglist.h [2:3] +KEEP COPYRIGHT_SERVICE_LABEL 6c11153e470211ed5e779b1c5990f89d +BELONGS lib/ya.make + License text: + Copyright (C) 1996-2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/filenamecat-lgpl.c [3:3] + lib/filenamecat.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 71499817b900aaf04d853fdffdc657b0 +BELONGS ya.make + License text: + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + INSTALL [4:5] + KEEP COPYRIGHT_SERVICE_LABEL 71de0111bb2934395d6c712100e955bf BELONGS lib/ya.make License text: @@ -649,545 +726,544 @@ BELONGS lib/ya.make Files with this license: lib/platform/win64/spawn.h [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 773aa1e6c51eddee7d07ce7ce2b1ab99 +KEEP COPYRIGHT_SERVICE_LABEL 735ec2d684a04ef21231f247536b29c8 BELONGS lib/ya.make License text: - Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2003-2004, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/cloexec.h [3:3] + lib/hard-locale.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 784d708766ce06df6c18e76dbf618bbe +KEEP COPYRIGHT_SERVICE_LABEL 74bf6d6cb74f3104314a106e04ce3152 BELONGS lib/ya.make License text: - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xalloc-die.c [3:4] + lib/progname.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 7ac575d17a582e20f8b561c93c284942 +KEEP COPYRIGHT_SERVICE_LABEL 7792bbce75afbb9ac20312cb5a4374be BELONGS lib/ya.make License text: - Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/dosname.h [3:3] + lib/printf-args.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 7b7a440b5b9672dede4b45418bd6ff73 +KEEP COPYRIGHT_SERVICE_LABEL 795febd0e8211d8af9b069ecbf574430 BELONGS lib/ya.make License text: - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/localeconv.c [2:2] + lib/unlocked-io.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 7ccf05a38bd8f519c2e08ea318d8a0b8 +KEEP COPYRIGHT_SERVICE_LABEL 7a936da6a1a519e3fdff149f8b0a8978 BELONGS lib/ya.make License text: - Copyright (C) 2001, 2003, 2006-2007, 2009-2013 Free Software Foundation, - Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. + Copyright (C) 2003-2004, 2006-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/clean-temp.c [2:4] + lib/fatal-signal.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 7fe411a514c6a2124401c5518cfce0bf -BELONGS lib/ya.make +KEEP COPYRIGHT_SERVICE_LABEL 7b6c8226902b3656b0bd91ff0c7e4e8f +BELONGS ya.make License text: - Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Copyright (C) 1989-1994, 2003, 2006-2014, 2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/spawn-pipe.h [2:3] - lib/wait-process.h [2:3] + src/symtab.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 87a2b4ef7420f613bbd7d104a9b85aca +KEEP COPYRIGHT_SERVICE_LABEL 7ba7e7c431dd4f511672633c48fff2e1 BELONGS ya.make License text: - Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 2000, 2006-2014, 2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - src/debug.c [3:4] + THANKS [143:143] -KEEP COPYRIGHT_SERVICE_LABEL 87b4383fae83c0bc4b1abfa5c78e9304 +KEEP COPYRIGHT_SERVICE_LABEL 7be90e0d0202acefed5049f50633159b BELONGS lib/ya.make License text: - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2003. + Copyright (C) 2001, 2003, 2006-2007, 2009-2016 Free Software Foundation, + Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/malloca.c [2:3] - lib/xmalloca.c [2:3] - lib/xstrndup.c [3:3] + lib/clean-temp.c [2:4] -KEEP COPYRIGHT_SERVICE_LABEL 8852eec613da8d0c23dbe9378c64629d +KEEP COPYRIGHT_SERVICE_LABEL 7e30414ba92d78e37f102f6ab2494d89 BELONGS lib/ya.make License text: - Copyright d Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/version-etc-fsf.c [26:30] + lib/c-strcasecmp.c [2:2] + lib/c-strncasecmp.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 8988632bc136efb8041411edd4493b82 +KEEP COPYRIGHT_SERVICE_LABEL 821c2564413e04c718ffc7a54d289632 BELONGS lib/ya.make License text: - Copyright (C) 2002-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. + Copyright (C) 2000, 2003, 2005-2006, 2009-2016 Free Software Foundation, + Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/regcomp.c [2:4] - lib/regex.c [2:4] - lib/regex_internal.c [2:4] - lib/regex_internal.h [2:4] - lib/regexec.c [2:4] + lib/fpending.h [3:4] -KEEP COPYRIGHT_SERVICE_LABEL 8f5cd12bb2141575153cc3bc45e631f9 +KEEP COPYRIGHT_SERVICE_LABEL 8719a2d74273264497746bf1dcd47ff5 BELONGS lib/ya.make License text: - Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/stdlib-safer.h [3:3] - lib/unistd--.h [3:3] + lib/cloexec.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 951365a51f6640f4abefc658cd5a58a9 +KEEP COPYRIGHT_SERVICE_LABEL 8852eec613da8d0c23dbe9378c64629d BELONGS lib/ya.make License text: - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright d Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/dup-safer-flag.c [4:4] - lib/dup-safer.c [3:3] - lib/fopen-safer.c [3:3] + lib/version-etc-fsf.c [26:30] -KEEP COPYRIGHT_SERVICE_LABEL 9846317830421b28752aae3ec0daaebd -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL 89987ec1024c9f4d65e939d586271b9f +BELONGS lib/ya.make License text: - Copyright (C) 2000, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - AUTHORS [35:35] - TODO [40:40] + lib/localeconv.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL 9ae366a7ff1d7343508f4419d8f30902 +KEEP COPYRIGHT_SERVICE_LABEL 8cd18281e0ba2868ccc73d5c2c1f695b BELONGS lib/ya.make License text: - Copyright (C) 2007-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2007. + Copyright (C) 2001, 2003-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/fpucw.h [2:3] - lib/freadahead.h [2:2] - lib/freading.h [2:2] - lib/isnan.c [2:2] - lib/isnand-nolibm.h [2:2] - lib/isnanf-nolibm.h [2:2] - lib/isnanl-nolibm.h [2:2] - lib/nl_langinfo.c [3:3] - lib/platform/win64/locale.h [3:3] - lib/platform/win64/sys/time.h [4:4] - lib/xprintf.h [2:2] + lib/w32spawn.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL 9b1b58fcfb772a472db1c3fb09bf34d1 +KEEP COPYRIGHT_SERVICE_LABEL 8dd7ff31f740aeca019fe2662a7e7ccf BELONGS lib/ya.make License text: - Copyright (C) 2002, 2004, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/c-stack.h [3:3] + lib/xmalloc.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL 9fbaab46200cfc8c4b4e1562ded458ac +KEEP COPYRIGHT_SERVICE_LABEL 8e0ab5b0f41c709c6282e35537ee543b BELONGS lib/ya.make License text: - Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc. + This file is part of the GNU CHARSET Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/getopt1.c [2:4] + lib/localcharset.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL a2a73a0e4276a111cc70d4e0c2a55b58 +KEEP COPYRIGHT_SERVICE_LABEL 8eeb4089b33f8b2f249f4052f7d93686 BELONGS lib/ya.make License text: - Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation, - Inc. + Copyright (C) 2001-2003, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/dirname.h [3:4] + lib/execute.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL a49d222350d83caf91027426eed2347d +KEEP COPYRIGHT_SERVICE_LABEL 8f32c78fd44b2f759221274b58abca44 BELONGS lib/ya.make License text: - Copyright (C) 1999, 2004-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/dup2.c [3:3] + lib/quotearg.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL a4c17a0a339347eccb15204e2957c984 +KEEP COPYRIGHT_SERVICE_LABEL 8fa64b3895a0d9ed96b8592b457e5134 BELONGS lib/ya.make License text: - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/fd-safer-flag.c [4:4] - lib/fd-safer.c [3:3] - lib/pipe-safer.c [2:2] - lib/pipe2-safer.c [2:2] - lib/stdio--.h [3:3] - lib/verify.h [3:3] + lib/dup-safer-flag.c [4:4] + lib/dup-safer.c [3:3] + lib/fopen-safer.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL a681cce71fccede25a5d0637e74d4cf1 +KEEP COPYRIGHT_SERVICE_LABEL 914d53bbffbf6815a58f629c2b82c301 BELONGS lib/ya.make License text: - Copyright (C) 1998-2002, 2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/close-stream.c [3:3] + lib/closein.c [3:3] + lib/closein.h [3:3] + lib/float+.h [2:3] + lib/printf-frexp.c [2:2] + lib/printf-frexp.h [2:2] + lib/printf-frexpl.c [2:2] + lib/printf-frexpl.h [2:2] + lib/xprintf.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL a6fa5ef5a6e35f8d45c238c9c265b6bc +KEEP COPYRIGHT_SERVICE_LABEL 92e42fb2fd3f2c5fead79f64ea58fdb2 BELONGS lib/ya.make License text: - Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xstrndup.h [3:3] + lib/gettimeofday.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL a8534a32046c85f9c163c599b7acf5fa -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL 959147d84977be57112b5fe8b89a8a23 +BELONGS lib/ya.make License text: - Copyright (C) 1989-1994, 2000, 2004, 2006-2013 Free Software + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - src/builtin.c [3:4] + lib/getopt.c [5:7] -KEEP COPYRIGHT_SERVICE_LABEL b78d2fba2b832b27e3066a77aeceb44a +KEEP COPYRIGHT_SERVICE_LABEL 96bf6bd5f021f33789770fb1c61c2386 BELONGS lib/ya.make License text: - Copyright (C) 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/fcntl.h [4:4] - lib/gl_anylinked_list2.h [1:3] - lib/gl_list.h [2:3] - lib/platform/win64/fcntl.h [4:4] - lib/platform/win64/signal.h [4:4] - lib/sigprocmask.c [2:3] + lib/raise.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL b8eb228e92142d90c52ac1f532deded9 +KEEP COPYRIGHT_SERVICE_LABEL 98ad972265fe8fdd0aae2a74a0919c24 BELONGS lib/ya.make License text: - Copyright (C) 1999, 2002-2013 Free Software Foundation, Inc. + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/vasnprintf.c [2:2] + lib/pathmax.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL b957f28d6fe2a6c19bfd1b221880d900 +KEEP COPYRIGHT_SERVICE_LABEL 9ae366a7ff1d7343508f4419d8f30902 BELONGS lib/ya.make License text: - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/msvc-inval.c [2:2] - lib/msvc-inval.h [2:2] - lib/msvc-nothrow.c [3:3] - lib/msvc-nothrow.h [3:3] + lib/platform/win64/locale.h [3:3] + lib/platform/win64/sys/time.h [4:4] -KEEP COPYRIGHT_SERVICE_LABEL b97536f0f5df238c15d5c12d52ab0c5a +KEEP COPYRIGHT_SERVICE_LABEL 9dccf46a2c0ae5b529abd023140ba384 BELONGS lib/ya.make License text: - Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc. - This file is part of the GNU CHARSET Library. + /* Sequential list data type implemented by a hash table with a linked list. + Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/localcharset.h [2:3] + lib/gl_linkedhash_list.c [1:3] -KEEP COPYRIGHT_SERVICE_LABEL bc024ddbff3d1712047f5138bde3fd38 +KEEP COPYRIGHT_SERVICE_LABEL 9eb6961d6c589a9f47d9ed09c91e4730 BELONGS lib/ya.make License text: - Copyright (C) 2003-2004, 2006-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2003. + Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/fatal-signal.c [2:3] + lib/closeout.h [3:4] -KEEP COPYRIGHT_SERVICE_LABEL bc4e82047bdc4ca05fa4e50667ef5ba0 +KEEP COPYRIGHT_SERVICE_LABEL 9ec93a01fbde7f55b38fde0295b04c70 BELONGS lib/ya.make +FILE_INCLUDE lib/obstack.c found in files: lib/obstack.c at line 1, lib/obstack.h at line 2 License text: - /* Copyright (C) 1991, 1994-2002, 2005, 2008-2013 Free Software Foundation, - Inc. + /* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/strsignal.c [1:3] + lib/obstack.c [1:3] + lib/obstack.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL bd69d607134ae9156c6d0e83aac20d6c +KEEP COPYRIGHT_SERVICE_LABEL a110b6de310cf601d9fa4e3146da66d1 BELONGS lib/ya.make License text: - Copyright (C) 1999-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/version-etc.c [2:2] + lib/spawn-pipe.h [2:3] + lib/wait-process.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL bff340ef4d002beefef7f8ee38124215 -BELONGS lib/ya.make +KEEP COPYRIGHT_SERVICE_LABEL a163ecc333dc48ad804fb19accd2c48b +BELONGS ya.make License text: - Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2013 Free Software - Foundation, Inc. + Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2014, 2016 Free + Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/closeout.h [3:4] + src/debug.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL c0163a2fe88e2703b1880e204238f2ec +KEEP COPYRIGHT_SERVICE_LABEL a26c5fb6cf2dd8ee29563c3fabbb3b95 BELONGS lib/ya.make License text: - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/glthread/lock.c [2:2] - lib/glthread/lock.h [2:2] - lib/glthread/threadlib.c [2:2] - lib/glthread/tls.c [2:2] - lib/platform/win64/sys/stat.h [3:3] + lib/tmpdir.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL c25c26483702f7bca157f8f73d5e056f +KEEP COPYRIGHT_SERVICE_LABEL a3ffe34b7c0227ffa2ecf65c45834d70 BELONGS lib/ya.make License text: - Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 2008-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/filenamecat.h [3:4] + lib/close.c [2:2] + lib/fclose.c [2:2] + lib/getdtablesize.c [2:3] + lib/ignore-value.h [3:3] + lib/memchr2.h [2:2] + lib/sig-handler.h [3:3] + lib/sigaction.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL c34e2546d35ccbb2c1f4737dd351e6af +KEEP COPYRIGHT_SERVICE_LABEL a44b350918471bd1b683751ff01f614f BELONGS lib/ya.make License text: - Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Copyright (C) 2007-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2007. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/execute.c [2:3] - lib/spawn-pipe.c [2:3] + lib/fpucw.h [2:3] + lib/freadahead.h [2:2] + lib/freading.h [2:2] + lib/isnand-nolibm.h [2:2] + lib/isnanf-nolibm.h [2:2] + lib/isnanl-nolibm.h [2:2] + lib/nl_langinfo.c [3:3] + lib/xprintf.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL c49923e7a55a963e7a02c2a7f406eef4 +KEEP COPYRIGHT_SERVICE_LABEL a61d5e110342a26917f3faebebc08629 BELONGS lib/ya.make License text: - Copyright (C) 2006, 2011-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/clean-temp.h [2:3] + lib/malloca.c [2:3] + lib/xmalloca.c [2:3] + lib/xstrndup.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL c5b4c3795b41b032298298e3146a344c +KEEP COPYRIGHT_SERVICE_LABEL a66bbf9a4475d3f8b4d177714e9e88d4 BELONGS lib/ya.make License text: - Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation, - Inc. - This file is part of the GNU C Library. + Copyright (C) 1999, 2002, 2006-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/error.h [2:4] + lib/vasprintf.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL cbc68f7f97745cdfbb2786dc61187706 -BELONGS lib/ya.make +KEEP COPYRIGHT_SERVICE_LABEL a8170d952ab4796676d574f35b4290c4 +BELONGS ya.make License text: - Copyright (C) 2002, 2004, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2000, 2005-2014, 2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/c-stack.c [3:3] + README [69:69] -KEEP COPYRIGHT_SERVICE_LABEL cbdf063c9090fff599e42620773cfc42 +KEEP COPYRIGHT_SERVICE_LABEL b3c1a47d4a4b023c9e95eb264186e69a BELONGS lib/ya.make License text: - Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/localcharset.c [3:3] + lib/fcntl.c [3:3] + lib/fd-hook.c [2:3] + lib/fd-hook.h [2:2] + lib/gl_xlist.h [2:3] + lib/gl_xoset.h [2:3] + lib/pipe2.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL ce730c13959bb52afcf459694cce2f32 +KEEP COPYRIGHT_SERVICE_LABEL b6950a75fcf0e973a4b16458cc379aaa BELONGS lib/ya.make License text: - Copyright (C) 2001, 2003-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/w32spawn.h [2:3] + lib/xmalloca.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL cf9cb97726f6ecb8f34de7433963ef78 -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL b78d2fba2b832b27e3066a77aeceb44a +BELONGS lib/ya.make License text: - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2013 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - src/input.c [3:3] - src/m4.c [3:3] - src/m4.h [3:3] - src/output.c [3:3] + lib/platform/win64/fcntl.h [4:4] + lib/platform/win64/signal.h [4:4] -KEEP COPYRIGHT_SERVICE_LABEL d00ba1bf4e95526accacbc7f64aeccc8 +KEEP COPYRIGHT_SERVICE_LABEL ba2add96cded3adb3a9fd060a9d7cc0e BELONGS lib/ya.make License text: - Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2001. + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/platform/win64/sys/wait.h [3:3] - lib/progname.c [2:3] - lib/wait-process.c [2:3] - lib/waitpid.c [2:2] + lib/filenamecat.h [3:4] -KEEP COPYRIGHT_SERVICE_LABEL d2a4dc23c40d2e7ebfda72ac558a7e00 +KEEP COPYRIGHT_SERVICE_LABEL bb055df14f87a9e8477c69bb1c41d405 BELONGS lib/ya.make License text: - Copyright (C) 2000, 2003, 2005-2006, 2009-2013 Free Software Foundation, - Inc. + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/fpending.h [3:4] + lib/xalloc-die.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL d5cd42bc7f6466d72fb5c45748172a64 -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL bdcf2252dc018af2e5097df309e87c63 +BELONGS lib/ya.make License text: - Copyright (C) 1989-1994, 2006-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 2006, 2011-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - src/eval.c [3:4] - src/macro.c [3:4] + lib/clean-temp.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL c0163a2fe88e2703b1880e204238f2ec +BELONGS lib/ya.make + License text: + Copyright (C) 2005-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/sys/stat.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL d667ff08e8fafd0a2a686f94251f31af +KEEP COPYRIGHT_SERVICE_LABEL c1c53c72ba1cfea48ae40b9743690aca BELONGS lib/ya.make License text: - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL @@ -1197,270 +1273,302 @@ BELONGS lib/ya.make lib/dirname-lgpl.c [3:4] lib/dirname.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL d82bb852333bcf3b61ce6e4e93b89bfc +KEEP COPYRIGHT_SERVICE_LABEL c2b537cfaf2e75502027b9f7dd37c12f BELONGS lib/ya.make License text: - Copyright (C) 1990-2000, 2002-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmalloc.c [3:3] + lib/vasnprintf.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL da48928a63b26aa3f98c78e8b3df198d -BELONGS ya.make +KEEP COPYRIGHT_SERVICE_LABEL c63774738612c2a6d394fc87e885fb7c +BELONGS lib/ya.make License text: - Copyright (C) 2000, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - THANKS [140:140] + lib/error.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL db6dbf9bcaacaf77ea5d31d8bbdd1630 +KEEP COPYRIGHT_SERVICE_LABEL c7c09f52633fc029bfc4bedec718e058 BELONGS lib/ya.make License text: - Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/c-strcaseeq.h [2:2] + lib/printf-parse.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL dbe06cb527798aade152667fb71b0913 +KEEP COPYRIGHT_SERVICE_LABEL ca8667a4b0d50e8656a98a8c87be9c94 BELONGS lib/ya.make License text: - Copyright (C) 1998-2002, 2004-2013 Free Software Foundation, Inc. + /* Copyright (C) 1991, 1994-2002, 2005, 2008-2016 Free Software Foundation, + Inc. + This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/quotearg.c [3:3] + lib/strsignal.c [1:3] -KEEP COPYRIGHT_SERVICE_LABEL df97657845f746f885a67c630a3b4b7d +KEEP COPYRIGHT_SERVICE_LABEL cc21af37886638cc44d3c01346fa635e BELONGS lib/ya.make License text: - Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2008. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/stdio-impl.h [2:2] + lib/mbrtowc.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL dff9484898bb53af32257afe4f396496 +KEEP COPYRIGHT_SERVICE_LABEL ceaffa082023b9a1bad67b7806ce54b1 BELONGS lib/ya.make License text: - Copyright (C) 1999, 2002-2004, 2006, 2009-2013 Free Software Foundation, - Inc. + Copyright (C) 2011-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xasprintf.c [2:3] + lib/msvc-inval.c [2:2] + lib/msvc-inval.h [2:2] + lib/msvc-nothrow.c [3:3] + lib/msvc-nothrow.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL e04888e6284b3d292729f957fce5ea5c +KEEP COPYRIGHT_SERVICE_LABEL cf8b5eb7be88c983ec362d16655c10e8 BELONGS lib/ya.make License text: - /* Sequential list data type implemented by a hash table with another list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. + Copyright (C) 2001, 2003, 2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/gl_anyhash_list1.h [1:3] - lib/gl_anyhash_list2.h [1:3] - lib/gl_anylinked_list1.h [1:3] - lib/gl_avltree_oset.h [1:3] - lib/gl_linkedhash_list.h [1:3] - lib/tempname.h [3:3] + lib/stdio-safer.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL e329f07beb92d1b098a25208dc86a840 +KEEP COPYRIGHT_SERVICE_LABEL cfcfc487949e8475fa2756714ff4827a BELONGS lib/ya.make License text: - Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xsize.h [3:3] + lib/version-etc.c [2:2] -KEEP COPYRIGHT_SERVICE_LABEL e3f5708a6f1e8c1584c69be73c82fdbd +KEEP COPYRIGHT_SERVICE_LABEL d00ba1bf4e95526accacbc7f64aeccc8 BELONGS lib/ya.make License text: - Copyright (C) 1991-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/tempname.c [3:3] + lib/platform/win64/sys/wait.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL e595547844fab779f343fa93a6e559e7 +KEEP COPYRIGHT_SERVICE_LABEL d5cef0f26539e08357c2551d8b15875e BELONGS lib/ya.make License text: - Copyright (C) 1998-2001, 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2006-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/quote.h [3:3] + lib/xvasprintf.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL e65fd6e5ba4f2ec80c3b64809d46a5a8 +KEEP COPYRIGHT_SERVICE_LABEL d75e399b570ee4aa6ff03850e9dfc4e7 BELONGS lib/ya.make License text: - Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/exitfail.c [3:3] + lib/basename-lgpl.c [3:4] + lib/basename.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL e74e555b63d2c0888f49c3596fa5e8d5 +KEEP COPYRIGHT_SERVICE_LABEL d9d8214ab92fb2f2e20d7e55a9af45f1 BELONGS lib/ya.make License text: - Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/printf-parse.c [2:2] + lib/regex.h [3:5] -KEEP COPYRIGHT_SERVICE_LABEL e88757980644cf5eae50af779a400879 +KEEP COPYRIGHT_SERVICE_LABEL d9f5816f4a588316ca2f09360e3175f9 BELONGS lib/ya.make License text: - Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/c-strcasecmp.c [2:2] - lib/c-strncasecmp.c [2:2] + lib/c-strcaseeq.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL e922d0e340952e8a672efb7856e820f9 +KEEP COPYRIGHT_SERVICE_LABEL df97657845f746f885a67c630a3b4b7d BELONGS lib/ya.make License text: - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/getopt_int.h [2:4] + lib/stdio-impl.h [2:2] -KEEP COPYRIGHT_SERVICE_LABEL ea529c8bbc5b15ff88bb87fbba92801e +KEEP COPYRIGHT_SERVICE_LABEL e298457ad046df8c39105db59c98ccf4 BELONGS lib/ya.make License text: - Copyright (C) 1988-1994, 1996-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/obstack.c [3:3] + lib/printf-args.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL ece2dc9da1a472caf28566b49eb32168 +KEEP COPYRIGHT_SERVICE_LABEL e449244634ffc918ab11e5bf4948f9d4 BELONGS lib/ya.make License text: - Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2013 Free Software - Foundation, Inc. + /* Copyright (C) 1999, 2001-2002, 2006, 2009-2016 Free Software Foundation, + Inc. This file is part of the GNU C Library. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/obstack.h [2:4] + lib/tmpdir.c [1:3] + +KEEP COPYRIGHT_SERVICE_LABEL e4d70afe20f4ac0875388b0e72ec907a +BELONGS ya.make + License text: + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/input.c [3:4] + src/m4.c [3:4] + src/m4.h [3:4] + src/output.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL ee222f77a16d4f3148321625257f15a6 +KEEP COPYRIGHT_SERVICE_LABEL e7f93a91902c57106f9ae9fca5dad5e4 BELONGS lib/ya.make License text: - Copyright (C) 2001-2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/tmpdir.h [2:2] + lib/fd-safer-flag.c [4:4] + lib/fd-safer.c [3:3] + lib/pipe-safer.c [2:2] + lib/pipe2-safer.c [2:2] + lib/stdio--.h [3:3] + lib/verify.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL ee86e96aba3e305f890e3242468ea4e9 +KEEP COPYRIGHT_SERVICE_LABEL e968e86436a1190f643c24d1ba2df9b4 BELONGS lib/ya.make License text: - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/basename-lgpl.c [3:4] - lib/basename.c [3:4] + lib/close-stream.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL f1e942edc857af01ccc1e18f1ed8536d +KEEP COPYRIGHT_SERVICE_LABEL ea6c01c4be1d841ec0f77d04be1bae1e BELONGS lib/ya.make License text: - Copyright (C) 2001-2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/execute.h [2:3] + lib/execute.c [2:3] + lib/spawn-pipe.c [2:3] -KEEP COPYRIGHT_SERVICE_LABEL f54ec8492caaee6122ab97c025085b70 -BELONGS lib/ya.make +KEEP COPYRIGHT_SERVICE_LABEL eb9847b9b3d1b9a2437be2833dcee73d +BELONGS ya.make License text: - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1989-1994, 2000, 2004, 2006-2014, 2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/pathmax.h [2:3] + src/builtin.c [3:4] -KEEP COPYRIGHT_SERVICE_LABEL f5b7778e3ba74a945ef4c73b5233e0e6 +KEEP COPYRIGHT_SERVICE_LABEL eb9b469c4d9d8f8ac344975f338e7769 BELONGS lib/ya.make License text: - Copyright (C) 2001-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/gettimeofday.c [3:3] + lib/localcharset.c [3:3] -KEEP COPYRIGHT_SERVICE_LABEL f62c5288c2c96dd652c7da573c17f4b3 +KEEP COPYRIGHT_SERVICE_LABEL f4c2b7991b69502ea5084a3836cc3f74 BELONGS lib/ya.make License text: - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software - Foundation, Inc. + /* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016 + Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/printf-args.h [2:3] + lib/memchr2.c [1:2] -KEEP COPYRIGHT_SERVICE_LABEL fbaaeb67f80365fc3ed5e085bc80881b +KEEP COPYRIGHT_SERVICE_LABEL f5cb65d965582d943744dcfbd9043de3 BELONGS lib/ya.make License text: - Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/c-stack.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL f7e3f488082a594ca29d0df624ce62b7 +BELONGS lib/ya.make + License text: + Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 @@ -1469,28 +1577,39 @@ BELONGS lib/ya.make lib/mkstemp-safer.c [3:3] lib/stdlib--.h [3:3] -KEEP COPYRIGHT_SERVICE_LABEL fd21bae584d2fc69b2af9ead1d430dea +KEEP COPYRIGHT_SERVICE_LABEL f95721e5fd5b346c98aaf8f423087ceb BELONGS lib/ya.make License text: - Copyright (C) 1999, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software + Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/version-etc.h [2:2] + lib/gettext.h [2:3] -KEEP COPYRIGHT_SERVICE_LABEL fe2068a4ac32499bd9c90c3059b52a95 +KEEP COPYRIGHT_SERVICE_LABEL f975dd3f6b5561ccd9040eeeb11a5165 BELONGS lib/ya.make License text: - Copyright (C) 2003-2004, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2003. + Copyright (C) 2003, 2008-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/fatal-signal.h [2:3] + lib/xsize.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL fc546066e5a39bbce394f359e85dbd6b +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2003, 2005, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/version-etc.h [2:2] KEEP COPYRIGHT_SERVICE_LABEL fe6f4a2cadd39168e946fc1f97e42e56 BELONGS ya.make @@ -1505,21 +1624,13 @@ BELONGS ya.make Files with this license: COPYING [4:6] -KEEP COPYRIGHT_SERVICE_LABEL fe8fcc676c3dcc20548fbdd1a0ce99a9 +KEEP COPYRIGHT_SERVICE_LABEL fe8ac3242674b9e52b8449d6f4cc5c96 BELONGS lib/ya.make License text: - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2016 Free Software Foundation, Inc. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/closein.c [3:3] - lib/closein.h [3:3] - lib/float+.h [2:3] - lib/isnanl.c [2:2] - lib/printf-frexp.c [2:2] - lib/printf-frexp.h [2:2] - lib/printf-frexpl.c [2:2] - lib/printf-frexpl.h [2:2] - lib/xprintf.c [2:2] + lib/c-ctype.h [8:8] diff --git a/contrib/tools/m4/.yandex_meta/devtools.licenses.report b/contrib/tools/m4/.yandex_meta/devtools.licenses.report index 885335192c..69d284571f 100644 --- a/contrib/tools/m4/.yandex_meta/devtools.licenses.report +++ b/contrib/tools/m4/.yandex_meta/devtools.licenses.report @@ -56,7 +56,6 @@ BELONGS lib/ya.make Match type : NOTICE Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later Files with this license: - lib/c-ctype.c [5:16] lib/c-ctype.h [10:21] KEEP GPL-3.0-or-later 3cd46c6a1211d1fc8d07f721f1554323 @@ -106,6 +105,8 @@ BELONGS lib/ya.make Match type : NOTICE Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later Files with this license: + lib/obstack.c [5:17] + lib/obstack.h [5:17] lib/regcomp.c [6:18] lib/regex.c [6:18] lib/regex.h [7:19] @@ -147,13 +148,13 @@ BELONGS ya.make src/builtin.c [8:19] src/debug.c [8:19] src/eval.c [8:19] - src/format.c [7:18] - src/freeze.c [7:18] - src/input.c [7:18] - src/m4.c [7:18] - src/m4.h [7:18] + src/format.c [8:19] + src/freeze.c [8:19] + src/input.c [8:19] + src/m4.c [8:19] + src/m4.h [8:19] src/macro.c [8:19] - src/output.c [7:18] + src/output.c [8:19] src/path.c [8:19] src/symtab.c [8:19] @@ -166,11 +167,11 @@ BELONGS ya.make Match type : NOTICE Links : http://www.gnu.org/licenses/fdl-1.3.txt, https://spdx.org/licenses/GFDL-1.3-or-later Files with this license: - AUTHORS [37:42] + AUTHORS [38:43] BACKLOG [55:60] README [71:76] - THANKS [142:147] - TODO [42:47] + THANKS [145:150] + TODO [43:48] KEEP GPL-3.0-or-later 659dd41b50d94dd686004e4d8e78c706 BELONGS lib/ya.make @@ -191,6 +192,7 @@ BELONGS lib/ya.make lib/glthread/threadlib.c [4:15] lib/malloca.c [5:16] lib/malloca.h [5:16] + lib/minmax.h [5:16] lib/pathmax.h [5:16] lib/platform/win64/langinfo.h [5:16] lib/platform/win64/sys/stat.h [5:16] @@ -251,6 +253,8 @@ BELONGS lib/ya.make lib/getopt.c [9:20] lib/getopt1.c [6:17] lib/getopt_int.h [6:17] + lib/getprogname.c [4:15] + lib/getprogname.h [4:15] lib/gl_anyhash_list1.h [5:16] lib/gl_anyhash_list2.h [5:16] lib/gl_anylinked_list1.h [5:16] @@ -266,19 +270,18 @@ BELONGS lib/ya.make lib/gl_xoset.h [5:16] lib/glthread/tls.c [4:15] lib/glthread/tls.h [4:15] + lib/hard-locale.c [6:17] + lib/hard-locale.h [5:16] lib/ignore-value.h [5:16] - lib/isnan.c [4:15] lib/isnand-nolibm.h [4:15] lib/isnanf-nolibm.h [4:15] lib/isnanl-nolibm.h [4:15] - lib/isnanl.c [4:15] lib/localeconv.c [4:15] + lib/mbrtowc.c [5:16] lib/memchr2.h [4:15] lib/mkdtemp.c [5:16] lib/mkstemp-safer.c [5:16] lib/nl_langinfo.c [5:16] - lib/obstack.c [5:16] - lib/obstack.h [6:17] lib/pipe-safer.c [4:15] lib/pipe2-safer.c [4:15] lib/platform/win64/fcntl.h [6:17] @@ -352,6 +355,17 @@ FILE_INCLUDE lib/filenamecat-lgpl.c found in files: lib/filenamecat.c at line 30 Files with this license: lib/filenamecat.c [30:30] +KEEP GPL-3.0-or-later a1643cc46ca6d0af0b8502b175335376 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/intprops.h [5:16] + KEEP GPL-3.0-or-later a6532c8141a6e70f23165e25c02c7e03 BELONGS lib/ya.make Note: matched license text is too long. Read it in the source files. diff --git a/contrib/tools/m4/.yandex_meta/licenses.list.txt b/contrib/tools/m4/.yandex_meta/licenses.list.txt index dbfa437485..cf12905758 100644 --- a/contrib/tools/m4/.yandex_meta/licenses.list.txt +++ b/contrib/tools/m4/.yandex_meta/licenses.list.txt @@ -1,61 +1,64 @@ ====================COPYRIGHT==================== - Copyright (C) 1989-1993, 2004, 2006-2013 Free Software Foundation, - Inc. + Copyright (C) 1989-1993, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2000, 2004, 2006-2013 Free Software + Copyright (C) 1989-1994, 2000, 2004, 2006-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2003, 2006-2013 Free Software Foundation, - Inc. + Copyright (C) 1989-1994, 2003, 2006-2014, 2016 Free Software + Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2006-2007, 2009-2013 Free Software + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, + Inc. ====================COPYRIGHT==================== - Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2014, 2016 Free + Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software +Foundation, Inc. ====================COPYRIGHT==================== -Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, -Inc. + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. ====================COPYRIGHT==================== -Copyright (C) 2000, 2005-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2005-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -Copyright (C) 2000, 2006, 2009-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006, 2009-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -Copyright (C) 2000, 2006-2007, 2009-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, +Inc. ====================COPYRIGHT==================== -Copyright (C) 2000, 2006-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006-2014, 2016 Free Software Foundation, Inc. ====================FSFAP==================== diff --git a/contrib/tools/m4/.yandex_meta/override.nix b/contrib/tools/m4/.yandex_meta/override.nix index ab2048da64..a1710c37d9 100644 --- a/contrib/tools/m4/.yandex_meta/override.nix +++ b/contrib/tools/m4/.yandex_meta/override.nix @@ -1,8 +1,8 @@ pkgs: attrs: with pkgs; with attrs; rec { - version = "1.4.17"; + version = "1.4.18"; src = fetchurl { url = "mirror://gnu/m4/m4-${version}.tar.bz2"; - sha256 = "sha256-jk4fljkyE27UXc1a+wxuI36Wpvzc0qL6Z1UECFlQDXA="; + sha256 = "sha256-ZkDXawQ7xlgTnIkD4pPVl4MJvw9AgQcUZQXspwHmfPY="; }; } diff --git a/contrib/tools/m4/AUTHORS b/contrib/tools/m4/AUTHORS index c2800095b3..44b959b721 100644 --- a/contrib/tools/m4/AUTHORS +++ b/contrib/tools/m4/AUTHORS @@ -32,7 +32,8 @@ Tim Rice tim@multitalents.net 2011-01-24 ======================================================================== -Copyright (C) 2000, 2006-2007, 2009-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, +Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or diff --git a/contrib/tools/m4/BACKLOG b/contrib/tools/m4/BACKLOG index 9b8973edc1..eeb59e2186 100644 --- a/contrib/tools/m4/BACKLOG +++ b/contrib/tools/m4/BACKLOG @@ -50,7 +50,7 @@ rmail/speed 2. 05 Sep 94 <djm@va.pubnix.com> slowness 3. 04 Oct 94 <pinard> Autoconf, m4, and dnl's. -Copyright (C) 2000, 2006, 2009-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006, 2009-2014, 2016 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or diff --git a/contrib/tools/m4/INSTALL b/contrib/tools/m4/INSTALL index 2099840756..8865734f81 100644 --- a/contrib/tools/m4/INSTALL +++ b/contrib/tools/m4/INSTALL @@ -1,8 +1,8 @@ Installation Instructions ************************* -Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, -Inc. + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software +Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -12,97 +12,96 @@ without warranty of any kind. Basic Installation ================== - Briefly, the shell command `./configure && make && make install' + Briefly, the shell command './configure && make && make install' should configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for +more-detailed instructions are generic; see the 'README' file for instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented +'INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. - The `configure' shell script attempts to guess correct values for + The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. Caching is disabled by +default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you +some point 'config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You need 'configure.ac' if +you want to change it or regenerate 'configure' using a newer version of +'autoconf'. The simplest way to compile this package is: - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. - Running `configure' might take a while. While running, it prints + Running 'configure' might take a while. While running, it prints some messages telling which features it is checking for. - 2. Type `make' to compile the package. + 2. Type 'make' to compile the package. - 3. Optionally, type `make check' to run any self-tests that come with + 3. Optionally, type 'make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. - 4. Type `make install' to install the programs and any data files and + 4. Type 'make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root + user, and only the 'make install' phase executed with root privileges. - 5. Optionally, type `make installcheck' to repeat any self-tests, but + 5. Optionally, type 'make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required + regular user, particularly if the prior 'make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. - 7. Often, you can also type `make uninstall' to remove the installed + 7. Often, you can also type 'make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. - 8. Some packages, particularly those that use Automake, provide `make + 8. Some packages, particularly those that use Automake, provide 'make distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. + targets like 'make install' and 'make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' +the 'configure' script does not know about. Run './configure --help' for details on some of the pertinent environment variables. - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: + You can give 'configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here is +an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix @@ -113,21 +112,21 @@ Compiling For Multiple Architectures You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the +own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. This is known +as a "VPATH" build. - With a non-GNU `make', it is safer to compile the package for one + With a non-GNU 'make', it is safer to compile the package for one architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before +installed the package for one architecture, use 'make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like +"universal" binaries--by specifying multiple '-arch' options to the +compiler but only a single '-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ @@ -136,105 +135,104 @@ this: This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. +using the 'lipo' tool if you have problems. Installation Names ================== - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an + By default, 'make install' installs the package's commands under +'/usr/local/bin', include files under '/usr/local/include', etc. You +can specify an installation prefix other than '/usr/local' by giving +'configure' the option '--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses +pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory +options like '--bindir=DIR' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the default +for these options is expressed in terms of '${prefix}', so that +specifying just '--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or +correct locations to 'configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without +'make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each -affected directory. For example, `make install +affected directory. For example, 'make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and +'${prefix}'. Any directories that were specified during 'configure', +but not in terms of '${prefix}', must each be overridden at install time +for the entire installation to be relocated. The approach of makefile +variable overrides for each directory variable is required by the GNU +Coding Standards, and ideally causes no recompilation. However, some +platforms have known limitations with the semantics of shared libraries +that end up requiring recompilation when using this method, particularly +noticeable in packages that use GNU Libtool. + + The second method involves providing the 'DESTDIR' variable. For +example, 'make install DESTDIR=/alternate/directory' will prepend +'/alternate/directory' before all installation names. The approach of +'DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. +when some directory options were not specified in terms of '${prefix}' +at 'configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + + Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the package recognizes. - For packages that use the X Window System, `configure' can usually + For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure +execution of 'make' will be. For these packages, running './configure --enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure +overridden with 'make V=1'; while running './configure --disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. +overridden with 'make V=0'. Particular systems ================== - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in + On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC +is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. - HP-UX `make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as `configure' are involved. Use GNU `make' -instead. + HP-UX 'make' updates targets which have the same time stamps as their +prerequisites, which makes it generally unusable when shipped generated +files such as 'configure' are involved. Use GNU 'make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `<wchar.h>' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try +parse its '<wchar.h>' header file. The option '-nodtk' can be used as a +workaround. If GNU CC is not installed, it is therefore recommended to +try ./configure CC="cc" @@ -242,26 +240,26 @@ and if that doesn't work, try ./configure CC="cc -nodtk" - On Solaris, don't put `/usr/ucb' early in your `PATH'. This + On Solaris, don't put '/usr/ucb' early in your 'PATH'. This directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. +these programs are available in '/usr/bin'. So, if you need '/usr/ucb' +in your 'PATH', put it _after_ '/usr/bin'. - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: + On Haiku, software installed for all users goes in '/boot/common', +not '/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== - There may be some features `configure' cannot figure out + There may be some features 'configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints +_same_ architectures, 'configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: +'--build=TYPE' option. TYPE can either be a short name for the system +type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM @@ -270,101 +268,101 @@ where SYSTEM can have one of these forms: OS KERNEL-OS - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will +use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. +eventually be run) with '--host=TYPE'. Sharing Defaults ================ - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. + If you want to set default values for 'configure' scripts to share, +you can create a site shell script called 'config.site' that gives +default values for variables like 'CC', 'cache_file', and 'prefix'. +'configure' looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run +environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: +them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -causes the specified `gcc' to be used as the C compiler (unless it is +causes the specified 'gcc' to be used as the C compiler (unless it is overridden in the site shell script). -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf limitation. Until the limitation is lifted, you can use -this workaround: +Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an +Autoconf limitation. Until the limitation is lifted, you can use this +workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash -`configure' Invocation +'configure' Invocation ====================== - `configure' recognizes the following options to control how it + 'configure' recognizes the following options to control how it operates. -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. +'--help' +'-h' + Print a summary of all of the options to 'configure', and exit. -`--help=short' -`--help=recursive' +'--help=short' +'--help=recursive' Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. + 'configure', and exit. The 'short' variant lists options used only + in the top level, while the 'recursive' variant lists options also + present in any nested packages. -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' script, and exit. -`--cache-file=FILE' +'--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to + traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. -`--quiet' -`--silent' -`-q' +'--quiet' +'--silent' +'-q' Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error + suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). -`--srcdir=DIR' +'--srcdir=DIR' Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. + 'configure' can determine that directory automatically. -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. +'--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: for + more details, including other options available for fine-tuning the + installation locations. -`--no-create' -`-n' +'--no-create' +'-n' Run the configure checks, but stop before creating any output files. -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/contrib/tools/m4/NEWS b/contrib/tools/m4/NEWS index 39082b8b68..356b6bcfab 100644 --- a/contrib/tools/m4/NEWS +++ b/contrib/tools/m4/NEWS @@ -1,5 +1,14 @@ GNU M4 NEWS - User visible changes. +* Noteworthy changes in release 1.4.18 (2016-12-31) [stable] + +** Diagnose --word-regexp as unsupported if it was not configured. + +** Preliminary support for OS/2. + +** A number of portability improvements inherited from gnulib. + + * Noteworthy changes in release 1.4.17 (2013-09-22) [stable] ** Fix compilation with newer glibc headers. @@ -712,7 +721,7 @@ mode: outline fill-column: 75 End: -Copyright (C) 1992-1994, 2004-2013 Free Software Foundation, Inc. +Copyright (C) 1992-1994, 2004-2014, 2016 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or diff --git a/contrib/tools/m4/README b/contrib/tools/m4/README index ed940588c0..d4ef916e94 100644 --- a/contrib/tools/m4/README +++ b/contrib/tools/m4/README @@ -66,7 +66,7 @@ note that the range specifies every single year in that closed interval. ======================================================================== -Copyright (C) 2000, 2005-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2005-2014, 2016 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or diff --git a/contrib/tools/m4/THANKS b/contrib/tools/m4/THANKS index 71bfaf3f21..bcd99a17a5 100644 --- a/contrib/tools/m4/THANKS +++ b/contrib/tools/m4/THANKS @@ -28,6 +28,7 @@ Carlo Teubner carlo.teubner@gmail.com Cesar Strauss cestrauss@gmail.com Chris McGuire chris@wso.net Chris Penev xpenev@gmail.com +Dagobert Michelsen dagobert@familie-michelsen.de Damian Menscher menscher@uiuc.edu Dan Jacobson jidanni@jidanni.org David J. MacKenzie djm@uunet.uu.net @@ -68,6 +69,7 @@ Karl Berry karl@freefriends.org Karl Nelson nelson85@llnl.gov Karl Vogel vogelke@c-17igp.wpafb.af.mil Kaveh R. Ghazi ghazi@noc.rutgers.edu +KO Myung-Hun komh@chollian.net Konrad Schwarz konrad.schwarz@siemens.com Kristine Lund lund@lpnaxp.in2p3.fr Krste Asanovic krste@icsi.berkeley.edu @@ -128,6 +130,7 @@ Tom Tromey tromey@cns.caltech.edu Ulrich Drepper drepper@gnu.org Vern Paxson vern@ee.lbl.gov Vincent Lonngren Vincent.lonngren.759@student.lu.se +Vitezslav Crhonek vcrhonek@redhat.com Vivek P. Singhal singhal@cs.utexas.edu Walter Wong wcw+@cmu.edu @@ -137,7 +140,7 @@ Local Variables: coding: utf-8 End: -Copyright (C) 2000, 2006-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006-2014, 2016 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or diff --git a/contrib/tools/m4/TODO b/contrib/tools/m4/TODO index 0b1d6f6032..55b5d1c5cc 100644 --- a/contrib/tools/m4/TODO +++ b/contrib/tools/m4/TODO @@ -37,7 +37,8 @@ mode: outline outline-regexp: " *[-+*.] \\|" End: -Copyright (C) 2000, 2006-2007, 2009-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, +Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or diff --git a/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt b/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt index d0b80967ae..a965e77fd8 100644 --- a/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt +++ b/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt @@ -1,38 +1,28 @@ ====================COPYRIGHT==================== - Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2013 Free Software + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - - -====================COPYRIGHT==================== - Copyright (C) 1988-1994, 1996-2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -44,43 +34,48 @@ ====================COPYRIGHT==================== - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990, 2001, 2003-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1990-2000, 2002-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1991, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1991-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software + Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. @@ -90,120 +85,134 @@ ====================COPYRIGHT==================== - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2013 Free Software + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1996-1999, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1996-1999, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2016 Free Software + Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2013 Free Software + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2013 Free Software + Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2001, 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2001, 2003, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2002, 2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2002, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2004, 2006, 2009-2013 Free Software Foundation, + Copyright (C) 1999, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2003, 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2004-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2003-2004, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000, 2003, 2005-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2008. + + +====================COPYRIGHT==================== + Copyright (C) 1999-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 2000, 2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. @@ -218,154 +227,162 @@ ====================COPYRIGHT==================== - Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. ====================COPYRIGHT==================== - Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2005, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2006-2007, 2009-2013 Free Software Foundation, + Copyright (C) 2001, 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== - Copyright (C) 2001, 2003-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 2001-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002, 2004, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002, 2004, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. ====================COPYRIGHT==================== - Copyright (C) 2003, 2005, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. @@ -374,23 +391,23 @@ ====================COPYRIGHT==================== - Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== @@ -398,7 +415,11 @@ ====================COPYRIGHT==================== - Copyright (C) 2006, 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 2006, 2011-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. @@ -407,7 +428,11 @@ ====================COPYRIGHT==================== - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== @@ -416,6 +441,10 @@ ====================COPYRIGHT==================== Copyright (C) 2007-2013 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 2007-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. @@ -428,69 +457,83 @@ ====================COPYRIGHT==================== + Copyright (C) 2008-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== Copyright (C) 2009-2013 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 2011-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright 2000-2003, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright 2013 Free Software Foundation, Inc. + Copyright 2013-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -/* Copyright (C) 1991, 1994-2002, 2005, 2008-2013 Free Software Foundation, +/* Copyright (C) 1991, 1994-2002, 2005, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== -/* Copyright (C) 1999, 2001-2002, 2006, 2009-2013 Free Software Foundation, +/* Copyright (C) 1999, 2001-2002, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== -/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2013 Free Software +/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== /* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== /* Sequential list data type implemented by a hash table with another list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== /* Variable with FSF copyright information, for version-etc. - Copyright (C) 1999-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2006, 2009-2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== +/* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. ====================COPYRIGHT==================== @@ -499,7 +542,7 @@ Copyright d Free Software Foundation, Inc. ====================File: lib/filenamecat-lgpl.c==================== /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009-2016 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 @@ -587,6 +630,359 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) } +====================File: lib/obstack.c==================== +/* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 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 + 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. + + The GNU C 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 the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + + +#ifdef _LIBC +# include <obstack.h> +#else +# include <config.h> +# include "obstack.h" +#endif + +/* NOTE BEFORE MODIFYING THIS FILE: _OBSTACK_INTERFACE_VERSION in + obstack.h must be incremented whenever callers compiled using an old + obstack.h can no longer properly call the functions in this file. */ + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself, and the installed library + supports the same library interface we do. This code is part of the GNU + C Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand 'configure --with-gnu-libc' and omit the object + files, it is simpler to just do this in the source for each such file. */ +#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 +# include <gnu-versions.h> +# if (_GNU_OBSTACK_INTERFACE_VERSION == _OBSTACK_INTERFACE_VERSION \ + || (_GNU_OBSTACK_INTERFACE_VERSION == 1 \ + && _OBSTACK_INTERFACE_VERSION == 2 \ + && defined SIZEOF_INT && defined SIZEOF_SIZE_T \ + && SIZEOF_INT == SIZEOF_SIZE_T)) +# define _OBSTACK_ELIDE_CODE +# endif +#endif + +#ifndef _OBSTACK_ELIDE_CODE +/* If GCC, or if an oddball (testing?) host that #defines __alignof__, + use the already-supplied __alignof__. Otherwise, this must be Gnulib + (as glibc assumes GCC); defer to Gnulib's alignof_type. */ +# include <stdlib.h> +# include <stdint.h> + +# ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +# endif + +/* Determine default alignment. */ + +/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. + But in fact it might be less smart and round addresses to as much as + DEFAULT_ROUNDING. So we prepare for it to do that. + + DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h. */ +#define DEFAULT_ALIGNMENT MAX (__alignof__ (long double), \ + MAX (__alignof__ (uintmax_t), \ + __alignof__ (void *))) +#define DEFAULT_ROUNDING MAX (sizeof (long double), \ + MAX (sizeof (uintmax_t), \ + sizeof (void *))) + +/* Call functions with either the traditional malloc/free calling + interface, or the mmalloc/mfree interface (that adds an extra first + argument), based on the value of use_extra_arg. */ + +static void * +call_chunkfun (struct obstack *h, size_t size) +{ + if (h->use_extra_arg) + return h->chunkfun.extra (h->extra_arg, size); + else + return h->chunkfun.plain (size); +} + +static void +call_freefun (struct obstack *h, void *old_chunk) +{ + if (h->use_extra_arg) + h->freefun.extra (h->extra_arg, old_chunk); + else + h->freefun.plain (old_chunk); +} + + +/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). + Objects start on multiples of ALIGNMENT (0 means use default). + + Return nonzero if successful, calls obstack_alloc_failed_handler if + allocation fails. */ + +static int +_obstack_begin_worker (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment) +{ + struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + + h->chunk_size = size; + h->alignment_mask = alignment - 1; + + chunk = h->chunk = call_chunkfun (h, h->chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); + h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +int +_obstack_begin (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (size_t), + void (*freefun) (void *)) +{ + h->chunkfun.plain = chunkfun; + h->freefun.plain = freefun; + h->use_extra_arg = 0; + return _obstack_begin_worker (h, size, alignment); +} + +int +_obstack_begin_1 (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (void *, size_t), + void (*freefun) (void *, void *), + void *arg) +{ + h->chunkfun.extra = chunkfun; + h->freefun.extra = freefun; + h->extra_arg = arg; + h->use_extra_arg = 1; + return _obstack_begin_worker (h, size, alignment); +} + +/* Allocate a new current chunk for the obstack *H + on the assumption that LENGTH bytes need to be added + to the current object, or a new object of length LENGTH allocated. + Copies any partial object from the end of the old chunk + to the beginning of the new one. */ + +void +_obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length) +{ + struct _obstack_chunk *old_chunk = h->chunk; + struct _obstack_chunk *new_chunk = 0; + size_t obj_size = h->next_free - h->object_base; + char *object_base; + + /* Compute size for new chunk. */ + size_t sum1 = obj_size + length; + size_t sum2 = sum1 + h->alignment_mask; + size_t new_size = sum2 + (obj_size >> 3) + 100; + if (new_size < sum2) + new_size = sum2; + if (new_size < h->chunk_size) + new_size = h->chunk_size; + + /* Allocate and initialize the new chunk. */ + if (obj_size <= sum1 && sum1 <= sum2) + new_chunk = call_chunkfun (h, new_size); + if (!new_chunk) + (*obstack_alloc_failed_handler)(); + h->chunk = new_chunk; + new_chunk->prev = old_chunk; + new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; + + /* Compute an aligned object_base in the new chunk */ + object_base = + __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); + + /* Move the existing object to the new chunk. */ + memcpy (object_base, h->object_base, obj_size); + + /* If the object just copied was the only data in OLD_CHUNK, + free that chunk and remove it from the chain. + But not if that chunk might contain an empty object. */ + if (!h->maybe_empty_object + && (h->object_base + == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, + h->alignment_mask))) + { + new_chunk->prev = old_chunk->prev; + call_freefun (h, old_chunk); + } + + h->object_base = object_base; + h->next_free = h->object_base + obj_size; + /* The new chunk certainly contains no empty object yet. */ + h->maybe_empty_object = 0; +} + +/* Return nonzero if object OBJ has been allocated from obstack H. + This is here for debugging. + If you use it in a program, you are probably losing. */ + +/* Suppress -Wmissing-prototypes warning. We don't want to declare this in + obstack.h because it is just for debugging. */ +int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__; + +int +_obstack_allocated_p (struct obstack *h, void *obj) +{ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = (h)->chunk; + /* We use >= rather than > since the object cannot be exactly at + the beginning of the chunk but might be an empty object exactly + at the end of an adjacent chunk. */ + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) + { + plp = lp->prev; + lp = plp; + } + return lp != 0; +} + +/* Free objects in obstack H, including OBJ and everything allocate + more recently than OBJ. If OBJ is zero, free everything in H. */ + +void +_obstack_free (struct obstack *h, void *obj) +{ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = h->chunk; + /* We use >= because there cannot be an object at the beginning of a chunk. + But there can be an empty object at that address + at the end of another chunk. */ + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) + { + plp = lp->prev; + call_freefun (h, lp); + lp = plp; + /* If we switch chunks, we can't tell whether the new current + chunk contains an empty object, so assume that it may. */ + h->maybe_empty_object = 1; + } + if (lp) + { + h->object_base = h->next_free = (char *) (obj); + h->chunk_limit = lp->limit; + h->chunk = lp; + } + else if (obj != 0) + /* obj is not in any of the chunks! */ + abort (); +} + +_OBSTACK_SIZE_T +_obstack_memory_used (struct obstack *h) +{ + struct _obstack_chunk *lp; + _OBSTACK_SIZE_T nbytes = 0; + + for (lp = h->chunk; lp != 0; lp = lp->prev) + { + nbytes += lp->limit - (char *) lp; + } + return nbytes; +} + +# ifndef _OBSTACK_NO_ERROR_HANDLER +/* Define the error handler. */ +# include <stdio.h> + +/* Exit value used when 'print_and_abort' is used. */ +# ifdef _LIBC +int obstack_exit_failure = EXIT_FAILURE; +# else +# include "exitfail.h" +# define obstack_exit_failure exit_failure +# endif + +# ifdef _LIBC +# include <libintl.h> +# else +# include "gettext.h" +# endif +# ifndef _ +# define _(msgid) gettext (msgid) +# endif + +# ifdef _LIBC +# include <libio/iolibio.h> +# endif + +static _Noreturn void +print_and_abort (void) +{ + /* Don't change any of these strings. Yes, it would be possible to add + the newline to the string and use fputs or so. But this must not + happen because the "memory exhausted" message appears in other places + like this and the translation should be reused instead of creating + a very similar string which requires a separate translation. */ +# ifdef _LIBC + (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); +# else + fprintf (stderr, "%s\n", _("memory exhausted")); +# endif + exit (obstack_exit_failure); +} + +/* The functions allocating more room by calling 'obstack_chunk_alloc' + jump to the handler pointed to by 'obstack_alloc_failed_handler'. + This can be set to a user defined function which should either + abort gracefully or use longjump - but shouldn't return. This + variable by default points to the internal function + 'print_and_abort'. */ +__attribute_noreturn__ void (*obstack_alloc_failed_handler) (void) + = print_and_abort; +# endif /* !_OBSTACK_NO_ERROR_HANDLER */ +#endif /* !_OBSTACK_ELIDE_CODE */ + + ====================GPL-3.0-or-later==================== 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 @@ -671,6 +1067,21 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) This program 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 <http://www.gnu.org/licenses/>. */ + + +====================GPL-3.0-or-later==================== + 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 Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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. diff --git a/contrib/tools/m4/lib/asnprintf.c b/contrib/tools/m4/lib/asnprintf.c index 76e228d860..f23b776786 100644 --- a/contrib/tools/m4/lib/asnprintf.c +++ b/contrib/tools/m4/lib/asnprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2016 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/contrib/tools/m4/lib/basename-lgpl.c b/contrib/tools/m4/lib/basename-lgpl.c index 9307e83142..11821096ae 100644 --- a/contrib/tools/m4/lib/basename-lgpl.c +++ b/contrib/tools/m4/lib/basename-lgpl.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/basename.c b/contrib/tools/m4/lib/basename.c index d73fd41aa1..ed1872d404 100644 --- a/contrib/tools/m4/lib/basename.c +++ b/contrib/tools/m4/lib/basename.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/binary-io.c b/contrib/tools/m4/lib/binary-io.c index 8bbdb44d12..d828bcd015 100644 --- a/contrib/tools/m4/lib/binary-io.c +++ b/contrib/tools/m4/lib/binary-io.c @@ -1,3 +1,4 @@ #include <config.h> #define BINARY_IO_INLINE _GL_EXTERN_INLINE #include "binary-io.h" +typedef int dummy; diff --git a/contrib/tools/m4/lib/binary-io.h b/contrib/tools/m4/lib/binary-io.h index 256c23a0ea..8dbc25b6a1 100644 --- a/contrib/tools/m4/lib/binary-io.h +++ b/contrib/tools/m4/lib/binary-io.h @@ -1,5 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2008-2016 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,7 +68,7 @@ set_binary_mode (int fd, int mode) /* SET_BINARY (fd); changes the file descriptor fd to perform binary I/O. */ -#ifdef __DJGPP__ +#if defined __DJGPP__ || defined __EMX__ # include <unistd.h> /* declares isatty() */ /* Avoid putting stdin/stdout in binary mode if it is connected to the console, because that would make it impossible for the user diff --git a/contrib/tools/m4/lib/c-ctype.c b/contrib/tools/m4/lib/c-ctype.c index 752d2e32ae..5d9d4d87a6 100644 --- a/contrib/tools/m4/lib/c-ctype.c +++ b/contrib/tools/m4/lib/c-ctype.c @@ -1,395 +1,3 @@ -/* Character handling in C locale. - - Copyright 2000-2003, 2006, 2009-2013 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 Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -This program 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 <http://www.gnu.org/licenses/>. */ - #include <config.h> - -/* Specification. */ -#define NO_C_CTYPE_MACROS +#define C_CTYPE_INLINE _GL_EXTERN_INLINE #include "c-ctype.h" - -/* The function isascii is not locale dependent. Its use in EBCDIC is - questionable. */ -bool -c_isascii (int c) -{ - return (c >= 0x00 && c <= 0x7f); -} - -bool -c_isalnum (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); -#else - return ((c >= '0' && c <= '9') - || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z')); -#endif -#else - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isalpha (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); -#else - return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); -#endif -#else - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isblank (int c) -{ - return (c == ' ' || c == '\t'); -} - -bool -c_iscntrl (int c) -{ -#if C_CTYPE_ASCII - return ((c & ~0x1f) == 0 || c == 0x7f); -#else - switch (c) - { - case ' ': case '!': case '"': case '#': case '$': case '%': - case '&': case '\'': case '(': case ')': case '*': case '+': - case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '[': case '\\': case ']': case '^': case '_': case '`': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '{': case '|': case '}': case '~': - return 0; - default: - return 1; - } -#endif -} - -bool -c_isdigit (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS - return (c >= '0' && c <= '9'); -#else - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - return 1; - default: - return 0; - } -#endif -} - -bool -c_islower (int c) -{ -#if C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'a' && c <= 'z'); -#else - switch (c) - { - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isgraph (int c) -{ -#if C_CTYPE_ASCII - return (c >= '!' && c <= '~'); -#else - switch (c) - { - case '!': case '"': case '#': case '$': case '%': case '&': - case '\'': case '(': case ')': case '*': case '+': case ',': - case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '[': case '\\': case ']': case '^': case '_': case '`': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isprint (int c) -{ -#if C_CTYPE_ASCII - return (c >= ' ' && c <= '~'); -#else - switch (c) - { - case ' ': case '!': case '"': case '#': case '$': case '%': - case '&': case '\'': case '(': case ')': case '*': case '+': - case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '[': case '\\': case ']': case '^': case '_': case '`': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_ispunct (int c) -{ -#if C_CTYPE_ASCII - return ((c >= '!' && c <= '~') - && !((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); -#else - switch (c) - { - case '!': case '"': case '#': case '$': case '%': case '&': - case '\'': case '(': case ')': case '*': case '+': case ',': - case '-': case '.': case '/': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - case '[': case '\\': case ']': case '^': case '_': case '`': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isspace (int c) -{ - return (c == ' ' || c == '\t' - || c == '\n' || c == '\v' || c == '\f' || c == '\r'); -} - -bool -c_isupper (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE - return (c >= 'A' && c <= 'Z'); -#else - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isxdigit (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); -#else - return ((c >= '0' && c <= '9') - || (c >= 'A' && c <= 'F') - || (c >= 'a' && c <= 'f')); -#endif -#else - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - return 1; - default: - return 0; - } -#endif -} - -int -c_tolower (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); -#else - switch (c) - { - case 'A': return 'a'; - case 'B': return 'b'; - case 'C': return 'c'; - case 'D': return 'd'; - case 'E': return 'e'; - case 'F': return 'f'; - case 'G': return 'g'; - case 'H': return 'h'; - case 'I': return 'i'; - case 'J': return 'j'; - case 'K': return 'k'; - case 'L': return 'l'; - case 'M': return 'm'; - case 'N': return 'n'; - case 'O': return 'o'; - case 'P': return 'p'; - case 'Q': return 'q'; - case 'R': return 'r'; - case 'S': return 's'; - case 'T': return 't'; - case 'U': return 'u'; - case 'V': return 'v'; - case 'W': return 'w'; - case 'X': return 'x'; - case 'Y': return 'y'; - case 'Z': return 'z'; - default: return c; - } -#endif -} - -int -c_toupper (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); -#else - switch (c) - { - case 'a': return 'A'; - case 'b': return 'B'; - case 'c': return 'C'; - case 'd': return 'D'; - case 'e': return 'E'; - case 'f': return 'F'; - case 'g': return 'G'; - case 'h': return 'H'; - case 'i': return 'I'; - case 'j': return 'J'; - case 'k': return 'K'; - case 'l': return 'L'; - case 'm': return 'M'; - case 'n': return 'N'; - case 'o': return 'O'; - case 'p': return 'P'; - case 'q': return 'Q'; - case 'r': return 'R'; - case 's': return 'S'; - case 't': return 'T'; - case 'u': return 'U'; - case 'v': return 'V'; - case 'w': return 'W'; - case 'x': return 'X'; - case 'y': return 'Y'; - case 'z': return 'Z'; - default: return c; - } -#endif -} diff --git a/contrib/tools/m4/lib/c-ctype.h b/contrib/tools/m4/lib/c-ctype.h index ad589b5c20..717ae78bb6 100644 --- a/contrib/tools/m4/lib/c-ctype.h +++ b/contrib/tools/m4/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-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2016 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 @@ -25,6 +25,13 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef C_CTYPE_INLINE +# define C_CTYPE_INLINE _GL_INLINE +#endif #ifdef __cplusplus extern "C" { @@ -39,38 +46,6 @@ extern "C" { characters. */ -/* Check whether the ASCII optimizations apply. */ - -/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that - '0', '1', ..., '9' have consecutive integer values. */ -#define C_CTYPE_CONSECUTIVE_DIGITS 1 - -#if ('A' <= 'Z') \ - && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ - && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ - && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ - && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ - && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ - && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ - && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ - && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ - && ('Y' + 1 == 'Z') -#define C_CTYPE_CONSECUTIVE_UPPERCASE 1 -#endif - -#if ('a' <= 'z') \ - && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ - && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ - && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ - && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ - && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ - && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ - && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ - && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ - && ('y' + 1 == 'z') -#define C_CTYPE_CONSECUTIVE_LOWERCASE 1 -#endif - #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ @@ -96,11 +71,84 @@ extern "C" { && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) /* The character set is ASCII or one of its variants or extensions, not EBCDIC. Testing the value of '\n' and '\r' is not relevant. */ -#define C_CTYPE_ASCII 1 +# define C_CTYPE_ASCII 1 +#elif ! (' ' == '\x40' && '0' == '\xf0' \ + && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \ + && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2') +# error "Only ASCII and EBCDIC are supported" #endif +#if 'A' < 0 +# error "EBCDIC and char is signed -- not supported" +#endif + +/* Cases for control characters. */ + +#define _C_CTYPE_CNTRL \ + case '\a': case '\b': case '\f': case '\n': \ + case '\r': case '\t': case '\v': \ + _C_CTYPE_OTHER_CNTRL + +/* ASCII control characters other than those with \-letter escapes. */ + +#if C_CTYPE_ASCII +# define _C_CTYPE_OTHER_CNTRL \ + case '\x00': case '\x01': case '\x02': case '\x03': \ + case '\x04': case '\x05': case '\x06': case '\x0e': \ + case '\x0f': case '\x10': case '\x11': case '\x12': \ + case '\x13': case '\x14': case '\x15': case '\x16': \ + case '\x17': case '\x18': case '\x19': case '\x1a': \ + case '\x1b': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x7f' +#else + /* Use EBCDIC code page 1047's assignments for ASCII control chars; + assume all EBCDIC code pages agree about these assignments. */ +# define _C_CTYPE_OTHER_CNTRL \ + case '\x00': case '\x01': case '\x02': case '\x03': \ + case '\x07': case '\x0e': case '\x0f': case '\x10': \ + case '\x11': case '\x12': case '\x13': case '\x18': \ + case '\x19': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x26': case '\x27': case '\x2d': \ + case '\x2e': case '\x32': case '\x37': case '\x3c': \ + case '\x3d': case '\x3f' +#endif -/* Function declarations. */ +/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ + +#define _C_CTYPE_LOWER_A_THRU_F_N(n) \ + case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ + case 'e' + (n): case 'f' + (n) +#define _C_CTYPE_LOWER_N(n) \ + _C_CTYPE_LOWER_A_THRU_F_N(n): \ + case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \ + case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \ + case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \ + case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \ + case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n) + +/* Cases for hex letters, digits, lower, punct, and upper. */ + +#define _C_CTYPE_A_THRU_F \ + _C_CTYPE_LOWER_A_THRU_F_N (0): \ + _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a') +#define _C_CTYPE_DIGIT \ + case '0': case '1': case '2': case '3': \ + case '4': case '5': case '6': case '7': \ + case '8': case '9' +#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0) +#define _C_CTYPE_PUNCT \ + case '!': case '"': case '#': case '$': \ + case '%': case '&': case '\'': case '(': \ + case ')': case '*': case '+': case ',': \ + case '-': case '.': case '/': case ':': \ + case ';': case '<': case '=': case '>': \ + case '?': case '@': case '[': case '\\': \ + case ']': case '^': case '_': case '`': \ + case '{': case '|': case '}': case '~' +#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a') + + +/* Function definitions. */ /* Unlike the functions in <ctype.h>, which require an argument in the range of the 'unsigned char' type, the functions here operate on values that are @@ -117,179 +165,202 @@ extern "C" { if (c_isalpha (*s)) ... */ -extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */ - -extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST; -extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST; -extern bool c_islower (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST; -extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST; - -extern int c_tolower (int c) _GL_ATTRIBUTE_CONST; -extern int c_toupper (int c) _GL_ATTRIBUTE_CONST; - - -#if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \ - && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS) - -/* ASCII optimizations. */ - -#undef c_isascii -#define c_isascii(c) \ - ({ int __c = (c); \ - (__c >= 0x00 && __c <= 0x7f); \ - }) +C_CTYPE_INLINE bool +c_isalnum (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isalnum -#define c_isalnum(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ - }) -#else -#undef c_isalnum -#define c_isalnum(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || (__c >= 'A' && __c <= 'Z') \ - || (__c >= 'a' && __c <= 'z')); \ - }) -#endif -#endif +C_CTYPE_INLINE bool +c_isalpha (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isalpha -#define c_isalpha(c) \ - ({ int __c = (c); \ - ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ - }) -#else -#undef c_isalpha -#define c_isalpha(c) \ - ({ int __c = (c); \ - ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ - }) -#endif -#endif +/* The function isascii is not locale dependent. + Its use in EBCDIC is questionable. */ +C_CTYPE_INLINE bool +c_isascii (int c) +{ + switch (c) + { + case ' ': + _C_CTYPE_CNTRL: + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#undef c_isblank -#define c_isblank(c) \ - ({ int __c = (c); \ - (__c == ' ' || __c == '\t'); \ - }) +C_CTYPE_INLINE bool +c_isblank (int c) +{ + return c == ' ' || c == '\t'; +} -#if C_CTYPE_ASCII -#undef c_iscntrl -#define c_iscntrl(c) \ - ({ int __c = (c); \ - ((__c & ~0x1f) == 0 || __c == 0x7f); \ - }) -#endif +C_CTYPE_INLINE bool +c_iscntrl (int c) +{ + switch (c) + { + _C_CTYPE_CNTRL: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_DIGITS -#undef c_isdigit -#define c_isdigit(c) \ - ({ int __c = (c); \ - (__c >= '0' && __c <= '9'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isdigit (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_LOWERCASE -#undef c_islower -#define c_islower(c) \ - ({ int __c = (c); \ - (__c >= 'a' && __c <= 'z'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isgraph (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_ASCII -#undef c_isgraph -#define c_isgraph(c) \ - ({ int __c = (c); \ - (__c >= '!' && __c <= '~'); \ - }) -#endif +C_CTYPE_INLINE bool +c_islower (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + return true; + default: + return false; + } +} -#if C_CTYPE_ASCII -#undef c_isprint -#define c_isprint(c) \ - ({ int __c = (c); \ - (__c >= ' ' && __c <= '~'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isprint (int c) +{ + switch (c) + { + case ' ': + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_ASCII -#undef c_ispunct -#define c_ispunct(c) \ - ({ int _c = (c); \ - (c_isgraph (_c) && ! c_isalnum (_c)); \ - }) -#endif +C_CTYPE_INLINE bool +c_ispunct (int c) +{ + switch (c) + { + _C_CTYPE_PUNCT: + return true; + default: + return false; + } +} -#undef c_isspace -#define c_isspace(c) \ - ({ int __c = (c); \ - (__c == ' ' || __c == '\t' \ - || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ - }) - -#if C_CTYPE_CONSECUTIVE_UPPERCASE -#undef c_isupper -#define c_isupper(c) \ - ({ int __c = (c); \ - (__c >= 'A' && __c <= 'Z'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isspace (int c) +{ + switch (c) + { + case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isxdigit -#define c_isxdigit(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ - }) -#else -#undef c_isxdigit -#define c_isxdigit(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || (__c >= 'A' && __c <= 'F') \ - || (__c >= 'a' && __c <= 'f')); \ - }) -#endif -#endif +C_CTYPE_INLINE bool +c_isupper (int c) +{ + switch (c) + { + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#undef c_tolower -#define c_tolower(c) \ - ({ int __c = (c); \ - (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ - }) -#undef c_toupper -#define c_toupper(c) \ - ({ int __c = (c); \ - (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ - }) -#endif +C_CTYPE_INLINE bool +c_isxdigit (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_A_THRU_F: + return true; + default: + return false; + } +} -#endif /* optimizing for speed */ +C_CTYPE_INLINE int +c_tolower (int c) +{ + switch (c) + { + _C_CTYPE_UPPER: + return c - 'A' + 'a'; + default: + return c; + } +} +C_CTYPE_INLINE int +c_toupper (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + return c - 'a' + 'A'; + default: + return c; + } +} #ifdef __cplusplus } #endif +_GL_INLINE_HEADER_END + #endif /* C_CTYPE_H */ diff --git a/contrib/tools/m4/lib/c-stack.c b/contrib/tools/m4/lib/c-stack.c index ac0aacba66..aab7d799f9 100644 --- a/contrib/tools/m4/lib/c-stack.c +++ b/contrib/tools/m4/lib/c-stack.c @@ -1,6 +1,6 @@ /* Stack overflow handling. - Copyright (C) 2002, 2004, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2008-2016 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 @@ -78,6 +78,7 @@ typedef struct sigaltstack stack_t; #include "c-stack.h" #include "exitfail.h" #include "ignore-value.h" +#include "getprogname.h" #if defined SA_ONSTACK && defined SA_SIGINFO # define SIGINFO_WORKS 1 @@ -88,8 +89,6 @@ typedef struct sigaltstack stack_t; # endif #endif -extern char *program_name; - /* The user-specified action to take when a SEGV-related program error or stack overflow occurs. */ static void (* volatile segv_action) (int); @@ -116,7 +115,7 @@ die (int signo) #endif /* !SIGINFO_WORKS && !HAVE_LIBSIGSEGV */ segv_action (signo); message = signo ? program_error_message : stack_overflow_message; - ignore_value (write (STDERR_FILENO, program_name, strlen (program_name))); + ignore_value (write (STDERR_FILENO, getprogname (), strlen (getprogname ()))); ignore_value (write (STDERR_FILENO, ": ", 2)); ignore_value (write (STDERR_FILENO, message, strlen (message))); ignore_value (write (STDERR_FILENO, "\n", 1)); diff --git a/contrib/tools/m4/lib/c-stack.h b/contrib/tools/m4/lib/c-stack.h index 2e61bdf01d..efd3b8f0b7 100644 --- a/contrib/tools/m4/lib/c-stack.h +++ b/contrib/tools/m4/lib/c-stack.h @@ -1,6 +1,6 @@ /* Stack overflow handling. - Copyright (C) 2002, 2004, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2008-2016 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/contrib/tools/m4/lib/c-strcase.h b/contrib/tools/m4/lib/c-strcase.h index 49e1bb03dd..7e570f59b8 100644 --- a/contrib/tools/m4/lib/c-strcase.h +++ b/contrib/tools/m4/lib/c-strcase.h @@ -1,5 +1,5 @@ /* Case-insensitive string comparison functions in C locale. - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/c-strcasecmp.c b/contrib/tools/m4/lib/c-strcasecmp.c index ef85f0e67d..bd113b7a2c 100644 --- a/contrib/tools/m4/lib/c-strcasecmp.c +++ b/contrib/tools/m4/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-2013 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2016 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/contrib/tools/m4/lib/c-strcaseeq.h b/contrib/tools/m4/lib/c-strcaseeq.h index afdea26ba9..ed5725165c 100644 --- a/contrib/tools/m4/lib/c-strcaseeq.h +++ b/contrib/tools/m4/lib/c-strcaseeq.h @@ -1,5 +1,5 @@ /* Optimized case-insensitive string comparison in C locale. - Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2016 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 @@ -33,9 +33,6 @@ # if C_CTYPE_ASCII # define CASEEQ(other,upper) \ (c_isupper (upper) ? ((other) & ~0x20) == (upper) : (other) == (upper)) -# elif C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -# define CASEEQ(other,upper) \ - (c_isupper (upper) ? (other) == (upper) || (other) == (upper) - 'A' + 'a' : (other) == (upper)) # else # define CASEEQ(other,upper) \ (c_toupper (other) == (upper)) diff --git a/contrib/tools/m4/lib/c-strncasecmp.c b/contrib/tools/m4/lib/c-strncasecmp.c index 04404b00cd..c316929d0d 100644 --- a/contrib/tools/m4/lib/c-strncasecmp.c +++ b/contrib/tools/m4/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-2013 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2016 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/contrib/tools/m4/lib/clean-temp.c b/contrib/tools/m4/lib/clean-temp.c index 1053312ecb..9e0fb27180 100644 --- a/contrib/tools/m4/lib/clean-temp.c +++ b/contrib/tools/m4/lib/clean-temp.c @@ -1,5 +1,5 @@ /* Temporary directories and temporary files with automatic cleanup. - Copyright (C) 2001, 2003, 2006-2007, 2009-2013 Free Software Foundation, + Copyright (C) 2001, 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. @@ -69,13 +69,6 @@ # define uintptr_t unsigned long #endif -#if !GNULIB_FCNTL_SAFER -/* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ -# undef open -# undef close -#endif - /* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5)) ensure that while constructing or modifying the data structures, the field @@ -591,7 +584,7 @@ supports_delete_on_close () /* According to <http://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx> - this structure must be initialised as follows: */ + this structure must be initialized as follows: */ v.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (GetVersionEx (&v)) diff --git a/contrib/tools/m4/lib/clean-temp.h b/contrib/tools/m4/lib/clean-temp.h index 24aeca83eb..335e504bfa 100644 --- a/contrib/tools/m4/lib/clean-temp.h +++ b/contrib/tools/m4/lib/clean-temp.h @@ -1,5 +1,5 @@ /* Temporary directories and temporary files with automatic cleanup. - Copyright (C) 2006, 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2011-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/cloexec.c b/contrib/tools/m4/lib/cloexec.c index e3e42d2855..1202836f7c 100644 --- a/contrib/tools/m4/lib/cloexec.c +++ b/contrib/tools/m4/lib/cloexec.c @@ -1,6 +1,6 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2016 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/contrib/tools/m4/lib/cloexec.h b/contrib/tools/m4/lib/cloexec.h index 0c5935ba56..0e5843736c 100644 --- a/contrib/tools/m4/lib/cloexec.h +++ b/contrib/tools/m4/lib/cloexec.h @@ -1,6 +1,6 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2016 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/contrib/tools/m4/lib/close-stream.c b/contrib/tools/m4/lib/close-stream.c index d6a869287e..0c4beaec80 100644 --- a/contrib/tools/m4/lib/close-stream.c +++ b/contrib/tools/m4/lib/close-stream.c @@ -1,6 +1,6 @@ /* Close a stream, with nicer error checking than fclose's. - Copyright (C) 1998-2002, 2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2016 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/contrib/tools/m4/lib/close.c b/contrib/tools/m4/lib/close.c index f620e54bba..46a7aa5176 100644 --- a/contrib/tools/m4/lib/close.c +++ b/contrib/tools/m4/lib/close.c @@ -1,5 +1,5 @@ /* close replacement. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 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/contrib/tools/m4/lib/closein.c b/contrib/tools/m4/lib/closein.c index 20d5035eec..7415b19f05 100644 --- a/contrib/tools/m4/lib/closein.c +++ b/contrib/tools/m4/lib/closein.c @@ -1,6 +1,6 @@ /* Close standard input, rewinding seekable stdin if necessary. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 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/contrib/tools/m4/lib/closein.h b/contrib/tools/m4/lib/closein.h index 84bbeefceb..c5788398c5 100644 --- a/contrib/tools/m4/lib/closein.h +++ b/contrib/tools/m4/lib/closein.h @@ -1,6 +1,6 @@ /* Close standard input, rewinding seekable stdin if necessary. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 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/contrib/tools/m4/lib/closeout.c b/contrib/tools/m4/lib/closeout.c index d4d3edca4e..311faf4c5a 100644 --- a/contrib/tools/m4/lib/closeout.c +++ b/contrib/tools/m4/lib/closeout.c @@ -1,6 +1,6 @@ /* Close standard output and standard error, exiting with a diagnostic on error. - Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/closeout.h b/contrib/tools/m4/lib/closeout.h index 131fe864ec..bde9bf0983 100644 --- a/contrib/tools/m4/lib/closeout.h +++ b/contrib/tools/m4/lib/closeout.h @@ -1,6 +1,6 @@ /* Close standard output and standard error. - Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2013 Free Software + Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/config-linux.h b/contrib/tools/m4/lib/config-linux.h index 3cdf582e1a..aa814feb46 100644 --- a/contrib/tools/m4/lib/config-linux.h +++ b/contrib/tools/m4/lib/config-linux.h @@ -31,6 +31,9 @@ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ +/* Define to 1 if the C locale may have encoding errors. */ +#define C_LOCALE_MAYBE_EILSEQ 1 + /* Define as the bit index in the word where to find bit 0 of the exponent of 'double'. */ #define DBL_EXPBIT0_BIT 20 @@ -44,6 +47,16 @@ /* Define as the word index where to find the sign of 'double'. */ /* #undef DBL_SIGNBIT_WORD */ +/* the name of the file descriptor member of DIR */ +/* #undef DIR_FD_MEMBER_NAME */ + +#ifdef DIR_FD_MEMBER_NAME +# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) +#else +# define DIR_TO_FD(Dir_p) -1 +#endif + + /* Define to 1 if // is a file system root distinct from /. */ /* #undef DOUBLE_SLASH_IS_DISTINCT_ROOT */ @@ -56,6 +69,15 @@ /* Define this to 1 if F_DUPFD behavior does not match POSIX */ /* #undef FCNTL_DUPFD_BUGGY */ +/* Define to nothing if C supports flexible array members, and to 1 if it does + not. That way, with a declaration like 'struct s { int n; double + d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 + compilers. When computing the size of such an object, don't use 'sizeof + (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' + instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with + MSVC and with C++ compilers. */ +#define FLEXIBLE_ARRAY_MEMBER /**/ + /* Define as the bit index in the word where to find bit 0 of the exponent of 'float'. */ #define FLT_EXPBIT0_BIT 23 @@ -101,7 +123,7 @@ /* Define this to 'void' or 'struct timezone' to match the system's declaration of the second argument to gettimeofday. */ -#define GETTIMEOFDAY_TIMEZONE struct timezone +#define GETTIMEOFDAY_TIMEZONE void /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module canonicalize-lgpl shall be considered present. */ @@ -140,13 +162,13 @@ #define GNULIB_LOCK 1 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending - whether the gnulib module malloc-gnu shall be considered present. */ -#define GNULIB_MALLOC_GNU 1 - -/* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module pipe2-safer shall be considered present. */ #define GNULIB_PIPE2_SAFER 1 +/* Define to 1 if printf and friends should be labeled with attribute + "__gnu_printf__" instead of "__printf__" */ +/* #undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU */ + /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module scanf shall be considered present. */ #define GNULIB_SCANF 1 @@ -182,6 +204,9 @@ /* Define to 1 when the gnulib module closedir should be tested. */ #define GNULIB_TEST_CLOSEDIR 1 +/* Define to 1 when the gnulib module dirfd should be tested. */ +#define GNULIB_TEST_DIRFD 1 + /* Define to 1 when the gnulib module dup should be tested. */ #define GNULIB_TEST_DUP 1 @@ -236,9 +261,6 @@ /* Define to 1 when the gnulib module getdtablesize should be tested. */ #define GNULIB_TEST_GETDTABLESIZE 1 -/* Define to 1 when the gnulib module getopt-gnu should be tested. */ -#define GNULIB_TEST_GETOPT_GNU 1 - /* Define to 1 when the gnulib module getpagesize should be tested. */ #define GNULIB_TEST_GETPAGESIZE 1 @@ -491,6 +513,10 @@ don't. */ /* #undef HAVE_DECL_COPYSIGNL */ +/* Define to 1 if you have the declaration of `dirfd', and to 0 if you don't. + */ +#define HAVE_DECL_DIRFD 1 + /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #define HAVE_DECL_FEOF_UNLOCKED 1 @@ -543,6 +569,10 @@ don't. */ #define HAVE_DECL_GETC_UNLOCKED 1 +/* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you + don't. */ +#define HAVE_DECL_GETDTABLESIZE 1 + /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. */ #define HAVE_DECL_GETENV 1 @@ -613,7 +643,7 @@ /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ -#define HAVE_DECL_SYS_SIGLIST 1 +#define HAVE_DECL_SYS_SIGLIST 0 /* Define to 1 if you have the declaration of `towlower', and to 0 if you don't. */ @@ -643,9 +673,20 @@ don't. */ /* #undef HAVE_DECL__SYS_SIGLIST */ +/* Define to 1 if you have the declaration of `__argv', and to 0 if you don't. + */ +#define HAVE_DECL___ARGV 0 + +/* Define to 1 if you have the declaration of `__fpending', and to 0 if you + don't. */ +#define HAVE_DECL___FPENDING 1 + /* Define to 1 if you have the <dirent.h> header file. */ #define HAVE_DIRENT_H 1 +/* Define to 1 if you have the `dirfd' function. */ +#define HAVE_DIRFD 1 + /* Define to 1 if you have the 'dup2' function. */ #define HAVE_DUP2 1 @@ -676,6 +717,21 @@ /* Define to 1 if you have the `getdtablesize' function. */ #define HAVE_GETDTABLESIZE 1 +/* Define to 1 if you have the `getegid' function. */ +#define HAVE_GETEGID 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `getexecname' function. */ +/* #undef HAVE_GETEXECNAME */ + +/* Define to 1 if you have the `getgid' function. */ +#define HAVE_GETGID 1 + +/* Define to 1 if you have the `getlocalename_l' function. */ +/* #undef HAVE_GETLOCALENAME_L */ + /* Define to 1 if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 @@ -685,9 +741,15 @@ /* Define to 1 if you have the `getpagesize' function. */ #define HAVE_GETPAGESIZE 1 +/* Define to 1 if you have the `getprogname' function. */ +/* #undef HAVE_GETPROGNAME */ + /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 +/* Define to 1 if you have the `getuid' function. */ +#define HAVE_GETUID 1 + /* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ #define HAVE_INTMAX_T 1 @@ -708,7 +770,7 @@ #define HAVE_ISNANF_IN_LIBC 1 /* Define if the isnan(long double) function is available in libc. */ -/* #undef HAVE_ISNANL_IN_LIBC */ +#define HAVE_ISNANL_IN_LIBC 1 /* Define to 1 if you have the `issetugid' function. */ /* #undef HAVE_ISSETUGID */ @@ -740,6 +802,9 @@ /* Define if you have the libsigsegv library. */ /* #undef HAVE_LIBSIGSEGV */ +/* Define to 1 if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + /* Define to 1 if you have the `link' function. */ #define HAVE_LINK 1 @@ -749,9 +814,8 @@ /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 -/* Define to 1 if your system has a GNU libc compatible 'malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC_GNU 1 +/* Define to 1 if you have the <malloc.h> header file. */ +#define HAVE_MALLOC_H 1 /* Define if the 'malloc' function is POSIX compliant. */ #define HAVE_MALLOC_POSIX 1 @@ -778,6 +842,12 @@ /* Define to 1 if you have the `mempcpy' function. */ #define HAVE_MEMPCPY 1 +/* Define to 1 if <limits.h> defines the MIN and MAX macros. */ +/* #undef HAVE_MINMAX_IN_LIMITS_H */ + +/* Define to 1 if <sys/param.h> defines the MIN and MAX macros. */ +#define HAVE_MINMAX_IN_SYS_PARAM_H 1 + /* Define to 1 if you have the `mkdtemp' function. */ #define HAVE_MKDTEMP 1 @@ -797,8 +867,8 @@ /* Define to 1 if you have the `nl_langinfo' function. */ #define HAVE_NL_LANGINFO 1 -/* Define to 1 if libc includes obstacks. */ -#define HAVE_OBSTACK 1 +/* Define to 1 if the system has obstacks that work with any size object. */ +/* #undef HAVE_OBSTACK */ /* Define to 1 if you have the `opendir' function. */ #define HAVE_OPENDIR 1 @@ -849,7 +919,7 @@ /* #undef HAVE_SAME_LONG_DOUBLE_AS_DOUBLE */ /* Define to 1 if you have the <sched.h> header file. */ -#define HAVE_SCHED_H 1 +/* #undef HAVE_SCHED_H */ /* Define to 1 if you have the `sched_setparam' function. */ /* #undef HAVE_SCHED_SETPARAM */ @@ -863,6 +933,9 @@ /* Define to 1 if you have the `secure_getenv' function. */ #define HAVE_SECURE_GETENV 1 +/* Define to 1 if you have the `setdtablesize' function. */ +/* #undef HAVE_SETDTABLESIZE */ + /* Define to 1 if you have the `setegid' function. */ /* #undef HAVE_SETEGID */ @@ -975,6 +1048,9 @@ /* Define to 1 if you have the <sys/bitypes.h> header file. */ /* #undef HAVE_SYS_BITYPES_H */ +/* Define to 1 if you have the <sys/cdefs.h> header file. */ +#define HAVE_SYS_CDEFS_H 1 + /* Define to 1 if you have the <sys/inttypes.h> header file. */ /* #undef HAVE_SYS_INTTYPES_H */ @@ -1023,6 +1099,9 @@ /* Define to 1 if you have the `uselocale' function. */ #define HAVE_USELOCALE 1 +/* Define if you have a global __progname variable */ +/* #undef HAVE_VAR___PROGNAME */ + /* Define to 1 if you have the `vasnprintf' function. */ /* #undef HAVE_VASNPRINTF */ @@ -1044,9 +1123,6 @@ /* Define to 1 if you have the `wcrtomb' function. */ #define HAVE_WCRTOMB 1 -/* Define to 1 if you have the `wcscoll' function. */ -#define HAVE_WCSCOLL 1 - /* Define to 1 if you have the `wcslen' function. */ #define HAVE_WCSLEN 1 @@ -1076,7 +1152,7 @@ #define HAVE_WORKING_POSIX_SPAWN 1 /* Define to 1 if you have the <xlocale.h> header file. */ -#define HAVE_XLOCALE_H 1 +/* #undef HAVE_XLOCALE_H */ /* Define to 1 if extending the stack slightly past the limit causes a SIGSEGV, and an alternate stack can be established with sigaltstack, and @@ -1101,6 +1177,16 @@ /* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ /* #undef HAVE__SET_INVALID_PARAMETER_HANDLER */ +/* Define to 1 if the compiler supports __builtin_expect, + and to 2 if <builtins.h> does. */ +#define HAVE___BUILTIN_EXPECT 1 +#ifndef HAVE___BUILTIN_EXPECT +# define __builtin_expect(e, c) (e) +#elif HAVE___BUILTIN_EXPECT == 2 +# include <builtins.h> +#endif + + /* Define to 1 if you have the `__fpurge' function. */ #define HAVE___FPURGE 1 @@ -1140,6 +1226,10 @@ /* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */ /* #undef MAP_ANONYMOUS */ +/* Define if the mbrtowc function does not return (size_t) -2 for empty input. + */ +/* #undef MBRTOWC_EMPTY_INPUT_BUG */ + /* Define if the mbrtowc function has the NULL pwc argument bug. */ /* #undef MBRTOWC_NULL_ARG1_BUG */ @@ -1152,6 +1242,12 @@ /* Define if the mbrtowc function returns a wrong return value. */ /* #undef MBRTOWC_RETVAL_BUG */ +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# define __USE_MINGW_ANSI_STDIO 1 +#endif + + /* Define to 1 if assertions should be disabled. */ /* #undef NDEBUG */ @@ -1193,7 +1289,7 @@ /* Define if the vasnprintf implementation needs special code for infinite 'long double' arguments. */ -#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1 +/* #undef NEED_PRINTF_INFINITE_LONG_DOUBLE */ /* Define if the vasnprintf implementation needs special code for 'long double' arguments. */ @@ -1225,7 +1321,7 @@ /* #undef PACKAGE_PACKAGER_VERSION */ /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU M4 1.4.17" +#define PACKAGE_STRING "GNU M4 1.4.18" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "m4" @@ -1234,10 +1330,7 @@ #define PACKAGE_URL "http://www.gnu.org/software/m4/" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.4.17" - -/* the number of pending output bytes on stream 'fp' */ -/* #undef PENDING_OUTPUT_N_BYTES */ +#define PACKAGE_VERSION "1.4.18" /* Define if <inttypes.h> exists and defines unusable PRI* macros. */ /* #undef PRI_MACROS_BROKEN */ @@ -1275,6 +1368,9 @@ such as on Solaris 9 or cygwin 1.5. */ /* #undef RENAME_TRAILING_SLASH_SOURCE_BUG */ +/* Define to 1 if gnulib's dirfd() replacement is used. */ +/* #undef REPLACE_DIRFD */ + /* Define to 1 if stat needs help when passed a directory name with a trailing slash */ /* #undef REPLACE_FUNC_STAT_DIR */ @@ -1332,7 +1428,7 @@ #define STRERROR_R_CHAR_P 1 /* Shell used by syscmd and esyscmd, must accept -c argument. */ -#define SYSCMD_SHELL "/var/empty/bash-4.3-p46/bin/bash" +#define SYSCMD_SHELL "/var/empty/bash-4.4-p23/bin/bash" /* Define to the prefix of C symbols at the assembler and linker level, either an underscore or empty. */ @@ -1363,7 +1459,7 @@ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif -/* Enable general extensions on OS X. */ +/* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # define _DARWIN_C_SOURCE 1 #endif @@ -1375,6 +1471,34 @@ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# define __STDC_WANT_IEC_60559_BFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# define __STDC_WANT_IEC_60559_DFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# define __STDC_WANT_LIB_EXT2__ 1 +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# define __STDC_WANT_MATH_SPEC_FUNCS__ 1 +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 @@ -1400,7 +1524,7 @@ /* #undef USE_WINDOWS_THREADS */ /* Version number of package */ -#define VERSION "1.4.17" +#define VERSION "1.4.18" /* Define to 1 if unsetenv returns void instead of int. */ /* #undef VOID_UNSETENV */ @@ -1485,6 +1609,12 @@ used. */ /* #undef __GETOPT_PREFIX */ +/* Define to 1 if the system <stdint.h> predates C++11. */ +/* #undef __STDC_CONSTANT_MACROS */ + +/* Define to 1 if the system <stdint.h> predates C++11. */ +/* #undef __STDC_LIMIT_MACROS */ + /* Please see the Gnulib manual for how to use these macros. Suppress extern inline with HP-UX cc, as it appears to be broken; see @@ -1496,29 +1626,50 @@ 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. - Suppress the use of extern inline on problematic Apple configurations, as - Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. - Perhaps Apple will fix this some day. */ -#if (defined __APPLE__ \ - && ((! defined _DONT_USE_CTYPE_INLINE_ \ - && (defined __GNUC__ || defined __cplusplus)) \ - || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ - && defined __GNUC__ && ! defined __cplusplus))) -# define _GL_EXTERN_INLINE_APPLE_BUG + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like <ctype.h>. For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions. This bug is known to occur on: + + OS X 10.8 and earlier; see: + http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + + FreeBSD; see: + http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. + Assume DragonFly and FreeBSD will be similar. */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ + && (defined __header_inline \ + ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ + && ! defined __clang__) \ + : ((! defined _DONT_USE_CTYPE_INLINE_ \ + && (defined __GNUC__ || defined __cplusplus)) \ + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + && defined __GNUC__ && ! defined __cplusplus)))) +# define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ + && !defined __PGI \ && !(defined __SUNPRO_C && __STDC__))) \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) -# if __GNUC_GNU_INLINE__ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) # else @@ -1531,17 +1682,19 @@ # define _GL_EXTERN_INLINE static _GL_UNUSED #endif -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA # else # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif - /* Suppress GCC's bogus "no previous prototype for 'FOO'" - and "no previous declaration for 'FOO'" diagnostics, - when FOO is an inline function in the header; see - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ @@ -1560,9 +1713,6 @@ /* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b)) -/* Define to rpl_gmtime if the replacement function should be used. */ -/* #undef gmtime */ - /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus @@ -1582,9 +1732,6 @@ # define __GNUC_STDC_INLINE__ 1 #endif -/* Define to rpl_localtime if the replacement function should be used. */ -/* #undef localtime */ - /* Define to a type if <wchar.h> does not define. */ /* #undef mbstate_t */ @@ -1685,6 +1832,16 @@ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) diff --git a/contrib/tools/m4/lib/config-win.h b/contrib/tools/m4/lib/config-win.h index ec49f309df..5470ade801 100644 --- a/contrib/tools/m4/lib/config-win.h +++ b/contrib/tools/m4/lib/config-win.h @@ -1220,7 +1220,7 @@ char *strsignal (int signum); /* #undef PACKAGE_PACKAGER_VERSION */ /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU M4 1.4.17" +#define PACKAGE_STRING "GNU M4 1.4.18" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "m4" @@ -1229,7 +1229,7 @@ char *strsignal (int signum); #define PACKAGE_URL "http://www.gnu.org/software/m4/" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.4.17" +#define PACKAGE_VERSION "1.4.18" /* the number of pending output bytes on stream 'fp' */ #if WIN_SDK10 @@ -1399,7 +1399,7 @@ char *strsignal (int signum); /* #undef USE_WINDOWS_THREADS */ /* Version number of package */ -#define VERSION "1.4.17" +#define VERSION "1.4.18" /* Define to 1 if unsetenv returns void instead of int. */ /* #undef VOID_UNSETENV */ diff --git a/contrib/tools/m4/lib/configmake-linux.h b/contrib/tools/m4/lib/configmake-linux.h index 14258f4921..b98a0b824a 100644 --- a/contrib/tools/m4/lib/configmake-linux.h +++ b/contrib/tools/m4/lib/configmake-linux.h @@ -1,27 +1,28 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ -#define PREFIX "/var/empty/gnum4-1.4.17" -#define EXEC_PREFIX "/var/empty/gnum4-1.4.17" -#define BINDIR "/var/empty/gnum4-1.4.17/bin" -#define SBINDIR "/var/empty/gnum4-1.4.17/sbin" -#define LIBEXECDIR "/var/empty/gnum4-1.4.17/libexec" -#define DATAROOTDIR "/var/empty/gnum4-1.4.17/share" -#define DATADIR "/var/empty/gnum4-1.4.17/share" -#define SYSCONFDIR "/var/empty/gnum4-1.4.17/etc" -#define SHAREDSTATEDIR "/var/empty/gnum4-1.4.17/com" -#define LOCALSTATEDIR "/var/empty/gnum4-1.4.17/var" -#define INCLUDEDIR "/var/empty/gnum4-1.4.17/include" +#define PREFIX "/var/empty/gnum4-1.4.18" +#define EXEC_PREFIX "/var/empty/gnum4-1.4.18" +#define BINDIR "/var/empty/gnum4-1.4.18/bin" +#define SBINDIR "/var/empty/gnum4-1.4.18/sbin" +#define LIBEXECDIR "/var/empty/gnum4-1.4.18/libexec" +#define DATAROOTDIR "/var/empty/gnum4-1.4.18/share" +#define DATADIR "/var/empty/gnum4-1.4.18/share" +#define SYSCONFDIR "/var/empty/gnum4-1.4.18/etc" +#define SHAREDSTATEDIR "/var/empty/gnum4-1.4.18/com" +#define LOCALSTATEDIR "/var/empty/gnum4-1.4.18/var" +#define RUNSTATEDIR "/var/empty/gnum4-1.4.18/var/run" +#define INCLUDEDIR "/var/empty/gnum4-1.4.18/include" #define OLDINCLUDEDIR "/usr/include" -#define DOCDIR "/var/empty/gnum4-1.4.17/share/doc/m4" -#define INFODIR "/var/empty/gnum4-1.4.17/share/info" -#define HTMLDIR "/var/empty/gnum4-1.4.17/share/doc/m4" -#define DVIDIR "/var/empty/gnum4-1.4.17/share/doc/m4" -#define PDFDIR "/var/empty/gnum4-1.4.17/share/doc/m4" -#define PSDIR "/var/empty/gnum4-1.4.17/share/doc/m4" -#define LIBDIR "/var/empty/gnum4-1.4.17/lib" -#define LISPDIR "/var/empty/gnum4-1.4.17/share/emacs/site-lisp" -#define LOCALEDIR "/var/empty/gnum4-1.4.17/share/locale" -#define MANDIR "/var/empty/gnum4-1.4.17/share/man" -#define PKGDATADIR "/var/empty/gnum4-1.4.17/share/m4" -#define PKGINCLUDEDIR "/var/empty/gnum4-1.4.17/include/m4" -#define PKGLIBDIR "/var/empty/gnum4-1.4.17/lib/m4" -#define PKGLIBEXECDIR "/var/empty/gnum4-1.4.17/libexec/m4" +#define DOCDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define INFODIR "/var/empty/gnum4-1.4.18/share/info" +#define HTMLDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define DVIDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define PDFDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define PSDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define LIBDIR "/var/empty/gnum4-1.4.18/lib" +#define LISPDIR "/var/empty/gnum4-1.4.18/share/emacs/site-lisp" +#define LOCALEDIR "/var/empty/gnum4-1.4.18/share/locale" +#define MANDIR "/var/empty/gnum4-1.4.18/share/man" +#define PKGDATADIR "/var/empty/gnum4-1.4.18/share/m4" +#define PKGINCLUDEDIR "/var/empty/gnum4-1.4.18/include/m4" +#define PKGLIBDIR "/var/empty/gnum4-1.4.18/lib/m4" +#define PKGLIBEXECDIR "/var/empty/gnum4-1.4.18/libexec/m4" diff --git a/contrib/tools/m4/lib/dirname-lgpl.c b/contrib/tools/m4/lib/dirname-lgpl.c index 82f66301f2..a7aabf9416 100644 --- a/contrib/tools/m4/lib/dirname-lgpl.c +++ b/contrib/tools/m4/lib/dirname-lgpl.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/dirname.c b/contrib/tools/m4/lib/dirname.c index 1fb65888bb..07aac13402 100644 --- a/contrib/tools/m4/lib/dirname.c +++ b/contrib/tools/m4/lib/dirname.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/dirname.h b/contrib/tools/m4/lib/dirname.h index 4ad0312008..875b31bae5 100644 --- a/contrib/tools/m4/lib/dirname.h +++ b/contrib/tools/m4/lib/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -31,6 +31,10 @@ # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 # endif +#ifdef __cplusplus +extern "C" { +#endif + # if GNULIB_DIRNAME char *base_name (char const *file); char *dir_name (char const *file); @@ -43,4 +47,8 @@ char *last_component (char const *file) _GL_ATTRIBUTE_PURE; bool strip_trailing_slashes (char *file); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* not DIRNAME_H_ */ diff --git a/contrib/tools/m4/lib/dosname.h b/contrib/tools/m4/lib/dosname.h index ba63ce4bd3..83a953f3c0 100644 --- a/contrib/tools/m4/lib/dosname.h +++ b/contrib/tools/m4/lib/dosname.h @@ -1,6 +1,6 @@ /* File names on MS-DOS/Windows systems. - Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2016 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/contrib/tools/m4/lib/dup-safer-flag.c b/contrib/tools/m4/lib/dup-safer-flag.c index 8a09821dc8..f5b81b733c 100644 --- a/contrib/tools/m4/lib/dup-safer-flag.c +++ b/contrib/tools/m4/lib/dup-safer-flag.c @@ -1,7 +1,7 @@ /* Duplicate a file descriptor result, avoiding clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2016 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/contrib/tools/m4/lib/dup-safer.c b/contrib/tools/m4/lib/dup-safer.c index c20310785a..6ed8f79253 100644 --- a/contrib/tools/m4/lib/dup-safer.c +++ b/contrib/tools/m4/lib/dup-safer.c @@ -1,6 +1,6 @@ /* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2016 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/contrib/tools/m4/lib/dup2.c b/contrib/tools/m4/lib/dup2.c index 9219eb3823..13dda55eef 100644 --- a/contrib/tools/m4/lib/dup2.c +++ b/contrib/tools/m4/lib/dup2.c @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2016 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 @@ -85,6 +85,57 @@ ms_windows_dup2 (int fd, int desired_fd) # define dup2 ms_windows_dup2 +# elif defined __KLIBC__ + +# error #include <InnoTekLIBC/backend.h> + +static int +klibc_dup2dirfd (int fd, int desired_fd) +{ + int tempfd; + int dupfd; + + tempfd = open ("NUL", O_RDONLY); + if (tempfd == -1) + return -1; + + if (tempfd == desired_fd) + { + close (tempfd); + + char path[_MAX_PATH]; + if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) + return -1; + + return open(path, O_RDONLY); + } + + dupfd = klibc_dup2dirfd (fd, desired_fd); + + close (tempfd); + + return dupfd; +} + +static int +klibc_dup2 (int fd, int desired_fd) +{ + int dupfd; + struct stat sbuf; + + dupfd = dup2 (fd, desired_fd); + if (dupfd == -1 && errno == ENOTSUP \ + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + close (desired_fd); + + return klibc_dup2dirfd (fd, desired_fd); + } + + return dupfd; +} + +# define dup2 klibc_dup2 # endif int @@ -96,7 +147,11 @@ rpl_dup2 (int fd, int desired_fd) /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. On Cygwin 1.5.x, dup2 (1, 1) returns 0. On Cygwin 1.7.17, dup2 (1, -1) dumps core. + On Cygwin 1.7.25, dup2 (1, 256) can dump core. On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */ +# if HAVE_SETDTABLESIZE + setdtablesize (desired_fd + 1); +# endif if (desired_fd < 0) fd = desired_fd; if (fd == desired_fd) diff --git a/contrib/tools/m4/lib/error.c b/contrib/tools/m4/lib/error.c index 2b182b4695..f77439ecdb 100644 --- a/contrib/tools/m4/lib/error.c +++ b/contrib/tools/m4/lib/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -39,6 +39,11 @@ # include <stdint.h> # include <wchar.h> # define mbsrtowcs __mbsrtowcs +# define USE_UNLOCKED_IO 0 +# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) +# define _GL_ARG_NONNULL(a) +#else +# include "getprogname.h" #endif #if USE_UNLOCKED_IO @@ -72,14 +77,14 @@ extern void __error (int status, int errnum, const char *message, ...) extern void __error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) - __attribute__ ((__format__ (__printf__, 5, 6)));; + __attribute__ ((__format__ (__printf__, 5, 6))); # define error __error # define error_at_line __error_at_line # include <libio/iolibio.h> -# define fflush(s) INTUSE(_IO_fflush) (s) +# define fflush(s) _IO_fflush (s) # undef putc -# define putc(c, fp) INTUSE(_IO_putc) (c, fp) +# define putc(c, fp) _IO_putc (c, fp) # error #include <bits/libc-lock.h> @@ -110,9 +115,7 @@ int strerror_r (); # endif # endif -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; +#define program_name getprogname () # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r @@ -171,7 +174,7 @@ print_errno_message (int errnum) #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; -# if STRERROR_R_CHAR_P || _LIBC +# if _LIBC || STRERROR_R_CHAR_P s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) @@ -195,13 +198,12 @@ print_errno_message (int errnum) #endif } -static void +static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3)) error_tail (int status, int errnum, const char *message, va_list args) { #if _LIBC if (_IO_fwide (stderr, 0) > 0) { -# define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; @@ -237,7 +239,7 @@ error_tail (int status, int errnum, const char *message, va_list args) if (res != len) break; - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; @@ -342,7 +344,10 @@ error_at_line (int status, int errnum, const char *file_name, if (old_line_number == line_number && (file_name == old_file_name - || strcmp (old_file_name, file_name) == 0)) + || (old_file_name != NULL + && file_name != NULL + && strcmp (old_file_name, file_name) == 0))) + /* Simply return and print nothing. */ return; @@ -374,10 +379,10 @@ error_at_line (int status, int errnum, const char *file_name, } #if _LIBC - __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", + __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #else - fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", + fprintf (stderr, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #endif diff --git a/contrib/tools/m4/lib/error.h b/contrib/tools/m4/lib/error.h index afcb0e10c8..6a69db0935 100644 --- a/contrib/tools/m4/lib/error.h +++ b/contrib/tools/m4/lib/error.h @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -31,6 +31,16 @@ # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif +/* On mingw, the flavor of printf depends on whether the extensions module + * is in use; the check for <stdio.h> determines the witness macro. */ +#ifndef _GL_ATTRIBUTE_SPEC_PRINTF +# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU +# define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__ +# else +# define _GL_ATTRIBUTE_SPEC_PRINTF __printf__ +# endif +#endif + #ifdef __cplusplus extern "C" { #endif @@ -40,11 +50,11 @@ extern "C" { If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4)); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 5, 6)); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this diff --git a/contrib/tools/m4/lib/execute.c b/contrib/tools/m4/lib/execute.c index 0b6f995dc5..e802e6aa02 100644 --- a/contrib/tools/m4/lib/execute.c +++ b/contrib/tools/m4/lib/execute.c @@ -1,5 +1,5 @@ /* Creation of autonomous subprocesses. - Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -52,12 +52,6 @@ extern char** environ; #endif -/* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ -#undef open -#undef close - - #if defined EINTR && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) /* EINTR handling for close(), open(). diff --git a/contrib/tools/m4/lib/execute.h b/contrib/tools/m4/lib/execute.h index 1fdc2abbad..224141ec3b 100644 --- a/contrib/tools/m4/lib/execute.h +++ b/contrib/tools/m4/lib/execute.h @@ -1,5 +1,5 @@ /* Creation of autonomous subprocesses. - Copyright (C) 2001-2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/exitfail.c b/contrib/tools/m4/lib/exitfail.c index b0b4ebe45a..8033c22ab4 100644 --- a/contrib/tools/m4/lib/exitfail.c +++ b/contrib/tools/m4/lib/exitfail.c @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2016 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/contrib/tools/m4/lib/exitfail.h b/contrib/tools/m4/lib/exitfail.h index e54333bdd2..62311bd48c 100644 --- a/contrib/tools/m4/lib/exitfail.h +++ b/contrib/tools/m4/lib/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2016 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/contrib/tools/m4/lib/fatal-signal.c b/contrib/tools/m4/lib/fatal-signal.c index 8f7cb8ea3b..2126a90a4b 100644 --- a/contrib/tools/m4/lib/fatal-signal.c +++ b/contrib/tools/m4/lib/fatal-signal.c @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/fatal-signal.h b/contrib/tools/m4/lib/fatal-signal.h index f5df78a048..01b9ae036a 100644 --- a/contrib/tools/m4/lib/fatal-signal.h +++ b/contrib/tools/m4/lib/fatal-signal.h @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/fclose.c b/contrib/tools/m4/lib/fclose.c index 90ed653a0e..d4783f6d8d 100644 --- a/contrib/tools/m4/lib/fclose.c +++ b/contrib/tools/m4/lib/fclose.c @@ -1,5 +1,5 @@ /* fclose replacement. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 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/contrib/tools/m4/lib/fcntl.c b/contrib/tools/m4/lib/fcntl.c index 735fa66f4d..360f1f0da6 100644 --- a/contrib/tools/m4/lib/fcntl.c +++ b/contrib/tools/m4/lib/fcntl.c @@ -1,6 +1,6 @@ /* Provide file descriptor control. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 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 @@ -89,8 +89,25 @@ dupfd (int oldfd, int newfd, int flags) inherit, /* InheritHandle */ DUPLICATE_SAME_ACCESS)) /* Options */ { - /* TODO: Translate GetLastError () into errno. */ - errno = EMFILE; + switch (GetLastError ()) + { + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; + break; + case ERROR_INVALID_HANDLE: + case ERROR_INVALID_TARGET_HANDLE: + case ERROR_DIRECT_ACCESS_HANDLE: + errno = EBADF; + break; + case ERROR_INVALID_PARAMETER: + case ERROR_INVALID_FUNCTION: + case ERROR_INVALID_ACCESS: + errno = EINVAL; + break; + default: + errno = EACCES; + break; + } result = -1; break; } @@ -98,7 +115,6 @@ dupfd (int oldfd, int newfd, int flags) if (duplicated_fd < 0) { CloseHandle (new_handle); - errno = EMFILE; result = -1; break; } @@ -146,6 +162,93 @@ dupfd (int oldfd, int newfd, int flags) } #endif /* W32 */ +#ifdef __KLIBC__ + +# define INCL_DOS +# error #include <os2.h> + +static int +klibc_fcntl (int fd, int action, /* arg */...) +{ + va_list arg_ptr; + int arg; + struct stat sbuf; + int result = -1; + + va_start (arg_ptr, action); + arg = va_arg (arg_ptr, int); + result = fcntl (fd, action, arg); + /* EPERM for F_DUPFD, ENOTSUP for others */ + if (result == -1 && (errno == EPERM || errno == ENOTSUP) + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + ULONG ulMode; + + switch (action) + { + case F_DUPFD: + /* Find available fd */ + while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) + arg++; + + result = dup2 (fd, arg); + break; + + /* Using underlying APIs is right ? */ + case F_GETFD: + if (DosQueryFHState (fd, &ulMode)) + break; + + result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; + break; + + case F_SETFD: + if (arg & ~FD_CLOEXEC) + break; + + if (DosQueryFHState (fd, &ulMode)) + break; + + if (arg & FD_CLOEXEC) + ulMode |= OPEN_FLAGS_NOINHERIT; + else + ulMode &= ~OPEN_FLAGS_NOINHERIT; + + /* Filter supported flags. */ + ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR + | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); + + if (DosSetFHState (fd, ulMode)) + break; + + result = 0; + break; + + case F_GETFL: + result = 0; + break; + + case F_SETFL: + if (arg != 0) + break; + + result = 0; + break; + + default : + errno = EINVAL; + break; + } + } + + va_end (arg_ptr); + + return result; +} + +# define fcntl klibc_fcntl +#endif + /* Perform the specified ACTION on the file descriptor FD, possibly using the argument ARG further described below. This replacement handles the following actions, and forwards all others on to the diff --git a/contrib/tools/m4/lib/fcntl.h b/contrib/tools/m4/lib/fcntl.h index a7a7d03b20..85c8a87362 100644 --- a/contrib/tools/m4/lib/fcntl.h +++ b/contrib/tools/m4/lib/fcntl.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Like <fcntl.h>, but with non-working flags defined to 0. - Copyright (C) 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 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 @@ -35,7 +35,7 @@ extern "C" { ... } block, which leads to errors in C++ mode with the overridden <sys/stat.h> from gnulib. These errors are known to be gone with g++ version >= 4.3. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) # include <sys/stat.h> #endif #include_next <fcntl.h> @@ -54,7 +54,7 @@ extern "C" { ... } block, which leads to errors in C++ mode with the overridden <sys/stat.h> from gnulib. These errors are known to be gone with g++ version >= 4.3. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) # include <sys/stat.h> #endif /* The include_next requires a split double-inclusion guard. */ @@ -78,6 +78,15 @@ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + /* The three most frequent use cases of these macros are: * For providing a substitute for a function that is missing on some @@ -172,14 +181,25 @@ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); - */ + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - rettype (*const func) parameters = ::rpl_func; \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -196,8 +216,15 @@ # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - rettype (*const func) parameters = \ - reinterpret_cast<rettype(*)parameters>(::rpl_func); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>(::rpl_func); \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -211,19 +238,24 @@ is defined. Example: _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); - */ + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ #if defined __cplusplus && defined GNULIB_NAMESPACE - /* If we were to write - rettype (*const func) parameters = ::func; - like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls - better (remove an indirection through a 'static' pointer variable), - but then the _GL_CXXALIASWARN macro below would cause a warning not only - for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ -# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = ::func; \ - } \ +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ + } func = {}; \ + } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ @@ -239,8 +271,15 @@ # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - static rettype (*func) parameters = \ - reinterpret_cast<rettype(*)parameters>(::func); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>(::func); \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -263,9 +302,15 @@ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ - static rettype (*func) parameters = \ - reinterpret_cast<rettype(*)parameters>( \ - (rettype2(*)parameters2)(::func)); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -498,6 +543,22 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " /* Fix up the O_* macros. */ +/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT + to values outside 'int' range, so omit these misdefinitions. + But avoid namespace pollution on non-AIX systems. */ +#ifdef _AIX +# include <limits.h> +# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) +# undef O_CLOEXEC +# endif +# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) +# undef O_NOFOLLOW +# endif +# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) +# undef O_TTY_INIT +# endif +#endif + #if !defined O_DIRECT && defined O_DIRECTIO /* Tru64 spells it 'O_DIRECTIO'. */ # define O_DIRECT O_DIRECTIO diff --git a/contrib/tools/m4/lib/fd-hook.c b/contrib/tools/m4/lib/fd-hook.c index e158a52aa3..8676c6bdfc 100644 --- a/contrib/tools/m4/lib/fd-hook.c +++ b/contrib/tools/m4/lib/fd-hook.c @@ -1,5 +1,5 @@ /* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/contrib/tools/m4/lib/fd-hook.h b/contrib/tools/m4/lib/fd-hook.h index d15b577114..9568d07511 100644 --- a/contrib/tools/m4/lib/fd-hook.h +++ b/contrib/tools/m4/lib/fd-hook.h @@ -1,5 +1,5 @@ /* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 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/contrib/tools/m4/lib/fd-safer-flag.c b/contrib/tools/m4/lib/fd-safer-flag.c index 8bc14bda2c..4b865839e9 100644 --- a/contrib/tools/m4/lib/fd-safer-flag.c +++ b/contrib/tools/m4/lib/fd-safer-flag.c @@ -1,7 +1,7 @@ /* Adjust a file descriptor result so that it avoids clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 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/contrib/tools/m4/lib/fd-safer.c b/contrib/tools/m4/lib/fd-safer.c index 8ded8886a5..8a6bee2ee1 100644 --- a/contrib/tools/m4/lib/fd-safer.c +++ b/contrib/tools/m4/lib/fd-safer.c @@ -1,6 +1,6 @@ /* Return a safer copy of a file descriptor. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 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/contrib/tools/m4/lib/filenamecat-lgpl.c b/contrib/tools/m4/lib/filenamecat-lgpl.c index 60c4988b4d..4903fbf370 100644 --- a/contrib/tools/m4/lib/filenamecat-lgpl.c +++ b/contrib/tools/m4/lib/filenamecat-lgpl.c @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009-2016 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/contrib/tools/m4/lib/filenamecat.c b/contrib/tools/m4/lib/filenamecat.c index 8809b571f5..06cfeae6ca 100644 --- a/contrib/tools/m4/lib/filenamecat.c +++ b/contrib/tools/m4/lib/filenamecat.c @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009-2016 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/contrib/tools/m4/lib/filenamecat.h b/contrib/tools/m4/lib/filenamecat.h index 1476e14c74..791a0af9b7 100644 --- a/contrib/tools/m4/lib/filenamecat.h +++ b/contrib/tools/m4/lib/filenamecat.h @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2013 Free Software + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/float+.h b/contrib/tools/m4/lib/float+.h index 32fb790bb5..00fcc76322 100644 --- a/contrib/tools/m4/lib/float+.h +++ b/contrib/tools/m4/lib/float+.h @@ -1,5 +1,5 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/fopen-safer.c b/contrib/tools/m4/lib/fopen-safer.c index 917920d904..6e7c08d64c 100644 --- a/contrib/tools/m4/lib/fopen-safer.c +++ b/contrib/tools/m4/lib/fopen-safer.c @@ -1,6 +1,6 @@ /* Invoke fopen, but avoid some glitches. - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2016 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/contrib/tools/m4/lib/fpending.h b/contrib/tools/m4/lib/fpending.h index 4eca3f18e1..61008aa765 100644 --- a/contrib/tools/m4/lib/fpending.h +++ b/contrib/tools/m4/lib/fpending.h @@ -1,6 +1,6 @@ /* Declare __fpending. - Copyright (C) 2000, 2003, 2005-2006, 2009-2013 Free Software Foundation, + Copyright (C) 2000, 2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -24,6 +24,6 @@ # include <stdio_ext.h> #endif -#ifndef __fpending -size_t __fpending (FILE *); +#if !HAVE_DECL___FPENDING +size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; #endif diff --git a/contrib/tools/m4/lib/fpucw.h b/contrib/tools/m4/lib/fpucw.h index 0b7f5284a1..05ee0cac94 100644 --- a/contrib/tools/m4/lib/fpucw.h +++ b/contrib/tools/m4/lib/fpucw.h @@ -1,5 +1,5 @@ -/* Manipulating the FPU control word. - Copyright (C) 2007-2013 Free Software Foundation, Inc. +/* Manipulating the FPU control word. -*- coding: utf-8 -*- + Copyright (C) 2007-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/freadahead.h b/contrib/tools/m4/lib/freadahead.h index c691f89c0f..f8211afe14 100644 --- a/contrib/tools/m4/lib/freadahead.h +++ b/contrib/tools/m4/lib/freadahead.h @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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/contrib/tools/m4/lib/freading.h b/contrib/tools/m4/lib/freading.h index 88ea789ea4..949efd5b00 100644 --- a/contrib/tools/m4/lib/freading.h +++ b/contrib/tools/m4/lib/freading.h @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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 @@ -44,7 +44,7 @@ extern "C" { # endif -extern bool freading (FILE *stream); +extern bool freading (FILE *stream) _GL_ATTRIBUTE_PURE; # ifdef __cplusplus } diff --git a/contrib/tools/m4/lib/getdtablesize.c b/contrib/tools/m4/lib/getdtablesize.c index 9947405af6..d23405571b 100644 --- a/contrib/tools/m4/lib/getdtablesize.c +++ b/contrib/tools/m4/lib/getdtablesize.c @@ -1,5 +1,5 @@ /* getdtablesize() function for platforms that don't have it. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -22,11 +22,11 @@ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -#include <stdio.h> +# include <stdio.h> -#include "msvc-inval.h" +# include "msvc-inval.h" -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int _setmaxstdio_nothrow (int newmax) { @@ -44,10 +44,11 @@ _setmaxstdio_nothrow (int newmax) return result; } -# define _setmaxstdio _setmaxstdio_nothrow -#endif +# define _setmaxstdio _setmaxstdio_nothrow +# endif -/* Cache for the previous getdtablesize () result. */ +/* Cache for the previous getdtablesize () result. Safe to cache because + Windows also lacks setrlimit. */ static int dtablesize; int @@ -83,4 +84,38 @@ getdtablesize (void) return dtablesize; } +#else + +# include <limits.h> +# include <sys/resource.h> + +# ifndef RLIM_SAVED_CUR +# define RLIM_SAVED_CUR RLIM_INFINITY +# endif +# ifndef RLIM_SAVED_MAX +# define RLIM_SAVED_MAX RLIM_INFINITY +# endif + +# ifdef __CYGWIN__ + /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it + hits the compile-time constant hard limit of 3200. We might as + well just report the hard limit. */ +# define rlim_cur rlim_max +# endif + +int +getdtablesize (void) +{ + struct rlimit lim; + + if (getrlimit (RLIMIT_NOFILE, &lim) == 0 + && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX + && lim.rlim_cur != RLIM_INFINITY + && lim.rlim_cur != RLIM_SAVED_CUR + && lim.rlim_cur != RLIM_SAVED_MAX) + return lim.rlim_cur; + + return INT_MAX; +} + #endif diff --git a/contrib/tools/m4/lib/getopt.c b/contrib/tools/m4/lib/getopt.c index ef0f4ceec7..8ccb9010ad 100644 --- a/contrib/tools/m4/lib/getopt.c +++ b/contrib/tools/m4/lib/getopt.c @@ -2,7 +2,7 @@ NOTE: getopt is part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -487,7 +487,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *p; struct option_list *next; } *ambig_list = NULL; +#ifdef _LIBC +/* malloc() not used for _LIBC to simplify failure messages. */ +# define free_option_list(l) +#else +# define free_option_list(l) \ + while (l != NULL) \ + { \ + struct option_list *pn = l->next; \ + free (l); \ + l = pn; \ + } +#endif int exact = 0; + int ambig = 0; int indfound = -1; int option_index; @@ -514,22 +527,37 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, pfound = p; indfound = option_index; } + else if (ambig) + ; /* Taking simpler path to handling ambiguities. */ else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) { /* Second or later nonexact match found. */ +#ifdef _LIBC + struct option_list *newp = alloca (sizeof (*newp)); +#else struct option_list *newp = malloc (sizeof (*newp)); - newp->p = p; - newp->next = ambig_list; - ambig_list = newp; + if (newp == NULL) + { + free_option_list (ambig_list); + ambig_list = NULL; + ambig = 1; /* Use simpler fallback message. */ + } + else +#endif + { + newp->p = p; + newp->next = ambig_list; + ambig_list = newp; + } } } - if (ambig_list != NULL && !exact) + if ((ambig || ambig_list) && !exact) { - if (print_errors) + if (print_errors && ambig_list) { struct option_list first; first.p = pfound; @@ -585,18 +613,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, fputc ('\n', stderr); #endif } + else if (print_errors && ambig) + { + fprintf (stderr, + _("%s: option '%s' is ambiguous\n"), + argv[0], argv[d->optind]); + } d->__nextchar += strlen (d->__nextchar); d->optind++; d->optopt = 0; + free_option_list (ambig_list); return '?'; } - while (ambig_list != NULL) - { - struct option_list *pn = ambig_list->next; - free (ambig_list); - ambig_list = pn; - } + free_option_list (ambig_list); if (pfound != NULL) { diff --git a/contrib/tools/m4/lib/getopt1.c b/contrib/tools/m4/lib/getopt1.c index 55a6b4eae4..63db74f9f7 100644 --- a/contrib/tools/m4/lib/getopt1.c +++ b/contrib/tools/m4/lib/getopt1.c @@ -1,5 +1,5 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2013 Free Software + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/getopt_int.h b/contrib/tools/m4/lib/getopt_int.h index a6e4b9ea71..be4c22e215 100644 --- a/contrib/tools/m4/lib/getopt_int.h +++ b/contrib/tools/m4/lib/getopt_int.h @@ -1,5 +1,5 @@ /* Internal declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/getprogname.c b/contrib/tools/m4/lib/getprogname.c new file mode 100644 index 0000000000..16d3b6c208 --- /dev/null +++ b/contrib/tools/m4/lib/getprogname.c @@ -0,0 +1,151 @@ +/* Program name management. + Copyright (C) 2016 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 Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "getprogname.h" + +#include <errno.h> /* get program_invocation_name declaration */ +#include <stdlib.h> /* get __argv declaration */ + +#ifdef _AIX +# include <unistd.h> +# include <procinfo.h> +# include <string.h> +#endif + +#ifdef __MVS__ +# ifndef _OPEN_SYS +# define _OPEN_SYS +# endif +# include <string.h> +# error #include <sys/ps.h> +#endif + +#ifdef __hpux +# include <unistd.h> +# include <sys/param.h> +# include <sys/pstat.h> +# include <string.h> +#endif + +#include "dirname.h" + +#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ +char const * +getprogname (void) +{ +# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return program_invocation_short_name; +# elif HAVE_DECL_PROGRAM_INVOCATION_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return last_component (program_invocation_name); +# elif HAVE_GETEXECNAME /* Solaris */ + /* http://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ + const char *p = getexecname (); + if (!p) + p = "?"; + return last_component (p); +# elif HAVE_DECL___ARGV /* mingw, MSVC */ + /* https://msdn.microsoft.com/en-us/library/dn727674.aspx */ + const char *p = __argv && __argv[0] ? __argv[0] : "?"; + return last_component (p); +# elif HAVE_VAR___PROGNAME /* OpenBSD, QNX */ + /* http://man.openbsd.org/style.9 */ + /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */ + /* Be careful to declare this only when we absolutely need it + (OpenBSD 5.1), rather than when it's available. Otherwise, + its mere declaration makes program_invocation_short_name + malfunction (have zero length) with Fedora 25's glibc. */ + extern char *__progname; + const char *p = __progname; + return p && p[0] ? p : "?"; +# elif _AIX /* AIX */ + /* Idea by Bastien ROUCARIÈS, + http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00095.html + Reference: http:// + ibm.biz/knowctr#ssw_aix_53/com.ibm.aix.basetechref/doc/basetrf1/getprocs.htm + */ + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct procentry64 procs; + p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1) + ? strdup (procs.pi_comm) + : NULL); + if (!p) + p = "?"; + } + return p; +# elif defined __hpux + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct pst_status status; + p = (0 < pstat_getproc (&status, sizeof status, 0, pid) + ? strdup (status.pst_ucomm) + : NULL); + if (!p) + p = "?"; + } + return p; +# elif __MVS__ /* z/OS */ + /* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */ + static char *p = "?"; + static int first = 1; + if (first) + { + pid_t pid = getpid (); + int token; + W_PSPROC buf; + first = 0; + memset (&buf, 0, sizeof(buf)); + buf.ps_cmdptr = (char *) malloc (buf.ps_cmdlen = PS_CMDBLEN_LONG); + buf.ps_conttyptr = (char *) malloc (buf.ps_conttylen = PS_CONTTYBLEN); + buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN); + if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr) + { + for (token = 0; token >= 0; + token = w_getpsent (token, &buf, sizeof(buf))) + { + if (token > 0 && buf.ps_pid == pid) + { + char *s = strdup (last_component (buf.ps_pathptr)); + if (s) + p = s; + break; + } + } + } + free (buf.ps_cmdptr); + free (buf.ps_conttyptr); + free (buf.ps_pathptr); + } + return p; +# else +# error "getprogname module not ported to this OS" +# endif +} + +#endif diff --git a/contrib/tools/m4/lib/getprogname.h b/contrib/tools/m4/lib/getprogname.h new file mode 100644 index 0000000000..e8f9e978b1 --- /dev/null +++ b/contrib/tools/m4/lib/getprogname.h @@ -0,0 +1,40 @@ +/* Program name management. + Copyright (C) 2016 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 Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 <http://www.gnu.org/licenses/>. */ + +#ifndef _GL_GETPROGNAME_H +#define _GL_GETPROGNAME_H + +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return the base name of the executing program. + On native Windows this will usually end in ".exe" or ".EXE". */ +#ifndef HAVE_GETPROGNAME +extern char const *getprogname (void) +# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME + _GL_ATTRIBUTE_PURE +# endif + ; +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/contrib/tools/m4/lib/gettext.h b/contrib/tools/m4/lib/gettext.h index d0215715a9..9a232cc3a8 100644 --- a/contrib/tools/m4/lib/gettext.h +++ b/contrib/tools/m4/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-2013 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -225,15 +225,17 @@ dcpgettext_expr (const char *domain, if (msg_ctxt_id != NULL) #endif { + int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); + found_translation = (translation != msg_ctxt_id); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif - if (translation != msg_ctxt_id) + if (found_translation) return translation; } return msgid; @@ -271,15 +273,17 @@ dcnpgettext_expr (const char *domain, if (msg_ctxt_id != NULL) #endif { + int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif - if (!(translation == msg_ctxt_id || translation == msgid_plural)) + if (found_translation) return translation; } return (n == 1 ? msgid : msgid_plural); diff --git a/contrib/tools/m4/lib/gettimeofday.c b/contrib/tools/m4/lib/gettimeofday.c index ad65c6da8b..224ca6a176 100644 --- a/contrib/tools/m4/lib/gettimeofday.c +++ b/contrib/tools/m4/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-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2016 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/contrib/tools/m4/lib/gl_anyhash_list1.h b/contrib/tools/m4/lib/gl_anyhash_list1.h index 57ead45073..de25706656 100644 --- a/contrib/tools/m4/lib/gl_anyhash_list1.h +++ b/contrib/tools/m4/lib/gl_anyhash_list1.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with another list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_anyhash_list2.h b/contrib/tools/m4/lib/gl_anyhash_list2.h index 3791ae2432..cace8f85c0 100644 --- a/contrib/tools/m4/lib/gl_anyhash_list2.h +++ b/contrib/tools/m4/lib/gl_anyhash_list2.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with another list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_anylinked_list1.h b/contrib/tools/m4/lib/gl_anylinked_list1.h index c8879f0f68..dcb66ec790 100644 --- a/contrib/tools/m4/lib/gl_anylinked_list1.h +++ b/contrib/tools/m4/lib/gl_anylinked_list1.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a linked list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_anylinked_list2.h b/contrib/tools/m4/lib/gl_anylinked_list2.h index 45ca7c829a..a1037ede2f 100644 --- a/contrib/tools/m4/lib/gl_anylinked_list2.h +++ b/contrib/tools/m4/lib/gl_anylinked_list2.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a linked list. - Copyright (C) 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify @@ -163,13 +163,13 @@ gl_linked_nx_create (gl_list_implementation_t implementation, return NULL; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_size (gl_list_t list) { return list->count; } -static const void * +static const void * _GL_ATTRIBUTE_PURE gl_linked_node_value (gl_list_t list, gl_list_node_t node) { return node->value; @@ -215,19 +215,19 @@ gl_linked_node_nx_set_value (gl_list_t list, gl_list_node_t node, return 0; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_next_node (gl_list_t list, gl_list_node_t node) { return (node->next != &list->root ? node->next : NULL); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_previous_node (gl_list_t list, gl_list_node_t node) { return (node->prev != &list->root ? node->prev : NULL); } -static const void * +static const void * _GL_ATTRIBUTE_PURE gl_linked_get_at (gl_list_t list, size_t position) { size_t count = list->count; @@ -312,7 +312,7 @@ gl_linked_nx_set_at (gl_list_t list, size_t position, const void *elt) return node; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -465,7 +465,7 @@ gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index, } } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -923,7 +923,7 @@ gl_linked_iterator (gl_list_t list) result.list = list; result.p = list->root.next; result.q = &list->root; -#ifdef lint +#if defined GCC_LINT || defined lint result.i = 0; result.j = 0; result.count = 0; @@ -994,7 +994,7 @@ gl_linked_iterator_from_to (gl_list_t list, result.q = node; } -#ifdef lint +#if defined GCC_LINT || defined lint result.i = 0; result.j = 0; result.count = 0; @@ -1027,7 +1027,7 @@ gl_linked_iterator_free (gl_list_iterator_t *iterator) /* ---------------------- Sorted gl_list_t Data Type ---------------------- */ -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -1045,7 +1045,7 @@ gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, return NULL; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, @@ -1093,7 +1093,7 @@ gl_linked_sortedlist_search_from_to (gl_list_t list, return NULL; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -1114,7 +1114,7 @@ gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, return (size_t)(-1); } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, diff --git a/contrib/tools/m4/lib/gl_anytree_oset.h b/contrib/tools/m4/lib/gl_anytree_oset.h index e1f90a99a2..127f4e338e 100644 --- a/contrib/tools/m4/lib/gl_anytree_oset.h +++ b/contrib/tools/m4/lib/gl_anytree_oset.h @@ -1,5 +1,5 @@ /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify @@ -255,7 +255,7 @@ gl_tree_iterator (gl_oset_t set) result.p = node; /* End point is past the rightmost node. */ result.q = NULL; -#ifdef lint +#if defined GCC_LINT || defined lint result.i = 0; result.j = 0; result.count = 0; diff --git a/contrib/tools/m4/lib/gl_avltree_oset.c b/contrib/tools/m4/lib/gl_avltree_oset.c index 09202ae0cc..ac7183bbd8 100644 --- a/contrib/tools/m4/lib/gl_avltree_oset.c +++ b/contrib/tools/m4/lib/gl_avltree_oset.c @@ -1,5 +1,5 @@ /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_avltree_oset.h b/contrib/tools/m4/lib/gl_avltree_oset.h index abac895f08..6229c84c3a 100644 --- a/contrib/tools/m4/lib/gl_avltree_oset.h +++ b/contrib/tools/m4/lib/gl_avltree_oset.h @@ -1,5 +1,5 @@ /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_linkedhash_list.c b/contrib/tools/m4/lib/gl_linkedhash_list.c index 2f4e05f3a7..33d9bcf769 100644 --- a/contrib/tools/m4/lib/gl_linkedhash_list.c +++ b/contrib/tools/m4/lib/gl_linkedhash_list.c @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_linkedhash_list.h b/contrib/tools/m4/lib/gl_linkedhash_list.h index 577756c9d4..9d740ea7ed 100644 --- a/contrib/tools/m4/lib/gl_linkedhash_list.h +++ b/contrib/tools/m4/lib/gl_linkedhash_list.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_list.h b/contrib/tools/m4/lib/gl_list.h index 9094723fe5..c9d05b0d4d 100644 --- a/contrib/tools/m4/lib/gl_list.h +++ b/contrib/tools/m4/lib/gl_list.h @@ -1,5 +1,5 @@ -/* Abstract sequential list data type. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Abstract sequential list data type. -*- coding: utf-8 -*- + Copyright (C) 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_oset.h b/contrib/tools/m4/lib/gl_oset.h index 5134065e5e..ffca315fa6 100644 --- a/contrib/tools/m4/lib/gl_oset.h +++ b/contrib/tools/m4/lib/gl_oset.h @@ -1,5 +1,5 @@ /* Abstract ordered set data type. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_xlist.h b/contrib/tools/m4/lib/gl_xlist.h index 1c9451c1ab..06824fcbd1 100644 --- a/contrib/tools/m4/lib/gl_xlist.h +++ b/contrib/tools/m4/lib/gl_xlist.h @@ -1,5 +1,5 @@ /* Abstract sequential list data type, with out-of-memory checking. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_xoset.h b/contrib/tools/m4/lib/gl_xoset.h index b30b2ced83..34191971e2 100644 --- a/contrib/tools/m4/lib/gl_xoset.h +++ b/contrib/tools/m4/lib/gl_xoset.h @@ -1,5 +1,5 @@ /* Abstract ordered set data type, with out-of-memory checking. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/glthread/lock.c b/contrib/tools/m4/lib/glthread/lock.c index f62aa301fe..935043b1a2 100644 --- a/contrib/tools/m4/lib/glthread/lock.c +++ b/contrib/tools/m4/lib/glthread/lock.c @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2016 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/contrib/tools/m4/lib/glthread/lock.h b/contrib/tools/m4/lib/glthread/lock.h index 42228df80f..035accd1a9 100644 --- a/contrib/tools/m4/lib/glthread/lock.h +++ b/contrib/tools/m4/lib/glthread/lock.h @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2016 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/contrib/tools/m4/lib/glthread/threadlib.c b/contrib/tools/m4/lib/glthread/threadlib.c index b447657302..be6371306d 100644 --- a/contrib/tools/m4/lib/glthread/threadlib.c +++ b/contrib/tools/m4/lib/glthread/threadlib.c @@ -1,5 +1,5 @@ /* Multithreading primitives. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2016 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/contrib/tools/m4/lib/glthread/tls.c b/contrib/tools/m4/lib/glthread/tls.c index bcd285c273..7c1916a817 100644 --- a/contrib/tools/m4/lib/glthread/tls.c +++ b/contrib/tools/m4/lib/glthread/tls.c @@ -1,5 +1,5 @@ /* Thread-local storage in multithreaded situations. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2016 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/contrib/tools/m4/lib/glthread/tls.h b/contrib/tools/m4/lib/glthread/tls.h index 2afe0b43c3..63955a2496 100644 --- a/contrib/tools/m4/lib/glthread/tls.h +++ b/contrib/tools/m4/lib/glthread/tls.h @@ -1,5 +1,5 @@ /* Thread-local storage in multithreaded situations. - Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2016 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/contrib/tools/m4/lib/hard-locale.c b/contrib/tools/m4/lib/hard-locale.c new file mode 100644 index 0000000000..c7d9da526f --- /dev/null +++ b/contrib/tools/m4/lib/hard-locale.c @@ -0,0 +1,72 @@ +/* hard-locale.c -- Determine whether a locale is hard. + + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2016 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 Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#include "hard-locale.h" + +#include <locale.h> +#include <stdlib.h> +#include <string.h> + +#ifdef __GLIBC__ +# define GLIBC_VERSION __GLIBC__ +#elif defined __UCLIBC__ +# define GLIBC_VERSION 2 +#else +# define GLIBC_VERSION 0 +#endif + +/* Return true if the current CATEGORY locale is hard, i.e. if you + can't get away with assuming traditional C or POSIX behavior. */ +bool +hard_locale (int category) +{ + bool hard = true; + char const *p = setlocale (category, NULL); + + if (p) + { + if (2 <= GLIBC_VERSION) + { + if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) + hard = false; + } + else + { + char *locale = strdup (p); + if (locale) + { + /* Temporarily set the locale to the "C" and "POSIX" locales + to find their names, so that we can determine whether one + or the other is the caller's locale. */ + if (((p = setlocale (category, "C")) + && strcmp (p, locale) == 0) + || ((p = setlocale (category, "POSIX")) + && strcmp (p, locale) == 0)) + hard = false; + + /* Restore the caller's locale. */ + setlocale (category, locale); + free (locale); + } + } + } + + return hard; +} diff --git a/contrib/tools/m4/lib/isnanl.c b/contrib/tools/m4/lib/hard-locale.h index 9d9d84b974..7644afa37f 100644 --- a/contrib/tools/m4/lib/isnanl.c +++ b/contrib/tools/m4/lib/hard-locale.h @@ -1,5 +1,6 @@ -/* Test for NaN that does not need libm. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. +/* Determine whether a locale is hard. + + Copyright (C) 1999, 2003-2004, 2009-2016 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 @@ -14,7 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ +#ifndef HARD_LOCALE_H_ +# define HARD_LOCALE_H_ 1 + +# include <stdbool.h> + +bool hard_locale (int); -#define USE_LONG_DOUBLE -#include "isnan.c" +#endif /* HARD_LOCALE_H_ */ diff --git a/contrib/tools/m4/lib/ignore-value.h b/contrib/tools/m4/lib/ignore-value.h index ebd6bf42f5..6713d96f84 100644 --- a/contrib/tools/m4/lib/ignore-value.h +++ b/contrib/tools/m4/lib/ignore-value.h @@ -1,6 +1,6 @@ -/* ignore a function return without a compiler warning +/* ignore a function return without a compiler warning. -*- coding: utf-8 -*- - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 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 @@ -35,9 +35,11 @@ #ifndef _GL_IGNORE_VALUE_H #define _GL_IGNORE_VALUE_H -/* The __attribute__((__warn_unused_result__)) feature - is available in gcc versions 3.4 and newer, - while the typeof feature has been available since 2.7 at least. */ +/* Normally casting an expression to void discards its value, but GCC + versions 3.4 and newer have __attribute__ ((__warn_unused_result__)) + which may cause unwanted diagnostics in that case. Use __typeof__ + and __extension__ to work around the problem, if the workaround is + known to be needed. */ #if 3 < __GNUC__ + (4 <= __GNUC_MINOR__) # define ignore_value(x) \ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; })) diff --git a/contrib/tools/m4/lib/intprops.h b/contrib/tools/m4/lib/intprops.h new file mode 100644 index 0000000000..8add5def8e --- /dev/null +++ b/contrib/tools/m4/lib/intprops.h @@ -0,0 +1,464 @@ +/* intprops.h -- properties of integer types + + Copyright (C) 2001-2016 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 Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert. */ + +#ifndef _GL_INTPROPS_H +#define _GL_INTPROPS_H + +#include <limits.h> +#include <verify.h> + +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/* Return a value with the common real type of E and V and the value of V. */ +#define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) + +/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */ +#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) + +/* The extra casts in the following macros work around compiler bugs, + e.g., in Cray C 5.0.3.0. */ + +/* True if the arithmetic type T is an integer type. bool counts as + an integer. */ +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) + +/* True if the real type T is signed. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* Return 1 if the real expression E, after promotion, has a + signed or floating type. */ +#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) + + +/* Minimum and maximum values for integer types and expressions. */ + +/* The width in bits of the integer type or expression T. + Padding bits are not supported; this is checked at compile-time below. */ +#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) + +/* The maximum and minimum values for the integer type T. */ +#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) + +/* The maximum and minimum values for the type of the expression E, + after integer promotion. E should not have side effects. */ +#define _GL_INT_MINIMUM(e) \ + (EXPR_SIGNED (e) \ + ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, 0)) +#define _GL_INT_MAXIMUM(e) \ + (EXPR_SIGNED (e) \ + ? _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_NEGATE_CONVERT (e, 1)) +#define _GL_SIGNED_INT_MAXIMUM(e) \ + (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) + +/* Work around OpenVMS incompatibility with C99. */ +#if !defined LLONG_MAX && defined __INT64_MAX +# define LLONG_MAX __INT64_MAX +# define LLONG_MIN __INT64_MIN +#endif + +/* This include file assumes that signed types are two's complement without + padding bits; the above macros have undefined behavior otherwise. + If this is a problem for you, please let us know how to fix it for your host. + As a sanity check, test the assumption for some signed types that + <limits.h> bounds. */ +verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); +verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); +verify (TYPE_MINIMUM (short int) == SHRT_MIN); +verify (TYPE_MAXIMUM (short int) == SHRT_MAX); +verify (TYPE_MINIMUM (int) == INT_MIN); +verify (TYPE_MAXIMUM (int) == INT_MAX); +verify (TYPE_MINIMUM (long int) == LONG_MIN); +verify (TYPE_MAXIMUM (long int) == LONG_MAX); +#ifdef LLONG_MAX +verify (TYPE_MINIMUM (long long int) == LLONG_MIN); +verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); +#endif +/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ +#ifdef UINT_WIDTH +verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); +#endif + +/* Does the __typeof__ keyword work? This could be done by + 'configure', but for now it's easier to do it by hand. */ +#if (2 <= __GNUC__ \ + || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +# define _GL_HAVE___TYPEOF__ 1 +#else +# define _GL_HAVE___TYPEOF__ 0 +#endif + +/* Return 1 if the integer type or expression T might be signed. Return 0 + if it is definitely unsigned. This macro does not evaluate its argument, + and expands to an integer constant expression. */ +#if _GL_HAVE___TYPEOF__ +# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 +#endif + +/* Bound on length of the string representing an unsigned integer + value representable in B bits. log10 (2.0) < 146/485. The + smallest value of B where this bound is not tight is 2621. */ +#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) + +/* Bound on length of the string representing an integer type or expression T. + Subtract 1 for the sign bit if T is signed, and then add 1 more for + a minus sign if needed. + + Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is + signed, this macro may overestimate the true bound by one byte when + applied to unsigned types of size 2, 4, 16, ... bytes. */ +#define INT_STRLEN_BOUND(t) \ + (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + + _GL_SIGNED_TYPE_OR_EXPR (t)) + +/* Bound on buffer size needed to represent an integer type or expression T, + including the terminating null. */ +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) + + +/* Range overflow checks. + + The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C + operators might not yield numerically correct answers due to + arithmetic overflow. They do not rely on undefined or + implementation-defined behavior. Their implementations are simple + and straightforward, but they are a bit harder to use than the + INT_<op>_OVERFLOW macros described below. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + Restrictions on *_RANGE_OVERFLOW macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, + so the arguments should not have side effects. The arithmetic + arguments (including the MIN and MAX arguments) must be of the same + integer type after the usual arithmetic conversions, and the type + must have minimum value MIN and maximum MAX. Unsigned types should + use a zero MIN of the proper type. + + These macros are tuned for constant MIN and MAX. For commutative + operations such as A + B, they are also tuned for constant B. */ + +/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (a) < (min) - (b) \ + : (max) - (b) < (a)) + +/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (max) + (b) < (a) \ + : (a) < (min) + (b)) + +/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ + ((min) < 0 \ + ? (a) < - (max) \ + : 0 < (a)) + +/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Avoid && and || as they tickle + bugs in Sun C 5.11 2010/08/13 and other compilers; see + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */ +#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (a) < (max) / (b) \ + : (b) == -1 \ + ? 0 \ + : (min) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (a) < (min) / (b) \ + : (max) / (b) < (a))) + +/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. */ +#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ + ((min) < 0 && (b) == -1 && (a) < - (max)) + +/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. + Mathematically, % should never overflow, but on x86-like hosts + INT_MIN % -1 traps, and the C standard permits this, so treat this + as an overflow too. */ +#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ + INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) + +/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Here, MIN and MAX are for A only, and B need + not be of the same type as the other arguments. The C standard says that + behavior is undefined for shifts unless 0 <= B < wordwidth, and that when + A is negative then A << B has undefined behavior and A >> B has + implementation-defined behavior, but do not check these other + restrictions. */ +#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ + ((a) < 0 \ + ? (a) < (min) >> (b) \ + : (max) >> (b) < (a)) + +/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ +#define _GL_HAS_BUILTIN_OVERFLOW \ + (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) + +/* True if __builtin_add_overflow_p (A, B, C) works. */ +#define _GL_HAS_BUILTIN_OVERFLOW_P \ + (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) + +/* The _GL*_OVERFLOW macros have the same restrictions as the + *_RANGE_OVERFLOW macros, except that they do not assume that operands + (e.g., A and B) have the same type as MIN and MAX. Instead, they assume + that the result (e.g., A + B) has that type. */ +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) +#else +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#endif +#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (b) <= (a) + (b) - 1 \ + : (b) < 0 && (a) + (b) <= (a)) +#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ + : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) + +/* Return a nonzero value if A is a mathematical multiple of B, where + A is unsigned, B is negative, and MAX is the maximum value of A's + type. A's type must be the same as (A % B)'s type. Normally (A % + -B == 0) suffices, but things get tricky if -B would overflow. */ +#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ + (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ + ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ + ? (a) \ + : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ + : (a) % - (b)) \ + == 0) + +/* Check for integer overflow, and report low order bits of answer. + + The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators + might not yield numerically correct answers due to arithmetic overflow. + The INT_<op>_WRAPV macros also store the low-order bits of the answer. + These macros work correctly on all known practical hosts, and do not rely + on undefined behavior due to signed arithmetic overflow. + + Example usage, assuming A and B are long int: + + if (INT_MULTIPLY_OVERFLOW (a, b)) + printf ("result would overflow\n"); + else + printf ("result is %ld (no overflow)\n", a * b); + + Example usage with WRAPV flavor: + + long int result; + bool overflow = INT_MULTIPLY_WRAPV (a, b, &result); + printf ("result is %ld (%s)\n", result, + overflow ? "after overflow" : "no overflow"); + + Restrictions on these macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, so the + arguments should not have side effects. + + The WRAPV macros are not constant expressions. They support only + +, binary -, and *. The result type must be signed. + + These macros are tuned for their last argument being a constant. + + Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, + A % B, and A << B would overflow, respectively. */ + +#define INT_ADD_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) +#define INT_SUBTRACT_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) +#else +# define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#endif +#define INT_MULTIPLY_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) +#define INT_DIVIDE_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) +#define INT_REMAINDER_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) +#define INT_LEFT_SHIFT_OVERFLOW(a, b) \ + INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ + _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) + +/* Return 1 if the expression A <op> B would overflow, + where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, + assuming MIN and MAX are the minimum and maximum for the result type. + Arguments should be free of side effects. */ +#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ + op_result_overflow (a, b, \ + _GL_INT_MINIMUM (0 * (b) + (a)), \ + _GL_INT_MAXIMUM (0 * (b) + (a))) + +/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. + Return 1 if the result overflows. See above for restrictions. */ +#define INT_ADD_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW) +#define INT_SUBTRACT_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW) +#define INT_MULTIPLY_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) + +/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 + https://llvm.org/bugs/show_bug.cgi?id=25390 + For now, assume all versions of GCC-like compilers generate bogus + warnings for _Generic. This matters only for older compilers that + lack __builtin_add_overflow. */ +#if __GNUC__ +# define _GL__GENERIC_BOGUS 1 +#else +# define _GL__GENERIC_BOGUS 0 +#endif + +/* Store the low-order bits of A <op> B into *R, where OP specifies + the operation. BUILTIN is the builtin operation, and OVERFLOW the + overflow predicate. Return 1 if the result overflows. See above + for restrictions. */ +#if _GL_HAS_BUILTIN_OVERFLOW +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) +#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (_Generic \ + (*(r), \ + signed char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX), \ + short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX), \ + int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX), \ + long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX), \ + long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX))) +#else +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (sizeof *(r) == sizeof (signed char) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX) \ + : sizeof *(r) == sizeof (short int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX) \ + : sizeof *(r) == sizeof (int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX) \ + : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) +# ifdef LLONG_MAX +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + (sizeof *(r) == sizeof (long int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX)) +# else +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) +# endif +#endif + +/* Store the low-order bits of A <op> B into *R, where the operation + is given by OP. Use the unsigned type UT for calculation to avoid + overflow problems. *R's type is T, with extremal values TMIN and + TMAX. T must be a signed integer type. Return 1 if the result + overflows. */ +#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ + (sizeof ((a) op (b)) < sizeof (t) \ + ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \ + : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax)) +#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \ + ((overflow (a, b) \ + || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \ + || (tmax) < ((a) op (b))) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0)) + +/* Return A <op> B, where the operation is given by OP. Use the + unsigned type UT for calculation to avoid overflow problems. + Convert the result to type T without overflow by subtracting TMIN + from large values before converting, and adding it afterwards. + Compilers can optimize all the operations except OP. */ +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \ + (((ut) (a) op (ut) (b)) <= (tmax) \ + ? (t) ((ut) (a) op (ut) (b)) \ + : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin))) + +#endif /* _GL_INTPROPS_H */ diff --git a/contrib/tools/m4/lib/isnan.c b/contrib/tools/m4/lib/isnan.c deleted file mode 100644 index d95e4bac77..0000000000 --- a/contrib/tools/m4/lib/isnan.c +++ /dev/null @@ -1,177 +0,0 @@ -/* Test for NaN that does not need libm. - Copyright (C) 2007-2013 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 Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program 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 <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -/* Specification. */ -#ifdef USE_LONG_DOUBLE -/* Specification found in math.h or isnanl-nolibm.h. */ -extern int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST; -#elif ! defined USE_FLOAT -/* Specification found in math.h or isnand-nolibm.h. */ -extern int rpl_isnand (double x); -#else /* defined USE_FLOAT */ -/* Specification found in math.h or isnanf-nolibm.h. */ -extern int rpl_isnanf (float x); -#endif - -#include <float.h> -#include <string.h> - -#include "float+.h" - -#ifdef USE_LONG_DOUBLE -# define FUNC rpl_isnanl -# define DOUBLE long double -# define MAX_EXP LDBL_MAX_EXP -# define MIN_EXP LDBL_MIN_EXP -# if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT -# define KNOWN_EXPBIT0_LOCATION -# define EXPBIT0_WORD LDBL_EXPBIT0_WORD -# define EXPBIT0_BIT LDBL_EXPBIT0_BIT -# endif -# define SIZE SIZEOF_LDBL -# define L_(literal) literal##L -#elif ! defined USE_FLOAT -# define FUNC rpl_isnand -# define DOUBLE double -# define MAX_EXP DBL_MAX_EXP -# define MIN_EXP DBL_MIN_EXP -# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT -# define KNOWN_EXPBIT0_LOCATION -# define EXPBIT0_WORD DBL_EXPBIT0_WORD -# define EXPBIT0_BIT DBL_EXPBIT0_BIT -# endif -# define SIZE SIZEOF_DBL -# define L_(literal) literal -#else /* defined USE_FLOAT */ -# define FUNC rpl_isnanf -# define DOUBLE float -# define MAX_EXP FLT_MAX_EXP -# define MIN_EXP FLT_MIN_EXP -# if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT -# define KNOWN_EXPBIT0_LOCATION -# define EXPBIT0_WORD FLT_EXPBIT0_WORD -# define EXPBIT0_BIT FLT_EXPBIT0_BIT -# endif -# define SIZE SIZEOF_FLT -# define L_(literal) literal##f -#endif - -#define EXP_MASK ((MAX_EXP - MIN_EXP) | 7) - -#define NWORDS \ - ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double; - -int -FUNC (DOUBLE x) -{ -#ifdef KNOWN_EXPBIT0_LOCATION -# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE - /* Special CPU dependent code is needed to treat bit patterns outside the - IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities, - Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs. - These bit patterns are: - - exponent = 0x0001..0x7FFF, mantissa bit 63 = 0, - - exponent = 0x0000, mantissa bit 63 = 1. - The NaN bit pattern is: - - exponent = 0x7FFF, mantissa >= 0x8000000000000001. */ - memory_double m; - unsigned int exponent; - - m.value = x; - exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK; -# ifdef WORDS_BIGENDIAN - /* Big endian: EXPBIT0_WORD = 0, EXPBIT0_BIT = 16. */ - if (exponent == 0) - return 1 & (m.word[0] >> 15); - else if (exponent == EXP_MASK) - return (((m.word[0] ^ 0x8000U) << 16) | m.word[1] | (m.word[2] >> 16)) != 0; - else - return 1 & ~(m.word[0] >> 15); -# else - /* Little endian: EXPBIT0_WORD = 2, EXPBIT0_BIT = 0. */ - if (exponent == 0) - return (m.word[1] >> 31); - else if (exponent == EXP_MASK) - return ((m.word[1] ^ 0x80000000U) | m.word[0]) != 0; - else - return (m.word[1] >> 31) ^ 1; -# endif -# else - /* Be careful to not do any floating-point operation on x, such as x == x, - because x may be a signaling NaN. */ -# if defined __SUNPRO_C || defined __ICC || defined _MSC_VER \ - || defined __DECC || defined __TINYC__ \ - || (defined __sgi && !defined __GNUC__) - /* The Sun C 5.0, Intel ICC 10.0, Microsoft Visual C/C++ 9.0, Compaq (ex-DEC) - 6.4, and TinyCC compilers don't recognize the initializers as constant - expressions. The Compaq compiler also fails when constant-folding - 0.0 / 0.0 even when constant-folding is not required. The Microsoft - Visual C/C++ compiler also fails when constant-folding 1.0 / 0.0 even - when constant-folding is not required. The SGI MIPSpro C compiler - complains about "floating-point operation result is out of range". */ - static DOUBLE zero = L_(0.0); - memory_double nan; - DOUBLE plus_inf = L_(1.0) / zero; - DOUBLE minus_inf = -L_(1.0) / zero; - nan.value = zero / zero; -# else - static memory_double nan = { L_(0.0) / L_(0.0) }; - static DOUBLE plus_inf = L_(1.0) / L_(0.0); - static DOUBLE minus_inf = -L_(1.0) / L_(0.0); -# endif - { - memory_double m; - - /* A NaN can be recognized through its exponent. But exclude +Infinity and - -Infinity, which have the same exponent. */ - m.value = x; - if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD]) - & (EXP_MASK << EXPBIT0_BIT)) - == 0) - return (memcmp (&m.value, &plus_inf, SIZE) != 0 - && memcmp (&m.value, &minus_inf, SIZE) != 0); - else - return 0; - } -# endif -#else - /* The configuration did not find sufficient information. Give up about - the signaling NaNs, handle only the quiet NaNs. */ - if (x == x) - { -# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE - /* Detect any special bit patterns that pass ==; see comment above. */ - memory_double m1; - memory_double m2; - - memset (&m1.value, 0, SIZE); - memset (&m2.value, 0, SIZE); - m1.value = x; - m2.value = x + (x ? 0.0L : -0.0L); - if (memcmp (&m1.value, &m2.value, SIZE) != 0) - return 1; -# endif - return 0; - } - else - return 1; -#endif -} diff --git a/contrib/tools/m4/lib/isnand-nolibm.h b/contrib/tools/m4/lib/isnand-nolibm.h index 8a84ff8140..dc4726464a 100644 --- a/contrib/tools/m4/lib/isnand-nolibm.h +++ b/contrib/tools/m4/lib/isnand-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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/contrib/tools/m4/lib/isnanf-nolibm.h b/contrib/tools/m4/lib/isnanf-nolibm.h index dc43863a69..4e68cada3a 100644 --- a/contrib/tools/m4/lib/isnanf-nolibm.h +++ b/contrib/tools/m4/lib/isnanf-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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/contrib/tools/m4/lib/isnanl-nolibm.h b/contrib/tools/m4/lib/isnanl-nolibm.h index 18eb803714..efd919959b 100644 --- a/contrib/tools/m4/lib/isnanl-nolibm.h +++ b/contrib/tools/m4/lib/isnanl-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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/contrib/tools/m4/lib/localcharset.c b/contrib/tools/m4/lib/localcharset.c index 212eb12e1f..252c451390 100644 --- a/contrib/tools/m4/lib/localcharset.c +++ b/contrib/tools/m4/lib/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2016 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 @@ #if defined _WIN32 || defined __WIN32__ # define WINDOWS_NATIVE +# include <locale.h> #endif #if defined __EMX__ @@ -127,7 +128,7 @@ get_charset_aliases (void) cp = charset_aliases; if (cp == NULL) { -#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__) +#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2) const char *dir; const char *base = "charset.alias"; char *file_name; @@ -341,6 +342,36 @@ get_charset_aliases (void) "CP54936" "\0" "GB18030" "\0" "CP65001" "\0" "UTF-8" "\0"; # endif +# if defined OS2 + /* To avoid the troubles of installing a separate file in the same + directory as the DLL and of retrieving the DLL's directory at + runtime, simply inline the aliases here. */ + + /* The list of encodings is taken from "List of OS/2 Codepages" + by Alex Taylor: + <http://altsan.org/os2/toolkits/uls/index.html#codepages>. + See also "IBM Globalization - Code page identifiers": + <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */ + cp = "CP813" "\0" "ISO-8859-7" "\0" + "CP878" "\0" "KOI8-R" "\0" + "CP819" "\0" "ISO-8859-1" "\0" + "CP912" "\0" "ISO-8859-2" "\0" + "CP913" "\0" "ISO-8859-3" "\0" + "CP914" "\0" "ISO-8859-4" "\0" + "CP915" "\0" "ISO-8859-5" "\0" + "CP916" "\0" "ISO-8859-8" "\0" + "CP920" "\0" "ISO-8859-9" "\0" + "CP921" "\0" "ISO-8859-13" "\0" + "CP923" "\0" "ISO-8859-15" "\0" + "CP954" "\0" "EUC-JP" "\0" + "CP964" "\0" "EUC-TW" "\0" + "CP970" "\0" "EUC-KR" "\0" + "CP1089" "\0" "ISO-8859-6" "\0" + "CP1208" "\0" "UTF-8" "\0" + "CP1381" "\0" "GB2312" "\0" + "CP1386" "\0" "GBK" "\0" + "CP3372" "\0" "EUC-JP" "\0"; +# endif #endif charset_aliases = cp; @@ -461,14 +492,34 @@ locale_charset (void) static char buf[2 + 10 + 1]; - /* The Windows API has a function returning the locale's codepage as a - number: GetACP(). - When the output goes to a console window, it needs to be provided in - GetOEMCP() encoding if the console is using a raster font, or in - GetConsoleOutputCP() encoding if it is using a TrueType font. - But in GUI programs and for output sent to files and pipes, GetACP() - encoding is the best bet. */ - sprintf (buf, "CP%u", GetACP ()); + /* The Windows API has a function returning the locale's codepage as + a number, but the value doesn't change according to what the + 'setlocale' call specified. So we use it as a last resort, in + case the string returned by 'setlocale' doesn't specify the + codepage. */ + char *current_locale = setlocale (LC_ALL, NULL); + char *pdot; + + /* If they set different locales for different categories, + 'setlocale' will return a semi-colon separated list of locale + values. To make sure we use the correct one, we choose LC_CTYPE. */ + if (strchr (current_locale, ';')) + current_locale = setlocale (LC_CTYPE, NULL); + + pdot = strrchr (current_locale, '.'); + if (pdot && 2 + strlen (pdot + 1) + 1 <= sizeof (buf)) + sprintf (buf, "CP%s", pdot + 1); + else + { + /* The Windows API has a function returning the locale's codepage as a + number: GetACP(). + When the output goes to a console window, it needs to be provided in + GetOEMCP() encoding if the console is using a raster font, or in + GetConsoleOutputCP() encoding if it is using a TrueType font. + But in GUI programs and for output sent to files and pipes, GetACP() + encoding is the best bet. */ + sprintf (buf, "CP%u", GetACP ()); + } codeset = buf; #elif defined OS2 @@ -478,6 +529,8 @@ locale_charset (void) ULONG cp[3]; ULONG cplen; + codeset = NULL; + /* Allow user to override the codeset, as set in the operating system, with standard language environment variables. */ locale = getenv ("LC_ALL"); @@ -509,10 +562,12 @@ locale_charset (void) } } - /* Resolve through the charset.alias file. */ - codeset = locale; + /* For the POSIX locale, don't use the system's codepage. */ + if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0) + codeset = ""; } - else + + if (codeset == NULL) { /* OS/2 has a function returning the locale's codepage as a number. */ if (DosQueryCp (sizeof (cp), cp, &cplen)) diff --git a/contrib/tools/m4/lib/localcharset.h b/contrib/tools/m4/lib/localcharset.h index c209829867..915182e328 100644 --- a/contrib/tools/m4/lib/localcharset.h +++ b/contrib/tools/m4/lib/localcharset.h @@ -1,5 +1,5 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/localeconv.c b/contrib/tools/m4/lib/localeconv.c index 7c7c77cfd4..8a1d6d77cc 100644 --- a/contrib/tools/m4/lib/localeconv.c +++ b/contrib/tools/m4/lib/localeconv.c @@ -1,5 +1,5 @@ /* Query locale dependent information for formatting numbers. - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2016 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/contrib/tools/m4/lib/malloca.c b/contrib/tools/m4/lib/malloca.c index 311be569bc..a6132775b1 100644 --- a/contrib/tools/m4/lib/malloca.c +++ b/contrib/tools/m4/lib/malloca.c @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/malloca.h b/contrib/tools/m4/lib/malloca.h index 6fbe45eab6..7996d1bcbf 100644 --- a/contrib/tools/m4/lib/malloca.h +++ b/contrib/tools/m4/lib/malloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify @@ -21,6 +21,9 @@ #include <alloca.h> #include <stddef.h> #include <stdlib.h> +#include <stdint.h> + +#include "xalloc-oversized.h" #ifdef __cplusplus @@ -73,15 +76,7 @@ extern void freea (void *p); It allocates an array of N objects, each with S bytes of memory, on the stack. S must be positive and N must be nonnegative. The array must be freed using freea() before the function returns. */ -#if 1 -/* Cf. the definition of xalloc_oversized. */ -# define nmalloca(n, s) \ - ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \ - ? NULL \ - : malloca ((n) * (s))) -#else -extern void * nmalloca (size_t n, size_t s); -#endif +#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s))) #ifdef __cplusplus diff --git a/contrib/tools/m4/lib/math.c b/contrib/tools/m4/lib/math.c index ddb2ded530..ba2a6abd62 100644 --- a/contrib/tools/m4/lib/math.c +++ b/contrib/tools/m4/lib/math.c @@ -1,3 +1,4 @@ #include <config.h> #define _GL_MATH_INLINE _GL_EXTERN_INLINE #include "math.h" +typedef int dummy; diff --git a/contrib/tools/m4/lib/mbrtowc.c b/contrib/tools/m4/lib/mbrtowc.c new file mode 100644 index 0000000000..11dddc065f --- /dev/null +++ b/contrib/tools/m4/lib/mbrtowc.c @@ -0,0 +1,407 @@ +/* Convert multibyte character to wide character. + Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2008. + + 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 Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <wchar.h> + +#if C_LOCALE_MAYBE_EILSEQ +# include "hard-locale.h" +# include <locale.h> +#endif + +#if GNULIB_defined_mbstate_t +/* Implement mbrtowc() on top of mbtowc(). */ + +# include <errno.h> +# include <stdlib.h> + +# include "localcharset.h" +# error #include "streq.h" +# include "verify.h" + + +verify (sizeof (mbstate_t) >= 4); + +static char internal_state[4]; + +size_t +mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) +{ + char *pstate = (char *)ps; + + if (s == NULL) + { + pwc = NULL; + s = ""; + n = 1; + } + + if (n == 0) + return (size_t)(-2); + + /* Here n > 0. */ + + if (pstate == NULL) + pstate = internal_state; + + { + size_t nstate = pstate[0]; + char buf[4]; + const char *p; + size_t m; + + switch (nstate) + { + case 0: + p = s; + m = n; + break; + case 3: + buf[2] = pstate[3]; + /*FALLTHROUGH*/ + case 2: + buf[1] = pstate[2]; + /*FALLTHROUGH*/ + case 1: + buf[0] = pstate[1]; + p = buf; + m = nstate; + buf[m++] = s[0]; + if (n >= 2 && m < 4) + { + buf[m++] = s[1]; + if (n >= 3 && m < 4) + buf[m++] = s[2]; + } + break; + default: + errno = EINVAL; + return (size_t)(-1); + } + + /* Here m > 0. */ + +# if __GLIBC__ || defined __UCLIBC__ + /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ + mbtowc (NULL, NULL, 0); +# endif + { + int res = mbtowc (pwc, p, m); + + if (res >= 0) + { + if (pwc != NULL && ((*pwc == 0) != (res == 0))) + abort (); + if (nstate >= (res > 0 ? res : 1)) + abort (); + res -= nstate; + pstate[0] = 0; + return res; + } + + /* mbtowc does not distinguish between invalid and incomplete multibyte + sequences. But mbrtowc needs to make this distinction. + There are two possible approaches: + - Use iconv() and its return value. + - Use built-in knowledge about the possible encodings. + Given the low quality of implementation of iconv() on the systems that + lack mbrtowc(), we use the second approach. + The possible encodings are: + - 8-bit encodings, + - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, + - UTF-8. + Use specialized code for each. */ + if (m >= 4 || m >= MB_CUR_MAX) + goto invalid; + /* Here MB_CUR_MAX > 1 and 0 < m < 4. */ + { + const char *encoding = locale_charset (); + + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + { + /* Cf. unistr/u8-mblen.c. */ + unsigned char c = (unsigned char) p[0]; + + if (c >= 0xc2) + { + if (c < 0xe0) + { + if (m == 1) + goto incomplete; + } + else if (c < 0xf0) + { + if (m == 1) + goto incomplete; + if (m == 2) + { + unsigned char c2 = (unsigned char) p[1]; + + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xe1 || c2 >= 0xa0) + && (c != 0xed || c2 < 0xa0)) + goto incomplete; + } + } + else if (c <= 0xf4) + { + if (m == 1) + goto incomplete; + else /* m == 2 || m == 3 */ + { + unsigned char c2 = (unsigned char) p[1]; + + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xf1 || c2 >= 0x90) + && (c < 0xf4 || (c == 0xf4 && c2 < 0x90))) + { + if (m == 2) + goto incomplete; + else /* m == 3 */ + { + unsigned char c3 = (unsigned char) p[2]; + + if ((c3 ^ 0x80) < 0x40) + goto incomplete; + } + } + } + } + } + goto invalid; + } + + /* As a reference for this code, you can use the GNU libiconv + implementation. Look for uses of the RET_TOOFEW macro. */ + + if (STREQ_OPT (encoding, + "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f) + goto incomplete; + } + if (m == 2) + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8f) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0xa1 && c2 < 0xff) + goto incomplete; + } + } + goto invalid; + } + if (STREQ_OPT (encoding, + "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ_OPT (encoding, + "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ_OPT (encoding, + "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0xa1 && c < 0xff) + goto incomplete; + } + goto invalid; + } + if (STREQ_OPT (encoding, + "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8e) + goto incomplete; + } + goto invalid; + } + if (STREQ_OPT (encoding, + "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0x90 && c <= 0xe3) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0x30 && c2 <= 0x39) + { + if (m == 2) + goto incomplete; + else /* m == 3 */ + { + unsigned char c3 = (unsigned char) p[2]; + + if (c3 >= 0x81 && c3 <= 0xfe) + goto incomplete; + } + } + } + } + goto invalid; + } + if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea) + || (c >= 0xf0 && c <= 0xf9)) + goto incomplete; + } + goto invalid; + } + + /* An unknown multibyte encoding. */ + goto incomplete; + } + + incomplete: + { + size_t k = nstate; + /* Here 0 <= k < m < 4. */ + pstate[++k] = s[0]; + if (k < m) + { + pstate[++k] = s[1]; + if (k < m) + pstate[++k] = s[2]; + } + if (k != m) + abort (); + } + pstate[0] = m; + return (size_t)(-2); + + invalid: + errno = EILSEQ; + /* The conversion state is undefined, says POSIX. */ + return (size_t)(-1); + } + } +} + +#else +/* Override the system's mbrtowc() function. */ + +# undef mbrtowc + +size_t +rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) +{ + size_t ret; + wchar_t wc; + +# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG + if (s == NULL) + { + pwc = NULL; + s = ""; + n = 1; + } +# endif + +# if MBRTOWC_EMPTY_INPUT_BUG + if (n == 0) + return (size_t) -2; +# endif + + if (! pwc) + pwc = &wc; + +# if MBRTOWC_RETVAL_BUG + { + static mbstate_t internal_state; + + /* Override mbrtowc's internal state. We cannot call mbsinit() on the + hidden internal state, but we can call it on our variable. */ + if (ps == NULL) + ps = &internal_state; + + if (!mbsinit (ps)) + { + /* Parse the rest of the multibyte character byte for byte. */ + size_t count = 0; + for (; n > 0; s++, n--) + { + ret = mbrtowc (&wc, s, 1, ps); + + if (ret == (size_t)(-1)) + return (size_t)(-1); + count++; + if (ret != (size_t)(-2)) + { + /* The multibyte character has been completed. */ + *pwc = wc; + return (wc == 0 ? 0 : count); + } + } + return (size_t)(-2); + } + } +# endif + + ret = mbrtowc (pwc, s, n, ps); + +# if MBRTOWC_NUL_RETVAL_BUG + if (ret < (size_t) -2 && !*pwc) + return 0; +# endif + +# if C_LOCALE_MAYBE_EILSEQ + if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE)) + { + unsigned char uc = *s; + *pwc = uc; + return 1; + } +# endif + + return ret; +} + +#endif diff --git a/contrib/tools/m4/lib/memchr2.c b/contrib/tools/m4/lib/memchr2.c index 8b105b7f27..66a217dd80 100644 --- a/contrib/tools/m4/lib/memchr2.c +++ b/contrib/tools/m4/lib/memchr2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), diff --git a/contrib/tools/m4/lib/memchr2.h b/contrib/tools/m4/lib/memchr2.h index cc04889f12..27f2c86116 100644 --- a/contrib/tools/m4/lib/memchr2.h +++ b/contrib/tools/m4/lib/memchr2.h @@ -1,5 +1,5 @@ /* Scan memory for the first of two bytes. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 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/contrib/tools/m4/lib/minmax.h b/contrib/tools/m4/lib/minmax.h new file mode 100644 index 0000000000..be6b321ee1 --- /dev/null +++ b/contrib/tools/m4/lib/minmax.h @@ -0,0 +1,60 @@ +/* MIN, MAX macros. + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2016 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 Free Software Foundation; either version 3, or (at your option) + any later version. + + This program 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 <http://www.gnu.org/licenses/>. */ + +#ifndef _MINMAX_H +#define _MINMAX_H + +/* Note: MIN, MAX are also defined in <sys/param.h> on some systems + (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about + MIN, MAX macro redefinitions on some systems; the workaround is to + #include this file as the last one among the #include list. */ + +/* Before we define the following symbols we get the <limits.h> file + since otherwise we get redefinitions on some systems if <limits.h> is + included after this file. Likewise for <sys/param.h>. + If more than one of these system headers define MIN and MAX, pick just + one of the headers (because the definitions most likely are the same). */ +#if HAVE_MINMAX_IN_LIMITS_H +# include <limits.h> +#elif HAVE_MINMAX_IN_SYS_PARAM_H +# include <sys/param.h> +#endif + +/* Note: MIN and MAX should be used with two arguments of the + same type. They might not return the minimum and maximum of their two + arguments, if the arguments have different types or have unusual + floating-point values. For example, on a typical host with 32-bit 'int', + 64-bit 'long long', and 64-bit IEEE 754 'double' types: + + MAX (-1, 2147483648) returns 4294967295. + MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. + MAX (NaN, 0.0) returns 0.0. + MAX (+0.0, -0.0) returns -0.0. + + and in each case the answer is in some sense bogus. */ + +/* MAX(a,b) returns the maximum of A and B. */ +#ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif + +/* MIN(a,b) returns the minimum of A and B. */ +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#endif /* _MINMAX_H */ diff --git a/contrib/tools/m4/lib/mkdtemp.c b/contrib/tools/m4/lib/mkdtemp.c index 6ba8b65d52..c1b05fd8ad 100644 --- a/contrib/tools/m4/lib/mkdtemp.c +++ b/contrib/tools/m4/lib/mkdtemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2013 Free Software +/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/mkstemp-safer.c b/contrib/tools/m4/lib/mkstemp-safer.c index 9ddf86fb60..560c0c10a6 100644 --- a/contrib/tools/m4/lib/mkstemp-safer.c +++ b/contrib/tools/m4/lib/mkstemp-safer.c @@ -1,6 +1,6 @@ /* Invoke mkstemp, but avoid some glitches. - Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2016 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/contrib/tools/m4/lib/msvc-inval.c b/contrib/tools/m4/lib/msvc-inval.c index 396031e4c2..baaf39eda1 100644 --- a/contrib/tools/m4/lib/msvc-inval.c +++ b/contrib/tools/m4/lib/msvc-inval.c @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2011-2016 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/contrib/tools/m4/lib/msvc-inval.h b/contrib/tools/m4/lib/msvc-inval.h index dcb0353dcd..027c94972a 100644 --- a/contrib/tools/m4/lib/msvc-inval.h +++ b/contrib/tools/m4/lib/msvc-inval.h @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2011-2016 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/contrib/tools/m4/lib/msvc-nothrow.c b/contrib/tools/m4/lib/msvc-nothrow.c index 8d65472a82..ba75bbfb27 100644 --- a/contrib/tools/m4/lib/msvc-nothrow.c +++ b/contrib/tools/m4/lib/msvc-nothrow.c @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2011-2016 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/contrib/tools/m4/lib/msvc-nothrow.h b/contrib/tools/m4/lib/msvc-nothrow.h index 5f521813df..3493b84a86 100644 --- a/contrib/tools/m4/lib/msvc-nothrow.h +++ b/contrib/tools/m4/lib/msvc-nothrow.h @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2011-2016 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/contrib/tools/m4/lib/nl_langinfo.c b/contrib/tools/m4/lib/nl_langinfo.c index 771c9533ae..1c110def13 100644 --- a/contrib/tools/m4/lib/nl_langinfo.c +++ b/contrib/tools/m4/lib/nl_langinfo.c @@ -1,6 +1,6 @@ /* nl_langinfo() replacement: query locale dependent information. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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 @@ -20,13 +20,71 @@ /* Specification. */ #include <langinfo.h> +#include <locale.h> +#include <string.h> +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include <windows.h> +# include <stdio.h> +#endif + +/* Return the codeset of the current locale, if this is easily deducible. + Otherwise, return "". */ +static char * +ctype_codeset (void) +{ + static char buf[2 + 10 + 1]; + char const *locale = setlocale (LC_CTYPE, NULL); + char *codeset = buf; + size_t codesetlen; + codeset[0] = '\0'; + + if (locale && locale[0]) + { + /* If the locale name contains an encoding after the dot, return it. */ + char *dot = strchr (locale, '.'); + + if (dot) + { + /* Look for the possible @... trailer and remove it, if any. */ + char *codeset_start = dot + 1; + char const *modifier = strchr (codeset_start, '@'); + + if (! modifier) + codeset = codeset_start; + else + { + codesetlen = modifier - codeset_start; + if (codesetlen < sizeof buf) + { + codeset = memcpy (buf, codeset_start, codesetlen); + codeset[codesetlen] = '\0'; + } + } + } + } + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + /* If setlocale is successful, it returns the number of the + codepage, as a string. Otherwise, fall back on Windows API + GetACP, which returns the locale's codepage as a number (although + this doesn't change according to what the 'setlocale' call specified). + Either way, prepend "CP" to make it a valid codeset name. */ + codesetlen = strlen (codeset); + if (0 < codesetlen && codesetlen < sizeof buf - 2) + memmove (buf + 2, codeset, codesetlen + 1); + else + sprintf (buf + 2, "%u", GetACP ()); + codeset = memcpy (buf, "CP", 2); +#endif + return codeset; +} + + #if REPLACE_NL_LANGINFO /* Override nl_langinfo with support for added nl_item values. */ -# include <locale.h> -# include <string.h> - # undef nl_langinfo char * @@ -36,47 +94,18 @@ rpl_nl_langinfo (nl_item item) { # if GNULIB_defined_CODESET case CODESET: - { - const char *locale; - static char buf[2 + 10 + 1]; - - locale = setlocale (LC_CTYPE, NULL); - if (locale != NULL && locale[0] != '\0') - { - /* If the locale name contains an encoding after the dot, return - it. */ - const char *dot = strchr (locale, '.'); - - if (dot != NULL) - { - const char *modifier; - - dot++; - /* Look for the possible @... trailer and remove it, if any. */ - modifier = strchr (dot, '@'); - if (modifier == NULL) - return dot; - if (modifier - dot < sizeof (buf)) - { - memcpy (buf, dot, modifier - dot); - buf [modifier - dot] = '\0'; - return buf; - } - } - } - return ""; - } + return ctype_codeset (); # endif # if GNULIB_defined_T_FMT_AMPM case T_FMT_AMPM: - return "%I:%M:%S %p"; + return (char *) "%I:%M:%S %p"; # endif # if GNULIB_defined_ERA case ERA: /* The format is not standardized. In glibc it is a sequence of strings of the form "direction:offset:start_date:end_date:era_name:era_format" with an empty string at the end. */ - return ""; + return (char *) ""; case ERA_D_FMT: /* The %Ex conversion in strftime behaves like %x if the locale does not have an alternative time format. */ @@ -95,13 +124,13 @@ rpl_nl_langinfo (nl_item item) case ALT_DIGITS: /* The format is not standardized. In glibc it is a sequence of 10 strings, appended in memory. */ - return "\0\0\0\0\0\0\0\0\0\0"; + return (char *) "\0\0\0\0\0\0\0\0\0\0"; # endif # if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS case YESEXPR: - return "^[yY]"; + return (char *) "^[yY]"; case NOEXPR: - return "^[nN]"; + return (char *) "^[nN]"; # endif default: break; @@ -111,45 +140,31 @@ rpl_nl_langinfo (nl_item item) #else -/* Provide nl_langinfo from scratch. */ - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Provide nl_langinfo from scratch, either for native MS-Windows, or + for old Unix platforms without locales, such as Linux libc5 or + BeOS. */ -/* Native Windows platforms. */ - -# define WIN32_LEAN_AND_MEAN /* avoid including junk */ -# include <windows.h> - -# include <stdio.h> - -# else - -/* An old Unix platform without locales, such as Linux libc5 or BeOS. */ - -# endif - -# include <locale.h> +# include <time.h> char * nl_langinfo (nl_item item) { + static char nlbuf[100]; + struct tm tmm = { 0 }; + switch (item) { /* nl_langinfo items of the LC_CTYPE category */ case CODESET: -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ { - static char buf[2 + 10 + 1]; - - /* The Windows API has a function returning the locale's codepage as - a number. */ - sprintf (buf, "CP%u", GetACP ()); - return buf; + char *codeset = ctype_codeset (); + if (*codeset) + return codeset; } -# elif defined __BEOS__ - return "UTF-8"; +# ifdef __BEOS__ + return (char *) "UTF-8"; # else - return "ISO-8859-1"; + return (char *) "ISO-8859-1"; # endif /* nl_langinfo items of the LC_NUMERIC category */ case RADIXCHAR: @@ -160,111 +175,146 @@ nl_langinfo (nl_item item) TODO: Really use the locale. */ case D_T_FMT: case ERA_D_T_FMT: - return "%a %b %e %H:%M:%S %Y"; + return (char *) "%a %b %e %H:%M:%S %Y"; case D_FMT: case ERA_D_FMT: - return "%m/%d/%y"; + return (char *) "%m/%d/%y"; case T_FMT: case ERA_T_FMT: - return "%H:%M:%S"; + return (char *) "%H:%M:%S"; case T_FMT_AMPM: - return "%I:%M:%S %p"; + return (char *) "%I:%M:%S %p"; case AM_STR: - return "AM"; + if (!strftime (nlbuf, sizeof nlbuf, "%p", &tmm)) + return (char *) "AM"; + return nlbuf; case PM_STR: - return "PM"; + tmm.tm_hour = 12; + if (!strftime (nlbuf, sizeof nlbuf, "%p", &tmm)) + return (char *) "PM"; + return nlbuf; case DAY_1: - return "Sunday"; case DAY_2: - return "Monday"; case DAY_3: - return "Tuesday"; case DAY_4: - return "Wednesday"; case DAY_5: - return "Thursday"; case DAY_6: - return "Friday"; case DAY_7: - return "Saturday"; + { + static char const days[][sizeof "Wednesday"] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday" + }; + tmm.tm_wday = item - DAY_1; + if (!strftime (nlbuf, sizeof nlbuf, "%A", &tmm)) + return (char *) days[item - DAY_1]; + return nlbuf; + } case ABDAY_1: - return "Sun"; case ABDAY_2: - return "Mon"; case ABDAY_3: - return "Tue"; case ABDAY_4: - return "Wed"; case ABDAY_5: - return "Thu"; case ABDAY_6: - return "Fri"; case ABDAY_7: - return "Sat"; + { + static char const abdays[][sizeof "Sun"] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + tmm.tm_wday = item - ABDAY_1; + if (!strftime (nlbuf, sizeof nlbuf, "%a", &tmm)) + return (char *) abdays[item - ABDAY_1]; + return nlbuf; + } case MON_1: - return "January"; case MON_2: - return "February"; case MON_3: - return "March"; case MON_4: - return "April"; case MON_5: - return "May"; case MON_6: - return "June"; case MON_7: - return "July"; case MON_8: - return "August"; case MON_9: - return "September"; case MON_10: - return "October"; case MON_11: - return "November"; case MON_12: - return "December"; + { + static char const months[][sizeof "September"] = { + "January", "February", "March", "April", "May", "June", "July", + "September", "October", "November", "December" + }; + tmm.tm_mon = item - MON_1; + if (!strftime (nlbuf, sizeof nlbuf, "%B", &tmm)) + return (char *) months[item - MON_1]; + return nlbuf; + } case ABMON_1: - return "Jan"; case ABMON_2: - return "Feb"; case ABMON_3: - return "Mar"; case ABMON_4: - return "Apr"; case ABMON_5: - return "May"; case ABMON_6: - return "Jun"; case ABMON_7: - return "Jul"; case ABMON_8: - return "Aug"; case ABMON_9: - return "Sep"; case ABMON_10: - return "Oct"; case ABMON_11: - return "Nov"; case ABMON_12: - return "Dec"; + { + static char const abmonths[][sizeof "Jan"] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Sep", "Oct", "Nov", "Dec" + }; + tmm.tm_mon = item - ABMON_1; + if (!strftime (nlbuf, sizeof nlbuf, "%b", &tmm)) + return (char *) abmonths[item - ABMON_1]; + return nlbuf; + } case ERA: - return ""; + return (char *) ""; case ALT_DIGITS: - return "\0\0\0\0\0\0\0\0\0\0"; - /* nl_langinfo items of the LC_MONETARY category - TODO: Really use the locale. */ + return (char *) "\0\0\0\0\0\0\0\0\0\0"; + /* nl_langinfo items of the LC_MONETARY category. */ case CRNCYSTR: - return "-"; + return localeconv () ->currency_symbol; +#if 0 + case INT_CURR_SYMBOL: + return localeconv () ->int_curr_symbol; + case MON_DECIMAL_POINT: + return localeconv () ->mon_decimal_point; + case MON_THOUSANDS_SEP: + return localeconv () ->mon_thousands_sep; + case MON_GROUPING: + return localeconv () ->mon_grouping; + case POSITIVE_SIGN: + return localeconv () ->positive_sign; + case NEGATIVE_SIGN: + return localeconv () ->negative_sign; + case FRAC_DIGITS: + return & localeconv () ->frac_digits; + case INT_FRAC_DIGITS: + return & localeconv () ->int_frac_digits; + case P_CS_PRECEDES: + return & localeconv () ->p_cs_precedes; + case N_CS_PRECEDES: + return & localeconv () ->n_cs_precedes; + case P_SEP_BY_SPACE: + return & localeconv () ->p_sep_by_space; + case N_SEP_BY_SPACE: + return & localeconv () ->n_sep_by_space; + case P_SIGN_POSN: + return & localeconv () ->p_sign_posn; + case N_SIGN_POSN: + return & localeconv () ->n_sign_posn; +#endif /* nl_langinfo items of the LC_MESSAGES category TODO: Really use the locale. */ case YESEXPR: - return "^[yY]"; + return (char *) "^[yY]"; case NOEXPR: - return "^[nN]"; + return (char *) "^[nN]"; default: - return ""; + return (char *) ""; } } diff --git a/contrib/tools/m4/lib/obstack.c b/contrib/tools/m4/lib/obstack.c index d915449def..b485b615a4 100644 --- a/contrib/tools/m4/lib/obstack.c +++ b/contrib/tools/m4/lib/obstack.c @@ -1,32 +1,32 @@ /* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. - Copyright (C) 1988-1994, 1996-2006, 2009-2013 Free Software Foundation, Inc. + The GNU C 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 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 Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, + The GNU C 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. + 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 the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef _LIBC # include <obstack.h> -# include <shlib-compat.h> #else # include <config.h> # include "obstack.h" #endif -/* NOTE BEFORE MODIFYING THIS FILE: This version number must be - incremented whenever callers compiled using an old obstack.h can no - longer properly call the functions in this obstack.c. */ -#define OBSTACK_INTERFACE_VERSION 1 +/* NOTE BEFORE MODIFYING THIS FILE: _OBSTACK_INTERFACE_VERSION in + obstack.h must be incremented whenever callers compiled using an old + obstack.h can no longer properly call the functions in this file. */ /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself, and the installed library @@ -36,114 +36,76 @@ (especially if it is a shared library). Rather than having every GNU program understand 'configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ - -#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */ #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 # include <gnu-versions.h> -# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION -# define ELIDE_CODE +# if (_GNU_OBSTACK_INTERFACE_VERSION == _OBSTACK_INTERFACE_VERSION \ + || (_GNU_OBSTACK_INTERFACE_VERSION == 1 \ + && _OBSTACK_INTERFACE_VERSION == 2 \ + && defined SIZEOF_INT && defined SIZEOF_SIZE_T \ + && SIZEOF_INT == SIZEOF_SIZE_T)) +# define _OBSTACK_ELIDE_CODE # endif #endif -#include <stddef.h> - -#ifndef ELIDE_CODE - +#ifndef _OBSTACK_ELIDE_CODE +/* If GCC, or if an oddball (testing?) host that #defines __alignof__, + use the already-supplied __alignof__. Otherwise, this must be Gnulib + (as glibc assumes GCC); defer to Gnulib's alignof_type. */ +# include <stdlib.h> # include <stdint.h> -/* Determine default alignment. */ -union fooround -{ - uintmax_t i; - long double d; - void *p; -}; -struct fooalign -{ - char c; - union fooround u; -}; -/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. - But in fact it might be less smart and round addresses to as much as - DEFAULT_ROUNDING. So we prepare for it to do that. */ -enum - { - DEFAULT_ALIGNMENT = offsetof (struct fooalign, u), - DEFAULT_ROUNDING = sizeof (union fooround) - }; - -/* When we copy a long block of data, this is the unit to do it with. - On some machines, copying successive ints does not work; - in such a case, redefine COPYING_UNIT to 'long' (if that works) - or 'char' as a last resort. */ -# ifndef COPYING_UNIT -# define COPYING_UNIT int +# ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) # endif +/* Determine default alignment. */ -/* The functions allocating more room by calling 'obstack_chunk_alloc' - jump to the handler pointed to by 'obstack_alloc_failed_handler'. - This can be set to a user defined function which should either - abort gracefully or use longjump - but shouldn't return. This - variable by default points to the internal function - 'print_and_abort'. */ -static _Noreturn void print_and_abort (void); -void (*obstack_alloc_failed_handler) (void) = print_and_abort; +/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. + But in fact it might be less smart and round addresses to as much as + DEFAULT_ROUNDING. So we prepare for it to do that. + + DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h. */ +#define DEFAULT_ALIGNMENT MAX (__alignof__ (long double), \ + MAX (__alignof__ (uintmax_t), \ + __alignof__ (void *))) +#define DEFAULT_ROUNDING MAX (sizeof (long double), \ + MAX (sizeof (uintmax_t), \ + sizeof (void *))) + +/* Call functions with either the traditional malloc/free calling + interface, or the mmalloc/mfree interface (that adds an extra first + argument), based on the value of use_extra_arg. */ + +static void * +call_chunkfun (struct obstack *h, size_t size) +{ + if (h->use_extra_arg) + return h->chunkfun.extra (h->extra_arg, size); + else + return h->chunkfun.plain (size); +} -/* Exit value used when 'print_and_abort' is used. */ -# include <stdlib.h> -# ifdef _LIBC -int obstack_exit_failure = EXIT_FAILURE; -# else -# include "exitfail.h" -# define obstack_exit_failure exit_failure -# endif +static void +call_freefun (struct obstack *h, void *old_chunk) +{ + if (h->use_extra_arg) + h->freefun.extra (h->extra_arg, old_chunk); + else + h->freefun.plain (old_chunk); +} -# ifdef _LIBC -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) -/* A looong time ago (before 1994, anyway; we're not sure) this global variable - was used by non-GNU-C macros to avoid multiple evaluation. The GNU C - library still exports it because somebody might use it. */ -struct obstack *_obstack_compat; -compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); -# endif -# endif -/* Define a macro that either calls functions with the traditional malloc/free - calling interface, or calls functions with the mmalloc/mfree interface - (that adds an extra first argument), based on the state of use_extra_arg. - For free, do not use ?:, since some compilers, like the MIPS compilers, - do not allow (expr) ? void : void. */ - -# define CALL_CHUNKFUN(h, size) \ - (((h) -> use_extra_arg) \ - ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ - : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) - -# define CALL_FREEFUN(h, old_chunk) \ - do { \ - if ((h) -> use_extra_arg) \ - (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ - else \ - (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ - } while (0) - - /* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). Objects start on multiples of ALIGNMENT (0 means use default). - CHUNKFUN is the function to use to allocate chunks, - and FREEFUN the function to free them. Return nonzero if successful, calls obstack_alloc_failed_handler if allocation fails. */ -int -_obstack_begin (struct obstack *h, - int size, int alignment, - void *(*chunkfun) (long), - void (*freefun) (void *)) +static int +_obstack_begin_worker (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment) { - register struct _obstack_chunk *chunk; /* points to new chunk */ + struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) alignment = DEFAULT_ALIGNMENT; @@ -164,19 +126,15 @@ _obstack_begin (struct obstack *h, size = 4096 - extra; } - h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; - h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; h->chunk_size = size; h->alignment_mask = alignment - 1; - h->use_extra_arg = 0; - chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + chunk = h->chunk = call_chunkfun (h, h->chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, alignment - 1); - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; + h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; /* The initial chunk now contains no empty object. */ h->maybe_empty_object = 0; @@ -185,51 +143,29 @@ _obstack_begin (struct obstack *h, } int -_obstack_begin_1 (struct obstack *h, int size, int alignment, - void *(*chunkfun) (void *, long), +_obstack_begin (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (size_t), + void (*freefun) (void *)) +{ + h->chunkfun.plain = chunkfun; + h->freefun.plain = freefun; + h->use_extra_arg = 0; + return _obstack_begin_worker (h, size, alignment); +} + +int +_obstack_begin_1 (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (void *, size_t), void (*freefun) (void *, void *), void *arg) { - register struct _obstack_chunk *chunk; /* points to new chunk */ - - if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; - if (size == 0) - /* Default size is what GNU malloc can fit in a 4096-byte block. */ - { - /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. - - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ - int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); - size = 4096 - extra; - } - - h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; - h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; - h->chunk_size = size; - h->alignment_mask = alignment - 1; + h->chunkfun.extra = chunkfun; + h->freefun.extra = freefun; h->extra_arg = arg; h->use_extra_arg = 1; - - chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); - if (!chunk) - (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, - alignment - 1); - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; - chunk->prev = 0; - /* The initial chunk now contains no empty object. */ - h->maybe_empty_object = 0; - h->alloc_failed = 0; - return 1; + return _obstack_begin_worker (h, size, alignment); } /* Allocate a new current chunk for the obstack *H @@ -239,25 +175,27 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment, to the beginning of the new one. */ void -_obstack_newchunk (struct obstack *h, int length) +_obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length) { - register struct _obstack_chunk *old_chunk = h->chunk; - register struct _obstack_chunk *new_chunk; - register long new_size; - register long obj_size = h->next_free - h->object_base; - register long i; - long already; + struct _obstack_chunk *old_chunk = h->chunk; + struct _obstack_chunk *new_chunk = 0; + size_t obj_size = h->next_free - h->object_base; char *object_base; /* Compute size for new chunk. */ - new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100; + size_t sum1 = obj_size + length; + size_t sum2 = sum1 + h->alignment_mask; + size_t new_size = sum2 + (obj_size >> 3) + 100; + if (new_size < sum2) + new_size = sum2; if (new_size < h->chunk_size) new_size = h->chunk_size; /* Allocate and initialize the new chunk. */ - new_chunk = CALL_CHUNKFUN (h, new_size); + if (obj_size <= sum1 && sum1 <= sum2) + new_chunk = call_chunkfun (h, new_size); if (!new_chunk) - (*obstack_alloc_failed_handler) (); + (*obstack_alloc_failed_handler)(); h->chunk = new_chunk; new_chunk->prev = old_chunk; new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; @@ -266,36 +204,19 @@ _obstack_newchunk (struct obstack *h, int length) object_base = __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); - /* Move the existing object to the new chunk. - Word at a time is fast and is safe if the object - is sufficiently aligned. */ - if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) - { - for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *)object_base)[i] - = ((COPYING_UNIT *)h->object_base)[i]; - /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, - but that can cross a page boundary on a machine - which does not do strict alignment for COPYING_UNITS. */ - already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); - } - else - already = 0; - /* Copy remaining bytes one by one. */ - for (i = already; i < obj_size; i++) - object_base[i] = h->object_base[i]; + /* Move the existing object to the new chunk. */ + memcpy (object_base, h->object_base, obj_size); /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. But not if that chunk might contain an empty object. */ - if (! h->maybe_empty_object + if (!h->maybe_empty_object && (h->object_base == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, h->alignment_mask))) { new_chunk->prev = old_chunk->prev; - CALL_FREEFUN (h, old_chunk); + call_freefun (h, old_chunk); } h->object_base = object_base; @@ -303,9 +224,6 @@ _obstack_newchunk (struct obstack *h, int length) /* The new chunk certainly contains no empty object yet. */ h->maybe_empty_object = 0; } -# ifdef _LIBC -libc_hidden_def (_obstack_newchunk) -# endif /* Return nonzero if object OBJ has been allocated from obstack H. This is here for debugging. @@ -313,13 +231,13 @@ libc_hidden_def (_obstack_newchunk) /* Suppress -Wmissing-prototypes warning. We don't want to declare this in obstack.h because it is just for debugging. */ -int _obstack_allocated_p (struct obstack *h, void *obj); +int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__; int _obstack_allocated_p (struct obstack *h, void *obj) { - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = (h)->chunk; /* We use >= rather than > since the object cannot be exactly at @@ -332,17 +250,15 @@ _obstack_allocated_p (struct obstack *h, void *obj) } return lp != 0; } - + /* Free objects in obstack H, including OBJ and everything allocate more recently than OBJ. If OBJ is zero, free everything in H. */ -# undef obstack_free - void -__obstack_free (struct obstack *h, void *obj) +_obstack_free (struct obstack *h, void *obj) { - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = h->chunk; /* We use >= because there cannot be an object at the beginning of a chunk. @@ -351,7 +267,7 @@ __obstack_free (struct obstack *h, void *obj) while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; - CALL_FREEFUN (h, lp); + call_freefun (h, lp); lp = plp; /* If we switch chunks, we can't tell whether the new current chunk contains an empty object, so assume that it may. */ @@ -368,17 +284,11 @@ __obstack_free (struct obstack *h, void *obj) abort (); } -# ifdef _LIBC -/* Older versions of libc used a function _obstack_free intended to be - called by non-GCC compilers. */ -strong_alias (obstack_free, _obstack_free) -# endif - -int +_OBSTACK_SIZE_T _obstack_memory_used (struct obstack *h) { - register struct _obstack_chunk* lp; - register int nbytes = 0; + struct _obstack_chunk *lp; + _OBSTACK_SIZE_T nbytes = 0; for (lp = h->chunk; lp != 0; lp = lp->prev) { @@ -386,20 +296,31 @@ _obstack_memory_used (struct obstack *h) } return nbytes; } - + +# ifndef _OBSTACK_NO_ERROR_HANDLER /* Define the error handler. */ -# ifdef _LIBC -# include <libintl.h> -# else -# include "gettext.h" -# endif -# ifndef _ -# define _(msgid) gettext (msgid) -# endif +# include <stdio.h> -# ifdef _LIBC -# include <libio/iolibio.h> -# endif +/* Exit value used when 'print_and_abort' is used. */ +# ifdef _LIBC +int obstack_exit_failure = EXIT_FAILURE; +# else +# include "exitfail.h" +# define obstack_exit_failure exit_failure +# endif + +# ifdef _LIBC +# include <libintl.h> +# else +# include "gettext.h" +# endif +# ifndef _ +# define _(msgid) gettext (msgid) +# endif + +# ifdef _LIBC +# include <libio/iolibio.h> +# endif static _Noreturn void print_and_abort (void) @@ -409,12 +330,21 @@ print_and_abort (void) happen because the "memory exhausted" message appears in other places like this and the translation should be reused instead of creating a very similar string which requires a separate translation. */ -# ifdef _LIBC +# ifdef _LIBC (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); -# else +# else fprintf (stderr, "%s\n", _("memory exhausted")); -# endif +# endif exit (obstack_exit_failure); } -#endif /* !ELIDE_CODE */ +/* The functions allocating more room by calling 'obstack_chunk_alloc' + jump to the handler pointed to by 'obstack_alloc_failed_handler'. + This can be set to a user defined function which should either + abort gracefully or use longjump - but shouldn't return. This + variable by default points to the internal function + 'print_and_abort'. */ +__attribute_noreturn__ void (*obstack_alloc_failed_handler) (void) + = print_and_abort; +# endif /* !_OBSTACK_NO_ERROR_HANDLER */ +#endif /* !_OBSTACK_ELIDE_CODE */ diff --git a/contrib/tools/m4/lib/obstack.h b/contrib/tools/m4/lib/obstack.h index 7cf98edbd2..e558133de8 100644 --- a/contrib/tools/m4/lib/obstack.h +++ b/contrib/tools/m4/lib/obstack.h @@ -1,90 +1,90 @@ /* obstack.h - object stack macros - Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. - 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 Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + The GNU C 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 program is distributed in the hope that it will be useful, + The GNU C 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. + 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 <http://www.gnu.org/licenses/>. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* Summary: -All the apparent functions defined here are macros. The idea -is that you would use these pre-tested macros to solve a -very specific set of problems, and they would run fast. -Caution: no side-effects in arguments please!! They may be -evaluated MANY times!! - -These macros operate a stack of objects. Each object starts life -small, and may grow to maturity. (Consider building a word syllable -by syllable.) An object can move while it is growing. Once it has -been "finished" it never changes address again. So the "top of the -stack" is typically an immature growing object, while the rest of the -stack is of mature, fixed size and fixed address objects. - -These routines grab large chunks of memory, using a function you -supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, -by calling 'obstack_chunk_free'. You must define them and declare -them before using any obstack macros. - -Each independent stack is represented by a 'struct obstack'. -Each of the obstack macros expects a pointer to such a structure -as the first argument. - -One motivation for this package is the problem of growing char strings -in symbol tables. Unless you are "fascist pig with a read-only mind" ---Gosper's immortal quote from HAKMEM item 154, out of context--you -would not like to put any arbitrary upper limit on the length of your -symbols. - -In practice this often means you will build many short symbols and a -few long symbols. At the time you are reading a symbol you don't know -how long it is. One traditional method is to read a symbol into a -buffer, realloc()ating the buffer every time you try to read a symbol -that is longer than the buffer. This is beaut, but you still will -want to copy the symbol from the buffer to a more permanent -symbol-table entry say about half the time. - -With obstacks, you can work differently. Use one obstack for all symbol -names. As you read a symbol, grow the name in the obstack gradually. -When the name is complete, finalize it. Then, if the symbol exists already, -free the newly read name. - -The way we do this is to take a large chunk, allocating memory from -low addresses. When you want to build a symbol in the chunk you just -add chars above the current "high water mark" in the chunk. When you -have finished adding chars, because you got to the end of the symbol, -you know how long the chars are, and you can create a new object. -Mostly the chars will not burst over the highest address of the chunk, -because you would typically expect a chunk to be (say) 100 times as -long as an average object. - -In case that isn't clear, when we have enough chars to make up -the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) -so we just point to it where it lies. No moving of chars is -needed and this is the second win: potentially long strings need -never be explicitly shuffled. Once an object is formed, it does not -change its address during its lifetime. - -When the chars burst over a chunk boundary, we allocate a larger -chunk, and then copy the partly formed object from the end of the old -chunk to the beginning of the new larger chunk. We then carry on -accreting characters to the end of the object as we normally would. - -A special macro is provided to add a single char at a time to a -growing object. This allows the use of register variables, which -break the ordinary 'growth' macro. - -Summary: + All the apparent functions defined here are macros. The idea + is that you would use these pre-tested macros to solve a + very specific set of problems, and they would run fast. + Caution: no side-effects in arguments please!! They may be + evaluated MANY times!! + + These macros operate a stack of objects. Each object starts life + small, and may grow to maturity. (Consider building a word syllable + by syllable.) An object can move while it is growing. Once it has + been "finished" it never changes address again. So the "top of the + stack" is typically an immature growing object, while the rest of the + stack is of mature, fixed size and fixed address objects. + + These routines grab large chunks of memory, using a function you + supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, + by calling 'obstack_chunk_free'. You must define them and declare + them before using any obstack macros. + + Each independent stack is represented by a 'struct obstack'. + Each of the obstack macros expects a pointer to such a structure + as the first argument. + + One motivation for this package is the problem of growing char strings + in symbol tables. Unless you are "fascist pig with a read-only mind" + --Gosper's immortal quote from HAKMEM item 154, out of context--you + would not like to put any arbitrary upper limit on the length of your + symbols. + + In practice this often means you will build many short symbols and a + few long symbols. At the time you are reading a symbol you don't know + how long it is. One traditional method is to read a symbol into a + buffer, realloc()ating the buffer every time you try to read a symbol + that is longer than the buffer. This is beaut, but you still will + want to copy the symbol from the buffer to a more permanent + symbol-table entry say about half the time. + + With obstacks, you can work differently. Use one obstack for all symbol + names. As you read a symbol, grow the name in the obstack gradually. + When the name is complete, finalize it. Then, if the symbol exists already, + free the newly read name. + + The way we do this is to take a large chunk, allocating memory from + low addresses. When you want to build a symbol in the chunk you just + add chars above the current "high water mark" in the chunk. When you + have finished adding chars, because you got to the end of the symbol, + you know how long the chars are, and you can create a new object. + Mostly the chars will not burst over the highest address of the chunk, + because you would typically expect a chunk to be (say) 100 times as + long as an average object. + + In case that isn't clear, when we have enough chars to make up + the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) + so we just point to it where it lies. No moving of chars is + needed and this is the second win: potentially long strings need + never be explicitly shuffled. Once an object is formed, it does not + change its address during its lifetime. + + When the chars burst over a chunk boundary, we allocate a larger + chunk, and then copy the partly formed object from the end of the old + chunk to the beginning of the new larger chunk. We then carry on + accreting characters to the end of the object as we normally would. + + A special macro is provided to add a single char at a time to a + growing object. This allows the use of register variables, which + break the ordinary 'growth' macro. + + Summary: We allocate large chunks. We carve out one object at a time from the current chunk. Once carved, an object never moves. @@ -96,24 +96,38 @@ Summary: Because of the way we do it, you can "unwind" an obstack back to a previous state. (You may remove objects much as you would with a stack.) -*/ + */ /* Don't do the contents of this file more than once. */ #ifndef _OBSTACK_H #define _OBSTACK_H 1 - -/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is - defined, as with GNU C, use that; that way we don't pollute the - namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h> - and use ptrdiff_t. */ - -#ifdef __PTRDIFF_TYPE__ -# define PTR_INT_TYPE __PTRDIFF_TYPE__ + +#ifndef _OBSTACK_INTERFACE_VERSION +# define _OBSTACK_INTERFACE_VERSION 2 +#endif + +#include <stddef.h> /* For size_t and ptrdiff_t. */ +#include <string.h> /* For __GNU_LIBRARY__, and memcpy. */ + +#if __STDC_VERSION__ < 199901L +# define __FLEXIBLE_ARRAY_MEMBER 1 #else -# include <stddef.h> -# define PTR_INT_TYPE ptrdiff_t +# define __FLEXIBLE_ARRAY_MEMBER +#endif + +#if _OBSTACK_INTERFACE_VERSION == 1 +/* For binary compatibility with obstack version 1, which used "int" + and "long" for these two types. */ +# define _OBSTACK_SIZE_T unsigned int +# define _CHUNK_SIZE_T unsigned long +# define _OBSTACK_CAST(type, expr) ((type) (expr)) +#else +/* Version 2 with sane types, especially for 64-bit hosts. */ +# define _OBSTACK_SIZE_T size_t +# define _CHUNK_SIZE_T size_t +# define _OBSTACK_CAST(type, expr) (expr) #endif /* If B is the base of an object addressed by P, return the result of @@ -122,18 +136,29 @@ Summary: #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) -/* Similar to _BPTR_ALIGN (B, P, A), except optimize the common case +/* Similar to __BPTR_ALIGN (B, P, A), except optimize the common case where pointers can be converted to integers, aligned as integers, - and converted back again. If PTR_INT_TYPE is narrower than a + and converted back again. If ptrdiff_t is narrower than a pointer (e.g., the AS/400), play it safe and compute the alignment relative to B. Otherwise, use the faster strategy of computing the alignment relative to 0. */ -#define __PTR_ALIGN(B, P, A) \ - __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \ +#define __PTR_ALIGN(B, P, A) \ + __BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0, \ P, A) -#include <string.h> +#ifndef __attribute_pure__ +# define __attribute_pure__ _GL_ATTRIBUTE_PURE +#endif + +/* Not the same as _Noreturn, since it also works with function pointers. */ +#ifndef __attribute_noreturn__ +# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C +# define __attribute_noreturn__ __attribute__ ((__noreturn__)) +# else +# define __attribute_noreturn__ +# endif +#endif #ifdef __cplusplus extern "C" { @@ -141,67 +166,72 @@ extern "C" { struct _obstack_chunk /* Lives at front of each chunk. */ { - char *limit; /* 1 past end of this chunk */ + char *limit; /* 1 past end of this chunk */ struct _obstack_chunk *prev; /* address of prior chunk or NULL */ - char contents[4]; /* objects begin here */ + char contents[__FLEXIBLE_ARRAY_MEMBER]; /* objects begin here */ }; struct obstack /* control current object in current chunk */ { - long chunk_size; /* preferred size to allocate chunks in */ + _CHUNK_SIZE_T chunk_size; /* preferred size to allocate chunks in */ struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ - char *object_base; /* address of object we are building */ - char *next_free; /* where to add next char to current object */ - char *chunk_limit; /* address of char after current chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + char *chunk_limit; /* address of char after current chunk */ union { - PTR_INT_TYPE tempint; - void *tempptr; + _OBSTACK_SIZE_T i; + void *p; } temp; /* Temporary for some macros. */ - int alignment_mask; /* Mask of alignment for each object. */ - /* These prototypes vary based on 'use_extra_arg', and we use - casts to the prototypeless function type in all assignments, - but having prototypes here quiets -Wstrict-prototypes. */ - struct _obstack_chunk *(*chunkfun) (void *, long); - void (*freefun) (void *, struct _obstack_chunk *); + _OBSTACK_SIZE_T alignment_mask; /* Mask of alignment for each object. */ + + /* These prototypes vary based on 'use_extra_arg'. */ + union + { + void *(*plain) (size_t); + void *(*extra) (void *, size_t); + } chunkfun; + union + { + void (*plain) (void *); + void (*extra) (void *, void *); + } freefun; + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ - unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ - unsigned maybe_empty_object:1;/* There is a possibility that the current - chunk contains a zero-length object. This - prevents freeing the chunk if we allocate - a bigger chunk to replace it. */ - unsigned alloc_failed:1; /* No longer used, as we now call the failed - handler on error, but retained for binary - compatibility. */ + unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */ + unsigned maybe_empty_object : 1; /* There is a possibility that the current + chunk contains a zero-length object. This + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed : 1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ -extern void _obstack_newchunk (struct obstack *, int); -extern int _obstack_begin (struct obstack *, int, int, - void *(*) (long), void (*) (void *)); -extern int _obstack_begin_1 (struct obstack *, int, int, - void *(*) (void *, long), +extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T); +extern void _obstack_free (struct obstack *, void *); +extern int _obstack_begin (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (size_t), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (void *, size_t), void (*) (void *, void *), void *); -extern int _obstack_memory_used (struct obstack *); +extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *) + __attribute_pure__; -/* The default name of the function for freeing a chunk is 'obstack_free', - but gnulib users can override this by defining '__obstack_free'. */ -#ifndef __obstack_free -# define __obstack_free obstack_free -#endif -extern void __obstack_free (struct obstack *obstack, void *block); - /* Error handler called when 'obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. The default action is to print a message and abort. */ -extern void (*obstack_alloc_failed_handler) (void); +extern __attribute_noreturn__ void (*obstack_alloc_failed_handler) (void); /* Exit value used when 'print_and_abort' is used. */ extern int obstack_exit_failure; - + /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ @@ -214,50 +244,47 @@ extern int obstack_exit_failure; /* Pointer to next byte not yet allocated in current chunk. */ -#define obstack_next_free(h) ((h)->next_free) +#define obstack_next_free(h) ((void *) (h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) /* To prevent prototype warnings provide complete argument list. */ -#define obstack_init(h) \ - _obstack_begin ((h), 0, 0, \ - (void *(*) (long)) obstack_chunk_alloc, \ - (void (*) (void *)) obstack_chunk_free) +#define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) -#define obstack_begin(h, size) \ - _obstack_begin ((h), (size), 0, \ - (void *(*) (long)) obstack_chunk_alloc, \ - (void (*) (void *)) obstack_chunk_free) +#define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) -#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ - _obstack_begin ((h), (size), (alignment), \ - (void *(*) (long)) (chunkfun), \ - (void (*) (void *)) (freefun)) +#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *), freefun)) #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ - _obstack_begin_1 ((h), (size), (alignment), \ - (void *(*) (void *, long)) (chunkfun), \ - (void (*) (void *, void *)) (freefun), (arg)) + _obstack_begin_1 ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *, void *), freefun), arg) -#define obstack_chunkfun(h, newchunkfun) \ - ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) +#define obstack_chunkfun(h, newchunkfun) \ + ((void) ((h)->chunkfun.extra = (void *(*) (void *, size_t)) (newchunkfun))) -#define obstack_freefun(h, newfreefun) \ - ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) +#define obstack_freefun(h, newfreefun) \ + ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun))) -#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) +#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar))) -#define obstack_blank_fast(h,n) ((h)->next_free += (n)) +#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n))) #define obstack_memory_used(h) _obstack_memory_used (h) - + #if defined __GNUC__ -/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and - does not implement __extension__. But that compiler doesn't define - __GNUC_MINOR__. */ -# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) +# if !defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ < 2008 # define __extension__ # endif @@ -266,160 +293,161 @@ extern int obstack_exit_failure; without using a global variable. Also, we can avoid using the 'temp' slot, to make faster code. */ -# define obstack_object_size(OBSTACK) \ - __extension__ \ - ({ struct obstack const *__o = (OBSTACK); \ - (unsigned) (__o->next_free - __o->object_base); }) - -# define obstack_room(OBSTACK) \ - __extension__ \ - ({ struct obstack const *__o = (OBSTACK); \ - (unsigned) (__o->chunk_limit - __o->next_free); }) - -# define obstack_make_room(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->chunk_limit - __o->next_free < __len) \ - _obstack_newchunk (__o, __len); \ - (void) 0; }) - -# define obstack_empty_p(OBSTACK) \ - __extension__ \ - ({ struct obstack const *__o = (OBSTACK); \ - (__o->chunk->prev == 0 \ - && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ - __o->chunk->contents, \ - __o->alignment_mask)); }) - -# define obstack_grow(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len > __o->chunk_limit) \ - _obstack_newchunk (__o, __len); \ - memcpy (__o->next_free, where, __len); \ - __o->next_free += __len; \ - (void) 0; }) - -# define obstack_grow0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, __len + 1); \ - memcpy (__o->next_free, where, __len); \ - __o->next_free += __len; \ - *(__o->next_free)++ = 0; \ - (void) 0; }) - -# define obstack_1grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, 1); \ - obstack_1grow_fast (__o, datum); \ - (void) 0; }) +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros. */ +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o1 = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); }) + +# define obstack_make_room(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) + +# define obstack_grow(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len + 1) \ + _obstack_newchunk (__o, __len + 1); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < 1) \ + _obstack_newchunk (__o, 1); \ + obstack_1grow_fast (__o, datum); }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ -# define obstack_ptr_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (void *)); \ - obstack_ptr_grow_fast (__o, datum); }) \ - -# define obstack_int_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (int) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (int)); \ - obstack_int_grow_fast (__o, datum); }) - -# define obstack_ptr_grow_fast(OBSTACK,aptr) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *__p1 = __o1->next_free; \ - *(const void **) __p1 = (aptr); \ - __o1->next_free += sizeof (const void *); \ - (void) 0; }) - -# define obstack_int_grow_fast(OBSTACK,aint) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *__p1 = __o1->next_free; \ - *(int *) __p1 = (aint); \ - __o1->next_free += sizeof (int); \ - (void) 0; }) - -# define obstack_blank(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->chunk_limit - __o->next_free < __len) \ - _obstack_newchunk (__o, __len); \ - obstack_blank_fast (__o, __len); \ - (void) 0; }) - -# define obstack_alloc(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_blank (__h, (length)); \ - obstack_finish (__h); }) - -# define obstack_copy(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow (__h, (where), (length)); \ - obstack_finish (__h); }) - -# define obstack_copy0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow0 (__h, (where), (length)); \ - obstack_finish (__h); }) - -/* The local variable is named __o1 to avoid a name conflict - when obstack_blank is called. */ -# define obstack_finish(OBSTACK) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *__value = (void *) __o1->object_base; \ - if (__o1->next_free == __value) \ - __o1->maybe_empty_object = 1; \ - __o1->next_free \ - = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ - __o1->alignment_mask); \ - if (__o1->next_free - (char *)__o1->chunk \ - > __o1->chunk_limit - (char *)__o1->chunk) \ - __o1->next_free = __o1->chunk_limit; \ - __o1->object_base = __o1->next_free; \ - __value; }) - -# define obstack_free(OBSTACK, OBJ) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - void *__obj = (OBJ); \ - if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = (char *)__obj; \ - else (__obstack_free) (__o, __obj); }) - +# define obstack_ptr_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (void *)) \ + _obstack_newchunk (__o, sizeof (void *)); \ + obstack_ptr_grow_fast (__o, datum); }) + +# define obstack_int_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (int)) \ + _obstack_newchunk (__o, sizeof (int)); \ + obstack_int_grow_fast (__o, datum); }) + +# define obstack_ptr_grow_fast(OBSTACK, aptr) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(const void **) __p1 = (aptr); \ + __o1->next_free += sizeof (const void *); \ + (void) 0; }) + +# define obstack_int_grow_fast(OBSTACK, aint) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(int *) __p1 = (aint); \ + __o1->next_free += sizeof (int); \ + (void) 0; }) + +# define obstack_blank(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + obstack_blank_fast (__o, __len); }) + +# define obstack_alloc(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros, typically obstack_free. */ +# define obstack_finish(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__value = (void *) __o1->object_base; \ + if (__o1->next_free == __value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ + __o1->alignment_mask); \ + if ((size_t) (__o1->next_free - (char *) __o1->chunk) \ + > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + __value; }) + +# define obstack_free(OBSTACK, OBJ) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + void *__obj = (void *) (OBJ); \ + if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \ + __o->next_free = __o->object_base = (char *) __obj; \ + else \ + _obstack_free (__o, __obj); }) + #else /* not __GNUC__ */ -# define obstack_object_size(h) \ - (unsigned) ((h)->next_free - (h)->object_base) +# define obstack_object_size(h) \ + ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base)) -# define obstack_room(h) \ - (unsigned) ((h)->chunk_limit - (h)->next_free) +# define obstack_room(h) \ + ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free)) -# define obstack_empty_p(h) \ - ((h)->chunk->prev == 0 \ - && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ - (h)->chunk->contents, \ - (h)->alignment_mask)) +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions @@ -427,83 +455,87 @@ __extension__ \ Casting the third operand to void was tried before, but some compilers won't accept it. */ -# define obstack_make_room(h,length) \ -( (h)->temp.tempint = (length), \ - (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0)) - -# define obstack_grow(h,where,length) \ -( (h)->temp.tempint = (length), \ - (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ - memcpy ((h)->next_free, where, (h)->temp.tempint), \ - (h)->next_free += (h)->temp.tempint) - -# define obstack_grow0(h,where,length) \ -( (h)->temp.tempint = (length), \ - (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \ - memcpy ((h)->next_free, where, (h)->temp.tempint), \ - (h)->next_free += (h)->temp.tempint, \ - *((h)->next_free)++ = 0) - -# define obstack_1grow(h,datum) \ -( (((h)->next_free + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), 1), 0) : 0), \ - obstack_1grow_fast (h, datum)) - -# define obstack_ptr_grow(h,datum) \ -( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ - obstack_ptr_grow_fast (h, datum)) - -# define obstack_int_grow(h,datum) \ -( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ - obstack_int_grow_fast (h, datum)) - -# define obstack_ptr_grow_fast(h,aptr) \ - (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) - -# define obstack_int_grow_fast(h,aint) \ - (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) - -# define obstack_blank(h,length) \ -( (h)->temp.tempint = (length), \ - (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ - obstack_blank_fast (h, (h)->temp.tempint)) - -# define obstack_alloc(h,length) \ - (obstack_blank ((h), (length)), obstack_finish ((h))) - -# define obstack_copy(h,where,length) \ - (obstack_grow ((h), (where), (length)), obstack_finish ((h))) - -# define obstack_copy0(h,where,length) \ - (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) - -# define obstack_finish(h) \ -( ((h)->next_free == (h)->object_base \ - ? (((h)->maybe_empty_object = 1), 0) \ - : 0), \ - (h)->temp.tempptr = (h)->object_base, \ - (h)->next_free \ - = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ - (h)->alignment_mask), \ - (((h)->next_free - (char *) (h)->chunk \ - > (h)->chunk_limit - (char *) (h)->chunk) \ - ? ((h)->next_free = (h)->chunk_limit) : 0), \ - (h)->object_base = (h)->next_free, \ - (h)->temp.tempptr) - -# define obstack_free(h,obj) \ -( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \ - ((((h)->temp.tempint > 0 \ - && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ - ? (int) ((h)->next_free = (h)->object_base \ - = (h)->temp.tempint + (char *) (h)->chunk) \ - : (((__obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0))) +# define obstack_make_room(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0), \ + (void) 0) + +# define obstack_grow(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + (void) 0) + +# define obstack_grow0(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i + 1) \ + ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + *((h)->next_free)++ = 0, \ + (void) 0) + +# define obstack_1grow(h, datum) \ + (((obstack_room (h) < 1) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + obstack_1grow_fast (h, datum)) + +# define obstack_ptr_grow(h, datum) \ + (((obstack_room (h) < sizeof (char *)) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + obstack_ptr_grow_fast (h, datum)) + +# define obstack_int_grow(h, datum) \ + (((obstack_room (h) < sizeof (int)) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + obstack_int_grow_fast (h, datum)) + +# define obstack_ptr_grow_fast(h, aptr) \ + (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr), \ + (void) 0) + +# define obstack_int_grow_fast(h, aint) \ + (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint), \ + (void) 0) + +# define obstack_blank(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + obstack_blank_fast (h, (h)->temp.i)) + +# define obstack_alloc(h, length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h, where, length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h, where, length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ + (((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp.p = (h)->object_base, \ + (h)->next_free \ + = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ + (h)->alignment_mask), \ + (((size_t) ((h)->next_free - (char *) (h)->chunk) \ + > (size_t) ((h)->chunk_limit - (char *) (h)->chunk)) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + (h)->temp.p) + +# define obstack_free(h, obj) \ + ((h)->temp.p = (void *) (obj), \ + (((h)->temp.p > (void *) (h)->chunk \ + && (h)->temp.p < (void *) (h)->chunk_limit) \ + ? (void) ((h)->next_free = (h)->object_base = (char *) (h)->temp.p) \ + : _obstack_free ((h), (h)->temp.p))) #endif /* not __GNUC__ */ @@ -511,4 +543,4 @@ __extension__ \ } /* C++ */ #endif -#endif /* obstack.h */ +#endif /* _OBSTACK_H */ diff --git a/contrib/tools/m4/lib/pathmax.h b/contrib/tools/m4/lib/pathmax.h index a9ddc33d17..aee22f8640 100644 --- a/contrib/tools/m4/lib/pathmax.h +++ b/contrib/tools/m4/lib/pathmax.h @@ -1,5 +1,5 @@ /* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/pipe-safer.c b/contrib/tools/m4/lib/pipe-safer.c index f2e0ad6fb0..fc6144e5ea 100644 --- a/contrib/tools/m4/lib/pipe-safer.c +++ b/contrib/tools/m4/lib/pipe-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 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/contrib/tools/m4/lib/pipe2-safer.c b/contrib/tools/m4/lib/pipe2-safer.c index e831d0c6c1..4b7084ff0b 100644 --- a/contrib/tools/m4/lib/pipe2-safer.c +++ b/contrib/tools/m4/lib/pipe2-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe2, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 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/contrib/tools/m4/lib/pipe2.c b/contrib/tools/m4/lib/pipe2.c index 211d75545c..f8912f2813 100644 --- a/contrib/tools/m4/lib/pipe2.c +++ b/contrib/tools/m4/lib/pipe2.c @@ -1,5 +1,5 @@ /* Create a pipe, with specific opening flags. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 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/contrib/tools/m4/lib/printf-args.c b/contrib/tools/m4/lib/printf-args.c index c27e6bc6b7..cfaed994a1 100644 --- a/contrib/tools/m4/lib/printf-args.c +++ b/contrib/tools/m4/lib/printf-args.c @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/printf-args.h b/contrib/tools/m4/lib/printf-args.h index 2a9c2a3f87..256c413112 100644 --- a/contrib/tools/m4/lib/printf-args.h +++ b/contrib/tools/m4/lib/printf-args.h @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/printf-frexp.c b/contrib/tools/m4/lib/printf-frexp.c index 1a7b0c438e..1841b86b68 100644 --- a/contrib/tools/m4/lib/printf-frexp.c +++ b/contrib/tools/m4/lib/printf-frexp.c @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 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/contrib/tools/m4/lib/printf-frexp.h b/contrib/tools/m4/lib/printf-frexp.h index 3976b73686..ec75c606fd 100644 --- a/contrib/tools/m4/lib/printf-frexp.h +++ b/contrib/tools/m4/lib/printf-frexp.h @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 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/contrib/tools/m4/lib/printf-frexpl.c b/contrib/tools/m4/lib/printf-frexpl.c index 26987a7bd1..3d0ce9b740 100644 --- a/contrib/tools/m4/lib/printf-frexpl.c +++ b/contrib/tools/m4/lib/printf-frexpl.c @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 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/contrib/tools/m4/lib/printf-frexpl.h b/contrib/tools/m4/lib/printf-frexpl.h index 3768b0915e..344f37abd1 100644 --- a/contrib/tools/m4/lib/printf-frexpl.h +++ b/contrib/tools/m4/lib/printf-frexpl.h @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 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/contrib/tools/m4/lib/printf-parse.c b/contrib/tools/m4/lib/printf-parse.c index 23cacc1dab..fad5d3d24c 100644 --- a/contrib/tools/m4/lib/printf-parse.c +++ b/contrib/tools/m4/lib/printf-parse.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2016 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/contrib/tools/m4/lib/printf-parse.h b/contrib/tools/m4/lib/printf-parse.h index d8474bee15..a46d946241 100644 --- a/contrib/tools/m4/lib/printf-parse.h +++ b/contrib/tools/m4/lib/printf-parse.h @@ -1,5 +1,5 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/progname.c b/contrib/tools/m4/lib/progname.c index 0c195e521a..debb76026d 100644 --- a/contrib/tools/m4/lib/progname.c +++ b/contrib/tools/m4/lib/progname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/progname.h b/contrib/tools/m4/lib/progname.h index b4f3c2778a..0a574071bf 100644 --- a/contrib/tools/m4/lib/progname.h +++ b/contrib/tools/m4/lib/progname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/quote.h b/contrib/tools/m4/lib/quote.h index 1679796763..b53d0ea117 100644 --- a/contrib/tools/m4/lib/quote.h +++ b/contrib/tools/m4/lib/quote.h @@ -1,6 +1,6 @@ /* quote.h - prototypes for quote.c - Copyright (C) 1998-2001, 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2001, 2003, 2009-2016 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/contrib/tools/m4/lib/quotearg.c b/contrib/tools/m4/lib/quotearg.c index 40114d7fbd..07658b24f5 100644 --- a/contrib/tools/m4/lib/quotearg.c +++ b/contrib/tools/m4/lib/quotearg.c @@ -1,6 +1,6 @@ /* quotearg.c - quote arguments for output - Copyright (C) 1998-2002, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2016 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 @@ -29,6 +29,7 @@ #include "quotearg.h" #include "quote.h" +#include "minmax.h" #include "xalloc.h" #include "c-strcaseeq.h" #include "localcharset.h" @@ -37,6 +38,7 @@ #include <errno.h> #include <limits.h> #include <stdbool.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <wchar.h> @@ -77,6 +79,8 @@ char const *const quoting_style_args[] = "literal", "shell", "shell-always", + "shell-escape", + "shell-escape-always", "c", "c-maybe", "escape", @@ -91,6 +95,8 @@ enum quoting_style const quoting_style_vals[] = literal_quoting_style, shell_quoting_style, shell_always_quoting_style, + shell_escape_quoting_style, + shell_escape_always_quoting_style, c_quoting_style, c_maybe_quoting_style, escape_quoting_style, @@ -116,7 +122,7 @@ clone_quoting_options (struct quoting_options *o) /* Get the value of O's quoting style. If O is null, use the default. */ enum quoting_style -get_quoting_style (struct quoting_options *o) +get_quoting_style (struct quoting_options const *o) { return (o ? o : &default_quoting_options)->style; } @@ -178,7 +184,7 @@ set_custom_quoting (struct quoting_options *o, static struct quoting_options /* NOT PURE!! */ quoting_options_from_style (enum quoting_style style) { - struct quoting_options o = { 0, 0, { 0 }, NULL, NULL }; + struct quoting_options o = { literal_quoting_style, 0, { 0 }, NULL, NULL }; if (style == custom_quoting_style) abort (); o.style = style; @@ -248,11 +254,15 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, { size_t i; size_t len = 0; + size_t orig_buffersize = 0; char const *quote_string = 0; size_t quote_string_len = 0; bool backslash_escapes = false; bool unibyte_locale = MB_CUR_MAX == 1; bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0; + bool pending_shell_escape_end = false; + bool encountered_single_quote = false; + bool all_c_and_shell_quote_compat = true; #define STORE(c) \ do \ @@ -263,6 +273,38 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } \ while (0) +#define START_ESC() \ + do \ + { \ + if (elide_outer_quotes) \ + goto force_outer_quoting_style; \ + escaping = true; \ + if (quoting_style == shell_always_quoting_style \ + && ! pending_shell_escape_end) \ + { \ + STORE ('\''); \ + STORE ('$'); \ + STORE ('\''); \ + pending_shell_escape_end = true; \ + } \ + STORE ('\\'); \ + } \ + while (0) + +#define END_ESC() \ + do \ + { \ + if (pending_shell_escape_end && ! escaping) \ + { \ + STORE ('\''); \ + STORE ('\''); \ + pending_shell_escape_end = false; \ + } \ + } \ + while (0) + + process_input: + switch (quoting_style) { case c_maybe_quoting_style: @@ -321,11 +363,18 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } break; + case shell_escape_quoting_style: + backslash_escapes = true; + /* Fall through. */ case shell_quoting_style: - quoting_style = shell_always_quoting_style; elide_outer_quotes = true; /* Fall through. */ + case shell_escape_always_quoting_style: + if (!elide_outer_quotes) + backslash_escapes = true; + /* Fall through. */ case shell_always_quoting_style: + quoting_style = shell_always_quoting_style; if (!elide_outer_quotes) STORE ('\''); quote_string = "'"; @@ -345,8 +394,11 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, unsigned char c; unsigned char esc; bool is_right_quote = false; + bool escaping = false; + bool c_and_shell_quote_compat = false; if (backslash_escapes + && quoting_style != shell_always_quoting_style && quote_string_len && (i + quote_string_len <= (argsize == SIZE_MAX && 1 < quote_string_len @@ -367,15 +419,15 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case '\0': if (backslash_escapes) { - if (elide_outer_quotes) - goto force_outer_quoting_style; - STORE ('\\'); + START_ESC (); /* If quote_string were to begin with digits, we'd need to test for the end of the arg as well. However, it's hard to imagine any locale that would use digits in quotes, and set_custom_quoting is documented not to - accept them. */ - if (i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9') + accept them. Use only a single \0 with shell-escape + as currently digits are not printed within $'...' */ + if (quoting_style != shell_always_quoting_style + && i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9') { STORE ('0'); STORE ('0'); @@ -436,6 +488,14 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case '\t': esc = 't'; goto c_and_shell_escape; case '\v': esc = 'v'; goto c_escape; case '\\': esc = c; + /* Never need to escape '\' in shell case. */ + if (quoting_style == shell_always_quoting_style) + { + if (elide_outer_quotes) + goto force_outer_quoting_style; + goto store_c; + } + /* No need to escape the escape if we are trying to elide outer quotes and nothing else is problematic. */ if (backslash_escapes && elide_outer_quotes && quote_string_len) @@ -463,6 +523,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, break; /* Fall through. */ case ' ': + c_and_shell_quote_compat = true; + /* Fall through. */ case '!': /* special in bash */ case '"': case '$': case '&': case '(': case ')': case '*': case ';': @@ -481,13 +543,26 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, break; case '\'': + encountered_single_quote = true; + c_and_shell_quote_compat = true; if (quoting_style == shell_always_quoting_style) { if (elide_outer_quotes) goto force_outer_quoting_style; + + if (buffersize && ! orig_buffersize) + { + /* Just scan string to see if supports a more concise + representation, rather than writing a longer string + but returning the length of the more concise form. */ + orig_buffersize = buffersize; + buffersize = 0; + } + STORE ('\''); STORE ('\\'); STORE ('\''); + pending_shell_escape_end = false; } break; @@ -513,6 +588,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, them. Also, a digit or a special letter would cause trouble if it appeared in quote_these_too, but that's also documented as not accepting them. */ + c_and_shell_quote_compat = true; break; default: @@ -591,6 +667,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, while (! mbsinit (&mbstate)); } + c_and_shell_quote_compat = printable; + if (1 < m || (backslash_escapes && ! printable)) { /* Output a multibyte sequence, or an escaped @@ -601,9 +679,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, { if (backslash_escapes && ! printable) { - if (elide_outer_quotes) - goto force_outer_quoting_style; - STORE ('\\'); + START_ESC (); STORE ('0' + (c >> 6)); STORE ('0' + ((c >> 3) & 7)); c = '0' + (c & 7); @@ -615,6 +691,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } if (ilim <= i + 1) break; + END_ESC (); STORE (c); c = arg[++i]; } @@ -624,25 +701,49 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } } - if (! ((backslash_escapes || elide_outer_quotes) + if (! (((backslash_escapes && quoting_style != shell_always_quoting_style) + || elide_outer_quotes) && quote_these_too - && quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))) + && quote_these_too[c / INT_BITS] >> (c % INT_BITS) & 1) && !is_right_quote) goto store_c; store_escape: - if (elide_outer_quotes) - goto force_outer_quoting_style; - STORE ('\\'); + START_ESC (); store_c: + END_ESC (); STORE (c); + + if (! c_and_shell_quote_compat) + all_c_and_shell_quote_compat = false; } if (len == 0 && quoting_style == shell_always_quoting_style && elide_outer_quotes) goto force_outer_quoting_style; + /* Single shell quotes (') are commonly enough used as an apostrophe, + that we attempt to minimize the quoting in this case. Note itʼs + better to use the apostrophe modifier "\u02BC" if possible, as that + renders better and works with the word match regex \W+ etc. */ + if (quoting_style == shell_always_quoting_style && ! elide_outer_quotes + && encountered_single_quote) + { + if (all_c_and_shell_quote_compat) + return quotearg_buffer_restyled (buffer, orig_buffersize, arg, argsize, + c_quoting_style, + flags, quote_these_too, + left_quote, right_quote); + else if (! buffersize && orig_buffersize) + { + /* Disable read-only scan, and reprocess to write quoted string. */ + buffersize = orig_buffersize; + len = 0; + goto process_input; + } + } + if (quote_string && !elide_outer_quotes) for (; *quote_string; quote_string++) STORE (*quote_string); @@ -654,6 +755,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, force_outer_quoting_style: /* Don't reuse quote_these_too, since the addition of outer quotes sufficiently quotes the specified characters. */ + if (quoting_style == shell_always_quoting_style && backslash_escapes) + quoting_style = shell_escape_always_quoting_style; return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, NULL, @@ -729,7 +832,7 @@ struct slotvec /* Preallocate a slot 0 buffer, so that the caller can always quote one small component of a "memory exhausted" message in slot 0. */ static char slot0[256]; -static unsigned int nslots = 1; +static int nslots = 1; static struct slotvec slotvec0 = {sizeof slot0, slot0}; static struct slotvec *slotvec = &slotvec0; @@ -737,7 +840,7 @@ void quotearg_free (void) { struct slotvec *sv = slotvec; - unsigned int i; + int i; for (i = 1; i < nslots; i++) free (sv[i].val); if (sv[0].val != slot0) @@ -768,30 +871,23 @@ quotearg_n_options (int n, char const *arg, size_t argsize, { int e = errno; - unsigned int n0 = n; struct slotvec *sv = slotvec; if (n < 0) abort (); - if (nslots <= n0) + if (nslots <= n) { - /* FIXME: technically, the type of n1 should be 'unsigned int', - but that evokes an unsuppressible warning from gcc-4.0.1 and - older. If gcc ever provides an option to suppress that warning, - revert to the original type, so that the test in xalloc_oversized - is once again performed only at compile time. */ - size_t n1 = n0 + 1; bool preallocated = (sv == &slotvec0); - if (xalloc_oversized (n1, sizeof *sv)) + if (MIN (INT_MAX, MIN (PTRDIFF_MAX, SIZE_MAX) / sizeof *sv) <= n) xalloc_die (); - slotvec = sv = xrealloc (preallocated ? NULL : sv, n1 * sizeof *sv); + slotvec = sv = xrealloc (preallocated ? NULL : sv, (n + 1) * sizeof *sv); if (preallocated) *sv = slotvec0; - memset (sv + nslots, 0, (n1 - nslots) * sizeof *sv); - nslots = n1; + memset (sv + nslots, 0, (n + 1 - nslots) * sizeof *sv); + nslots = n + 1; } { @@ -901,6 +997,15 @@ quotearg_colon_mem (char const *arg, size_t argsize) } char * +quotearg_n_style_colon (int n, enum quoting_style s, char const *arg) +{ + struct quoting_options options; + options = quoting_options_from_style (s); + set_char_quoting (&options, ':', 1); + return quotearg_n_options (n, arg, SIZE_MAX, &options); +} + +char * quotearg_n_custom (int n, char const *left_quote, char const *right_quote, char const *arg) { diff --git a/contrib/tools/m4/lib/quotearg.h b/contrib/tools/m4/lib/quotearg.h index 58ee3f6089..bc29052b00 100644 --- a/contrib/tools/m4/lib/quotearg.h +++ b/contrib/tools/m4/lib/quotearg.h @@ -1,6 +1,6 @@ /* quotearg.h - quote arguments for output - Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -73,6 +73,37 @@ enum quoting_style */ shell_always_quoting_style, + /* Quote names for the shell if they contain shell metacharacters + or other problematic characters (ls --quoting-style=shell-escape). + Non printable characters are quoted using the $'...' syntax, + which originated in ksh93 and is widely supported by most shells, + and proposed for inclusion in POSIX. + + quotearg_buffer: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b" + quotearg: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b" + quotearg_colon: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "'a:b'" + */ + shell_escape_quoting_style, + + /* Quote names for the shell even if they would normally not + require quoting (ls --quoting-style=shell-escape). + Non printable characters are quoted using the $'...' syntax, + which originated in ksh93 and is widely supported by most shells, + and proposed for inclusion in POSIX. Behaves like + shell_escape_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect. + + quotearg_buffer: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b" + quotearg: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b" + quotearg_colon: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "'a:b'" + */ + shell_escape_always_quoting_style, + /* Quote names as for a C language string (ls --quoting-style=c). Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect. Split into consecutive strings if @@ -247,7 +278,7 @@ struct quoting_options; struct quoting_options *clone_quoting_options (struct quoting_options *o); /* Get the value of O's quoting style. If O is null, use the default. */ -enum quoting_style get_quoting_style (struct quoting_options *o); +enum quoting_style get_quoting_style (struct quoting_options const *o); /* In O (or in the default if O is null), set the value of the quoting style to S. */ @@ -362,6 +393,9 @@ char *quotearg_colon (char const *arg); /* Like quotearg_colon (ARG), except it can quote null bytes. */ char *quotearg_colon_mem (char const *arg, size_t argsize); +/* Like quotearg_n_style, except with ':' quoting enabled. */ +char *quotearg_n_style_colon (int n, enum quoting_style s, char const *arg); + /* Like quotearg_n_style (N, S, ARG) but with S as custom_quoting_style with left quote as LEFT_QUOTE and right quote as RIGHT_QUOTE. See set_custom_quoting for a description of acceptable LEFT_QUOTE and diff --git a/contrib/tools/m4/lib/raise.c b/contrib/tools/m4/lib/raise.c index 5b546d2b8d..bf24c3ee79 100644 --- a/contrib/tools/m4/lib/raise.c +++ b/contrib/tools/m4/lib/raise.c @@ -1,6 +1,6 @@ /* Provide a non-threads replacement for the POSIX raise function. - Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2006, 2009-2016 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/contrib/tools/m4/lib/regcomp.c b/contrib/tools/m4/lib/regcomp.c index f0b2e52216..aaa66b9f55 100644 --- a/contrib/tools/m4/lib/regcomp.c +++ b/contrib/tools/m4/lib/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -17,6 +17,10 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#ifdef _LIBC +# include <locale/weight.h> +#endif + static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, size_t length, reg_syntax_t syntax); static void re_compile_fastmap_iter (regex_t *bufp, @@ -149,9 +153,9 @@ static const char __re_error_msgid[] = gettext_noop ("Invalid back reference") /* REG_ESUBREG */ "\0" #define REG_EBRACK_IDX (REG_ESUBREG_IDX + sizeof "Invalid back reference") - gettext_noop ("Unmatched [ or [^") /* REG_EBRACK */ + gettext_noop ("Unmatched [, [^, [:, [., or [=") /* REG_EBRACK */ "\0" -#define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [ or [^") +#define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [, [^, [:, [., or [=") gettext_noop ("Unmatched ( or \\(") /* REG_EPAREN */ "\0" #define REG_EBRACE_IDX (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(") @@ -209,17 +213,9 @@ static const size_t __re_error_msgid_idx[] = Assumes the 'allocated' (and perhaps 'buffer') and 'translate' fields are set in BUFP on entry. */ -#ifdef _LIBC -const char * -re_compile_pattern (pattern, length, bufp) - const char *pattern; - size_t length; - struct re_pattern_buffer *bufp; -#else /* size_t might promote */ const char * re_compile_pattern (const char *pattern, size_t length, struct re_pattern_buffer *bufp) -#endif { reg_errcode_t ret; @@ -257,8 +253,7 @@ reg_syntax_t re_syntax_options; defined in regex.h. We return the old syntax. */ reg_syntax_t -re_set_syntax (syntax) - reg_syntax_t syntax; +re_set_syntax (reg_syntax_t syntax) { reg_syntax_t ret = re_syntax_options; @@ -270,8 +265,7 @@ weak_alias (__re_set_syntax, re_set_syntax) #endif int -re_compile_fastmap (bufp) - struct re_pattern_buffer *bufp; +re_compile_fastmap (struct re_pattern_buffer *bufp) { re_dfa_t *dfa = bufp->buffer; char *fastmap = bufp->fastmap; @@ -335,7 +329,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, memset (&state, '\0', sizeof (state)); if (__mbrtowc (&wc, (const char *) buf, p - buf, &state) == p - buf - && (__wcrtomb ((char *) buf, towlower (wc), &state) + && (__wcrtomb ((char *) buf, __towlower (wc), &state) != (size_t) -1)) re_set_fastmap (fastmap, false, buf[0]); } @@ -411,7 +405,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, re_set_fastmap (fastmap, icase, *(unsigned char *) buf); if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) { - if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state) + if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state) != (size_t) -1) re_set_fastmap (fastmap, false, *(unsigned char *) buf); } @@ -470,10 +464,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, the return codes and their meanings.) */ int -regcomp (preg, pattern, cflags) - 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 @@ -531,18 +522,9 @@ weak_alias (__regcomp, regcomp) /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ -#ifdef _LIBC -size_t -regerror (errcode, preg, errbuf, errbuf_size) - int errcode; - const regex_t *_Restrict_ preg; - char *_Restrict_ errbuf; - size_t errbuf_size; -#else /* size_t might promote */ size_t -regerror (int errcode, const regex_t *_Restrict_ preg, - char *_Restrict_ errbuf, size_t errbuf_size) -#endif +regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf, + size_t errbuf_size) { const char *msg; size_t msg_size; @@ -658,8 +640,7 @@ free_dfa_content (re_dfa_t *dfa) /* Free dynamically allocated space used by PREG. */ void -regfree (preg) - regex_t *preg; +regfree (regex_t *preg) { re_dfa_t *dfa = preg->buffer; if (BE (dfa != NULL, 1)) @@ -695,8 +676,7 @@ char * regcomp/regexec above without link errors. */ weak_function # endif -re_comp (s) - const char *s; +re_comp (const char *s) { reg_errcode_t ret; char *fastmap; @@ -1417,7 +1397,7 @@ calc_first (void *extra, bin_tree_t *node) { node->first = node; node->node_idx = re_dfa_add_node (dfa, node->token); - if (BE (node->node_idx == REG_MISSING, 0)) + if (BE (node->node_idx == -1, 0)) return REG_ESPACE; if (node->token.type == ANCHOR) dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type; @@ -1478,8 +1458,8 @@ link_nfa_nodes (void *extra, bin_tree_t *node) right = node->right->first->node_idx; else right = node->next->node_idx; - assert (REG_VALID_INDEX (left)); - assert (REG_VALID_INDEX (right)); + assert (left > -1); + assert (right > -1); err = re_node_set_init_2 (dfa->edests + idx, left, right); } break; @@ -1529,7 +1509,7 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, org_dest = dfa->nexts[org_node]; re_node_set_empty (dfa->edests + clone_node); clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; dfa->nexts[clone_node] = dfa->nexts[org_node]; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); @@ -1562,7 +1542,7 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, /* In case the node has another constraint, append it. */ constraint |= dfa->nodes[org_node].constraint; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (BE (! ok, 0)) @@ -1576,12 +1556,12 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, re_node_set_empty (dfa->edests + clone_node); /* Search for a duplicated node which satisfies the constraint. */ clone_dest = search_duplicated_node (dfa, org_dest, constraint); - if (clone_dest == REG_MISSING) + if (clone_dest == -1) { /* There is no such duplicated node, create a new one. */ reg_errcode_t err; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (BE (! ok, 0)) @@ -1602,7 +1582,7 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, org_dest = dfa->edests[org_node].elems[1]; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (BE (! ok, 0)) @@ -1628,18 +1608,18 @@ search_duplicated_node (const re_dfa_t *dfa, Idx org_node, && constraint == dfa->nodes[idx].constraint) return idx; /* Found. */ } - return REG_MISSING; /* Not found. */ + return -1; /* Not found. */ } /* Duplicate the node whose index is ORG_IDX and set the constraint CONSTRAINT. - Return the index of the new node, or REG_MISSING if insufficient storage is + Return the index of the new node, or -1 if insufficient storage is available. */ static Idx duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint) { Idx dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]); - if (BE (dup_idx != REG_MISSING, 1)) + if (BE (dup_idx != -1, 1)) { dfa->nodes[dup_idx].constraint = constraint; dfa->nodes[dup_idx].constraint |= dfa->nodes[org_idx].constraint; @@ -1698,7 +1678,7 @@ calc_eclosure (re_dfa_t *dfa) } #ifdef DEBUG - assert (dfa->eclosures[node_idx].nelem != REG_MISSING); + assert (dfa->eclosures[node_idx].nelem != -1); #endif /* If we have already calculated, skip it. */ @@ -1734,7 +1714,7 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) /* This indicates that we are calculating this node now. We reference this value to avoid infinite loop. */ - dfa->eclosures[node].nelem = REG_MISSING; + dfa->eclosures[node].nelem = -1; /* If the current node has constraints, duplicate all nodes since they must inherit the constraints. */ @@ -1756,7 +1736,7 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) Idx edest = dfa->edests[node].elems[i]; /* If calculating the epsilon closure of 'edest' is in progress, return intermediate result. */ - if (dfa->eclosures[edest].nelem == REG_MISSING) + if (dfa->eclosures[edest].nelem == -1) { incomplete = true; continue; @@ -2187,6 +2167,7 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree, *branch = NULL; + bitset_word_t initial_bkref_map = dfa->completed_bkref_map; tree = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2197,9 +2178,16 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, if (token->type != OP_ALT && token->type != END_OF_RE && (nest == 0 || token->type != OP_CLOSE_SUBEXP)) { + bitset_word_t accumulated_bkref_map = dfa->completed_bkref_map; + dfa->completed_bkref_map = initial_bkref_map; branch = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && branch == NULL, 0)) - return NULL; + { + if (tree != NULL) + postorder (tree, free_tree, NULL); + return NULL; + } + dfa->completed_bkref_map |= accumulated_bkref_map; } else branch = NULL; @@ -2460,14 +2448,22 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM) { - tree = parse_dup_op (tree, regexp, dfa, token, syntax, err); - if (BE (*err != REG_NOERROR && tree == NULL, 0)) - return NULL; + bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, + syntax, err); + if (BE (*err != REG_NOERROR && dup_tree == NULL, 0)) + { + if (tree != NULL) + postorder (tree, free_tree, NULL); + return NULL; + } + tree = dup_tree; /* In BRE consecutive duplications are not allowed. */ if ((syntax & RE_CONTEXT_INVALID_DUP) && (token->type == OP_DUP_ASTERISK || token->type == OP_OPEN_DUP_NUM)) { + if (tree != NULL) + postorder (tree, free_tree, NULL); *err = REG_BADRPT; return NULL; } @@ -2537,7 +2533,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, { end = 0; start = fetch_number (regexp, token, syntax); - if (start == REG_MISSING) + if (start == -1) { if (token->type == CHARACTER && token->opr.c == ',') start = 0; /* We treat "{,m}" as "{0,m}". */ @@ -2547,14 +2543,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, return NULL; } } - if (BE (start != REG_ERROR, 1)) + if (BE (start != -2, 1)) { /* We treat "{n}" as "{n,n}". */ end = ((token->type == OP_CLOSE_DUP_NUM) ? start : ((token->type == CHARACTER && token->opr.c == ',') - ? fetch_number (regexp, token, syntax) : REG_ERROR)); + ? fetch_number (regexp, token, syntax) : -2)); } - if (BE (start == REG_ERROR || end == REG_ERROR, 0)) + if (BE (start == -2 || end == -2, 0)) { /* Invalid sequence. */ if (BE (!(syntax & RE_INVALID_INTERVAL_ORD), 0)) @@ -2576,7 +2572,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, return elem; } - if (BE ((end != REG_MISSING && start > end) + if (BE ((end != -1 && start > end) || token->type != OP_CLOSE_DUP_NUM, 0)) { /* First number greater than second. */ @@ -2584,7 +2580,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, return NULL; } - if (BE (RE_DUP_MAX < (end == REG_MISSING ? start : end), 0)) + if (BE (RE_DUP_MAX < (end == -1 ? start : end), 0)) { *err = REG_ESIZE; return NULL; @@ -2593,7 +2589,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, else { start = (token->type == OP_DUP_PLUS) ? 1 : 0; - end = (token->type == OP_DUP_QUESTION) ? 1 : REG_MISSING; + end = (token->type == OP_DUP_QUESTION) ? 1 : -1; } fetch_token (token, regexp, syntax); @@ -2623,6 +2619,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, /* Duplicate ELEM before it is marked optional. */ elem = duplicate_tree (elem, dfa); + if (BE (elem == NULL, 0)) + goto parse_dup_op_espace; old_tree = tree; } else @@ -2635,7 +2633,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, } tree = create_tree (dfa, elem, NULL, - (end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT)); + (end == -1 ? OP_DUP_ASTERISK : OP_ALT)); if (BE (tree == NULL, 0)) goto parse_dup_op_espace; @@ -2643,10 +2641,10 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, True if the arithmetic type T is signed. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) - /* This loop is actually executed only when end != REG_MISSING, + /* This loop is actually executed only when end != -1, to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?... We have already created the start+1-th copy. */ - if (TYPE_SIGNED (Idx) || end != REG_MISSING) + if (TYPE_SIGNED (Idx) || end != -1) for (i = start + 2; i <= end; ++i) { elem = duplicate_tree (elem, dfa); @@ -2674,6 +2672,19 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, #define BRACKET_NAME_BUF_SIZE 32 #ifndef _LIBC + +# ifdef RE_ENABLE_I18N +/* Convert the byte B to the corresponding wide character. In a + unibyte locale, treat B as itself if it is an encoding error. + In a multibyte locale, return WEOF if B is an encoding error. */ +static wint_t +parse_byte (unsigned char b, re_charset_t *mbcset) +{ + wint_t wc = __btowc (b); + return wc == WEOF && !mbcset ? b : wc; +} +#endif + /* Local function for parse_bracket_exp only used in case of NOT _LIBC. Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. @@ -2725,9 +2736,9 @@ build_range_exp (const reg_syntax_t syntax, : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0] : 0)); start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM) - ? __btowc (start_ch) : start_elem->opr.wch); + ? parse_byte (start_ch, mbcset) : start_elem->opr.wch); end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM) - ? __btowc (end_ch) : end_elem->opr.wch); + ? parse_byte (end_ch, mbcset) : end_elem->opr.wch); if (start_wc == WEOF || end_wc == WEOF) return REG_ECOLLATE; else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0)) @@ -2757,7 +2768,11 @@ build_range_exp (const reg_syntax_t syntax, new_nranges); if (BE (new_array_start == NULL || new_array_end == NULL, 0)) - return REG_ESPACE; + { + re_free (new_array_start); + re_free (new_array_end); + return REG_ESPACE; + } mbcset->range_starts = new_array_start; mbcset->range_ends = new_array_end; @@ -3161,6 +3176,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, re_token_t token2; start_elem.opr.name = start_name_buf; + start_elem.type = COLL_SYM; ret = parse_bracket_element (&start_elem, regexp, token, token_len, dfa, syntax, first_round); if (BE (ret != REG_NOERROR, 0)) @@ -3204,6 +3220,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, if (is_range_exp == true) { end_elem.opr.name = end_name_buf; + end_elem.type = COLL_SYM; ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2, dfa, syntax, true); if (BE (ret != REG_NOERROR, 0)) @@ -3478,8 +3495,6 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) int32_t idx1, idx2; unsigned int ch; size_t len; - /* This #include defines a local function! */ -# include <locale/weight.h> /* Calculate the index for equivalence class. */ cp = name; table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); @@ -3489,7 +3504,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); - idx1 = findidx (&cp, -1); + idx1 = findidx (table, indirect, extra, &cp, -1); if (BE (idx1 == 0 || *cp != '\0', 0)) /* This isn't a valid character. */ return REG_ECOLLATE; @@ -3500,7 +3515,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) { char_buf[0] = ch; cp = char_buf; - idx2 = findidx (&cp, 1); + idx2 = findidx (table, indirect, extra, &cp, 1); /* idx2 = table[ch]; */ @@ -3654,26 +3669,21 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, bin_tree_t *tree; sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); -#ifdef RE_ENABLE_I18N - mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); -#endif /* RE_ENABLE_I18N */ - -#ifdef RE_ENABLE_I18N - if (BE (sbcset == NULL || mbcset == NULL, 0)) -#else /* not RE_ENABLE_I18N */ if (BE (sbcset == NULL, 0)) -#endif /* not RE_ENABLE_I18N */ { *err = REG_ESPACE; return NULL; } - - if (non_match) - { #ifdef RE_ENABLE_I18N - mbcset->non_match = 1; -#endif /* not RE_ENABLE_I18N */ + mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); + if (BE (mbcset == NULL, 0)) + { + re_free (sbcset); + *err = REG_ESPACE; + return NULL; } + mbcset->non_match = non_match; +#endif /* RE_ENABLE_I18N */ /* We don't care the syntax in this case. */ ret = build_charclass (trans, sbcset, @@ -3706,6 +3716,9 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, #endif /* Build a tree for simple bracket. */ +#if defined GCC_LINT || defined lint + memset (&br_token, 0, sizeof br_token); +#endif br_token.type = SIMPLE_BRACKET; br_token.opr.sbcset = sbcset; tree = create_token_tree (dfa, NULL, NULL, &br_token); @@ -3748,27 +3761,26 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, /* This is intended for the expressions like "a{1,3}". Fetch a number from 'input', and return the number. - Return REG_MISSING if the number field is empty like "{,1}". + Return -1 if the number field is empty like "{,1}". Return RE_DUP_MAX + 1 if the number field is too large. - Return REG_ERROR if an error occurred. */ + Return -2 if an error occurred. */ static Idx fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) { - Idx num = REG_MISSING; + Idx num = -1; unsigned char c; while (1) { fetch_token (token, input, syntax); c = token->opr.c; if (BE (token->type == END_OF_RE, 0)) - return REG_ERROR; + return -2; if (token->type == OP_CLOSE_DUP_NUM || c == ',') break; - num = ((token->type != CHARACTER || c < '0' || '9' < c - || num == REG_ERROR) - ? REG_ERROR - : num == REG_MISSING + num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) + ? -2 + : num == -1 ? c - '0' : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); } @@ -3800,6 +3812,9 @@ create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, re_token_type_t type) { re_token_t t; +#if defined GCC_LINT || defined lint + memset (&t, 0, sizeof t); +#endif t.type = type; return create_token_tree (dfa, left, right, &t); } @@ -3829,7 +3844,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, tree->token.opt_subexp = 0; tree->first = NULL; tree->next = NULL; - tree->node_idx = REG_MISSING; + tree->node_idx = -1; if (left != NULL) left->parent = tree; diff --git a/contrib/tools/m4/lib/regex.c b/contrib/tools/m4/lib/regex.c index 85091669c7..a96d82aa87 100644 --- a/contrib/tools/m4/lib/regex.c +++ b/contrib/tools/m4/lib/regex.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. diff --git a/contrib/tools/m4/lib/regex.h b/contrib/tools/m4/lib/regex.h index 854c6edaf7..b7496f9d7d 100644 --- a/contrib/tools/m4/lib/regex.h +++ b/contrib/tools/m4/lib/regex.h @@ -1,6 +1,6 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -42,11 +42,6 @@ extern "C" { supported within glibc itself, and glibc users should not define _REGEX_LARGE_OFFSETS. */ -/* The type of nonnegative object indexes. Traditionally, GNU regex - uses 'int' for these. Code that uses __re_idx_t should work - regardless of whether the type is signed. */ -typedef size_t __re_idx_t; - /* The type of object sizes. */ typedef size_t __re_size_t; @@ -58,7 +53,6 @@ typedef size_t __re_long_size_t; /* The traditional GNU regex implementation mishandles strings longer than INT_MAX. */ -typedef int __re_idx_t; typedef unsigned int __re_size_t; typedef unsigned long int __re_long_size_t; @@ -244,19 +238,16 @@ extern reg_syntax_t re_syntax_options; | RE_INVALID_INTERVAL_ORD) # define RE_SYNTAX_GREP \ - (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ - | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ - | RE_NEWLINE_ALT) + ((RE_SYNTAX_POSIX_BASIC | RE_NEWLINE_ALT) \ + & ~(RE_CONTEXT_INVALID_DUP | RE_DOT_NOT_NULL)) # define RE_SYNTAX_EGREP \ - (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ - | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ - | RE_NO_BK_VBAR) + ((RE_SYNTAX_POSIX_EXTENDED | RE_INVALID_INTERVAL_ORD | RE_NEWLINE_ALT) \ + & ~(RE_CONTEXT_INVALID_OPS | RE_DOT_NOT_NULL)) +/* POSIX grep -E behavior is no longer incompatible with GNU. */ # define RE_SYNTAX_POSIX_EGREP \ - (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \ - | RE_INVALID_INTERVAL_ORD) + RE_SYNTAX_EGREP /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ # define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC @@ -491,7 +482,8 @@ typedef struct re_pattern_buffer regex_t; #ifdef _REGEX_LARGE_OFFSETS /* POSIX 1003.1-2008 requires that regoff_t be at least as wide as ptrdiff_t and ssize_t. We don't know of any hosts where ptrdiff_t - is wider than ssize_t, so ssize_t is safe. */ + is wider than ssize_t, so ssize_t is safe. ptrdiff_t is not + visible here, so use ssize_t. */ typedef ssize_t regoff_t; #else /* The traditional GNU regex implementation mishandles strings longer @@ -541,7 +533,7 @@ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); BUFFER. Return NULL if successful, and an error string if not. To free the allocated storage, you must call 'regfree' on BUFFER. - Note that the translate table must either have been initialised by + Note that the translate table must either have been initialized by 'regcomp', with a malloc'ed value, or set to NULL before calling 'regfree'. */ extern const char *re_compile_pattern (const char *__pattern, size_t __length, @@ -560,34 +552,34 @@ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer); match, or -2 for an internal error. Also return register information in REGS (if REGS and BUFFER->no_sub are nonzero). */ extern regoff_t re_search (struct re_pattern_buffer *__buffer, - const char *__string, __re_idx_t __length, - __re_idx_t __start, regoff_t __range, + const char *__String, regoff_t __length, + regoff_t __start, regoff_t __range, struct re_registers *__regs); /* Like 're_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, - const char *__string1, __re_idx_t __length1, - const char *__string2, __re_idx_t __length2, - __re_idx_t __start, regoff_t __range, + const char *__string1, regoff_t __length1, + const char *__string2, regoff_t __length2, + regoff_t __start, regoff_t __range, struct re_registers *__regs, - __re_idx_t __stop); + regoff_t __stop); /* Like 're_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern regoff_t re_match (struct re_pattern_buffer *__buffer, - const char *__string, __re_idx_t __length, - __re_idx_t __start, struct re_registers *__regs); + const char *__String, regoff_t __length, + regoff_t __start, struct re_registers *__regs); /* Relates to 're_match' as 're_search_2' relates to 're_search'. */ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, - const char *__string1, __re_idx_t __length1, - const char *__string2, __re_idx_t __length2, - __re_idx_t __start, struct re_registers *__regs, - __re_idx_t __stop); + const char *__string1, regoff_t __length1, + const char *__string2, regoff_t __length2, + regoff_t __start, struct re_registers *__regs, + regoff_t __stop); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and @@ -608,7 +600,7 @@ extern void re_set_registers (struct re_pattern_buffer *__buffer, regoff_t *__starts, regoff_t *__ends); #endif /* Use GNU */ -#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD) +#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC) # ifndef _CRAY /* 4.2 bsd compatibility. */ extern char *re_comp (const char *); @@ -650,7 +642,7 @@ extern int regcomp (regex_t *_Restrict_ __preg, int __cflags); extern int regexec (const regex_t *_Restrict_ __preg, - const char *_Restrict_ __string, size_t __nmatch, + const char *_Restrict_ __String, size_t __nmatch, regmatch_t __pmatch[_Restrict_arr_], int __eflags); diff --git a/contrib/tools/m4/lib/regex_internal.c b/contrib/tools/m4/lib/regex_internal.c index 899b0ae67e..a3b10ddcc9 100644 --- a/contrib/tools/m4/lib/regex_internal.c +++ b/contrib/tools/m4/lib/regex_internal.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -311,13 +311,12 @@ build_wcs_upper_buffer (re_string_t *pstr) + byte_idx), remain_len, &pstr->cur_state); if (BE (mbclen < (size_t) -2, 1)) { - wchar_t wcu = wc; - if (iswlower (wc)) + wchar_t wcu = __towupper (wc); + if (wcu != wc) { size_t mbcdlen; - wcu = towupper (wc); - mbcdlen = wcrtomb (buf, wcu, &prev_st); + mbcdlen = __wcrtomb (buf, wcu, &prev_st); if (BE (mbclen == mbcdlen, 1)) memcpy (pstr->mbs + byte_idx, buf, mbclen); else @@ -381,12 +380,11 @@ build_wcs_upper_buffer (re_string_t *pstr) mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); if (BE (mbclen < (size_t) -2, 1)) { - wchar_t wcu = wc; - if (iswlower (wc)) + wchar_t wcu = __towupper (wc); + if (wcu != wc) { size_t mbcdlen; - wcu = towupper (wc); mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st); if (BE (mbclen == mbcdlen, 1)) memcpy (pstr->mbs + byte_idx, buf, mbclen); @@ -538,10 +536,7 @@ build_upper_buffer (re_string_t *pstr) int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx]; if (BE (pstr->trans != NULL, 0)) ch = pstr->trans[ch]; - if (islower (ch)) - pstr->mbs[char_idx] = toupper (ch); - else - pstr->mbs[char_idx] = ch; + pstr->mbs[char_idx] = toupper (ch); } pstr->valid_len = char_idx; pstr->valid_raw_len = char_idx; @@ -682,7 +677,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) pstr->valid_len - offset); pstr->valid_len -= offset; pstr->valid_raw_len -= offset; -#if DEBUG +#if defined DEBUG && DEBUG assert (pstr->valid_len > 0); #endif } @@ -927,7 +922,7 @@ internal_function re_string_context_at (const re_string_t *input, Idx idx, int eflags) { int c; - if (BE (! REG_VALID_INDEX (idx), 0)) + if (BE (idx < 0, 0)) /* In this case, we use the value stored in input->tip_context, since we can't know the character in input->mbs[-1] here. */ return input->tip_context; @@ -941,12 +936,12 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags) Idx wc_idx = idx; while(input->wcs[wc_idx] == WEOF) { -#ifdef DEBUG +#if defined DEBUG && DEBUG /* It must not happen. */ - assert (REG_VALID_INDEX (wc_idx)); + assert (wc_idx >= 0); #endif --wc_idx; - if (! REG_VALID_INDEX (wc_idx)) + if (wc_idx < 0) return input->tip_context; } wc = input->wcs[wc_idx]; @@ -1082,25 +1077,25 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, if (src1->elems[i1] == src2->elems[i2]) { /* Try to find the item in DEST. Maybe we could binary search? */ - while (REG_VALID_INDEX (id) && dest->elems[id] > src1->elems[i1]) + while (id >= 0 && dest->elems[id] > src1->elems[i1]) --id; - if (! REG_VALID_INDEX (id) || dest->elems[id] != src1->elems[i1]) + if (id < 0 || dest->elems[id] != src1->elems[i1]) dest->elems[--sbase] = src1->elems[i1]; - if (! REG_VALID_INDEX (--i1) || ! REG_VALID_INDEX (--i2)) + if (--i1 < 0 || --i2 < 0) break; } /* Lower the highest of the two items. */ else if (src1->elems[i1] < src2->elems[i2]) { - if (! REG_VALID_INDEX (--i2)) + if (--i2 < 0) break; } else { - if (! REG_VALID_INDEX (--i1)) + if (--i1 < 0) break; } } @@ -1113,7 +1108,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, DEST elements are already in place; this is more or less the same loop that is in re_node_set_merge. */ dest->nelem += delta; - if (delta > 0 && REG_VALID_INDEX (id)) + if (delta > 0 && id >= 0) for (;;) { if (dest->elems[is] > dest->elems[id]) @@ -1127,7 +1122,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; - if (! REG_VALID_INDEX (--id)) + if (--id < 0) break; } } @@ -1221,8 +1216,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) /* Copy into the top of DEST the items of SRC that are not found in DEST. Maybe we could binary search in DEST? */ for (sbase = dest->nelem + 2 * src->nelem, - is = src->nelem - 1, id = dest->nelem - 1; - REG_VALID_INDEX (is) && REG_VALID_INDEX (id); ) + is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; ) { if (dest->elems[id] == src->elems[is]) is--, id--; @@ -1232,7 +1226,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) --id; } - if (REG_VALID_INDEX (is)) + if (is >= 0) { /* If DEST is exhausted, the remaining items of SRC must be unique. */ sbase -= is + 1; @@ -1261,7 +1255,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; - if (! REG_VALID_INDEX (--id)) + if (--id < 0) { /* Copy remaining SRC elements. */ memcpy (dest->elems, dest->elems + sbase, @@ -1360,7 +1354,7 @@ re_node_set_compare (const re_node_set *set1, const re_node_set *set2) Idx i; if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem) return false; - for (i = set1->nelem ; REG_VALID_INDEX (--i) ; ) + for (i = set1->nelem ; --i >= 0 ; ) if (set1->elems[i] != set2->elems[i]) return false; return true; @@ -1373,7 +1367,7 @@ internal_function __attribute__ ((pure)) re_node_set_contains (const re_node_set *set, Idx elem) { __re_size_t idx, right, mid; - if (! REG_VALID_NONZERO_INDEX (set->nelem)) + if (set->nelem <= 0) return 0; /* Binary search the element. */ @@ -1403,7 +1397,7 @@ re_node_set_remove_at (re_node_set *set, Idx idx) /* Add the token TOKEN to dfa->nodes, and return the index of the token. - Or return REG_MISSING if an error occurred. */ + Or return -1 if an error occurred. */ static Idx internal_function @@ -1421,11 +1415,11 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) MAX (sizeof (re_node_set), sizeof (Idx))); if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_nodes_alloc, 0)) - return REG_MISSING; + return -1; new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc); if (BE (new_nodes == NULL, 0)) - return REG_MISSING; + return -1; dfa->nodes = new_nodes; new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc); new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc); @@ -1433,7 +1427,13 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) new_eclosures = re_realloc (dfa->eclosures, re_node_set, new_nodes_alloc); if (BE (new_nexts == NULL || new_indices == NULL || new_edests == NULL || new_eclosures == NULL, 0)) - return REG_MISSING; + { + re_free (new_nexts); + re_free (new_indices); + re_free (new_edests); + re_free (new_eclosures); + return -1; + } dfa->nexts = new_nexts; dfa->org_indices = new_indices; dfa->edests = new_edests; @@ -1447,7 +1447,7 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) ((token.type == OP_PERIOD && dfa->mb_cur_max > 1) || token.type == COMPLEX_BRACKET); #endif - dfa->nexts[dfa->nodes_len] = REG_MISSING; + dfa->nexts[dfa->nodes_len] = -1; re_node_set_init_empty (dfa->edests + dfa->nodes_len); re_node_set_init_empty (dfa->eclosures + dfa->nodes_len); return dfa->nodes_len++; @@ -1482,7 +1482,7 @@ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa, re_dfastate_t *new_state; struct re_state_table_entry *spot; Idx i; -#ifdef lint +#if defined GCC_LINT || defined lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; #endif @@ -1530,7 +1530,7 @@ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa, re_dfastate_t *new_state; struct re_state_table_entry *spot; Idx i; -#ifdef lint +#if defined GCC_LINT || defined lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; #endif diff --git a/contrib/tools/m4/lib/regex_internal.h b/contrib/tools/m4/lib/regex_internal.h index 87038435b6..16eb228b76 100644 --- a/contrib/tools/m4/lib/regex_internal.h +++ b/contrib/tools/m4/lib/regex_internal.h @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -33,14 +33,16 @@ #include <stdbool.h> #include <stdint.h> +#include "intprops.h" + #ifdef _LIBC -# error #include <bits/libc-lock.h> +# error #include <libc-lock.h> # define lock_define(name) __libc_lock_define (, name) # define lock_init(lock) (__libc_lock_init (lock), 0) # define lock_fini(lock) 0 # define lock_lock(lock) __libc_lock_lock (lock) # define lock_unlock(lock) __libc_lock_unlock (lock) -#elif defined GNULIB_LOCK +#elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO # include "glthread/lock.h" /* Use gl_lock_define if empty macro arguments are known to work. Otherwise, fall back on less-portable substitutes. */ @@ -62,7 +64,7 @@ # define lock_fini(lock) glthread_lock_destroy (&(lock)) # define lock_lock(lock) glthread_lock_lock (&(lock)) # define lock_unlock(lock) glthread_lock_unlock (&(lock)) -#elif defined GNULIB_PTHREAD +#elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO # include <pthread.h> # define lock_define(name) pthread_mutex_t name; # define lock_init(lock) pthread_mutex_init (&(lock), 0) @@ -87,7 +89,6 @@ # ifndef _RE_DEFINE_LOCALE_FUNCTIONS # define _RE_DEFINE_LOCALE_FUNCTIONS 1 # include <locale/localeinfo.h> -# include <locale/elem-hash.h> # include <locale/coll-lookup.h> # endif #endif @@ -110,15 +111,11 @@ # define gettext_noop(String) String #endif -#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC +#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE) || _LIBC # define RE_ENABLE_I18N #endif -#if __GNUC__ >= 3 -# define BE(expr, val) __builtin_expect (expr, val) -#else -# define BE(expr, val) (expr) -#endif +#define BE(expr, val) __builtin_expect (expr, val) /* Number of ASCII characters. */ #define ASCII_CHARS 0x80 @@ -137,7 +134,10 @@ # undef __wctype # undef __iswctype # define __wctype wctype +# define __iswalnum iswalnum # define __iswctype iswctype +# define __towlower towlower +# define __towupper towupper # define __btowc btowc # define __mbrtowc mbrtowc # define __wcrtomb wcrtomb @@ -149,31 +149,22 @@ # define __attribute__(arg) #endif -typedef __re_idx_t Idx; -#ifdef _REGEX_LARGE_OFFSETS -# define IDX_MAX (SIZE_MAX - 2) -#else -# define IDX_MAX INT_MAX -#endif - -/* Special return value for failure to match. */ -#define REG_MISSING ((Idx) -1) - -/* Special return value for internal error. */ -#define REG_ERROR ((Idx) -2) - -/* Test whether N is a valid index, and is not one of the above. */ -#ifdef _REGEX_LARGE_OFFSETS -# define REG_VALID_INDEX(n) ((Idx) (n) < REG_ERROR) -#else -# define REG_VALID_INDEX(n) (0 <= (n)) +#ifndef SSIZE_MAX +# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif -/* Test whether N is a valid nonzero index. */ +/* The type of indexes into strings. This is signed, not size_t, + since the API requires indexes to fit in regoff_t anyway, and using + signed integers makes the code a bit smaller and presumably faster. + The traditional GNU regex implementation uses int for indexes. + The POSIX-compatible implementation uses a possibly-wider type. + The name 'Idx' is three letters to minimize the hassle of + reindenting a lot of regex code that formerly used 'int'. */ +typedef regoff_t Idx; #ifdef _REGEX_LARGE_OFFSETS -# define REG_VALID_NONZERO_INDEX(n) ((Idx) ((n) - 1) < (Idx) (REG_ERROR - 1)) +# define IDX_MAX SSIZE_MAX #else -# define REG_VALID_NONZERO_INDEX(n) (0 < (n)) +# define IDX_MAX INT_MAX #endif /* A hash value, suitable for computing hash tables. */ @@ -447,23 +438,23 @@ typedef struct re_dfa_t re_dfa_t; #ifndef _LIBC # define internal_function +# define IS_IN(libc) false #endif -#ifndef NOT_IN_libc static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) internal_function; -# ifdef RE_ENABLE_I18N +#ifdef RE_ENABLE_I18N static void build_wcs_buffer (re_string_t *pstr) internal_function; static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) internal_function; -# endif /* RE_ENABLE_I18N */ +#endif /* RE_ENABLE_I18N */ static void build_upper_buffer (re_string_t *pstr) internal_function; static void re_string_translate_buffer (re_string_t *pstr) internal_function; static unsigned int re_string_context_at (const re_string_t *input, Idx idx, int eflags) internal_function __attribute__ ((pure)); -#endif + #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) #define re_string_fetch_byte(pstr) \ @@ -556,7 +547,7 @@ typedef struct bin_tree_storage_t bin_tree_storage_t; #define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_') #define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR) -#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_') +#define IS_WIDE_WORD_CHAR(ch) (__iswalnum (ch) || (ch) == L'_') #define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR) #define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \ @@ -860,15 +851,17 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx) return (wint_t) pstr->wcs[idx]; } -# ifndef NOT_IN_libc +# ifdef _LIBC +# include <locale/weight.h> +# endif + static int internal_function __attribute__ ((pure, unused)) re_string_elem_size_at (const re_string_t *pstr, Idx idx) { -# ifdef _LIBC +# ifdef _LIBC const unsigned char *p, *extra; const int32_t *table, *indirect; -# include <locale/weight.h> uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) @@ -879,14 +872,13 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); p = pstr->mbs + idx; - findidx (&p, pstr->len - idx); + findidx (table, indirect, extra, &p, pstr->len - idx); return p - pstr->mbs - idx; } else -# endif /* _LIBC */ +# endif /* _LIBC */ return 1; } -# endif #endif /* RE_ENABLE_I18N */ #ifndef __GNUC_PREREQ diff --git a/contrib/tools/m4/lib/regexec.c b/contrib/tools/m4/lib/regexec.c index d29d442baf..895db8208b 100644 --- a/contrib/tools/m4/lib/regexec.c +++ b/contrib/tools/m4/lib/regexec.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -219,12 +219,8 @@ 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 (preg, string, nmatch, pmatch, eflags) - const regex_t *_Restrict_ preg; - const char *_Restrict_ string; - size_t nmatch; - regmatch_t pmatch[_Restrict_arr_]; - int eflags; +regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string, + size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; Idx start, length; @@ -305,11 +301,8 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0); match was found and -2 indicates an internal error. */ regoff_t -re_match (bufp, string, length, start, regs) - struct re_pattern_buffer *bufp; - const char *string; - Idx length, start; - struct re_registers *regs; +re_match (struct re_pattern_buffer *bufp, const char *string, Idx length, + Idx start, struct re_registers *regs) { return re_search_stub (bufp, string, length, start, 0, length, regs, true); } @@ -318,12 +311,8 @@ weak_alias (__re_match, re_match) #endif regoff_t -re_search (bufp, string, length, start, range, regs) - struct re_pattern_buffer *bufp; - const char *string; - Idx length, start; - regoff_t range; - struct re_registers *regs; +re_search (struct re_pattern_buffer *bufp, const char *string, Idx length, + Idx start, regoff_t range, struct re_registers *regs) { return re_search_stub (bufp, string, length, start, range, length, regs, false); @@ -333,11 +322,9 @@ weak_alias (__re_search, re_search) #endif regoff_t -re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - Idx length1, length2, start, stop; - struct re_registers *regs; +re_match_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, + const char *string2, Idx length2, Idx start, + struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, 0, regs, stop, true); @@ -347,12 +334,9 @@ weak_alias (__re_match_2, re_match_2) #endif regoff_t -re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - Idx length1, length2, start, stop; - regoff_t range; - struct re_registers *regs; +re_search_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, + const char *string2, Idx length2, Idx start, regoff_t range, + struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, stop, false); @@ -362,18 +346,20 @@ weak_alias (__re_search_2, re_search_2) #endif static regoff_t -re_search_2_stub (struct re_pattern_buffer *bufp, - const char *string1, Idx length1, - const char *string2, Idx length2, - Idx start, regoff_t range, struct re_registers *regs, +internal_function +re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, + Idx length1, const char *string2, Idx length2, Idx start, + regoff_t range, struct re_registers *regs, Idx stop, bool ret_len) { const char *str; regoff_t rval; - Idx len = length1 + length2; + Idx len; char *s = NULL; - if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0)) + if (BE ((length1 < 0 || length2 < 0 || stop < 0 + || INT_ADD_WRAPV (length1, length2, &len)), + 0)) return -2; /* Concatenate the strings. */ @@ -409,8 +395,8 @@ re_search_2_stub (struct re_pattern_buffer *bufp, otherwise the position of the match is returned. */ static regoff_t -re_search_stub (struct re_pattern_buffer *bufp, - const char *string, Idx length, +internal_function +re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, bool ret_len) { @@ -499,6 +485,7 @@ re_search_stub (struct re_pattern_buffer *bufp, } static unsigned +internal_function re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated) { @@ -577,11 +564,8 @@ re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, freeing the old data. */ void -re_set_registers (bufp, regs, num_regs, starts, ends) - struct re_pattern_buffer *bufp; - struct re_registers *regs; - __re_size_t num_regs; - regoff_t *starts, *ends; +re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, + __re_size_t num_regs, regoff_t *starts, regoff_t *ends) { if (num_regs) { @@ -609,8 +593,7 @@ int # ifdef _LIBC weak_function # endif -re_exec (s) - const char *s; +re_exec (const char *s) { return 0 == regexec (&re_comp_buf, s, 0, NULL, 0); } @@ -628,12 +611,10 @@ re_exec (s) (0 <= LAST_START && LAST_START <= LENGTH) */ static reg_errcode_t -__attribute_warn_unused_result__ -re_search_internal (const regex_t *preg, - const char *string, Idx length, - Idx start, Idx last_start, Idx stop, - size_t nmatch, regmatch_t pmatch[], - int eflags) +__attribute_warn_unused_result__ internal_function +re_search_internal (const regex_t *preg, const char *string, Idx length, + Idx start, Idx last_start, Idx stop, size_t nmatch, + regmatch_t pmatch[], int eflags) { reg_errcode_t err; const re_dfa_t *dfa = preg->buffer; @@ -642,7 +623,7 @@ re_search_internal (const regex_t *preg, bool fl_longest_match; int match_kind; Idx match_first; - Idx match_last = REG_MISSING; + Idx match_last = -1; Idx extra_nmatch; bool sb; int ch; @@ -851,9 +832,9 @@ re_search_internal (const regex_t *preg, mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0; match_last = check_matching (&mctx, fl_longest_match, start <= last_start ? &match_first : NULL); - if (match_last != REG_MISSING) + if (match_last != -1) { - if (BE (match_last == REG_ERROR, 0)) + if (BE (match_last == -2, 0)) { err = REG_ESPACE; goto free_return; @@ -875,7 +856,7 @@ re_search_internal (const regex_t *preg, break; if (BE (err != REG_NOMATCH, 0)) goto free_return; - match_last = REG_MISSING; + match_last = -1; } else break; /* We found a match. */ @@ -886,7 +867,7 @@ re_search_internal (const regex_t *preg, } #ifdef DEBUG - assert (match_last != REG_MISSING); + assert (match_last != -1); assert (err == REG_NOERROR); #endif @@ -964,7 +945,7 @@ re_search_internal (const regex_t *preg, } static reg_errcode_t -__attribute_warn_unused_result__ +internal_function __attribute_warn_unused_result__ prune_impossible_nodes (re_match_context_t *mctx) { const re_dfa_t *const dfa = mctx->dfa; @@ -1012,7 +993,7 @@ prune_impossible_nodes (re_match_context_t *mctx) do { --match_last; - if (! REG_VALID_INDEX (match_last)) + if (match_last < 0) { ret = REG_NOMATCH; goto free_return; @@ -1093,8 +1074,8 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, } /* Check whether the regular expression match input string INPUT or not, - and return the index where the matching end. Return REG_MISSING if - there is no match, and return REG_ERROR in case of an error. + and return the index where the matching end. Return -1 if + there is no match, and return -2 in case of an error. FL_LONGEST_MATCH means we want the POSIX longest matching. If P_MATCH_FIRST is not NULL, and the match fails, it is set to the next place where we may want to try matching. @@ -1109,7 +1090,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; Idx match = 0; - Idx match_last = REG_MISSING; + Idx match_last = -1; Idx cur_str_idx = re_string_cur_idx (&mctx->input); re_dfastate_t *cur_state; bool at_init_state = p_match_first != NULL; @@ -1121,7 +1102,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, if (BE (cur_state == NULL, 0)) { assert (err == REG_ESPACE); - return REG_ERROR; + return -2; } if (mctx->state_log != NULL) @@ -1176,7 +1157,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, if (BE (err != REG_NOERROR, 0)) { assert (err == REG_ESPACE); - return REG_ERROR; + return -2; } } @@ -1190,7 +1171,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, state using the state log, if available and if we have not already found a valid (even if not the longest) match. */ if (BE (err != REG_NOERROR, 0)) - return REG_ERROR; + return -2; if (mctx->state_log == NULL || (match && !fl_longest_match) @@ -1273,7 +1254,7 @@ check_halt_state_context (const re_match_context_t *mctx, /* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA corresponding to the DFA). Return the destination node, and update EPS_VIA_NODES; - return REG_MISSING in case of errors. */ + return -1 in case of errors. */ static Idx internal_function @@ -1291,15 +1272,15 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, Idx dest_node; ok = re_node_set_insert (eps_via_nodes, node); if (BE (! ok, 0)) - return REG_ERROR; - /* Pick up a valid destination, or return REG_MISSING if none + return -2; + /* Pick up a valid destination, or return -1 if none is found. */ - for (dest_node = REG_MISSING, i = 0; i < edests->nelem; ++i) + for (dest_node = -1, i = 0; i < edests->nelem; ++i) { Idx candidate = edests->elems[i]; if (!re_node_set_contains (cur_nodes, candidate)) continue; - if (dest_node == REG_MISSING) + if (dest_node == -1) dest_node = candidate; else @@ -1313,7 +1294,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, else if (fs != NULL && push_fail_stack (fs, *pidx, candidate, nregs, regs, eps_via_nodes)) - return REG_ERROR; + return -2; /* We know we are going to exit. */ break; @@ -1338,13 +1319,13 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, if (fs != NULL) { if (regs[subexp_idx].rm_so == -1 || regs[subexp_idx].rm_eo == -1) - return REG_MISSING; + return -1; else if (naccepted) { char *buf = (char *) re_string_get_buffer (&mctx->input); if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, naccepted) != 0) - return REG_MISSING; + return -1; } } @@ -1353,7 +1334,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, Idx dest_node; ok = re_node_set_insert (eps_via_nodes, node); if (BE (! ok, 0)) - return REG_ERROR; + return -2; dest_node = dfa->edests[node].elems[0]; if (re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node)) @@ -1369,12 +1350,12 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, if (fs && (*pidx > mctx->match_last || mctx->state_log[*pidx] == NULL || !re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node))) - return REG_MISSING; + return -1; re_node_set_empty (eps_via_nodes); return dest_node; } } - return REG_MISSING; + return -1; } static reg_errcode_t @@ -1410,7 +1391,7 @@ pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) { Idx num = --fs->num; - assert (REG_VALID_INDEX (num)); + assert (num >= 0); *pidx = fs->stack[num].idx; memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs); re_node_set_free (eps_via_nodes); @@ -1503,9 +1484,9 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node, &eps_via_nodes, fs); - if (BE (! REG_VALID_INDEX (cur_node), 0)) + if (BE (cur_node < 0, 0)) { - if (BE (cur_node == REG_ERROR, 0)) + if (BE (cur_node == -2, 0)) { re_node_set_free (&eps_via_nodes); if (prev_idx_match_malloced) @@ -1889,10 +1870,10 @@ sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes, { Idx edst1 = dfa->edests[cur_node].elems[0]; Idx edst2 = ((dfa->edests[cur_node].nelem > 1) - ? dfa->edests[cur_node].elems[1] : REG_MISSING); + ? dfa->edests[cur_node].elems[1] : -1); if ((!re_node_set_contains (inv_eclosure, edst1) && re_node_set_contains (dest_nodes, edst1)) - || (REG_VALID_NONZERO_INDEX (edst2) + || (edst2 > 0 && !re_node_set_contains (inv_eclosure, edst2) && re_node_set_contains (dest_nodes, edst2))) { @@ -1972,7 +1953,7 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, switch (dfa->nodes[node].type) { case OP_BACK_REF: - if (bkref_idx != REG_MISSING) + if (bkref_idx != -1) { struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx; do @@ -2088,8 +2069,8 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, subexp_idx = dfa->nodes[ent->node].opr.idx; if (ent->subexp_to == str_idx) { - Idx ops_node = REG_MISSING; - Idx cls_node = REG_MISSING; + Idx ops_node = -1; + Idx cls_node = -1; for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { Idx node = dest_nodes->elems[node_idx]; @@ -2104,7 +2085,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, /* Check the limitation of the open subexpression. */ /* Note that (ent->subexp_to = str_idx != ent->subexp_from). */ - if (REG_VALID_INDEX (ops_node)) + if (ops_node >= 0) { err = sub_epsilon_src_nodes (dfa, ops_node, dest_nodes, candidates); @@ -2113,7 +2094,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, } /* Check the limitation of the close subexpression. */ - if (REG_VALID_INDEX (cls_node)) + if (cls_node >= 0) for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { Idx node = dest_nodes->elems[node_idx]; @@ -2166,7 +2147,7 @@ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, re_sift_context_t local_sctx; Idx first_idx = search_cur_bkref_entry (mctx, str_idx); - if (first_idx == REG_MISSING) + if (first_idx == -1) return REG_NOERROR; local_sctx.sifted_states = NULL; /* Mark that it hasn't been initialized. */ @@ -2570,7 +2551,7 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate) if (BE (err != REG_NOERROR, 0)) return err; #ifdef DEBUG - assert (dfa->nexts[cur_node_idx] != REG_MISSING); + assert (dfa->nexts[cur_node_idx] != -1); #endif new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx]; @@ -2636,7 +2617,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) /* And add the epsilon closures (which is 'new_dest_nodes') of the backreference to appropriate state_log. */ #ifdef DEBUG - assert (dfa->nexts[node_idx] != REG_MISSING); + assert (dfa->nexts[node_idx] != -1); #endif for (; bkc_idx < mctx->nbkref_ents; ++bkc_idx) { @@ -2720,7 +2701,7 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) const char *buf = (const char *) re_string_get_buffer (&mctx->input); /* Return if we have already checked BKREF_NODE at BKREF_STR_IDX. */ Idx cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx); - if (cache_idx != REG_MISSING) + if (cache_idx != -1) { const struct re_backref_cache_entry *entry = mctx->bkref_ents + cache_idx; @@ -2825,7 +2806,7 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) nodes = &mctx->state_log[sl_str]->nodes; cls_node = find_subexp_node (dfa, nodes, subexp_num, OP_CLOSE_SUBEXP); - if (cls_node == REG_MISSING) + if (cls_node == -1) continue; /* No. */ if (sub_top->path == NULL) { @@ -2904,7 +2885,7 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, && node->opr.idx == subexp_idx) return cls_node; } - return REG_MISSING; + return -1; } /* Check whether the node TOP_NODE at TOP_STR can arrive to the node @@ -3180,7 +3161,7 @@ check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, Idx cur_node = cur_nodes->elems[idx]; const re_node_set *eclosure = dfa->eclosures + cur_node; outside_node = find_subexp_node (dfa, eclosure, ex_subexp, type); - if (outside_node == REG_MISSING) + if (outside_node == -1) { /* There are no problematic nodes, just merge them. */ err = re_node_set_merge (&new_nodes, eclosure); @@ -3266,7 +3247,7 @@ expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Idx cache_idx_start = search_cur_bkref_entry (mctx, cur_str); struct re_backref_cache_entry *ent; - if (cache_idx_start == REG_MISSING) + if (cache_idx_start == -1) return REG_NOERROR; restart: @@ -3391,7 +3372,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) /* At first, group all nodes belonging to 'state' into several destinations. */ ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch); - if (BE (! REG_VALID_NONZERO_INDEX (ndests), 0)) + if (BE (ndests <= 0, 0)) { if (dests_node_malloced) free (dests_alloc); @@ -3453,7 +3434,7 @@ out_free: for (j = 0; j < dests_node[i].nelem; ++j) { next_node = dfa->nexts[dests_node[i].elems[j]]; - if (next_node != REG_MISSING) + if (next_node != -1) { err = re_node_set_merge (&follows, dfa->eclosures + next_node); if (BE (err != REG_NOERROR, 0)) @@ -3764,7 +3745,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, error_return: for (j = 0; j < ndests; ++j) re_node_set_free (dests_node + j); - return REG_MISSING; + return -1; } #ifdef RE_ENABLE_I18N @@ -3776,6 +3757,10 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, one collating element like '.', '[a-z]', opposite to the other nodes can only accept one byte. */ +# ifdef _LIBC +# include <locale/weight.h> +# endif + static int internal_function check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, @@ -3895,8 +3880,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, const int32_t *table, *indirect; const unsigned char *weights, *extra; const char *collseqwc; - /* This #include defines a local function! */ -# include <locale/weight.h> /* match with collating_symbol? */ if (cset->ncoll_syms) @@ -3953,7 +3936,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); - int32_t idx = findidx (&cp, elem_len); + int32_t idx = findidx (table, indirect, extra, &cp, elem_len); if (idx > 0) for (i = 0; i < cset->nequiv_classes; ++i) { @@ -4193,7 +4176,7 @@ internal_function __attribute_warn_unused_result__ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n) { mctx->eflags = eflags; - mctx->match_last = REG_MISSING; + mctx->match_last = -1; if (n > 0) { /* Avoid overflow. */ @@ -4314,7 +4297,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, return REG_NOERROR; } -/* Return the first entry with the same str_idx, or REG_MISSING if none is +/* Return the first entry with the same str_idx, or -1 if none is found. Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX. */ static Idx @@ -4334,7 +4317,7 @@ search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) if (left < last && mctx->bkref_ents[left].str_idx == str_idx) return left; else - return REG_MISSING; + return -1; } /* Register the node NODE, whose type is OP_OPEN_SUBEXP, and which matches diff --git a/contrib/tools/m4/lib/secure_getenv.c b/contrib/tools/m4/lib/secure_getenv.c index 6c11c5e0ed..88a60dc33c 100644 --- a/contrib/tools/m4/lib/secure_getenv.c +++ b/contrib/tools/m4/lib/secure_getenv.c @@ -1,6 +1,6 @@ -/* Look up an environment variable more securely. +/* Look up an environment variable, returning NULL in insecure situations. - Copyright 2013 Free Software Foundation, Inc. + Copyright 2013-2016 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 @@ -20,22 +20,35 @@ #include <stdlib.h> #if !HAVE___SECURE_GETENV -# if HAVE_ISSETUGID +# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID) # include <unistd.h> -# else -# undef issetugid -# define issetugid() 1 # endif #endif char * secure_getenv (char const *name) { -#if HAVE___SECURE_GETENV +#if HAVE___SECURE_GETENV /* glibc */ return __secure_getenv (name); -#else +#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */ if (issetugid ()) - return 0; + return NULL; + return getenv (name); +#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */ + if (geteuid () != getuid () || getegid () != getgid ()) + return NULL; return getenv (name); +#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */ + /* On native Windows, there is no such concept as setuid or setgid binaries. + - Programs launched as system services have high privileges, but they don't + inherit environment variables from a user. + - Programs launched by a user with "Run as Administrator" have high + privileges and use the environment variables, but the user has been asked + whether he agrees. + - Programs launched by a user without "Run as Administrator" cannot gain + high privileges, therefore there is no risk. */ + return getenv (name); +#else + return NULL; #endif } diff --git a/contrib/tools/m4/lib/sig-handler.h b/contrib/tools/m4/lib/sig-handler.h index 67d061d599..ad8c1dd8e7 100644 --- a/contrib/tools/m4/lib/sig-handler.h +++ b/contrib/tools/m4/lib/sig-handler.h @@ -1,6 +1,6 @@ /* Convenience declarations when working with <signal.h>. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 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,7 +34,7 @@ typedef void (*sa_handler_t) (int); /* Return the handler of a signal, as a sa_handler_t value regardless of its true type. The resulting function can be compared to special values like SIG_IGN but it is not portable to call it. */ -SIG_HANDLER_INLINE sa_handler_t +SIG_HANDLER_INLINE sa_handler_t _GL_ATTRIBUTE_PURE get_handler (struct sigaction const *a) { #ifdef SA_SIGINFO diff --git a/contrib/tools/m4/lib/sigaction.c b/contrib/tools/m4/lib/sigaction.c index 97eb76d92e..529b612f88 100644 --- a/contrib/tools/m4/lib/sigaction.c +++ b/contrib/tools/m4/lib/sigaction.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 Free Software Foundation, Inc. Written by Eric Blake <ebb9@byu.net>, 2008. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/siglist.h b/contrib/tools/m4/lib/siglist.h index 7817c95b31..7e1da0bde5 100644 --- a/contrib/tools/m4/lib/siglist.h +++ b/contrib/tools/m4/lib/siglist.h @@ -1,5 +1,5 @@ /* Canonical list of all signal names. - Copyright (C) 1996-1999, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1996-1999, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/sigprocmask.c b/contrib/tools/m4/lib/sigprocmask.c index 8de3777db3..fcbf032637 100644 --- a/contrib/tools/m4/lib/sigprocmask.c +++ b/contrib/tools/m4/lib/sigprocmask.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/spawn-pipe.c b/contrib/tools/m4/lib/spawn-pipe.c index d96f514d63..6e6513047f 100644 --- a/contrib/tools/m4/lib/spawn-pipe.c +++ b/contrib/tools/m4/lib/spawn-pipe.c @@ -1,5 +1,5 @@ /* Creation of subprocesses, communicating via pipes. - Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -35,7 +35,8 @@ #define _(str) gettext (str) -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if (((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + || defined __KLIBC__) /* Native Windows API. */ # include <process.h> @@ -52,12 +53,6 @@ extern char** environ; #endif -/* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ -#undef open -#undef close - - #ifdef EINTR /* EINTR handling for close(). @@ -118,7 +113,8 @@ create_pipe (const char *progname, bool slave_process, bool exit_on_error, int fd[2]) { -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if (((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + || defined __KLIBC__) /* Native Windows API. This uses _pipe(), dup2(), and spawnv(). It could also be implemented diff --git a/contrib/tools/m4/lib/spawn-pipe.h b/contrib/tools/m4/lib/spawn-pipe.h index ea8284f268..96e7bebc8b 100644 --- a/contrib/tools/m4/lib/spawn-pipe.h +++ b/contrib/tools/m4/lib/spawn-pipe.h @@ -1,5 +1,5 @@ /* Creation of subprocesses, communicating via pipes. - Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/stdio--.h b/contrib/tools/m4/lib/stdio--.h index fe6d83edc4..8e238171af 100644 --- a/contrib/tools/m4/lib/stdio--.h +++ b/contrib/tools/m4/lib/stdio--.h @@ -1,6 +1,6 @@ /* Like stdio.h, but redefine some names to avoid glitches. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 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/contrib/tools/m4/lib/stdio-safer.h b/contrib/tools/m4/lib/stdio-safer.h index 7b67ae059d..4231609741 100644 --- a/contrib/tools/m4/lib/stdio-safer.h +++ b/contrib/tools/m4/lib/stdio-safer.h @@ -1,6 +1,6 @@ /* Invoke stdio functions, but avoid some glitches. - Copyright (C) 2001, 2003, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2006, 2009-2016 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/contrib/tools/m4/lib/stdlib--.h b/contrib/tools/m4/lib/stdlib--.h index ac02ece9b0..af83455aa3 100644 --- a/contrib/tools/m4/lib/stdlib--.h +++ b/contrib/tools/m4/lib/stdlib--.h @@ -1,6 +1,6 @@ /* Like stdlib.h, but redefine some names to avoid glitches. - Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2016 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/contrib/tools/m4/lib/stdlib-safer.h b/contrib/tools/m4/lib/stdlib-safer.h index 1e3149370e..91294f4ef4 100644 --- a/contrib/tools/m4/lib/stdlib-safer.h +++ b/contrib/tools/m4/lib/stdlib-safer.h @@ -1,6 +1,6 @@ /* Invoke stdlib.h functions, but avoid some glitches. - Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2016 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/contrib/tools/m4/lib/stripslash.c b/contrib/tools/m4/lib/stripslash.c index 0e452a95ef..0453e36cc6 100644 --- a/contrib/tools/m4/lib/stripslash.c +++ b/contrib/tools/m4/lib/stripslash.c @@ -1,6 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/strsignal.c b/contrib/tools/m4/lib/strsignal.c index 59614abb30..8c64c4e3dd 100644 --- a/contrib/tools/m4/lib/strsignal.c +++ b/contrib/tools/m4/lib/strsignal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994-2002, 2005, 2008-2013 Free Software Foundation, +/* Copyright (C) 1991, 1994-2002, 2005, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/tempname.c b/contrib/tools/m4/lib/tempname.c index 087b79b31f..b1e9880f7b 100644 --- a/contrib/tools/m4/lib/tempname.c +++ b/contrib/tools/m4/lib/tempname.c @@ -1,6 +1,6 @@ /* tempname.c - generate the name of a temporary file. - Copyright (C) 1991-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2016 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 @@ -62,6 +62,7 @@ # define struct_stat64 struct stat64 #else # define struct_stat64 struct stat +# define __try_tempname try_tempname # define __gen_tempname gen_tempname # define __getpid getpid # define __gettimeofday gettimeofday @@ -176,21 +177,9 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; -/* Generate a temporary file name based on TMPL. TMPL must match the - rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). - The name constructed does not exist at the time of the call to - __gen_tempname. TMPL is overwritten with the result. - - KIND may be one of: - __GT_NOCREATE: simply verify that the name does not exist - at the time of the call. - __GT_FILE: create the file using open(O_CREAT|O_EXCL) - and return a read-write fd. The file is mode 0600. - __GT_DIR: create a directory, which will be mode 0700. - - We use a clever algorithm to get hard-to-predict names. */ int -__gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +__try_tempname (char *tmpl, int suffixlen, void *args, + int (*tryfunc) (char *, void *)) { int len; char *XXXXXX; @@ -199,7 +188,6 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) unsigned int count; int fd = -1; int save_errno = errno; - struct_stat64 st; /* A lower bound on the number of temporary files to attempt to generate. The maximum total number of temporary file names that @@ -256,41 +244,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) v /= 62; XXXXXX[5] = letters[v % 62]; - switch (kind) - { - case __GT_FILE: - fd = __open (tmpl, - (flags & ~O_ACCMODE) - | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); - break; - - case __GT_DIR: - fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); - break; - - case __GT_NOCREATE: - /* This case is backward from the other three. __gen_tempname - succeeds if __xstat fails because the name does not exist. - Note the continue to bypass the common logic at the bottom - of the loop. */ - if (__lxstat64 (_STAT_VER, tmpl, &st) < 0) - { - if (errno == ENOENT) - { - __set_errno (save_errno); - return 0; - } - else - /* Give up now. */ - return -1; - } - continue; - - default: - assert (! "invalid KIND in __gen_tempname"); - abort (); - } - + fd = tryfunc (tmpl, args); if (fd >= 0) { __set_errno (save_errno); @@ -304,3 +258,67 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) __set_errno (EEXIST); return -1; } + +static int +try_file (char *tmpl, void *flags) +{ + int *openflags = flags; + return __open (tmpl, + (*openflags & ~O_ACCMODE) + | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); +} + +static int +try_dir (char *tmpl, void *flags _GL_UNUSED) +{ + return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); +} + +static int +try_nocreate (char *tmpl, void *flags _GL_UNUSED) +{ + struct_stat64 st; + + if (__lxstat64 (_STAT_VER, tmpl, &st) == 0) + __set_errno (EEXIST); + return errno == ENOENT ? 0 : -1; +} + +/* Generate a temporary file name based on TMPL. TMPL must match the + rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). + The name constructed does not exist at the time of the call to + __gen_tempname. TMPL is overwritten with the result. + + KIND may be one of: + __GT_NOCREATE: simply verify that the name does not exist + at the time of the call. + __GT_FILE: create the file using open(O_CREAT|O_EXCL) + and return a read-write fd. The file is mode 0600. + __GT_DIR: create a directory, which will be mode 0700. + + We use a clever algorithm to get hard-to-predict names. */ +int +__gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +{ + int (*tryfunc) (char *, void *); + + switch (kind) + { + case __GT_FILE: + tryfunc = try_file; + break; + + case __GT_DIR: + tryfunc = try_dir; + break; + + case __GT_NOCREATE: + tryfunc = try_nocreate; + break; + + default: + assert (! "invalid KIND in __gen_tempname"); + abort (); + } + return __try_tempname (tmpl, suffixlen, &flags, tryfunc); +} diff --git a/contrib/tools/m4/lib/tempname.h b/contrib/tools/m4/lib/tempname.h index 333267dfd0..be01c51436 100644 --- a/contrib/tools/m4/lib/tempname.h +++ b/contrib/tools/m4/lib/tempname.h @@ -1,6 +1,6 @@ /* Create a temporary file or directory. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 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 @@ -32,6 +32,10 @@ # define GT_NOCREATE 2 # endif +#ifdef __cplusplus +extern "C" { +#endif + /* Generate a temporary file name based on TMPL. TMPL must match the rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). The name constructed does not exist at the time of the call to @@ -47,4 +51,15 @@ We use a clever algorithm to get hard-to-predict names. */ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind); +/* Similar to gen_tempname, but TRYFUNC is called for each temporary + name to try. If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME + returns with this value. Otherwise, if errno is set to EEXIST, another + name is tried, or else TRY_GEN_TEMPNAME returns -1. */ +extern int try_tempname (char *tmpl, int suffixlen, void *args, + int (*tryfunc) (char *, void *)); + +#ifdef __cplusplus +} +#endif + #endif /* GL_TEMPNAME_H */ diff --git a/contrib/tools/m4/lib/tmpdir.c b/contrib/tools/m4/lib/tmpdir.c index 97fc3ff888..1cc01fb1c2 100644 --- a/contrib/tools/m4/lib/tmpdir.c +++ b/contrib/tools/m4/lib/tmpdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001-2002, 2006, 2009-2013 Free Software Foundation, +/* Copyright (C) 1999, 2001-2002, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/tmpdir.h b/contrib/tools/m4/lib/tmpdir.h index ff7c70f346..ef615fcb23 100644 --- a/contrib/tools/m4/lib/tmpdir.h +++ b/contrib/tools/m4/lib/tmpdir.h @@ -1,5 +1,5 @@ /* Determine a temporary directory. - Copyright (C) 2001-2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2009-2016 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/contrib/tools/m4/lib/unistd--.h b/contrib/tools/m4/lib/unistd--.h index ac2de1cf1a..bd1d0fb252 100644 --- a/contrib/tools/m4/lib/unistd--.h +++ b/contrib/tools/m4/lib/unistd--.h @@ -1,6 +1,6 @@ /* Like unistd.h, but redefine some names to avoid glitches. - Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2016 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/contrib/tools/m4/lib/unistd-safer.h b/contrib/tools/m4/lib/unistd-safer.h index 5c2b55ae2f..c8179ce376 100644 --- a/contrib/tools/m4/lib/unistd-safer.h +++ b/contrib/tools/m4/lib/unistd-safer.h @@ -1,6 +1,6 @@ /* Invoke unistd-like functions, but avoid some glitches. - Copyright (C) 2001, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2009-2016 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/contrib/tools/m4/lib/unistd.c b/contrib/tools/m4/lib/unistd.c index 6c6a8e268c..72bad1c052 100644 --- a/contrib/tools/m4/lib/unistd.c +++ b/contrib/tools/m4/lib/unistd.c @@ -1,3 +1,4 @@ #include <config.h> #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include "unistd.h" +typedef int dummy; diff --git a/contrib/tools/m4/lib/unlocked-io.h b/contrib/tools/m4/lib/unlocked-io.h index df3e13911e..c0ece50787 100644 --- a/contrib/tools/m4/lib/unlocked-io.h +++ b/contrib/tools/m4/lib/unlocked-io.h @@ -1,6 +1,6 @@ /* Prefer faster, non-thread-safe stdio functions if available. - Copyright (C) 2001-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2016 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/contrib/tools/m4/lib/vasnprintf.c b/contrib/tools/m4/lib/vasnprintf.c index 184937d6f1..2f39b38734 100644 --- a/contrib/tools/m4/lib/vasnprintf.c +++ b/contrib/tools/m4/lib/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2016 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 @@ -195,7 +195,7 @@ /* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" warnings in this file. Use -Dlint to suppress them. */ -#ifdef lint +#if defined GCC_LINT || defined lint # define IF_LINT(Code) Code #else # define IF_LINT(Code) /* empty */ @@ -1886,7 +1886,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, else { do - result[length++] = (unsigned char) *cp++; + result[length++] = *cp++; while (--n > 0); } } @@ -1957,15 +1957,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -2073,8 +2072,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2127,8 +2125,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2201,8 +2198,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2255,8 +2251,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2329,8 +2324,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2383,8 +2377,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2435,15 +2428,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -2573,8 +2565,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2635,8 +2626,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2827,8 +2817,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* w doesn't matter. */ w = 0; - if (has_width && width > w - && !(dp->flags & FLAG_LEFT)) + if (w < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); @@ -2911,8 +2900,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, length += tmpdst_len; # endif - if (has_width && width > w - && (dp->flags & FLAG_LEFT)) + if (w < width && (dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); @@ -2939,17 +2927,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; - int has_width; size_t width; int has_precision; size_t precision; size_t tmp_length; + size_t count; DCHAR_T tmpbuf[700]; DCHAR_T *tmp; DCHAR_T *pad_ptr; DCHAR_T *p; - has_width = 0; width = 0; if (dp->width_start != dp->width_end) { @@ -2960,15 +2947,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -2978,7 +2964,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } - has_width = 1; } has_precision = 0; @@ -3354,11 +3339,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, abort (); # endif } + /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) + count = p - tmp; + + if (count < width) { - size_t pad = width - (p - tmp); + size_t pad = width - count; DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) @@ -3391,28 +3379,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, p = end; } - { - size_t count = p - tmp; + count = p - tmp; - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); + /* Make room for the result. */ + if (count >= allocated - length) + { + size_t n = xsum (length, count); - ENSURE_ALLOCATION (n); - } + ENSURE_ALLOCATION (n); + } - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } + /* Append the result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + if (tmp != tmpbuf) + free (tmp); + length += count; } #endif #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL @@ -3446,8 +3432,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, arg_type type = a.arg[dp->arg_index].type; # endif int flags = dp->flags; - int has_width; size_t width; + size_t count; int has_precision; size_t precision; size_t tmp_length; @@ -3456,7 +3442,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, DCHAR_T *pad_ptr; DCHAR_T *p; - has_width = 0; width = 0; if (dp->width_start != dp->width_end) { @@ -3467,15 +3452,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -3485,7 +3469,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } - has_width = 1; } has_precision = 0; @@ -3925,9 +3908,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, digits without trailing zeroes. */ if (exponent >= 0) { - size_t count = exponent + 1; + size_t ecount = exponent + 1; /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) + for (; ecount > 0; ecount--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { @@ -3941,10 +3924,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } else { - size_t count = -exponent - 1; + size_t ecount = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); - for (; count > 0; count--) + for (; ecount > 0; ecount--) *p++ = '0'; while (ndigits > nzeroes) { @@ -4395,9 +4378,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, digits without trailing zeroes. */ if (exponent >= 0) { - size_t count = exponent + 1; - /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) + size_t ecount = exponent + 1; + /* Note: ecount <= precision = ndigits. */ + for (; ecount > 0; ecount--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { @@ -4411,10 +4394,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } else { - size_t count = -exponent - 1; + size_t ecount = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); - for (; count > 0; count--) + for (; ecount > 0; ecount--) *p++ = '0'; while (ndigits > nzeroes) { @@ -4542,9 +4525,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) + count = p - tmp; + + if (count < width) { - size_t pad = width - (p - tmp); + size_t pad = width - count; DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) @@ -4577,36 +4562,36 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, p = end; } - { - size_t count = p - tmp; + count = p - tmp; - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); + /* Make room for the result. */ + if (count >= allocated - length) + { + size_t n = xsum (length, count); - ENSURE_ALLOCATION (n); - } + ENSURE_ALLOCATION (n); + } - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } + /* Append the result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + if (tmp != tmpbuf) + free (tmp); + length += count; } #endif else { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int has_width; +#endif +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION size_t width; #endif #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION @@ -4635,8 +4620,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, TCHAR_T *tmp; #endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 0; +#endif +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION width = 0; if (dp->width_start != dp->width_end) { @@ -4647,15 +4634,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -4665,7 +4651,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 1; +#endif } #endif @@ -4805,7 +4793,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { const FCHAR_T *mp = dp->width_start; do - *fbp++ = (unsigned char) *mp++; + *fbp++ = *mp++; while (--n > 0); } } @@ -4826,7 +4814,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { const FCHAR_T *mp = dp->precision_start; do - *fbp++ = (unsigned char) *mp++; + *fbp++ = *mp++; while (--n > 0); } } @@ -4844,9 +4832,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, break; # else *fbp++ = 'l'; - /*FALLTHROUGH*/ # endif #endif + /*FALLTHROUGH*/ case TYPE_LONGINT: case TYPE_ULONGINT: #if HAVE_WINT_T @@ -5153,7 +5141,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, size_t tmp_length = MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type, flags, - has_width ? width : 0, + width, has_precision, precision, pad_ourselves); @@ -5191,18 +5179,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* SNPRINTF or sprintf failed. Save and use the errno that it has set, if any. */ int saved_errno = errno; + if (saved_errno == 0) + { + if (dp->conversion == 'c' || dp->conversion == 's') + saved_errno = EILSEQ; + else + saved_errno = EINVAL; + } if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); - errno = - (saved_errno != 0 - ? saved_errno - : (dp->conversion == 'c' || dp->conversion == 's' - ? EILSEQ - : EINVAL)); + + errno = saved_errno; return NULL; } @@ -5391,7 +5382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, tmpsrc += count; tmpdst += count; for (n = count; n > 0; n--) - *--tmpdst = (unsigned char) *--tmpsrc; + *--tmpdst = *--tmpsrc; } } #endif diff --git a/contrib/tools/m4/lib/vasnprintf.h b/contrib/tools/m4/lib/vasnprintf.h index 7658f505e5..8e9d84f015 100644 --- a/contrib/tools/m4/lib/vasnprintf.h +++ b/contrib/tools/m4/lib/vasnprintf.h @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2016 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/contrib/tools/m4/lib/vasprintf.c b/contrib/tools/m4/lib/vasprintf.c index d0d4a11bf7..a5dc1beb4e 100644 --- a/contrib/tools/m4/lib/vasprintf.c +++ b/contrib/tools/m4/lib/vasprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2016 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/contrib/tools/m4/lib/verify.h b/contrib/tools/m4/lib/verify.h index d42d0750ee..5c8381d290 100644 --- a/contrib/tools/m4/lib/verify.h +++ b/contrib/tools/m4/lib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 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 @@ -250,6 +250,30 @@ template <int w> #define verify(R) _GL_VERIFY (R, "verify (" #R ")") +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/* Assume that R always holds. This lets the compiler optimize + accordingly. R should not have side-effects; it may or may not be + evaluated. Behavior is undefined if R is false. */ + +#if (__has_builtin (__builtin_unreachable) \ + || 4 < __GNUC__ + (5 <= __GNUC_MINOR__)) +# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) +#elif 1200 <= _MSC_VER +# define assume(R) __assume (R) +#elif ((defined GCC_LINT || defined lint) \ + && (__has_builtin (__builtin_trap) \ + || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) + /* Doing it this way helps various packages when configured with + --enable-gcc-warnings, which compiles with -Dlint. It's nicer + when 'assume' silences warnings even with older GCCs. */ +# define assume(R) ((R) ? (void) 0 : __builtin_trap ()) +#else +# define assume(R) ((void) (0 && (R))) +#endif + /* @assert.h omit end@ */ #endif diff --git a/contrib/tools/m4/lib/verror.c b/contrib/tools/m4/lib/verror.c index 5f899c1b7a..1abf3fe1e3 100644 --- a/contrib/tools/m4/lib/verror.c +++ b/contrib/tools/m4/lib/verror.c @@ -1,5 +1,5 @@ /* va_list error handler for noninteractive utilities - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 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/contrib/tools/m4/lib/verror.h b/contrib/tools/m4/lib/verror.h index 7e7284ad82..6d5123aa84 100644 --- a/contrib/tools/m4/lib/verror.h +++ b/contrib/tools/m4/lib/verror.h @@ -1,5 +1,5 @@ /* Declaration for va_list error-reporting function - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 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/contrib/tools/m4/lib/version-etc-fsf.c b/contrib/tools/m4/lib/version-etc-fsf.c index e1c69da94a..baaebb61c7 100644 --- a/contrib/tools/m4/lib/version-etc-fsf.c +++ b/contrib/tools/m4/lib/version-etc-fsf.c @@ -1,5 +1,5 @@ /* Variable with FSF copyright information, for version-etc. - Copyright (C) 1999-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2006, 2009-2016 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/contrib/tools/m4/lib/version-etc.c b/contrib/tools/m4/lib/version-etc.c index b7d23ab597..a9a0fdb0ad 100644 --- a/contrib/tools/m4/lib/version-etc.c +++ b/contrib/tools/m4/lib/version-etc.c @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2016 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 @@ -38,7 +38,7 @@ # define PACKAGE PACKAGE_TARNAME #endif -enum { COPYRIGHT_YEAR = 2013 }; +enum { COPYRIGHT_YEAR = 2016 }; /* The three functions below display the --version information the standard way. diff --git a/contrib/tools/m4/lib/version-etc.h b/contrib/tools/m4/lib/version-etc.h index 6c3d08431c..1a5f603c04 100644 --- a/contrib/tools/m4/lib/version-etc.h +++ b/contrib/tools/m4/lib/version-etc.h @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2003, 2005, 2009-2016 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/contrib/tools/m4/lib/w32spawn.h b/contrib/tools/m4/lib/w32spawn.h index 3b5c08afcd..389054aa6d 100644 --- a/contrib/tools/m4/lib/w32spawn.h +++ b/contrib/tools/m4/lib/w32spawn.h @@ -1,5 +1,5 @@ /* Auxiliary functions for the creation of subprocesses. Native Windows API. - Copyright (C) 2001, 2003-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -15,9 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef __KLIBC__ /* Get declarations of the native Windows API functions. */ -#define WIN32_LEAN_AND_MEAN -#include <windows.h> +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif /* Get _open_osfhandle(). */ #include <io.h> @@ -123,8 +125,13 @@ undup_safer_noinherit (int tempfd, int origfd) - mingw programs that have a global variable 'int _CRT_glob = 0;', - Cygwin programs, when invoked from a Cygwin program. */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037*?" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#ifndef __KLIBC__ +# define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037*?" +# define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#else +# define SHELL_SPECIAL_CHARS "" +# define SHELL_SPACE_CHARS "" +#endif static char ** prepare_spawn (char **argv) { diff --git a/contrib/tools/m4/lib/wait-process.c b/contrib/tools/m4/lib/wait-process.c index 17a2430f91..d081385eee 100644 --- a/contrib/tools/m4/lib/wait-process.c +++ b/contrib/tools/m4/lib/wait-process.c @@ -1,5 +1,5 @@ /* Waiting for a subprocess to finish. - Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/wait-process.h b/contrib/tools/m4/lib/wait-process.h index 6d8f0d2b94..50dbb895d0 100644 --- a/contrib/tools/m4/lib/wait-process.h +++ b/contrib/tools/m4/lib/wait-process.h @@ -1,5 +1,5 @@ /* Waiting for a subprocess to finish. - Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/waitpid.c b/contrib/tools/m4/lib/waitpid.c index d28a70b3ea..162ade87d4 100644 --- a/contrib/tools/m4/lib/waitpid.c +++ b/contrib/tools/m4/lib/waitpid.c @@ -1,5 +1,5 @@ /* Wait for process state change. - Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2016 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/contrib/tools/m4/lib/xalloc-die.c b/contrib/tools/m4/lib/xalloc-die.c index daa403b9c8..4c7994bf1e 100644 --- a/contrib/tools/m4/lib/xalloc-die.c +++ b/contrib/tools/m4/lib/xalloc-die.c @@ -1,6 +1,6 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2013 Free Software + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xalloc-oversized.h b/contrib/tools/m4/lib/xalloc-oversized.h index a971c78ad3..503bb37801 100644 --- a/contrib/tools/m4/lib/xalloc-oversized.h +++ b/contrib/tools/m4/lib/xalloc-oversized.h @@ -1,6 +1,6 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2016 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 @@ -16,23 +16,53 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef XALLOC_OVERSIZED_H_ -# define XALLOC_OVERSIZED_H_ +#define XALLOC_OVERSIZED_H_ -# include <stddef.h> +#include <stddef.h> +#include <stdint.h> -/* Return 1 if an array of N objects, each of size S, cannot exist due - to size arithmetic overflow. S must be positive and N must be - nonnegative. This is a macro, not a function, so that it - works correctly even when SIZE_MAX < N. +/* Default for (non-Clang) compilers that lack __has_builtin. */ +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif +/* True if N * S would overflow in a size_t calculation, + or would generate a value larger than PTRDIFF_MAX. + This expands to a constant expression if N and S are both constants. By gnulib convention, SIZE_MAX represents overflow in size - calculations, so the conservative dividend to use here is - SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. - However, malloc (SIZE_MAX) fails on all known hosts where - sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for - exactly-SIZE_MAX allocations on such hosts; this avoids a test and - branch when S is known to be 1. */ + calculations, so the conservative size_t-based dividend to use here + is SIZE_MAX - 1. */ +#define __xalloc_oversized(n, s) \ + ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) + +#if PTRDIFF_MAX < SIZE_MAX +typedef ptrdiff_t __xalloc_count_type; +#else +typedef size_t __xalloc_count_type; +#endif + +/* Return 1 if an array of N objects, each of size S, cannot exist + reliably due to size or ptrdiff_t arithmetic overflow. S must be + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ + +#if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p) # define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) +#elif ((5 <= __GNUC__ \ + || (__has_builtin (__builtin_mul_overflow) \ + && __has_builtin (__builtin_constant_p))) \ + && !__STRICT_ANSI__) +# define xalloc_oversized(n, s) \ + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ + : ({ __xalloc_count_type __xalloc_count; \ + __builtin_mul_overflow (n, s, &__xalloc_count); })) + +/* Other compilers use integer division; this may be slower but is + more portable. */ +#else +# define xalloc_oversized(n, s) __xalloc_oversized (n, s) +#endif #endif /* !XALLOC_OVERSIZED_H_ */ diff --git a/contrib/tools/m4/lib/xalloc.h b/contrib/tools/m4/lib/xalloc.h index 6c9b53bf6f..3aad4e3110 100644 --- a/contrib/tools/m4/lib/xalloc.h +++ b/contrib/tools/m4/lib/xalloc.h @@ -1,6 +1,6 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2016 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 @@ -19,6 +19,7 @@ #define XALLOC_H_ #include <stddef.h> +#include <stdint.h> #include "xalloc-oversized.h" @@ -41,7 +42,8 @@ extern "C" { # define _GL_ATTRIBUTE_MALLOC #endif -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if ! defined __clang__ && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) #else # define _GL_ATTRIBUTE_ALLOC_SIZE(args) @@ -64,7 +66,7 @@ void *xrealloc (void *p, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); void *x2realloc (void *p, size_t *pn); void *xmemdup (void const *p, size_t s) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2)); + _GL_ATTRIBUTE_ALLOC_SIZE ((2)); char *xstrdup (char const *str) _GL_ATTRIBUTE_MALLOC; @@ -122,10 +124,9 @@ xnrealloc (void *p, size_t n, size_t s) /* If P is null, allocate a block of at least *PN such objects; otherwise, reallocate P so that it contains more than *PN objects - each of S bytes. *PN must be nonzero unless P is null, and S must - be nonzero. Set *PN to the new number of objects, and return the - pointer to the new block. *PN is never set to zero, and the - returned pointer is never null. + each of S bytes. S must be nonzero. Set *PN to the new number of + objects, and return the pointer to the new block. *PN is never set + to zero, and the returned pointer is never null. Repeated reallocations are guaranteed to make progress, either by allocating an initial block with a nonzero size, or by allocating a @@ -196,13 +197,14 @@ x2nrealloc (void *p, size_t *pn, size_t s) } else { - /* Set N = ceil (1.5 * N) so that progress is made if N == 1. - Check for overflow, so that N * S stays in size_t range. - The check is slightly conservative, but an exact check isn't - worth the trouble. */ - if ((size_t) -1 / 3 * 2 / s <= n) + /* Set N = floor (1.5 * N) + 1 so that progress is made even if N == 0. + Check for overflow, so that N * S stays in both ptrdiff_t and + size_t range. The check may be slightly conservative, but an + exact check isn't worth the trouble. */ + if ((PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX) / 3 * 2 / s + <= n) xalloc_die (); - n += (n + 1) / 2; + n += n / 2 + 1; } *pn = n; @@ -259,5 +261,6 @@ xmemdup (T const *p, size_t s) #endif +_GL_INLINE_HEADER_END #endif /* !XALLOC_H_ */ diff --git a/contrib/tools/m4/lib/xasprintf.c b/contrib/tools/m4/lib/xasprintf.c index 1808b70182..e9e83ef9b0 100644 --- a/contrib/tools/m4/lib/xasprintf.c +++ b/contrib/tools/m4/lib/xasprintf.c @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 1999, 2002-2004, 2006, 2009-2013 Free Software Foundation, + Copyright (C) 1999, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xmalloc.c b/contrib/tools/m4/lib/xmalloc.c index 57e34b7cdb..7d9c077729 100644 --- a/contrib/tools/m4/lib/xmalloc.c +++ b/contrib/tools/m4/lib/xmalloc.c @@ -1,6 +1,6 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-2000, 2002-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2016 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 @@ -93,11 +93,11 @@ void * xcalloc (size_t n, size_t s) { void *p; - /* Test for overflow, since some calloc implementations don't have - proper overflow checks. But omit overflow and size-zero tests if - HAVE_GNU_CALLOC, since GNU calloc catches overflow and never - returns NULL if successful. */ - if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) + /* Test for overflow, since objects with size greater than + PTRDIFF_MAX cause pointer subtraction to go awry. Omit size-zero + tests if HAVE_GNU_CALLOC, since GNU calloc never returns NULL if + successful. */ + if (xalloc_oversized (n, s) || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) xalloc_die (); return p; diff --git a/contrib/tools/m4/lib/xmalloca.c b/contrib/tools/m4/lib/xmalloca.c index 50ee4807fb..bcbed77f58 100644 --- a/contrib/tools/m4/lib/xmalloca.c +++ b/contrib/tools/m4/lib/xmalloca.c @@ -1,5 +1,5 @@ /* Safe automatic memory allocation with out of memory checking. - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xmalloca.h b/contrib/tools/m4/lib/xmalloca.h index 2f7567d498..f90fa9f72a 100644 --- a/contrib/tools/m4/lib/xmalloca.h +++ b/contrib/tools/m4/lib/xmalloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation with out of memory checking. - Copyright (C) 2003, 2005, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xprintf.c b/contrib/tools/m4/lib/xprintf.c index e24b4f1875..eed2269ef3 100644 --- a/contrib/tools/m4/lib/xprintf.c +++ b/contrib/tools/m4/lib/xprintf.c @@ -1,5 +1,5 @@ /* printf wrappers that fail immediately for non-file-related errors - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 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/contrib/tools/m4/lib/xprintf.h b/contrib/tools/m4/lib/xprintf.h index 62986a8cee..31ae6f9272 100644 --- a/contrib/tools/m4/lib/xprintf.h +++ b/contrib/tools/m4/lib/xprintf.h @@ -1,5 +1,5 @@ /* printf wrappers that fail immediately for non-file-related errors - Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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/contrib/tools/m4/lib/xsize.h b/contrib/tools/m4/lib/xsize.h index 5675593f54..202a87e086 100644 --- a/contrib/tools/m4/lib/xsize.h +++ b/contrib/tools/m4/lib/xsize.h @@ -1,6 +1,6 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2008-2016 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/contrib/tools/m4/lib/xstrndup.c b/contrib/tools/m4/lib/xstrndup.c index eae92d039d..3d605ef88b 100644 --- a/contrib/tools/m4/lib/xstrndup.c +++ b/contrib/tools/m4/lib/xstrndup.c @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2016 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/contrib/tools/m4/lib/xstrndup.h b/contrib/tools/m4/lib/xstrndup.h index 59673b0489..0d3021c885 100644 --- a/contrib/tools/m4/lib/xstrndup.h +++ b/contrib/tools/m4/lib/xstrndup.h @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2009-2016 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/contrib/tools/m4/lib/xvasprintf.c b/contrib/tools/m4/lib/xvasprintf.c index 702b5e6b1a..9deaad0f43 100644 --- a/contrib/tools/m4/lib/xvasprintf.c +++ b/contrib/tools/m4/lib/xvasprintf.c @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 1999, 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2004, 2006-2016 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/contrib/tools/m4/lib/xvasprintf.h b/contrib/tools/m4/lib/xvasprintf.h index 1208fa193c..d62d7b7313 100644 --- a/contrib/tools/m4/lib/xvasprintf.h +++ b/contrib/tools/m4/lib/xvasprintf.h @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2006-2016 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/contrib/tools/m4/lib/ya.make b/contrib/tools/m4/lib/ya.make index 1c410bcd5a..7602f70a92 100644 --- a/contrib/tools/m4/lib/ya.make +++ b/contrib/tools/m4/lib/ya.make @@ -9,7 +9,7 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.4.17) +VERSION(1.4.18) PEERDIR( contrib/libs/libc_compat @@ -54,6 +54,7 @@ SRCS( fopen-safer.c freadahead.c fseeko.c + getprogname.c gl_avltree_oset.c gl_linkedhash_list.c gl_list.c @@ -63,10 +64,11 @@ SRCS( glthread/lock.c glthread/threadlib.c glthread/tls.c - isnanl.c + hard-locale.c localcharset.c malloca.c math.c + mbrtowc.c memchr2.c mkstemp-safer.c pipe-safer.c diff --git a/contrib/tools/m4/patches/darwin-extern-environ.patch b/contrib/tools/m4/patches/darwin-extern-environ.patch index 5114c8d0c8..a7ffbaec01 100644 --- a/contrib/tools/m4/patches/darwin-extern-environ.patch +++ b/contrib/tools/m4/patches/darwin-extern-environ.patch @@ -1,26 +1,25 @@ ---- a/lib/spawn-pipe.c (index) -+++ b/lib/spawn-pipe.c (working tree) -@@ -48,6 +48,10 @@ +--- a/lib/execute.c (index) ++++ b/lib/execute.c (working tree) +@@ -48,6 +48,9 @@ #endif +#if defined(__FreeBSD__) || defined(__MACH__) + extern char** environ; +#endif -+ - /* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ - #undef open ---- a/lib/execute.c (index) -+++ b/lib/execute.c (working tree) -@@ -48,6 +48,10 @@ + #if defined EINTR && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) + +--- a/lib/spawn-pipe.c (index) ++++ b/lib/spawn-pipe.c (working tree) +@@ -53,7 +53,10 @@ + # include <spawn.h> + #endif +#if defined(__FreeBSD__) || defined(__MACH__) + extern char** environ; +#endif -+ - /* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ - #undef open + + #ifdef EINTR + diff --git a/contrib/tools/m4/patches/disable-includes.patch b/contrib/tools/m4/patches/disable-includes.patch new file mode 100644 index 0000000000..3650e4adca --- /dev/null +++ b/contrib/tools/m4/patches/disable-includes.patch @@ -0,0 +1,13 @@ +--- a/lib/obstack.c (index) ++++ b/lib/obstack.c (working tree) +@@ -51,10 +51,6 @@ + /* If GCC, or if an oddball (testing?) host that #defines __alignof__, + use the already-supplied __alignof__. Otherwise, this must be Gnulib + (as glibc assumes GCC); defer to Gnulib's alignof_type. */ +-# if !defined __GNUC__ && !defined __alignof__ +-# include <alignof.h> +-# define __alignof__(type) alignof_type (type) +-# endif + # include <stdlib.h> + # include <stdint.h> + diff --git a/contrib/tools/m4/patches/langinfo-windows.patch b/contrib/tools/m4/patches/langinfo-windows.patch new file mode 100644 index 0000000000..737fa39d4d --- /dev/null +++ b/contrib/tools/m4/patches/langinfo-windows.patch @@ -0,0 +1,27 @@ +--- contrib/tools/m4/lib/nl_langinfo.c (index) ++++ contrib/tools/m4/lib/nl_langinfo.c (working tree) +@@ -171,8 +171,6 @@ nl_langinfo (nl_item item) + return localeconv () ->decimal_point; + case THOUSEP: + return localeconv () ->thousands_sep; +- case GROUPING: +- return localeconv () ->grouping; + /* nl_langinfo items of the LC_TIME category. + TODO: Really use the locale. */ + case D_T_FMT: +@@ -279,6 +277,7 @@ nl_langinfo (nl_item item) + /* nl_langinfo items of the LC_MONETARY category. */ + case CRNCYSTR: + return localeconv () ->currency_symbol; ++#if 0 + case INT_CURR_SYMBOL: + return localeconv () ->int_curr_symbol; + case MON_DECIMAL_POINT: +@@ -307,6 +306,7 @@ nl_langinfo (nl_item item) + return & localeconv () ->p_sign_posn; + case N_SIGN_POSN: + return & localeconv () ->n_sign_posn; ++#endif + /* nl_langinfo items of the LC_MESSAGES category + TODO: Really use the locale. */ + case YESEXPR: diff --git a/contrib/tools/m4/src/builtin.c b/contrib/tools/m4/src/builtin.c index b3700c3219..302a86a495 100644 --- a/contrib/tools/m4/src/builtin.c +++ b/contrib/tools/m4/src/builtin.c @@ -1,6 +1,6 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2000, 2004, 2006-2013 Free Software + Copyright (C) 1989-1994, 2000, 2004, 2006-2014, 2016 Free Software Foundation, Inc. This file is part of GNU M4. @@ -1019,7 +1019,13 @@ m4_esyscmd (struct obstack *obs, int argc, token_data **argv) sysval = 127; return; } +#if OS2 + /* On OS/2 kLIBC, fdopen() creates a stream in a mode of a file descriptor. + So include "t" to open a stream in a text mode explicitly on OS/2. */ + pin = fdopen (fd, "rt"); +#else pin = fdopen (fd, "r"); +#endif if (pin == NULL) { M4ERROR ((warning_status, errno, "cannot run command `%s'", cmd)); @@ -1420,7 +1426,7 @@ mkstemp_helper (struct obstack *obs, const char *me, const char *pattern, { close (fd); /* Remove NUL, then finish quote. */ - obstack_blank (obs, -1); + obstack_blank_fast (obs, -1); obstack_grow (obs, rquote.string, rquote.length); } } diff --git a/contrib/tools/m4/src/debug.c b/contrib/tools/m4/src/debug.c index c13a205b89..70a5b806f2 100644 --- a/contrib/tools/m4/src/debug.c +++ b/contrib/tools/m4/src/debug.c @@ -1,7 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2014, 2016 Free + Software Foundation, Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/eval.c b/contrib/tools/m4/src/eval.c index 8b4b05afb1..64b389a810 100644 --- a/contrib/tools/m4/src/eval.c +++ b/contrib/tools/m4/src/eval.c @@ -1,6 +1,6 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2007, 2009-2013 Free Software + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software Foundation, Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/format.c b/contrib/tools/m4/src/format.c index fd8830ed7c..608ac72e5d 100644 --- a/contrib/tools/m4/src/format.c +++ b/contrib/tools/m4/src/format.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/freeze.c b/contrib/tools/m4/src/freeze.c index edc0568b96..fd7623d1a4 100644 --- a/contrib/tools/m4/src/freeze.c +++ b/contrib/tools/m4/src/freeze.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/input.c b/contrib/tools/m4/src/input.c index 579faddf4f..74891a0540 100644 --- a/contrib/tools/m4/src/input.c +++ b/contrib/tools/m4/src/input.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/m4.c b/contrib/tools/m4/src/m4.c index 3e56e9d017..79946b90a3 100644 --- a/contrib/tools/m4/src/m4.c +++ b/contrib/tools/m4/src/m4.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. @@ -307,7 +308,9 @@ static const struct option long_options[] = {"trace", required_argument, NULL, 't'}, {"traditional", no_argument, NULL, 'G'}, {"undefine", required_argument, NULL, 'U'}, +#ifdef ENABLE_CHANGEWORD {"word-regexp", required_argument, NULL, 'W'}, +#endif {"debugfile", optional_argument, NULL, DEBUGFILE_OPTION}, {"diversions", required_argument, NULL, DIVERSIONS_OPTION}, diff --git a/contrib/tools/m4/src/m4.h b/contrib/tools/m4/src/m4.h index 96e549eb76..9a13257fbc 100644 --- a/contrib/tools/m4/src/m4.h +++ b/contrib/tools/m4/src/m4.h @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/macro.c b/contrib/tools/m4/src/macro.c index 0e7624372e..81218e78bc 100644 --- a/contrib/tools/m4/src/macro.c +++ b/contrib/tools/m4/src/macro.c @@ -1,6 +1,6 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2007, 2009-2013 Free Software + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software Foundation, Inc. This file is part of GNU M4. @@ -46,8 +46,8 @@ static struct obstack argc_stack; /* The shared stack of pointers to collected arguments for macro calls. This object is never finished; we exploit the fact that - obstack_blank is documented to take a negative size to reduce the - size again. */ + obstack_blank_fast is documented to take a negative size to reduce + the size again. */ static struct obstack argv_stack; /*----------------------------------------------------------------------. @@ -387,5 +387,5 @@ expand_macro (symbol *sym) obstack_free (&argc_stack, argv[0]); else obstack_free (&arguments, NULL); - obstack_blank (&argv_stack, -argc * sizeof (token_data *)); + obstack_blank_fast (&argv_stack, -argc * sizeof (token_data *)); } diff --git a/contrib/tools/m4/src/output.c b/contrib/tools/m4/src/output.c index c378afebdb..9c916d9233 100644 --- a/contrib/tools/m4/src/output.c +++ b/contrib/tools/m4/src/output.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/path.c b/contrib/tools/m4/src/path.c index 6fb1e5c96f..8b81e29f2c 100644 --- a/contrib/tools/m4/src/path.c +++ b/contrib/tools/m4/src/path.c @@ -1,7 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1993, 2004, 2006-2013 Free Software Foundation, - Inc. + Copyright (C) 1989-1993, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/symtab.c b/contrib/tools/m4/src/symtab.c index fe37bee694..26a722f2af 100644 --- a/contrib/tools/m4/src/symtab.c +++ b/contrib/tools/m4/src/symtab.c @@ -1,7 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2003, 2006-2013 Free Software Foundation, - Inc. + Copyright (C) 1989-1994, 2003, 2006-2014, 2016 Free Software + Foundation, Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/ya.make b/contrib/tools/m4/ya.make index a53617110c..e8e1c4ed4a 100644 --- a/contrib/tools/m4/ya.make +++ b/contrib/tools/m4/ya.make @@ -1,4 +1,4 @@ -# Generated by devtools/yamaker from nixpkgs 21f6cb79a7082e36d3a6374ea5b25a1645875f78. +# Generated by devtools/yamaker from nixpkgs 21.05. PROGRAM(m4) @@ -11,9 +11,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.4.17) +VERSION(1.4.18) -ORIGINAL_SOURCE(mirror://gnu/m4/m4-1.4.17.tar.bz2) +ORIGINAL_SOURCE(mirror://gnu/m4/m4-1.4.18.tar.bz2) PEERDIR( contrib/tools/m4/lib |