aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2020-05-03 14:57:10 -0700
committerPaul Eggert2020-05-03 15:10:07 -0700
commit6bd47f4477904a55fc08345394bfab9cd7eae2eb (patch)
tree12c98d95f3e66d85164bcf3adbc8f8db1c391939 /lib
parent40149b871889461713dc73634498f9d2150b0249 (diff)
downloademacs-6bd47f4477904a55fc08345394bfab9cd7eae2eb.tar.gz
emacs-6bd47f4477904a55fc08345394bfab9cd7eae2eb.zip
Update from Gnulib
This incorporates: 2020-05-03 attribute: new module 2020-04-13 explicit_bzero: improve code style 2020-04-13 explicit_bzero: On native Windows, use SecureZeroMemory 2020-04-13 explicit_bzero: use memset_s() when available 2020-04-04 maint: remove a stray inter-word space * build-aux/config.guess, build-aux/config.sub: * build-aux/gitlog-to-changelog, build-aux/update-copyright: * doc/misc/texinfo.tex, lib/explicit_bzero.c, lib/ieee754.in.h: * lib/nstrftime.c, m4/explicit_bzero.m4, m4/gnulib-common.m4: Copy from Gnulib. * lib/attribute.h: New file, copied from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Diffstat (limited to 'lib')
-rw-r--r--lib/attribute.h58
-rw-r--r--lib/explicit_bzero.c18
-rw-r--r--lib/gnulib.mk.in10
-rw-r--r--lib/ieee754.in.h4
-rw-r--r--lib/nstrftime.c9
5 files changed, 87 insertions, 12 deletions
diff --git a/lib/attribute.h b/lib/attribute.h
new file mode 100644
index 00000000000..8ef9a399ade
--- /dev/null
+++ b/lib/attribute.h
@@ -0,0 +1,58 @@
1/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers
2
3 Copyright 2020 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by 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 GNU
13 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 <https://www.gnu.org/licenses/>. */
17
18/* Written by Paul Eggert. */
19
20/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_*
21 macros used within Gnulib. */
22
23#ifndef _GL_ATTRIBUTE_H
24#define _GL_ATTRIBUTE_H
25
26/* C2X standard attributes have macro names that do not begin with
27 'ATTRIBUTE_'. */
28#define DEPRECATED _GL_ATTRIBUTE_DEPRECATED
29#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
30#define MAYBE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
31#define NODISCARD _GL_ATTRIBUTE_NODISCARD
32
33/* Selected GCC attributes; see:
34 https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
35 These names begin with 'ATTRIBUTE_' to avoid name clashes. */
36#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE(args)
37#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
38#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL
39#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD
40#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
41#define ATTRIBUTE_DEPRECATED _GL_ATTRIBUTE_DEPRECATED
42#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR(msg)
43#define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
44#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT(spec)
45#define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF
46#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS
47#define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC
48#define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE
49#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL(args)
50#define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING
51#define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW
52#define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED
53#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
54#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL
55#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL(pos)
56#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING(msg)
57
58#endif /* _GL_ATTRIBUTE_H */
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index c82771fb1e3..b1f5acb7771 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -25,8 +25,18 @@
25# include <config.h> 25# include <config.h>
26#endif 26#endif
27 27
28/* memset_s need this define */
29#if HAVE_MEMSET_S
30# define __STDC_WANT_LIB_EXT1__ 1
31#endif
32
28#include <string.h> 33#include <string.h>
29 34
35#if defined _WIN32 && !defined __CYGWIN__
36# define WIN32_LEAN_AND_MEAN
37# include <windows.h>
38#endif
39
30#if _LIBC 40#if _LIBC
31/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero 41/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero
32 redirects to that. */ 42 redirects to that. */
@@ -38,8 +48,12 @@
38void 48void
39explicit_bzero (void *s, size_t len) 49explicit_bzero (void *s, size_t len)
40{ 50{
41#ifdef HAVE_EXPLICIT_MEMSET 51#if defined _WIN32 && !defined __CYGWIN__
42 explicit_memset (s, 0, len); 52 (void) SecureZeroMemory (s, len);
53#elif HAVE_EXPLICIT_MEMSET
54 explicit_memset (s, '\0', len);
55#elif HAVE_MEMSET_S
56 (void) memset_s (s, len, '\0', len);
43#else 57#else
44 memset (s, '\0', len); 58 memset (s, '\0', len);
45# if defined __GNUC__ && !defined __clang__ 59# if defined __GNUC__ && !defined __clang__
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 0c7c2fb2b66..5c11dfc95ca 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -1122,6 +1122,7 @@ pdfdir = @pdfdir@
1122prefix = @prefix@ 1122prefix = @prefix@
1123program_transform_name = @program_transform_name@ 1123program_transform_name = @program_transform_name@
1124psdir = @psdir@ 1124psdir = @psdir@
1125runstatedir = @runstatedir@
1125sbindir = @sbindir@ 1126sbindir = @sbindir@
1126sharedstatedir = @sharedstatedir@ 1127sharedstatedir = @sharedstatedir@
1127srcdir = @srcdir@ 1128srcdir = @srcdir@
@@ -1208,6 +1209,15 @@ endif
1208endif 1209endif
1209## end gnulib module at-internal 1210## end gnulib module at-internal
1210 1211
1212## begin gnulib module attribute
1213ifeq (,$(OMIT_GNULIB_MODULE_attribute))
1214
1215
1216EXTRA_DIST += attribute.h
1217
1218endif
1219## end gnulib module attribute
1220
1211## begin gnulib module binary-io 1221## begin gnulib module binary-io
1212ifeq (,$(OMIT_GNULIB_MODULE_binary-io)) 1222ifeq (,$(OMIT_GNULIB_MODULE_binary-io))
1213 1223
diff --git a/lib/ieee754.in.h b/lib/ieee754.in.h
index 01ca648905f..d64bb46e9de 100644
--- a/lib/ieee754.in.h
+++ b/lib/ieee754.in.h
@@ -67,7 +67,7 @@ union ieee754_float
67#endif /* Little endian. */ 67#endif /* Little endian. */
68 } ieee; 68 } ieee;
69 69
70 /* This format makes it easier to see if a NaN is a signaling NaN. */ 70 /* This format makes it easier to see if a NaN is a signalling NaN. */
71 struct 71 struct
72 { 72 {
73#if __BYTE_ORDER == __BIG_ENDIAN 73#if __BYTE_ORDER == __BIG_ENDIAN
@@ -118,7 +118,7 @@ union ieee754_double
118#endif /* Little endian. */ 118#endif /* Little endian. */
119 } ieee; 119 } ieee;
120 120
121 /* This format makes it easier to see if a NaN is a signaling NaN. */ 121 /* This format makes it easier to see if a NaN is a signalling NaN. */
122 struct 122 struct
123 { 123 {
124#if __BYTE_ORDER == __BIG_ENDIAN 124#if __BYTE_ORDER == __BIG_ENDIAN
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
index fc5052a549c..28b539dc2f2 100644
--- a/lib/nstrftime.c
+++ b/lib/nstrftime.c
@@ -68,16 +68,9 @@ extern char *tzname[];
68#include <string.h> 68#include <string.h>
69#include <stdbool.h> 69#include <stdbool.h>
70 70
71#include "attribute.h"
71#include <intprops.h> 72#include <intprops.h>
72 73
73#ifndef FALLTHROUGH
74# if __GNUC__ < 7
75# define FALLTHROUGH ((void) 0)
76# else
77# define FALLTHROUGH __attribute__ ((__fallthrough__))
78# endif
79#endif
80
81#ifdef COMPILE_WIDE 74#ifdef COMPILE_WIDE
82# include <endian.h> 75# include <endian.h>
83# define CHAR_T wchar_t 76# define CHAR_T wchar_t