Update from gnulib
This incorporates: 2016-09-07 flexmember: new macro FLEXALIGNOF 2016-09-07 flexmember: port better to GCC + valgrind 2016-08-18 Port modules to use getprogname explicitly 2016-09-02 manywarnings: add -fno-common * admin/merge-gnulib (GNULIB_TOOL_FLAGS): Don’t avoid flexmember, since time_rz now uses part of it. Instead, remove m4/flexmember.m4. * configure.ac (AC_C_FLEXIBLE_ARRAY_MEMBER): Define away, since Emacs assumes C99 and therefore removes m4/flexmember.m4. * lib/euidaccess.c, lib/group-member.c, lib/time_rz.c: * m4/manywarnings.m4: Copy from gnulib. * lib/flexmember.h: New file, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
This commit is contained in:
parent
a08ce41ed8
commit
12a7e0f88e
9 changed files with 75 additions and 11 deletions
|
@ -44,7 +44,7 @@ GNULIB_MODULES='
|
|||
|
||||
GNULIB_TOOL_FLAGS='
|
||||
--avoid=close --avoid=dup
|
||||
--avoid=fchdir --avoid=flexmember --avoid=fstat
|
||||
--avoid=fchdir --avoid=fstat
|
||||
--avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow
|
||||
--avoid=open --avoid=openat-die --avoid=opendir
|
||||
--avoid=raise
|
||||
|
@ -93,7 +93,8 @@ test -x "$gnulib_srcdir"/gnulib-tool || {
|
|||
}
|
||||
|
||||
"$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES &&
|
||||
rm -- "$src"lib/gl_openssl.h "$src"m4/fcntl-o.m4 "$src"m4/gl-openssl.m4 \
|
||||
rm -- "$src"lib/gl_openssl.h "$src"m4/fcntl-o.m4 "$src"m4/flexmember.m4 \
|
||||
"$src"m4/gl-openssl.m4 \
|
||||
"$src"m4/gnulib-cache.m4"$src" m4/warn-on-use.m4 &&
|
||||
cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc &&
|
||||
cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux &&
|
||||
|
|
|
@ -775,6 +775,8 @@ dnl alternative to lib/gnulib.mk, so as to avoid generating header files
|
|||
dnl that clash with MinGW.
|
||||
AM_CONDITIONAL([BUILDING_FOR_WINDOWSNT], [test "x$opsys" = "xmingw32"])
|
||||
|
||||
# Skip gnulib's tests for flexible array members, as Emacs assumes C99.
|
||||
AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER])
|
||||
# Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it.
|
||||
AC_DEFUN([gl_CRYPTO_CHECK])
|
||||
# Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
|
||||
|
|
|
@ -197,8 +197,6 @@ weak_alias (__euidaccess, euidaccess)
|
|||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
char *program_name;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
@ -206,7 +204,6 @@ main (int argc, char **argv)
|
|||
int mode;
|
||||
int err;
|
||||
|
||||
program_name = argv[0];
|
||||
if (argc < 3)
|
||||
abort ();
|
||||
file = argv[1];
|
||||
|
|
42
lib/flexmember.h
Normal file
42
lib/flexmember.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* Sizes of structs with flexible array members.
|
||||
|
||||
Copyright 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. */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below.
|
||||
On older platforms without _Alignof, use a pessimistic bound that is
|
||||
safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1.
|
||||
On newer platforms, use _Alignof to get a tighter bound. */
|
||||
|
||||
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
|
||||
# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1))
|
||||
#else
|
||||
# define FLEXALIGNOF(type) _Alignof (type)
|
||||
#endif
|
||||
|
||||
/* Upper bound on the size of a struct of type TYPE with a flexible
|
||||
array member named MEMBER that is followed by N bytes of other data.
|
||||
This is not simply sizeof (TYPE) + N, since it may require
|
||||
alignment on unusually picky C11 platforms, and
|
||||
FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms.
|
||||
Yield a value less than N if and only if arithmetic overflow occurs. */
|
||||
|
||||
#define FLEXSIZEOF(type, member, n) \
|
||||
((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \
|
||||
& ~ (FLEXALIGNOF (type) - 1))
|
|
@ -21,7 +21,7 @@
|
|||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=flexmember --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings
|
||||
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings
|
||||
|
||||
|
||||
MOSTLYCLEANFILES += core *.stackdump
|
||||
|
@ -449,6 +449,15 @@ EXTRA_DIST += filevercmp.h
|
|||
|
||||
## end gnulib module filevercmp
|
||||
|
||||
## begin gnulib module flexmember
|
||||
|
||||
if gl_GNULIB_ENABLED_flexmember
|
||||
|
||||
endif
|
||||
EXTRA_DIST += flexmember.h
|
||||
|
||||
## end gnulib module flexmember
|
||||
|
||||
## begin gnulib module fpending
|
||||
|
||||
|
||||
|
|
|
@ -97,15 +97,11 @@ group_member (gid_t gid)
|
|||
|
||||
#ifdef TEST
|
||||
|
||||
char *program_name;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
program_name = argv[0];
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
gid_t gid;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "flexmember.h"
|
||||
#include "time-internal.h"
|
||||
|
||||
#if !HAVE_TZSET
|
||||
|
@ -94,7 +95,7 @@ tzalloc (char const *name)
|
|||
{
|
||||
size_t name_size = name ? strlen (name) + 1 : 0;
|
||||
size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1;
|
||||
timezone_t tz = malloc (offsetof (struct tm_zone, abbrs) + abbr_size);
|
||||
timezone_t tz = malloc (FLEXSIZEOF (struct tm_zone, abbrs, abbr_size));
|
||||
if (tz)
|
||||
{
|
||||
tz->next = NULL;
|
||||
|
|
|
@ -79,6 +79,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module fdopendir:
|
||||
# Code from module filemode:
|
||||
# Code from module filevercmp:
|
||||
# Code from module flexmember:
|
||||
# Code from module fpending:
|
||||
# Code from module fstatat:
|
||||
# Code from module fsync:
|
||||
|
@ -413,6 +414,7 @@ AC_DEFUN([gl_INIT],
|
|||
gl_gnulib_enabled_dirfd=false
|
||||
gl_gnulib_enabled_dosname=false
|
||||
gl_gnulib_enabled_euidaccess=false
|
||||
gl_gnulib_enabled_flexmember=false
|
||||
gl_gnulib_enabled_getdtablesize=false
|
||||
gl_gnulib_enabled_getgroups=false
|
||||
gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
|
||||
|
@ -472,6 +474,13 @@ AC_DEFUN([gl_INIT],
|
|||
fi
|
||||
fi
|
||||
}
|
||||
func_gl_gnulib_m4code_flexmember ()
|
||||
{
|
||||
if ! $gl_gnulib_enabled_flexmember; then
|
||||
AC_C_FLEXIBLE_ARRAY_MEMBER
|
||||
gl_gnulib_enabled_flexmember=true
|
||||
fi
|
||||
}
|
||||
func_gl_gnulib_m4code_getdtablesize ()
|
||||
{
|
||||
if ! $gl_gnulib_enabled_getdtablesize; then
|
||||
|
@ -679,6 +688,9 @@ AC_DEFUN([gl_INIT],
|
|||
if { test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1; } && test $ac_cv_type_unsigned_long_long_int = yes; then
|
||||
func_gl_gnulib_m4code_strtoull
|
||||
fi
|
||||
if test "$HAVE_TIMEZONE_T" = 0; then
|
||||
func_gl_gnulib_m4code_flexmember
|
||||
fi
|
||||
if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
|
||||
func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31
|
||||
fi
|
||||
|
@ -687,6 +699,7 @@ AC_DEFUN([gl_INIT],
|
|||
AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], [$gl_gnulib_enabled_euidaccess])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_flexmember], [$gl_gnulib_enabled_flexmember])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], [$gl_gnulib_enabled_getdtablesize])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
|
||||
|
@ -892,6 +905,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/filemode.h
|
||||
lib/filevercmp.c
|
||||
lib/filevercmp.h
|
||||
lib/flexmember.h
|
||||
lib/fpending.c
|
||||
lib/fpending.h
|
||||
lib/fstatat.c
|
||||
|
@ -1013,6 +1027,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/fdatasync.m4
|
||||
m4/fdopendir.m4
|
||||
m4/filemode.m4
|
||||
m4/flexmember.m4
|
||||
m4/fpending.m4
|
||||
m4/fstatat.m4
|
||||
m4/fsync.m4
|
||||
|
|
|
@ -103,6 +103,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
|
|||
|
||||
gl_manywarn_set=
|
||||
for gl_manywarn_item in \
|
||||
-fno-common \
|
||||
-W \
|
||||
-Wabi \
|
||||
-Waddress \
|
||||
|
|
Loading…
Add table
Reference in a new issue