aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-09-07 17:04:49 -0700
committerPaul Eggert2016-09-07 18:10:11 -0700
commit12a7e0f88eaa68aabe7e32589e2d5c8f776f6346 (patch)
treeac3b18f919ab71149b7fe50fdcaf7a953cced651
parenta08ce41ed8e9fd8768dcd1ecd22ff6bc4c4c7f8f (diff)
downloademacs-12a7e0f88eaa68aabe7e32589e2d5c8f776f6346.tar.gz
emacs-12a7e0f88eaa68aabe7e32589e2d5c8f776f6346.zip
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.
-rwxr-xr-xadmin/merge-gnulib5
-rw-r--r--configure.ac2
-rw-r--r--lib/euidaccess.c3
-rw-r--r--lib/flexmember.h42
-rw-r--r--lib/gnulib.mk11
-rw-r--r--lib/group-member.c4
-rw-r--r--lib/time_rz.c3
-rw-r--r--m4/gnulib-comp.m415
-rw-r--r--m4/manywarnings.m41
9 files changed, 75 insertions, 11 deletions
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 5d6512760d9..1e3b7599626 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -44,7 +44,7 @@ GNULIB_MODULES='
44 44
45GNULIB_TOOL_FLAGS=' 45GNULIB_TOOL_FLAGS='
46 --avoid=close --avoid=dup 46 --avoid=close --avoid=dup
47 --avoid=fchdir --avoid=flexmember --avoid=fstat 47 --avoid=fchdir --avoid=fstat
48 --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow 48 --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow
49 --avoid=open --avoid=openat-die --avoid=opendir 49 --avoid=open --avoid=openat-die --avoid=opendir
50 --avoid=raise 50 --avoid=raise
@@ -93,7 +93,8 @@ test -x "$gnulib_srcdir"/gnulib-tool || {
93} 93}
94 94
95"$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES && 95"$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES &&
96rm -- "$src"lib/gl_openssl.h "$src"m4/fcntl-o.m4 "$src"m4/gl-openssl.m4 \ 96rm -- "$src"lib/gl_openssl.h "$src"m4/fcntl-o.m4 "$src"m4/flexmember.m4 \
97 "$src"m4/gl-openssl.m4 \
97 "$src"m4/gnulib-cache.m4"$src" m4/warn-on-use.m4 && 98 "$src"m4/gnulib-cache.m4"$src" m4/warn-on-use.m4 &&
98cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc && 99cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc &&
99cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux && 100cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux &&
diff --git a/configure.ac b/configure.ac
index e8aeae266f0..9856228d517 100644
--- a/configure.ac
+++ b/configure.ac
@@ -775,6 +775,8 @@ dnl alternative to lib/gnulib.mk, so as to avoid generating header files
775dnl that clash with MinGW. 775dnl that clash with MinGW.
776AM_CONDITIONAL([BUILDING_FOR_WINDOWSNT], [test "x$opsys" = "xmingw32"]) 776AM_CONDITIONAL([BUILDING_FOR_WINDOWSNT], [test "x$opsys" = "xmingw32"])
777 777
778# Skip gnulib's tests for flexible array members, as Emacs assumes C99.
779AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER])
778# Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it. 780# Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it.
779AC_DEFUN([gl_CRYPTO_CHECK]) 781AC_DEFUN([gl_CRYPTO_CHECK])
780# Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW, 782# Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index 82af9417ac3..e9eb0e948a3 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -197,8 +197,6 @@ weak_alias (__euidaccess, euidaccess)
197# include <stdio.h> 197# include <stdio.h>
198# include <stdlib.h> 198# include <stdlib.h>
199 199
200char *program_name;
201
202int 200int
203main (int argc, char **argv) 201main (int argc, char **argv)
204{ 202{
@@ -206,7 +204,6 @@ main (int argc, char **argv)
206 int mode; 204 int mode;
207 int err; 205 int err;
208 206
209 program_name = argv[0];
210 if (argc < 3) 207 if (argc < 3)
211 abort (); 208 abort ();
212 file = argv[1]; 209 file = argv[1];
diff --git a/lib/flexmember.h b/lib/flexmember.h
new file mode 100644
index 00000000000..62c556bae25
--- /dev/null
+++ b/lib/flexmember.h
@@ -0,0 +1,42 @@
1/* Sizes of structs with flexible array members.
2
3 Copyright 2016 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 Written by Paul Eggert. */
19
20#include <stddef.h>
21
22/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below.
23 On older platforms without _Alignof, use a pessimistic bound that is
24 safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1.
25 On newer platforms, use _Alignof to get a tighter bound. */
26
27#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
28# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1))
29#else
30# define FLEXALIGNOF(type) _Alignof (type)
31#endif
32
33/* Upper bound on the size of a struct of type TYPE with a flexible
34 array member named MEMBER that is followed by N bytes of other data.
35 This is not simply sizeof (TYPE) + N, since it may require
36 alignment on unusually picky C11 platforms, and
37 FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms.
38 Yield a value less than N if and only if arithmetic overflow occurs. */
39
40#define FLEXSIZEOF(type, member, n) \
41 ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \
42 & ~ (FLEXALIGNOF (type) - 1))
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index cc8429658e1..c431de6811c 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
21# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
22# 22#
23# Generated by gnulib-tool. 23# Generated by gnulib-tool.
24# 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 24# 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
25 25
26 26
27MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
@@ -449,6 +449,15 @@ EXTRA_DIST += filevercmp.h
449 449
450## end gnulib module filevercmp 450## end gnulib module filevercmp
451 451
452## begin gnulib module flexmember
453
454if gl_GNULIB_ENABLED_flexmember
455
456endif
457EXTRA_DIST += flexmember.h
458
459## end gnulib module flexmember
460
452## begin gnulib module fpending 461## begin gnulib module fpending
453 462
454 463
diff --git a/lib/group-member.c b/lib/group-member.c
index 365e1669216..6bbab893c7e 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -97,15 +97,11 @@ group_member (gid_t gid)
97 97
98#ifdef TEST 98#ifdef TEST
99 99
100char *program_name;
101
102int 100int
103main (int argc, char **argv) 101main (int argc, char **argv)
104{ 102{
105 int i; 103 int i;
106 104
107 program_name = argv[0];
108
109 for (i = 1; i < argc; i++) 105 for (i = 1; i < argc; i++)
110 { 106 {
111 gid_t gid; 107 gid_t gid;
diff --git a/lib/time_rz.c b/lib/time_rz.c
index 55b764ea8b3..38afb5fc3cd 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -32,6 +32,7 @@
32#include <stdlib.h> 32#include <stdlib.h>
33#include <string.h> 33#include <string.h>
34 34
35#include "flexmember.h"
35#include "time-internal.h" 36#include "time-internal.h"
36 37
37#if !HAVE_TZSET 38#if !HAVE_TZSET
@@ -94,7 +95,7 @@ tzalloc (char const *name)
94{ 95{
95 size_t name_size = name ? strlen (name) + 1 : 0; 96 size_t name_size = name ? strlen (name) + 1 : 0;
96 size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1; 97 size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1;
97 timezone_t tz = malloc (offsetof (struct tm_zone, abbrs) + abbr_size); 98 timezone_t tz = malloc (FLEXSIZEOF (struct tm_zone, abbrs, abbr_size));
98 if (tz) 99 if (tz)
99 { 100 {
100 tz->next = NULL; 101 tz->next = NULL;
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 5a3fc98597c..5fc667c3520 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -79,6 +79,7 @@ AC_DEFUN([gl_EARLY],
79 # Code from module fdopendir: 79 # Code from module fdopendir:
80 # Code from module filemode: 80 # Code from module filemode:
81 # Code from module filevercmp: 81 # Code from module filevercmp:
82 # Code from module flexmember:
82 # Code from module fpending: 83 # Code from module fpending:
83 # Code from module fstatat: 84 # Code from module fstatat:
84 # Code from module fsync: 85 # Code from module fsync:
@@ -413,6 +414,7 @@ AC_DEFUN([gl_INIT],
413 gl_gnulib_enabled_dirfd=false 414 gl_gnulib_enabled_dirfd=false
414 gl_gnulib_enabled_dosname=false 415 gl_gnulib_enabled_dosname=false
415 gl_gnulib_enabled_euidaccess=false 416 gl_gnulib_enabled_euidaccess=false
417 gl_gnulib_enabled_flexmember=false
416 gl_gnulib_enabled_getdtablesize=false 418 gl_gnulib_enabled_getdtablesize=false
417 gl_gnulib_enabled_getgroups=false 419 gl_gnulib_enabled_getgroups=false
418 gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false 420 gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
@@ -472,6 +474,13 @@ AC_DEFUN([gl_INIT],
472 fi 474 fi
473 fi 475 fi
474 } 476 }
477 func_gl_gnulib_m4code_flexmember ()
478 {
479 if ! $gl_gnulib_enabled_flexmember; then
480 AC_C_FLEXIBLE_ARRAY_MEMBER
481 gl_gnulib_enabled_flexmember=true
482 fi
483 }
475 func_gl_gnulib_m4code_getdtablesize () 484 func_gl_gnulib_m4code_getdtablesize ()
476 { 485 {
477 if ! $gl_gnulib_enabled_getdtablesize; then 486 if ! $gl_gnulib_enabled_getdtablesize; then
@@ -679,6 +688,9 @@ AC_DEFUN([gl_INIT],
679 if { test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1; } && test $ac_cv_type_unsigned_long_long_int = yes; then 688 if { test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1; } && test $ac_cv_type_unsigned_long_long_int = yes; then
680 func_gl_gnulib_m4code_strtoull 689 func_gl_gnulib_m4code_strtoull
681 fi 690 fi
691 if test "$HAVE_TIMEZONE_T" = 0; then
692 func_gl_gnulib_m4code_flexmember
693 fi
682 if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then 694 if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
683 func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31 695 func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31
684 fi 696 fi
@@ -687,6 +699,7 @@ AC_DEFUN([gl_INIT],
687 AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd]) 699 AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd])
688 AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname]) 700 AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname])
689 AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], [$gl_gnulib_enabled_euidaccess]) 701 AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], [$gl_gnulib_enabled_euidaccess])
702 AM_CONDITIONAL([gl_GNULIB_ENABLED_flexmember], [$gl_gnulib_enabled_flexmember])
690 AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], [$gl_gnulib_enabled_getdtablesize]) 703 AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], [$gl_gnulib_enabled_getdtablesize])
691 AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups]) 704 AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups])
692 AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) 705 AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
@@ -892,6 +905,7 @@ AC_DEFUN([gl_FILE_LIST], [
892 lib/filemode.h 905 lib/filemode.h
893 lib/filevercmp.c 906 lib/filevercmp.c
894 lib/filevercmp.h 907 lib/filevercmp.h
908 lib/flexmember.h
895 lib/fpending.c 909 lib/fpending.c
896 lib/fpending.h 910 lib/fpending.h
897 lib/fstatat.c 911 lib/fstatat.c
@@ -1013,6 +1027,7 @@ AC_DEFUN([gl_FILE_LIST], [
1013 m4/fdatasync.m4 1027 m4/fdatasync.m4
1014 m4/fdopendir.m4 1028 m4/fdopendir.m4
1015 m4/filemode.m4 1029 m4/filemode.m4
1030 m4/flexmember.m4
1016 m4/fpending.m4 1031 m4/fpending.m4
1017 m4/fstatat.m4 1032 m4/fstatat.m4
1018 m4/fsync.m4 1033 m4/fsync.m4
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 90823b0acf4..89fd0ae38e3 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -103,6 +103,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
103 103
104 gl_manywarn_set= 104 gl_manywarn_set=
105 for gl_manywarn_item in \ 105 for gl_manywarn_item in \
106 -fno-common \
106 -W \ 107 -W \
107 -Wabi \ 108 -Wabi \
108 -Waddress \ 109 -Waddress \