mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Update from gnulib
* admin/merge-gnulib (GNULIB_MODULES): * cross/lib/getopt-pfx-core.h (optind): * cross/lib/limits.in.h (BOOL_WIDTH): * cross/lib/math.in.h: * cross/lib/stpncpy.c (__stpncpy): * cross/lib/string.in.h: * lib/getopt-pfx-core.h (optind): * lib/gnulib.mk.in (ANDROID_MIN_SDK): (GL_COND_OBJ_STDIO_READ_CONDITION): (LIBS): (NDK_BUILD_AR): (REPLACE__EXIT): (libgnu_a_SOURCES): * lib/limits.in.h (BOOL_WIDTH): * lib/math.in.h: * lib/stpncpy.c (__stpncpy): * lib/string.in.h: * m4/assert_h.m4 (gl_ASSERT_H): * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): * m4/getdelim.m4 (gl_FUNC_GETDELIM): * m4/getline.m4 (gl_FUNC_GETLINE): * m4/gnulib-common.m4 (gl_COMMON_BODY): (gl_CONDITIONAL_HEADER): (gl_CHECK_FUNCS_ANDROID): * m4/gnulib-comp.m4 (gl_EARLY): (gl_INIT): (gl_FILE_LIST): * m4/limits-h.m4: * m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): * m4/malloc.m4 (_AC_FUNC_MALLOC_IF): * m4/printf.m4 (gl_PRINTF_SIZES_C99): (gl_PRINTF_INFINITE): (gl_PRINTF_INFINITE_LONG_DOUBLE): (gl_PRINTF_DIRECTIVE_A): (gl_PRINTF_DIRECTIVE_F): (gl_PRINTF_FLAG_ZERO): (gl_SNPRINTF_PRESENCE): (gl_SNPRINTF_DIRECTIVE_N): (gl_VSNPRINTF_ZEROSIZE_C99): * m4/pselect.m4 (gl_FUNC_PSELECT): * m4/readlink.m4 (gl_FUNC_READLINK): * m4/realloc.m4 (_AC_FUNC_REALLOC_IF): * m4/signbit.m4 (gl_SIGNBIT): * m4/stpncpy.m4 (gl_FUNC_STPNCPY): * m4/symlink.m4 (gl_FUNC_SYMLINK): Add gnulib module stpncpy. * src/android.c: Include string.h.
This commit is contained in:
parent
7aa4ffddd8
commit
8ca4162ecd
29 changed files with 624 additions and 117 deletions
|
|
@ -47,7 +47,7 @@
|
|||
# define optind __GETOPT_ID (optind)
|
||||
# define optopt __GETOPT_ID (optopt)
|
||||
|
||||
/* Work around a a problem on macOS, which declares getopt with a
|
||||
/* Work around a problem on macOS, which declares getopt with a
|
||||
trailing __DARWIN_ALIAS(getopt) that would expand to something like
|
||||
__asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
|
||||
hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */
|
||||
|
|
|
|||
|
|
@ -119,11 +119,14 @@
|
|||
|
||||
/* Macros specified by C23. */
|
||||
|
||||
#if (! defined BOOL_WIDTH \
|
||||
&& (defined _GNU_SOURCE \
|
||||
|| (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
|
||||
# define BOOL_MAX 1
|
||||
# define BOOL_WIDTH 1
|
||||
#if (defined _GNU_SOURCE \
|
||||
|| (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))
|
||||
# if ! defined BOOL_WIDTH
|
||||
# define BOOL_WIDTH 1
|
||||
# define BOOL_MAX 1
|
||||
# elif ! defined BOOL_MAX
|
||||
# define BOOL_MAX ((((1U << (BOOL_WIDTH - 1)) - 1) << 1) + 1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_LIMITS_H */
|
||||
|
|
|
|||
|
|
@ -2624,7 +2624,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
|
|||
# if defined isnan || defined GNULIB_NAMESPACE
|
||||
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
|
||||
# undef isnan
|
||||
# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ < 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
|
||||
# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ != 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
|
||||
/* This platform's <cmath> possibly defines isnan through a set of inline
|
||||
functions. */
|
||||
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
|
||||
|
|
|
|||
92
cross/lib/stpncpy.c
Normal file
92
cross/lib/stpncpy.c
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2023 Free Software
|
||||
* Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@gnu.org.
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This file 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
#ifndef weak_alias
|
||||
# define __stpncpy stpncpy
|
||||
#endif
|
||||
|
||||
/* Copy no more than N bytes of SRC to DST, returning a pointer past the
|
||||
last non-NUL byte written into DST. */
|
||||
char *
|
||||
(__stpncpy) (char *dest, const char *src, size_t n)
|
||||
{
|
||||
char c;
|
||||
char *s = dest;
|
||||
|
||||
if (n >= 4)
|
||||
{
|
||||
size_t n4 = n >> 2;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = *src++;
|
||||
*dest++ = c;
|
||||
if (c == '\0')
|
||||
break;
|
||||
c = *src++;
|
||||
*dest++ = c;
|
||||
if (c == '\0')
|
||||
break;
|
||||
c = *src++;
|
||||
*dest++ = c;
|
||||
if (c == '\0')
|
||||
break;
|
||||
c = *src++;
|
||||
*dest++ = c;
|
||||
if (c == '\0')
|
||||
break;
|
||||
if (--n4 == 0)
|
||||
goto last_chars;
|
||||
}
|
||||
n -= dest - s;
|
||||
goto zero_fill;
|
||||
}
|
||||
|
||||
last_chars:
|
||||
n &= 3;
|
||||
if (n == 0)
|
||||
return dest;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = *src++;
|
||||
--n;
|
||||
*dest++ = c;
|
||||
if (c == '\0')
|
||||
break;
|
||||
if (n == 0)
|
||||
return dest;
|
||||
}
|
||||
|
||||
zero_fill:
|
||||
while (n-- > 0)
|
||||
dest[n] = '\0';
|
||||
|
||||
return dest - 1;
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__stpncpy, stpncpy)
|
||||
#endif
|
||||
|
|
@ -126,7 +126,11 @@
|
|||
# if (@REPLACE_FREE@ && !defined free \
|
||||
&& !(defined __cplusplus && defined GNULIB_NAMESPACE))
|
||||
/* We can't do '#define free rpl_free' here. */
|
||||
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
|
||||
_GL_EXTERN_C void rpl_free (void *) throw ();
|
||||
# else
|
||||
_GL_EXTERN_C void rpl_free (void *);
|
||||
# endif
|
||||
# undef _GL_ATTRIBUTE_DEALLOC_FREE
|
||||
# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
|
||||
# else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue