aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2021-01-23 11:35:44 -0800
committerPaul Eggert2021-01-23 11:37:49 -0800
commit7c9841b8428edfbc369eccf54788b668d4b27328 (patch)
treed0835a270d1ed4e02b920a8d9468f52f7f8570ea /lib
parent30d95d33737e4694b579c38328564716d10217b6 (diff)
downloademacs-7c9841b8428edfbc369eccf54788b668d4b27328.tar.gz
emacs-7c9841b8428edfbc369eccf54788b668d4b27328.zip
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'lib')
-rw-r--r--lib/cdefs.h6
-rw-r--r--lib/explicit_bzero.c16
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/cdefs.h b/lib/cdefs.h
index de74f4211cf..17a0919cd83 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -320,14 +320,16 @@
320#endif 320#endif
321 321
322/* The nonnull function attribute marks pointer parameters that 322/* The nonnull function attribute marks pointer parameters that
323 must not be NULL. Do not define __nonnull if it is already defined, 323 must not be NULL. */
324 for portability when this file is used in Gnulib. */
325#ifndef __nonnull 324#ifndef __nonnull
326# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) 325# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
327# define __nonnull(params) __attribute__ ((__nonnull__ params)) 326# define __nonnull(params) __attribute__ ((__nonnull__ params))
328# else 327# else
329# define __nonnull(params) 328# define __nonnull(params)
330# endif 329# endif
330#elif !defined __GLIBC__
331# undef __nonnull
332# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
331#endif 333#endif
332 334
333/* If fortification mode, we warn about unused results of certain 335/* If fortification mode, we warn about unused results of certain
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index feea4446c06..f50ed0875d7 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -54,11 +54,21 @@ explicit_bzero (void *s, size_t len)
54 explicit_memset (s, '\0', len); 54 explicit_memset (s, '\0', len);
55#elif HAVE_MEMSET_S 55#elif HAVE_MEMSET_S
56 (void) memset_s (s, len, '\0', len); 56 (void) memset_s (s, len, '\0', len);
57#else 57#elif defined __GNUC__ && !defined __clang__
58 memset (s, '\0', len); 58 memset (s, '\0', len);
59# if defined __GNUC__ && !defined __clang__
60 /* Compiler barrier. */ 59 /* Compiler barrier. */
61 asm volatile ("" ::: "memory"); 60 asm volatile ("" ::: "memory");
62# endif 61#elif defined __clang__
62 memset (s, '\0', len);
63 /* Compiler barrier. */
64 /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the
65 whole thing is dead and eliminates it. Use 'g' to work around this
66 problem. See <https://bugs.llvm.org/show_bug.cgi?id=15495#c11>. */
67 __asm__ volatile ("" : : "g"(s) : "memory");
68#else
69 /* Invoke memset through a volatile function pointer. This defeats compiler
70 optimizations. */
71 void * (* const volatile volatile_memset) (void *, int, size_t) = memset;
72 (void) volatile_memset (s, '\0', len);
63#endif 73#endif
64} 74}