1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

; Update from Gnulib

This commit is contained in:
Po Lu 2023-05-15 10:39:43 +08:00
parent a46e231a5f
commit 5a3f009ad7
23 changed files with 2618 additions and 552 deletions

View file

@ -17,6 +17,11 @@
#ifndef _FSETERR_H
#define _FSETERR_H
/* This file uses HAVE___FSETERR. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
#include <stdio.h>
/* Set the error indicator of the stream FP.

View file

@ -186,6 +186,8 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
ANDROID = @ANDROID@
ANDROID_ABI = @ANDROID_ABI@
ANDROID_BUILD_CFLAGS = @ANDROID_BUILD_CFLAGS@
ANDROID_CC = @ANDROID_CC@
ANDROID_CFLAGS = @ANDROID_CFLAGS@
ANDROID_DEBUGGABLE = @ANDROID_DEBUGGABLE@
ANDROID_JAR = @ANDROID_JAR@
ANDROID_LDFLAGS = @ANDROID_LDFLAGS@
@ -194,6 +196,7 @@ ANDROID_MIN_SDK = @ANDROID_MIN_SDK@
ANDROID_OBJ = @ANDROID_OBJ@
ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
ANDROID_SDK_8_OR_EARLIER = @ANDROID_SDK_8_OR_EARLIER@
ANDROID_SHARED_USER_ID = @ANDROID_SHARED_USER_ID@
APKSIGNER = @APKSIGNER@
APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
AR = @AR@
@ -1193,7 +1196,6 @@ LIB_WSOCK32 = @LIB_WSOCK32@
LIB_XATTR = @LIB_XATTR@
LIMITS_H = @LIMITS_H@
LN_S_FILEONLY = @LN_S_FILEONLY@
LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@
LTLIBGMP = @LTLIBGMP@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
@ -1495,11 +1497,8 @@ REPLACE_REMAINDERL = @REPLACE_REMAINDERL@
REPLACE_REMOVE = @REPLACE_REMOVE@
REPLACE_RENAME = @REPLACE_RENAME@
REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
<<<<<<< HEAD
REPLACE_RINTL = @REPLACE_RINTL@
=======
REPLACE_REWINDDIR = @REPLACE_REWINDDIR@
>>>>>>> origin/master
REPLACE_RINTL = @REPLACE_RINTL@
REPLACE_RMDIR = @REPLACE_RMDIR@
REPLACE_ROUND = @REPLACE_ROUND@
REPLACE_ROUNDF = @REPLACE_ROUNDF@
@ -1682,6 +1681,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
emacs_major_version = @emacs_major_version@
emacs_use_mailutils = @emacs_use_mailutils@
etcdir = @etcdir@
etcdocdir = @etcdocdir@
exec_prefix = @exec_prefix@

View file

@ -14,6 +14,11 @@
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 file uses HAVE_ISNAND_IN_LIBC. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
#if HAVE_ISNAND_IN_LIBC
/* Get declaration of isnan macro. */
# include <math.h>

View file

@ -14,6 +14,11 @@
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 file uses HAVE_ISNANF_IN_LIBC. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
#if HAVE_ISNANF_IN_LIBC
/* Get declaration of isnan macro or (older) isnanf function. */
# include <math.h>

View file

@ -14,6 +14,11 @@
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 file uses HAVE_ISNANL_IN_LIBC. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
#if HAVE_ISNANL_IN_LIBC
/* Get declaration of isnan macro or (older) isnanl function. */
# include <math.h>

View file

@ -48,14 +48,17 @@
#ifndef _@GUARD_PREFIX@_MATH_H
#define _@GUARD_PREFIX@_MATH_H
/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_CONST,
GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
/* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in <fp.h>. */
#if defined __VMS && ! defined NAN
# include <fp.h>
#endif
#ifndef _GL_INLINE_HEADER_BEGIN
#error "Please include config.h first."
#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_MATH_INLINE
# define _GL_MATH_INLINE _GL_INLINE
@ -2630,6 +2633,11 @@ _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
# define isnan rpl_isnan
# define GNULIB_NAMESPACE_LACKS_ISNAN 1
# elif (defined __FreeBSD__ && __clang_major__ >= 14)
/* Neither of the two possible _GL_MATH_CXX_REAL_FLOATING_DECL_2 invocations
works. Inline functions are already present in /usr/include/c++/v1/math.h,
which comes from LLVM. */
# define GNULIB_NAMESPACE_LACKS_ISNAN 1
# else
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
# endif

View file

@ -29,6 +29,9 @@
# include "printf-args.h"
#endif
/* Get INT_WIDTH. */
#include <limits.h>
#ifdef STATIC
STATIC
#endif
@ -71,6 +74,102 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
case TYPE_ULONGLONGINT:
ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
break;
case TYPE_INT8_T:
#if INT8_WIDTH < INT_WIDTH
ap->a.a_int8_t = va_arg (args, /* int8_t */ int);
#else
ap->a.a_int8_t = va_arg (args, int8_t);
#endif
break;
case TYPE_UINT8_T:
#if UINT8_WIDTH < INT_WIDTH
ap->a.a_uint8_t = va_arg (args, /* uint8_t */ int);
#else
ap->a.a_uint8_t = va_arg (args, uint8_t);
#endif
break;
case TYPE_INT16_T:
#if INT16_WIDTH < INT_WIDTH
ap->a.a_int16_t = va_arg (args, /* int16_t */ int);
#else
ap->a.a_int16_t = va_arg (args, int16_t);
#endif
break;
case TYPE_UINT16_T:
#if UINT16_WIDTH < INT_WIDTH
ap->a.a_uint16_t = va_arg (args, /* uint16_t */ int);
#else
ap->a.a_uint16_t = va_arg (args, uint16_t);
#endif
break;
case TYPE_INT32_T:
#if INT32_WIDTH < INT_WIDTH
ap->a.a_int32_t = va_arg (args, /* int32_t */ int);
#else
ap->a.a_int32_t = va_arg (args, int32_t);
#endif
break;
case TYPE_UINT32_T:
#if UINT32_WIDTH < INT_WIDTH
ap->a.a_uint32_t = va_arg (args, /* uint32_t */ int);
#else
ap->a.a_uint32_t = va_arg (args, uint32_t);
#endif
break;
case TYPE_INT64_T:
ap->a.a_int64_t = va_arg (args, int64_t);
break;
case TYPE_UINT64_T:
ap->a.a_uint64_t = va_arg (args, uint64_t);
break;
case TYPE_INT_FAST8_T:
#if INT_FAST8_WIDTH < INT_WIDTH
ap->a.a_int_fast8_t = va_arg (args, /* int_fast8_t */ int);
#else
ap->a.a_int_fast8_t = va_arg (args, int_fast8_t);
#endif
break;
case TYPE_UINT_FAST8_T:
#if UINT_FAST8_WIDTH < INT_WIDTH
ap->a.a_uint_fast8_t = va_arg (args, /* uint_fast8_t */ int);
#else
ap->a.a_uint_fast8_t = va_arg (args, uint_fast8_t);
#endif
break;
case TYPE_INT_FAST16_T:
#if INT_FAST16_WIDTH < INT_WIDTH
ap->a.a_int_fast16_t = va_arg (args, /* int_fast16_t */ int);
#else
ap->a.a_int_fast16_t = va_arg (args, int_fast16_t);
#endif
break;
case TYPE_UINT_FAST16_T:
#if UINT_FAST16_WIDTH < INT_WIDTH
ap->a.a_uint_fast16_t = va_arg (args, /* uint_fast16_t */ int);
#else
ap->a.a_uint_fast16_t = va_arg (args, uint_fast16_t);
#endif
break;
case TYPE_INT_FAST32_T:
#if INT_FAST32_WIDTH < INT_WIDTH
ap->a.a_int_fast32_t = va_arg (args, /* int_fast32_t */ int);
#else
ap->a.a_int_fast32_t = va_arg (args, int_fast32_t);
#endif
break;
case TYPE_UINT_FAST32_T:
#if UINT_FAST32_WIDTH < INT_WIDTH
ap->a.a_uint_fast32_t = va_arg (args, /* uint_fast32_t */ int);
#else
ap->a.a_uint_fast32_t = va_arg (args, uint_fast32_t);
#endif
break;
case TYPE_INT_FAST64_T:
ap->a.a_int_fast64_t = va_arg (args, int_fast64_t);
break;
case TYPE_UINT_FAST64_T:
ap->a.a_uint_fast64_t = va_arg (args, uint_fast64_t);
break;
case TYPE_DOUBLE:
ap->a.a_double = va_arg (args, double);
break;
@ -136,6 +235,30 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
case TYPE_COUNT_LONGLONGINT_POINTER:
ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
break;
case TYPE_COUNT_INT8_T_POINTER:
ap->a.a_count_int8_t_pointer = va_arg (args, int8_t *);
break;
case TYPE_COUNT_INT16_T_POINTER:
ap->a.a_count_int16_t_pointer = va_arg (args, int16_t *);
break;
case TYPE_COUNT_INT32_T_POINTER:
ap->a.a_count_int32_t_pointer = va_arg (args, int32_t *);
break;
case TYPE_COUNT_INT64_T_POINTER:
ap->a.a_count_int64_t_pointer = va_arg (args, int64_t *);
break;
case TYPE_COUNT_INT_FAST8_T_POINTER:
ap->a.a_count_int_fast8_t_pointer = va_arg (args, int_fast8_t *);
break;
case TYPE_COUNT_INT_FAST16_T_POINTER:
ap->a.a_count_int_fast16_t_pointer = va_arg (args, int_fast16_t *);
break;
case TYPE_COUNT_INT_FAST32_T_POINTER:
ap->a.a_count_int_fast32_t_pointer = va_arg (args, int_fast32_t *);
break;
case TYPE_COUNT_INT_FAST64_T_POINTER:
ap->a.a_count_int_fast64_t_pointer = va_arg (args, int_fast64_t *);
break;
#if ENABLE_UNISTDIO
/* The unistdio extensions. */
case TYPE_U8_STRING:

View file

@ -41,6 +41,9 @@
# include <wchar.h>
#endif
/* Get intN_t, uintN_t, intN_fast_t, uintN_fast_t. */
#include <stdint.h>
/* Get va_list. */
#include <stdarg.h>
@ -59,6 +62,26 @@ typedef enum
TYPE_ULONGINT,
TYPE_LONGLONGINT,
TYPE_ULONGLONGINT,
/* According to ISO C 23 § 7.23.6.1, "all exact-width integer types",
"all minimum-width integer types", and "all fastest minimum-width integer
types" defined in <stdint.h> should be supported. But for portability
between platforms, we support only those with N = 8, 16, 32, 64. */
TYPE_INT8_T,
TYPE_UINT8_T,
TYPE_INT16_T,
TYPE_UINT16_T,
TYPE_INT32_T,
TYPE_UINT32_T,
TYPE_INT64_T,
TYPE_UINT64_T,
TYPE_INT_FAST8_T,
TYPE_UINT_FAST8_T,
TYPE_INT_FAST16_T,
TYPE_UINT_FAST16_T,
TYPE_INT_FAST32_T,
TYPE_UINT_FAST32_T,
TYPE_INT_FAST64_T,
TYPE_UINT_FAST64_T,
TYPE_DOUBLE,
TYPE_LONGDOUBLE,
TYPE_CHAR,
@ -74,7 +97,15 @@ typedef enum
TYPE_COUNT_SHORT_POINTER,
TYPE_COUNT_INT_POINTER,
TYPE_COUNT_LONGINT_POINTER,
TYPE_COUNT_LONGLONGINT_POINTER
TYPE_COUNT_LONGLONGINT_POINTER,
TYPE_COUNT_INT8_T_POINTER,
TYPE_COUNT_INT16_T_POINTER,
TYPE_COUNT_INT32_T_POINTER,
TYPE_COUNT_INT64_T_POINTER,
TYPE_COUNT_INT_FAST8_T_POINTER,
TYPE_COUNT_INT_FAST16_T_POINTER,
TYPE_COUNT_INT_FAST32_T_POINTER,
TYPE_COUNT_INT_FAST64_T_POINTER
#if ENABLE_UNISTDIO
/* The unistdio extensions. */
, TYPE_U8_STRING
@ -99,7 +130,23 @@ typedef struct
unsigned long int a_ulongint;
long long int a_longlongint;
unsigned long long int a_ulonglongint;
float a_float;
int8_t a_int8_t;
uint8_t a_uint8_t;
int16_t a_int16_t;
uint16_t a_uint16_t;
int32_t a_int32_t;
uint32_t a_uint32_t;
int64_t a_int64_t;
uint64_t a_uint64_t;
int_fast8_t a_int_fast8_t;
uint_fast8_t a_uint_fast8_t;
int_fast16_t a_int_fast16_t;
uint_fast16_t a_uint_fast16_t;
int_fast32_t a_int_fast32_t;
uint_fast32_t a_uint_fast32_t;
int_fast64_t a_int_fast64_t;
uint_fast64_t a_uint_fast64_t;
float a_float; /* unused */
double a_double;
long double a_longdouble;
int a_char;
@ -116,6 +163,14 @@ typedef struct
int * a_count_int_pointer;
long int * a_count_longint_pointer;
long long int * a_count_longlongint_pointer;
int8_t * a_count_int8_t_pointer;
int16_t * a_count_int16_t_pointer;
int32_t * a_count_int32_t_pointer;
int64_t * a_count_int64_t_pointer;
int_fast8_t * a_count_int_fast8_t_pointer;
int_fast16_t * a_count_int_fast16_t_pointer;
int_fast32_t * a_count_int_fast32_t_pointer;
int_fast64_t * a_count_int_fast64_t_pointer;
#if ENABLE_UNISTDIO
/* The unistdio extensions. */
const uint8_t * a_u8_string;

View file

@ -326,226 +326,317 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
arg_type type;
/* Parse argument type/size specifiers. */
{
int flags = 0;
/* Relevant for the conversion characters d, i. */
arg_type signed_type = TYPE_INT;
/* Relevant for the conversion characters b, o, u, x, X. */
arg_type unsigned_type = TYPE_UINT;
/* Relevant for the conversion characters n. */
arg_type pointer_type = TYPE_COUNT_INT_POINTER;
/* Relevant for the conversion characters a, A, e, E, f, F, g, G. */
arg_type floatingpoint_type = TYPE_DOUBLE;
for (;;)
{
if (*cp == 'h')
{
flags |= (1 << (flags & 1));
cp++;
}
else if (*cp == 'L')
{
flags |= 4;
cp++;
}
else if (*cp == 'l')
{
flags += 8;
cp++;
}
else if (*cp == 'j')
{
if (sizeof (intmax_t) > sizeof (long))
{
/* intmax_t = long long */
flags += 16;
}
else if (sizeof (intmax_t) > sizeof (int))
{
/* intmax_t = long */
flags += 8;
}
cp++;
}
else if (*cp == 'z' || *cp == 'Z')
{
/* 'z' is standardized in ISO C 99, but glibc uses 'Z'
because the warning facility in gcc-2.95.2 understands
only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */
if (sizeof (size_t) > sizeof (long))
{
/* size_t = long long */
flags += 16;
}
else if (sizeof (size_t) > sizeof (int))
{
/* size_t = long */
flags += 8;
}
cp++;
}
else if (*cp == 't')
{
if (sizeof (ptrdiff_t) > sizeof (long))
{
/* ptrdiff_t = long long */
flags += 16;
}
else if (sizeof (ptrdiff_t) > sizeof (int))
{
/* ptrdiff_t = long */
flags += 8;
}
cp++;
}
if (*cp == 'h')
{
if (cp[1] == 'h')
{
signed_type = TYPE_SCHAR;
unsigned_type = TYPE_UCHAR;
pointer_type = TYPE_COUNT_SCHAR_POINTER;
cp += 2;
}
else
{
signed_type = TYPE_SHORT;
unsigned_type = TYPE_USHORT;
pointer_type = TYPE_COUNT_SHORT_POINTER;
cp++;
}
}
else if (*cp == 'l')
{
if (cp[1] == 'l')
{
signed_type = TYPE_LONGLONGINT;
unsigned_type = TYPE_ULONGLONGINT;
pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
/* For backward compatibility only. */
floatingpoint_type = TYPE_LONGDOUBLE;
cp += 2;
}
else
{
signed_type = TYPE_LONGINT;
unsigned_type = TYPE_ULONGINT;
pointer_type = TYPE_COUNT_LONGINT_POINTER;
cp++;
}
}
else if (*cp == 'j')
{
if (sizeof (intmax_t) > sizeof (long))
{
/* intmax_t = long long */
signed_type = TYPE_LONGLONGINT;
unsigned_type = TYPE_ULONGLONGINT;
pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
/* For backward compatibility only. */
floatingpoint_type = TYPE_LONGDOUBLE;
}
else if (sizeof (intmax_t) > sizeof (int))
{
/* intmax_t = long */
signed_type = TYPE_LONGINT;
unsigned_type = TYPE_ULONGINT;
pointer_type = TYPE_COUNT_LONGINT_POINTER;
}
cp++;
}
else if (*cp == 'z' || *cp == 'Z')
{
/* 'z' is standardized in ISO C 99, but glibc uses 'Z'
because the warning facility in gcc-2.95.2 understands
only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */
if (sizeof (size_t) > sizeof (long))
{
/* size_t = unsigned long long */
signed_type = TYPE_LONGLONGINT;
unsigned_type = TYPE_ULONGLONGINT;
pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
/* For backward compatibility only. */
floatingpoint_type = TYPE_LONGDOUBLE;
}
else if (sizeof (size_t) > sizeof (int))
{
/* size_t = unsigned long */
signed_type = TYPE_LONGINT;
unsigned_type = TYPE_ULONGINT;
pointer_type = TYPE_COUNT_LONGINT_POINTER;
}
cp++;
}
else if (*cp == 't')
{
if (sizeof (ptrdiff_t) > sizeof (long))
{
/* ptrdiff_t = long long */
signed_type = TYPE_LONGLONGINT;
unsigned_type = TYPE_ULONGLONGINT;
pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
/* For backward compatibility only. */
floatingpoint_type = TYPE_LONGDOUBLE;
}
else if (sizeof (ptrdiff_t) > sizeof (int))
{
/* ptrdiff_t = long */
signed_type = TYPE_LONGINT;
unsigned_type = TYPE_ULONGINT;
pointer_type = TYPE_COUNT_LONGINT_POINTER;
}
cp++;
}
else if (*cp == 'w')
{
/* wN and wfN are standardized in ISO C 23. */
if (cp[1] == 'f')
{
if (cp[2] == '8')
{
signed_type = TYPE_INT_FAST8_T;
unsigned_type = TYPE_UINT_FAST8_T;
pointer_type = TYPE_COUNT_INT_FAST8_T_POINTER;
cp += 3;
}
else if (cp[2] == '1' && cp[3] == '6')
{
signed_type = TYPE_INT_FAST16_T;
unsigned_type = TYPE_UINT_FAST16_T;
pointer_type = TYPE_COUNT_INT_FAST16_T_POINTER;
cp += 4;
}
else if (cp[2] == '3' && cp[3] == '2')
{
signed_type = TYPE_INT_FAST32_T;
unsigned_type = TYPE_UINT_FAST32_T;
pointer_type = TYPE_COUNT_INT_FAST32_T_POINTER;
cp += 4;
}
else if (cp[2] == '6' && cp[3] == '4')
{
signed_type = TYPE_INT_FAST64_T;
unsigned_type = TYPE_UINT_FAST64_T;
pointer_type = TYPE_COUNT_INT_FAST64_T_POINTER;
cp += 4;
}
}
else
{
if (cp[1] == '8')
{
signed_type = TYPE_INT8_T;
unsigned_type = TYPE_UINT8_T;
pointer_type = TYPE_COUNT_INT8_T_POINTER;
cp += 2;
}
else if (cp[1] == '1' && cp[2] == '6')
{
signed_type = TYPE_INT16_T;
unsigned_type = TYPE_UINT16_T;
pointer_type = TYPE_COUNT_INT16_T_POINTER;
cp += 3;
}
else if (cp[1] == '3' && cp[2] == '2')
{
signed_type = TYPE_INT32_T;
unsigned_type = TYPE_UINT32_T;
pointer_type = TYPE_COUNT_INT32_T_POINTER;
cp += 3;
}
else if (cp[1] == '6' && cp[2] == '4')
{
signed_type = TYPE_INT64_T;
unsigned_type = TYPE_UINT64_T;
pointer_type = TYPE_COUNT_INT64_T_POINTER;
cp += 3;
}
}
}
else if (*cp == 'L')
{
signed_type = TYPE_LONGLONGINT;
unsigned_type = TYPE_ULONGLONGINT;
pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
floatingpoint_type = TYPE_LONGDOUBLE;
cp++;
}
#if defined __APPLE__ && defined __MACH__
/* On Mac OS X 10.3, PRIdMAX is defined as "qd".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'q')
{
if (64 / 8 > sizeof (long))
{
/* int64_t = long long */
flags += 16;
}
else
{
/* int64_t = long */
flags += 8;
}
cp++;
}
/* On Mac OS X 10.3, PRIdMAX is defined as "qd".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'q')
{
if (64 / 8 > sizeof (long))
{
/* int64_t = long long */
signed_type = TYPE_LONGLONGINT;
unsigned_type = TYPE_ULONGLONGINT;
pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
/* For backward compatibility only. */
floatingpoint_type = TYPE_LONGDOUBLE;
}
else
{
/* int64_t = long */
signed_type = TYPE_LONGINT;
unsigned_type = TYPE_ULONGINT;
pointer_type = TYPE_COUNT_LONGINT_POINTER;
}
cp++;
}
#endif
#if defined _WIN32 && ! defined __CYGWIN__
/* On native Windows, PRIdMAX is defined as "I64d".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
{
if (64 / 8 > sizeof (long))
{
/* __int64 = long long */
flags += 16;
}
else
{
/* __int64 = long */
flags += 8;
}
cp += 3;
}
/* On native Windows, PRIdMAX is defined as "I64d".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
{
if (64 / 8 > sizeof (long))
{
/* __int64_t = long long */
signed_type = TYPE_LONGLONGINT;
unsigned_type = TYPE_ULONGLONGINT;
pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
/* For backward compatibility only. */
floatingpoint_type = TYPE_LONGDOUBLE;
}
else
{
/* __int64_t = long */
signed_type = TYPE_LONGINT;
unsigned_type = TYPE_ULONGINT;
pointer_type = TYPE_COUNT_LONGINT_POINTER;
}
cp++;
}
#endif
else
break;
}
/* Read the conversion character. */
c = *cp++;
switch (c)
{
case 'd': case 'i':
/* If 'long long' is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_LONGLONGINT;
else
/* If 'long long' is the same as 'long', we parse "lld" into
TYPE_LONGINT. */
if (flags >= 8)
type = TYPE_LONGINT;
else if (flags & 2)
type = TYPE_SCHAR;
else if (flags & 1)
type = TYPE_SHORT;
else
type = TYPE_INT;
break;
case 'o': case 'u': case 'x': case 'X':
/* If 'unsigned long long' is larger than 'unsigned long': */
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;
else
/* If 'unsigned long long' is the same as 'unsigned long', we
parse "llu" into TYPE_ULONGINT. */
if (flags >= 8)
type = TYPE_ULONGINT;
else if (flags & 2)
type = TYPE_UCHAR;
else if (flags & 1)
type = TYPE_USHORT;
else
type = TYPE_UINT;
break;
case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
case 'a': case 'A':
if (flags >= 16 || (flags & 4))
type = TYPE_LONGDOUBLE;
else
type = TYPE_DOUBLE;
break;
case 'c':
if (flags >= 8)
/* Read the conversion character. */
c = *cp++;
switch (c)
{
case 'd': case 'i':
type = signed_type;
break;
case 'b': case 'o': case 'u': case 'x': case 'X':
#if SUPPORT_GNU_PRINTF_DIRECTIVES \
|| (__GLIBC__ + (__GLIBC_MINOR__ >= 35) > 2)
case 'B':
#endif
type = unsigned_type;
break;
case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
case 'a': case 'A':
type = floatingpoint_type;
break;
case 'c':
if (signed_type == TYPE_LONGINT
/* For backward compatibility only. */
|| signed_type == TYPE_LONGLONGINT)
#if HAVE_WINT_T
type = TYPE_WIDE_CHAR;
#else
goto error;
#endif
else
type = TYPE_CHAR;
break;
#if HAVE_WINT_T
case 'C':
type = TYPE_WIDE_CHAR;
c = 'c';
break;
#endif
case 's':
if (flags >= 8)
#if HAVE_WCHAR_T
type = TYPE_WIDE_STRING;
#else
goto error;
#endif
else
type = TYPE_STRING;
break;
#if HAVE_WCHAR_T
case 'S':
type = TYPE_WIDE_STRING;
c = 's';
break;
#endif
case 'p':
type = TYPE_POINTER;
break;
case 'n':
/* If 'long long' is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_COUNT_LONGLONGINT_POINTER;
else
/* If 'long long' is the same as 'long', we parse "lln" into
TYPE_COUNT_LONGINT_POINTER. */
if (flags >= 8)
type = TYPE_COUNT_LONGINT_POINTER;
else if (flags & 2)
type = TYPE_COUNT_SCHAR_POINTER;
else if (flags & 1)
type = TYPE_COUNT_SHORT_POINTER;
else
type = TYPE_COUNT_INT_POINTER;
break;
#if ENABLE_UNISTDIO
/* The unistdio extensions. */
case 'U':
if (flags >= 16)
type = TYPE_U32_STRING;
else if (flags >= 8)
type = TYPE_U16_STRING;
else
type = TYPE_U8_STRING;
break;
#endif
case '%':
type = TYPE_NONE;
break;
default:
/* Unknown conversion character. */
goto error;
}
}
#endif
else
type = TYPE_CHAR;
break;
#if HAVE_WINT_T
case 'C':
type = TYPE_WIDE_CHAR;
c = 'c';
break;
#endif
case 's':
if (signed_type == TYPE_LONGINT
/* For backward compatibility only. */
|| signed_type == TYPE_LONGLONGINT)
#if HAVE_WCHAR_T
type = TYPE_WIDE_STRING;
#else
goto error;
#endif
else
type = TYPE_STRING;
break;
#if HAVE_WCHAR_T
case 'S':
type = TYPE_WIDE_STRING;
c = 's';
break;
#endif
case 'p':
type = TYPE_POINTER;
break;
case 'n':
type = pointer_type;
break;
#if ENABLE_UNISTDIO
/* The unistdio extensions. */
case 'U':
if (signed_type == TYPE_LONGLONGINT)
type = TYPE_U32_STRING;
else if (signed_type == TYPE_LONGINT)
type = TYPE_U16_STRING;
else
type = TYPE_U8_STRING;
break;
#endif
case '%':
type = TYPE_NONE;
break;
default:
/* Unknown conversion character. */
goto error;
}
if (type != TYPE_NONE)
{

View file

@ -61,7 +61,7 @@ typedef struct
const char* precision_start;
const char* precision_end;
size_t precision_arg_index;
char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
char conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
size_t arg_index;
}
char_directive;
@ -91,7 +91,7 @@ typedef struct
const uint8_t* precision_start;
const uint8_t* precision_end;
size_t precision_arg_index;
uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
uint8_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
size_t arg_index;
}
u8_directive;
@ -119,7 +119,7 @@ typedef struct
const uint16_t* precision_start;
const uint16_t* precision_end;
size_t precision_arg_index;
uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
uint16_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
size_t arg_index;
}
u16_directive;
@ -147,7 +147,7 @@ typedef struct
const uint32_t* precision_start;
const uint32_t* precision_end;
size_t precision_arg_index;
uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
uint32_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
size_t arg_index;
}
u32_directive;

View file

@ -18,6 +18,11 @@
#ifndef GNULIB_SIZE_MAX_H
#define GNULIB_SIZE_MAX_H
/* This file uses HAVE_STDINT_H. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
/* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */
# include <limits.h>
/* Get SIZE_MAX declaration on systems like glibc 2. */

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,11 @@
#ifndef _VASNPRINTF_H
#define _VASNPRINTF_H
/* This file uses _GL_ATTRIBUTE_FORMAT. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
/* Get va_list. */
#include <stdarg.h>

View file

@ -18,6 +18,11 @@
#ifndef _XSIZE_H
#define _XSIZE_H
/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, HAVE_STDINT_H. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
/* Get size_t. */
#include <stddef.h>
@ -30,9 +35,6 @@
/* Get ATTRIBUTE_PURE. */
#include "attribute.h"
#ifndef _GL_INLINE_HEADER_BEGIN
#error "Please include config.h first."
#endif
_GL_INLINE_HEADER_BEGIN
#ifndef XSIZE_INLINE
# define XSIZE_INLINE _GL_INLINE