aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2016-09-07 17:04:49 -0700
committerPaul Eggert2016-09-07 18:10:11 -0700
commit12a7e0f88eaa68aabe7e32589e2d5c8f776f6346 (patch)
treeac3b18f919ab71149b7fe50fdcaf7a953cced651 /lib
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.
Diffstat (limited to 'lib')
-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
5 files changed, 54 insertions, 9 deletions
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;