diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-05-03 14:57:10 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-05-03 15:10:07 -0700 |
commit | 6bd47f4477904a55fc08345394bfab9cd7eae2eb (patch) | |
tree | 12c98d95f3e66d85164bcf3adbc8f8db1c391939 /lib | |
parent | 40149b871889461713dc73634498f9d2150b0249 (diff) | |
download | emacs-6bd47f4477904a55fc08345394bfab9cd7eae2eb.tar.gz emacs-6bd47f4477904a55fc08345394bfab9cd7eae2eb.tar.bz2 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.h | 58 | ||||
-rw-r--r-- | lib/explicit_bzero.c | 18 | ||||
-rw-r--r-- | lib/gnulib.mk.in | 10 | ||||
-rw-r--r-- | lib/ieee754.in.h | 4 | ||||
-rw-r--r-- | lib/nstrftime.c | 9 |
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 @@ +/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers + + Copyright 2020 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 <https://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert. */ + +/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_* + macros used within Gnulib. */ + +#ifndef _GL_ATTRIBUTE_H +#define _GL_ATTRIBUTE_H + +/* C2X standard attributes have macro names that do not begin with + 'ATTRIBUTE_'. */ +#define DEPRECATED _GL_ATTRIBUTE_DEPRECATED +#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH +#define MAYBE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED +#define NODISCARD _GL_ATTRIBUTE_NODISCARD + +/* Selected GCC attributes; see: + https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html + These names begin with 'ATTRIBUTE_' to avoid name clashes. */ +#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE(args) +#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE +#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL +#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD +#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST +#define ATTRIBUTE_DEPRECATED _GL_ATTRIBUTE_DEPRECATED +#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR(msg) +#define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT(spec) +#define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF +#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS +#define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC +#define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE +#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL(args) +#define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING +#define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW +#define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED +#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE +#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL +#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL(pos) +#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING(msg) + +#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 @@ # include <config.h> #endif +/* memset_s need this define */ +#if HAVE_MEMSET_S +# define __STDC_WANT_LIB_EXT1__ 1 +#endif + #include <string.h> +#if defined _WIN32 && !defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif + #if _LIBC /* glibc-internal users use __explicit_bzero_chk, and explicit_bzero redirects to that. */ @@ -38,8 +48,12 @@ void explicit_bzero (void *s, size_t len) { -#ifdef HAVE_EXPLICIT_MEMSET - explicit_memset (s, 0, len); +#if defined _WIN32 && !defined __CYGWIN__ + (void) SecureZeroMemory (s, len); +#elif HAVE_EXPLICIT_MEMSET + explicit_memset (s, '\0', len); +#elif HAVE_MEMSET_S + (void) memset_s (s, len, '\0', len); #else memset (s, '\0', len); # 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@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1208,6 +1209,15 @@ endif endif ## end gnulib module at-internal +## begin gnulib module attribute +ifeq (,$(OMIT_GNULIB_MODULE_attribute)) + + +EXTRA_DIST += attribute.h + +endif +## end gnulib module attribute + ## begin gnulib module binary-io ifeq (,$(OMIT_GNULIB_MODULE_binary-io)) 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 #endif /* Little endian. */ } ieee; - /* This format makes it easier to see if a NaN is a signaling NaN. */ + /* This format makes it easier to see if a NaN is a signalling NaN. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN @@ -118,7 +118,7 @@ union ieee754_double #endif /* Little endian. */ } ieee; - /* This format makes it easier to see if a NaN is a signaling NaN. */ + /* This format makes it easier to see if a NaN is a signalling NaN. */ struct { #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[]; #include <string.h> #include <stdbool.h> +#include "attribute.h" #include <intprops.h> -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - #ifdef COMPILE_WIDE # include <endian.h> # define CHAR_T wchar_t |