1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Merge from gnulib (Bug#26398)

This incorporates:
2017-04-08 getopt: prefer - to _ in new file names
2017-04-08 getopt: port recent getopt changes to macOS
* .gitignore: Add lib/getopt-cdefs.h.
* lib/getopt-cdefs.in.h: Rename from lib/getopt_cdefs.in.h.
* lib/getopt-core.h: Rename from lib/getopt_core.h.
* lib/getopt-ext.h: Rename from lib/getopt_ext.h.
* lib/getopt-pfx-core.h: Rename from lib/getopt_pfx_core.h.
* lib/getopt-pfx-ext.h: Rename from lib/getopt_pfx_ext.h.
* lib/getopt.in.h, lib/unistd.in.h, m4/getopt.m4:
Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
This commit is contained in:
Paul Eggert 2017-04-09 00:53:27 -07:00
parent 440bafef7c
commit 43bc45ba16
11 changed files with 42 additions and 45 deletions

1
.gitignore vendored
View file

@ -56,6 +56,7 @@ lib/errno.h
lib/execinfo.h lib/execinfo.h
lib/fcntl.h lib/fcntl.h
lib/getopt.h lib/getopt.h
lib/getopt-cdefs.h
lib/inttypes.h lib/inttypes.h
lib/libgnu.a lib/libgnu.a
lib/limits.h lib/limits.h

View file

@ -25,7 +25,7 @@
unistd.h instead. It does not have a protective #error, because unistd.h instead. It does not have a protective #error, because
the guard macro for getopt.h in gnulib is not fixed. */ the guard macro for getopt.h in gnulib is not fixed. */
/* getopt_core.h and getopt_ext.h are shared with GNU libc, and expect /* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect
a number of the internal macros supplied to GNU libc's headers by a number of the internal macros supplied to GNU libc's headers by
sys/cdefs.h. Provide fallback definitions for all of them. */ sys/cdefs.h. Provide fallback definitions for all of them. */
#if @HAVE_SYS_CDEFS_H@ #if @HAVE_SYS_CDEFS_H@
@ -64,12 +64,4 @@
# endif # endif
#endif #endif
#ifndef __nonnull #endif /* _GETOPT_CDEFS_H */
# if __GNUC_PREREQ (3,3)
# define __nonnull(params) __attribute__ ((__nonnull__ params))
# else
# define __nonnull(params)
# endif
#endif
#endif /* getopt_cdefs.h */

View file

@ -89,8 +89,8 @@ extern int optopt;
writable. */ writable. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
__THROW __nonnull ((2, 3)); __THROW _GL_ARG_NONNULL ((2, 3));
__END_DECLS __END_DECLS
#endif /* getopt_core.h */ #endif /* _GETOPT_CORE_H */

View file

@ -66,12 +66,12 @@ struct option
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts, const char *__shortopts,
const struct option *__longopts, int *__longind) const struct option *__longopts, int *__longind)
__THROW __nonnull ((2, 3)); __THROW _GL_ARG_NONNULL ((2, 3));
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts, const char *__shortopts,
const struct option *__longopts, int *__longind) const struct option *__longopts, int *__longind)
__THROW __nonnull ((2, 3)); __THROW _GL_ARG_NONNULL ((2, 3));
__END_DECLS __END_DECLS
#endif /* getopt_ext.h */ #endif /* _GETOPT_EXT_H */

View file

@ -27,7 +27,7 @@
/* Standalone applications should #define __GETOPT_PREFIX to an /* Standalone applications should #define __GETOPT_PREFIX to an
identifier that prefixes the external functions and variables identifier that prefixes the external functions and variables
defined in getopt_core.h and getopt_ext.h. Systematically defined in getopt-core.h and getopt-ext.h. Systematically
rename identifiers so that they do not collide with the system rename identifiers so that they do not collide with the system
functions and variables. Renaming avoids problems with some functions and variables. Renaming avoids problems with some
compilers and linkers. */ compilers and linkers. */
@ -49,6 +49,6 @@
# define optopt __GETOPT_ID (optopt) # define optopt __GETOPT_ID (optopt)
#endif #endif
#include <getopt_core.h> #include <getopt-core.h>
#endif /* getopt_pfx_core.h */ #endif /* _GETOPT_PFX_CORE_H */

View file

@ -27,7 +27,7 @@
/* Standalone applications should #define __GETOPT_PREFIX to an /* Standalone applications should #define __GETOPT_PREFIX to an
identifier that prefixes the external functions and variables identifier that prefixes the external functions and variables
defined in getopt_core.h and getopt_ext.h. Systematically defined in getopt-core.h and getopt-ext.h. Systematically
rename identifiers so that they do not collide with the system rename identifiers so that they do not collide with the system
functions and variables. Renaming avoids problems with some functions and variables. Renaming avoids problems with some
compilers and linkers. */ compilers and linkers. */
@ -59,6 +59,6 @@
# endif # endif
#endif #endif
#include <getopt_ext.h> #include <getopt-ext.h>
#endif /* getopt_pfx_ext.h */ #endif /* _GETOPT_PFX_EXT_H */

View file

@ -38,7 +38,7 @@
/* Standalone applications should #define __GETOPT_PREFIX to an /* Standalone applications should #define __GETOPT_PREFIX to an
identifier that prefixes the external functions and variables identifier that prefixes the external functions and variables
defined in getopt_core.h and getopt_ext.h. When this happens, defined in getopt-core.h and getopt-ext.h. When this happens,
include the headers that might declare getopt so that they will not include the headers that might declare getopt so that they will not
cause confusion if included after this file (if the system had cause confusion if included after this file (if the system had
<getopt.h>, we have already included it). */ <getopt.h>, we have already included it). */
@ -52,8 +52,10 @@
# endif # endif
#endif #endif
#include <getopt_cdefs.h> /* The definition of _GL_ARG_NONNULL is copied here. */
#include <getopt_pfx_core.h>
#include <getopt_pfx_ext.h> #include <getopt-cdefs.h>
#include <getopt-pfx-core.h>
#include <getopt-pfx-ext.h>
#endif /* _@GUARD_PREFIX@_GETOPT_H */ #endif /* _@GUARD_PREFIX@_GETOPT_H */

View file

@ -922,6 +922,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -1527,21 +1528,22 @@ getopt.h: getopt.in.h $(top_builddir)/config.status
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/getopt.in.h; \ < $(srcdir)/getopt.in.h; \
} > $@-t && \ } > $@-t && \
mv -f $@-t $@ mv -f $@-t $@
getopt_cdefs.h: getopt_cdefs.in.h $(top_builddir)/config.status getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \ $(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
< $(srcdir)/getopt_cdefs.in.h; \ < $(srcdir)/getopt-cdefs.in.h; \
} > $@-t && \ } > $@-t && \
mv -f $@-t $@ mv -f $@-t $@
MOSTLYCLEANFILES += getopt.h getopt.h-t getopt_cdefs.h getopt_cdefs.h-t MOSTLYCLEANFILES += getopt.h getopt.h-t getopt-cdefs.h getopt-cdefs.h-t
EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_cdefs.in.h getopt_core.h getopt_ext.h getopt_int.h getopt_pfx_core.h getopt_pfx_ext.h EXTRA_DIST += getopt-cdefs.in.h getopt-core.h getopt-ext.h getopt-pfx-core.h getopt-pfx-ext.h getopt.c getopt.in.h getopt1.c getopt_int.h
EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c

View file

@ -127,11 +127,18 @@
# include <sys/types.h> # include <sys/types.h>
#endif #endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Get getopt(), optarg, optind, opterr, optopt. /* Get getopt(), optarg, optind, opterr, optopt.
But avoid namespace pollution on glibc systems. */ But avoid namespace pollution on glibc systems. */
#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
# include <getopt_cdefs.h> # include <getopt-cdefs.h>
# include <getopt_pfx_core.h> # include <getopt-pfx-core.h>
#endif #endif
#ifndef _GL_INLINE_HEADER_BEGIN #ifndef _GL_INLINE_HEADER_BEGIN
@ -142,13 +149,6 @@ _GL_INLINE_HEADER_BEGIN
# define _GL_UNISTD_INLINE _GL_INLINE # define _GL_UNISTD_INLINE _GL_INLINE
#endif #endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Hide some function declarations from <winsock2.h>. */ /* Hide some function declarations from <winsock2.h>. */
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@

View file

@ -1,4 +1,4 @@
# getopt.m4 serial 45 # getopt.m4 serial 46
dnl Copyright (C) 2002-2006, 2008-2017 Free Software Foundation, Inc. dnl Copyright (C) 2002-2006, 2008-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -364,7 +364,7 @@ AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
[Define to rpl_ if the getopt replacement functions and variables [Define to rpl_ if the getopt replacement functions and variables
should be used.]) should be used.])
GETOPT_H=getopt.h GETOPT_H=getopt.h
GETOPT_CDEFS_H=getopt_cdefs.h GETOPT_CDEFS_H=getopt-cdefs.h
AC_SUBST([GETOPT_H]) AC_SUBST([GETOPT_H])
AC_SUBST([GETOPT_CDEFS_H]) AC_SUBST([GETOPT_CDEFS_H])
]) ])

View file

@ -899,15 +899,15 @@ AC_DEFUN([gl_FILE_LIST], [
lib/getdtablesize.c lib/getdtablesize.c
lib/getgroups.c lib/getgroups.c
lib/getloadavg.c lib/getloadavg.c
lib/getopt-cdefs.in.h
lib/getopt-core.h
lib/getopt-ext.h
lib/getopt-pfx-core.h
lib/getopt-pfx-ext.h
lib/getopt.c lib/getopt.c
lib/getopt.in.h lib/getopt.in.h
lib/getopt1.c lib/getopt1.c
lib/getopt_cdefs.in.h
lib/getopt_core.h
lib/getopt_ext.h
lib/getopt_int.h lib/getopt_int.h
lib/getopt_pfx_core.h
lib/getopt_pfx_ext.h
lib/gettext.h lib/gettext.h
lib/gettime.c lib/gettime.c
lib/gettimeofday.c lib/gettimeofday.c