1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Update from Gnulib by running admin/merge-gnulib

* admin/merge-gnulib (AVOIDED_MODULES): Avoid gnulib-i18n.
* lib/stdlib.c, m4/selinux-selinux-h.m4:
New files, taken from Gnulib.
This commit is contained in:
Paul Eggert 2024-12-17 14:02:41 -08:00
parent 22806c65f4
commit b1e5f6d6ef
172 changed files with 1541 additions and 667 deletions

View file

@ -54,7 +54,7 @@
/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE,
GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
_GL_INLINE_HEADER_BEGIN, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@ -130,6 +130,14 @@ struct random_data
# include <string>
#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_STDLIB_INLINE
# define _GL_STDLIB_INLINE _GL_INLINE
#endif
#ifndef _GL_REALLOC_INLINE
# define _GL_REALLOC_INLINE _GL_INLINE
#endif
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
function F. */
@ -283,8 +291,8 @@ _GL_CXXALIASWARN (free);
#elif defined GNULIB_POSIXCHECK
# undef free
/* Assume free is always declared. */
_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
"use gnulib module free for portability");
_GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - "
"use gnulib module free-posix for portability");
#endif
@ -367,9 +375,10 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
#endif
#if @GNULIB_CALLOC_POSIX@
# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
# if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \
|| (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC)
# undef calloc
# define calloc rpl_calloc
# endif
@ -681,7 +690,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
by never specifying a zero size), so it does not need malloc or
realloc to be redefined. */
#if @GNULIB_MALLOC_POSIX@
# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
# if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \
|| (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC)
@ -740,11 +749,12 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
/* Return maximum number of bytes of a multibyte character. */
#if @REPLACE_MB_CUR_MAX@
# if !GNULIB_defined_MB_CUR_MAX
static inline
int gl_MB_CUR_MAX (void)
_GL_STDLIB_INLINE int
gl_MB_CUR_MAX (void)
{
/* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
return MB_CUR_MAX + (MB_CUR_MAX == 3);
int gl_mb_cur_max = MB_CUR_MAX;
return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max;
}
# undef MB_CUR_MAX
# define MB_CUR_MAX gl_MB_CUR_MAX ()
@ -1454,16 +1464,25 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
#if @GNULIB_REALLOC_POSIX@
# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
|| (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
# define _GL_INLINE_RPL_REALLOC 1
_GL_REALLOC_INLINE void *
rpl_realloc (void *ptr, size_t size)
{
return realloc (ptr, size ? size : 1);
}
# endif
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC)
# undef realloc
# define realloc rpl_realloc
# endif
# if !defined _GL_INLINE_RPL_REALLOC
_GL_FUNCDECL_RPL (realloc, void *,
(void *ptr, size_t size),
_GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
# else
# if __GNUC__ >= 11 && !defined __clang__
@ -1968,6 +1987,8 @@ _GL_CXXALIASWARN (wctomb);
#endif
_GL_INLINE_HEADER_END
#endif /* _@GUARD_PREFIX@_STDLIB_H */
#endif /* _@GUARD_PREFIX@_STDLIB_H */
#endif