mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
2007-04-25 Eric Blake <ebb9@byu.net>
* libc/stdio/vfprintf.c (get_arg): Support %1$lc. Simplify types that promote to int.
This commit is contained in:
parent
245240b5e9
commit
8b36608695
@ -1,3 +1,8 @@
|
|||||||
|
2007-04-25 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
|
* libc/stdio/vfprintf.c (get_arg): Support %1$lc. Simplify types
|
||||||
|
that promote to int.
|
||||||
|
|
||||||
2007-04-25 Patrick Mansfield <patmans@us.ibm.com>
|
2007-04-25 Patrick Mansfield <patmans@us.ibm.com>
|
||||||
|
|
||||||
* libm/machine/spu/headers/feholdexcept.h: Use *envp not env so
|
* libm/machine/spu/headers/feholdexcept.h: Use *envp not env so
|
||||||
|
@ -1603,7 +1603,8 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
ACTION action;
|
ACTION action;
|
||||||
int pos, last_arg;
|
int pos, last_arg;
|
||||||
int max_pos_arg = n;
|
int max_pos_arg = n;
|
||||||
enum types { INT, LONG_INT, SHORT_INT, CHAR_INT, QUAD_INT, CHAR, CHAR_PTR, DOUBLE, LONG_DOUBLE, WIDE_CHAR };
|
/* Only need types that can be reached via vararg promotions. */
|
||||||
|
enum types { INT, LONG_INT, QUAD_INT, CHAR_PTR, DOUBLE, LONG_DOUBLE, WIDE_CHAR };
|
||||||
#ifdef _MB_CAPABLE
|
#ifdef _MB_CAPABLE
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
mbstate_t wc_state;
|
mbstate_t wc_state;
|
||||||
@ -1662,13 +1663,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case 'h':
|
case 'h':
|
||||||
if (*fmt == 'h')
|
/* No flag needed, since short and char promote to int. */
|
||||||
{
|
|
||||||
flags |= CHARINT;
|
|
||||||
++fmt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
flags |= SHORTINT;
|
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
flags |= LONGDBL;
|
flags |= LONGDBL;
|
||||||
@ -1683,10 +1678,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
flags |= QUADINT;
|
flags |= QUADINT;
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
if (sizeof (size_t) < sizeof (int))
|
if (sizeof (size_t) <= sizeof (int))
|
||||||
/* POSIX states size_t is 16 or more bits, as is short. */
|
|
||||||
flags |= SHORTINT;
|
|
||||||
else if (sizeof (size_t) == sizeof (int))
|
|
||||||
/* no flag needed */;
|
/* no flag needed */;
|
||||||
else if (sizeof (size_t) <= sizeof (long))
|
else if (sizeof (size_t) <= sizeof (long))
|
||||||
flags |= LONGINT;
|
flags |= LONGINT;
|
||||||
@ -1698,11 +1690,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
flags |= QUADINT;
|
flags |= QUADINT;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
if (sizeof (ptrdiff_t) < sizeof (int))
|
if (sizeof (ptrdiff_t) <= sizeof (int))
|
||||||
/* POSIX states ptrdiff_t is 16 or more bits, as
|
|
||||||
is short. */
|
|
||||||
flags |= SHORTINT;
|
|
||||||
else if (sizeof (ptrdiff_t) == sizeof (int))
|
|
||||||
/* no flag needed */;
|
/* no flag needed */;
|
||||||
else if (sizeof (ptrdiff_t) <= sizeof (long))
|
else if (sizeof (ptrdiff_t) <= sizeof (long))
|
||||||
flags |= LONGINT;
|
flags |= LONGINT;
|
||||||
@ -1739,10 +1727,6 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
case 'u':
|
case 'u':
|
||||||
if (flags & LONGINT)
|
if (flags & LONGINT)
|
||||||
spec_type = LONG_INT;
|
spec_type = LONG_INT;
|
||||||
else if (flags & SHORTINT)
|
|
||||||
spec_type = SHORT_INT;
|
|
||||||
else if (flags & CHARINT)
|
|
||||||
spec_type = CHAR_INT;
|
|
||||||
#ifndef _NO_LONGLONG
|
#ifndef _NO_LONGLONG
|
||||||
else if (flags & QUADINT)
|
else if (flags & QUADINT)
|
||||||
spec_type = QUAD_INT;
|
spec_type = QUAD_INT;
|
||||||
@ -1775,7 +1759,10 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
spec_type = CHAR_PTR;
|
spec_type = CHAR_PTR;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
spec_type = CHAR;
|
if (flags & LONGINT)
|
||||||
|
spec_type = WIDE_CHAR;
|
||||||
|
else
|
||||||
|
spec_type = INT;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
spec_type = WIDE_CHAR;
|
spec_type = WIDE_CHAR;
|
||||||
@ -1799,9 +1786,6 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
case WIDE_CHAR:
|
case WIDE_CHAR:
|
||||||
args[numargs++].val_wint_t = va_arg (*ap, wint_t);
|
args[numargs++].val_wint_t = va_arg (*ap, wint_t);
|
||||||
break;
|
break;
|
||||||
case CHAR:
|
|
||||||
case CHAR_INT:
|
|
||||||
case SHORT_INT:
|
|
||||||
case INT:
|
case INT:
|
||||||
args[numargs++].val_int = va_arg (*ap, int);
|
args[numargs++].val_int = va_arg (*ap, int);
|
||||||
break;
|
break;
|
||||||
@ -1886,9 +1870,6 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
|||||||
args[numargs++].val_wint_t = va_arg (*ap, wint_t);
|
args[numargs++].val_wint_t = va_arg (*ap, wint_t);
|
||||||
break;
|
break;
|
||||||
case INT:
|
case INT:
|
||||||
case CHAR_INT:
|
|
||||||
case SHORT_INT:
|
|
||||||
case CHAR:
|
|
||||||
default:
|
default:
|
||||||
args[numargs++].val_int = va_arg (*ap, int);
|
args[numargs++].val_int = va_arg (*ap, int);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user