From e6d3eaa69871d800eb078580b64f2bc5806a0fcc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 23 Mar 2017 08:51:44 -0700 Subject: [PATCH] Merge from gnulib This incorporates: 2017-03-22 getopt: merge from glibc * build-aux/config.sub, lib/getopt.c, lib/getopt.in.h: * lib/getopt1.c, lib/getopt_int.h: Copy from gnulib. * lib/gnulib.mk.in: Regenerate. --- build-aux/config.sub | 7 +++++- lib/getopt.c | 70 ++++++++++++++++++++++++++-------------------------- lib/getopt.in.h | 41 +++++++++++++++++++++--------- lib/getopt1.c | 22 ++++++++--------- lib/getopt_int.h | 22 ++++++++--------- lib/gnulib.mk.in | 1 - 6 files changed, 93 insertions(+), 70 deletions(-) diff --git a/build-aux/config.sub b/build-aux/config.sub index 87abeab6cdf..7203bf1e64b 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-02-07' +timestamp='2017-03-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -315,6 +315,7 @@ case $basic_machine in | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ + | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -446,6 +447,7 @@ case $basic_machine in | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -1246,6 +1248,9 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + wasm32) + basic_machine=wasm32-unknown + ;; w65*) basic_machine=w65-wdc os=-none diff --git a/lib/getopt.c b/lib/getopt.c index e40ea8d5eaa..7afd0dcabe8 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -2,22 +2,22 @@ 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-2017 Free Software - Foundation, Inc. + Copyright (C) 1987-2017 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 . */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ #ifndef _LIBC # include @@ -27,8 +27,8 @@ #include #include -#include #include +#include #ifdef _LIBC # include @@ -37,7 +37,7 @@ # define _(msgid) gettext (msgid) #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC # include #endif @@ -181,7 +181,7 @@ exchange (char **argv, struct _getopt_data *d) { /* Bottom segment is the short one. */ int len = middle - bottom; - register int i; + int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) @@ -198,7 +198,7 @@ exchange (char **argv, struct _getopt_data *d) { /* Top segment is the short one. */ int len = top - middle; - register int i; + int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) @@ -564,11 +564,11 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, first.next = ambig_list; ambig_list = &first; -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf = NULL; size_t buflen = 0; - FILE *fp = open_memstream (&buf, &buflen); + FILE *fp = __open_memstream (&buf, &buflen); if (fp != NULL) { fprintf (fp, @@ -584,7 +584,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, fputc_unlocked ('\n', fp); - if (__builtin_expect (fclose (fp) != EOF, 1)) + if (__glibc_likely (fclose (fp) != EOF)) { _IO_flockfile (stderr); @@ -642,7 +642,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; int n; #endif @@ -650,7 +650,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, if (argv[d->optind - 1][1] == '-') { /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("\ %s: option '--%s' doesn't allow an argument\n"), argv[0], pfound->name); @@ -663,7 +663,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, else { /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("\ %s: option '%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], @@ -676,7 +676,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, #endif } -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC if (n >= 0) { _IO_flockfile (stderr); @@ -709,7 +709,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ @@ -760,7 +760,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; int n; #endif @@ -768,7 +768,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, if (argv[d->optind][1] == '-') { /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), argv[0], d->__nextchar); #else @@ -779,7 +779,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, else { /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #else @@ -788,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, #endif } -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC if (n >= 0) { _IO_flockfile (stderr); @@ -826,19 +826,19 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; int n; #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC if (n >= 0) { _IO_flockfile (stderr); @@ -884,7 +884,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, @@ -958,7 +958,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), @@ -998,7 +998,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ @@ -1037,7 +1037,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ @@ -1112,7 +1112,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 6cbad8e0339..3f57c68a25e 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -1,20 +1,20 @@ /* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2017 Free Software - Foundation, Inc. + Copyright (C) 1989-2017 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 . */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ #ifndef _@GUARD_PREFIX@_GETOPT_H @@ -238,6 +238,25 @@ struct option extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW _GL_ARG_NONNULL ((2, 3)); +#ifndef __GETOPT_PREFIX +# if defined __need_getopt && defined __USE_POSIX2 \ + && !defined __USE_POSIX_IMPLICITLY && !defined __USE_GNU +/* The GNU getopt has more functionality than the standard version. The + additional functionality can be disable at runtime. This redirection + helps to also do this at runtime. */ +# ifdef __REDIRECT + extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv, + const char *__shortopts), + __posix_getopt); +# else +extern int __posix_getopt (int ___argc, char *const *___argv, + const char *__shortopts) + __THROW _GL_ARG_NONNULL ((2, 3)); +# define getopt __posix_getopt +# endif +# endif +#endif + #ifndef __need_getopt extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, diff --git a/lib/getopt1.c b/lib/getopt1.c index 4d2e8cbac33..166b1295333 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -1,20 +1,20 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2017 Free Software - Foundation, Inc. + Copyright (C) 1987-2017 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 . */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ #ifdef _LIBC # include diff --git a/lib/getopt_int.h b/lib/getopt_int.h index a7ce0e9cc14..c614fcb65be 100644 --- a/lib/getopt_int.h +++ b/lib/getopt_int.h @@ -1,20 +1,20 @@ /* Internal declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2017 Free Software - Foundation, Inc. + Copyright (C) 1989-2017 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 . */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 2c0b689e710..ca95ed7e825 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -558,7 +558,6 @@ LIBS_GNUSTEP = @LIBS_GNUSTEP@ LIBS_MAIL = @LIBS_MAIL@ LIBS_SYSTEM = @LIBS_SYSTEM@ LIBS_TERMCAP = @LIBS_TERMCAP@ -LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTIFF = @LIBTIFF@ LIBXMENU = @LIBXMENU@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ -- 2.11.4.GIT