1
1
/* Decomposed printf argument list.
2
Copyright (C) 1999, 2002-2003, 2005-2006 Free Software Foundation, Inc.
2
Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
4
4
This program is free software; you can redistribute it and/or modify it
5
5
under the terms of the GNU Library General Public License as published
16
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19
/* This file can be parametrized with the following macros:
20
ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
21
PRINTF_FETCHARGS Name of the function to be defined.
22
STATIC Set to 'static' to declare the function static. */
24
#ifndef PRINTF_FETCHARGS
21
28
/* Specification. */
22
#include "printf-args.h"
29
#ifndef PRINTF_FETCHARGS
30
# include "printf-args.h"
28
printf_fetchargs (va_list args, arguments *a)
37
PRINTF_FETCHARGS (va_list args, arguments *a)
69
78
ap->a.a_double = va_arg (args, double);
71
#ifdef HAVE_LONG_DOUBLE
72
80
case TYPE_LONGDOUBLE:
73
81
ap->a.a_longdouble = va_arg (args, long double);
77
84
ap->a.a_char = va_arg (args, int);
80
87
case TYPE_WIDE_CHAR:
81
88
/* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
82
89
default argument promotions", this is not the case in mingw32,
129
136
case TYPE_COUNT_LONGINT_POINTER:
130
137
ap->a.a_count_longint_pointer = va_arg (args, long int *);
132
#ifdef HAVE_LONG_LONG_INT
139
#if HAVE_LONG_LONG_INT
133
140
case TYPE_COUNT_LONGLONGINT_POINTER:
134
141
ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
145
/* The unistdio extensions. */
147
ap->a.a_u8_string = va_arg (args, const uint8_t *);
148
/* A null pointer is an invalid argument for "%U", but in practice
149
it occurs quite frequently in printf statements that produce
150
debug output. Use a fallback in this case. */
151
if (ap->a.a_u8_string == NULL)
153
static const uint8_t u8_null_string[] =
154
{ '(', 'N', 'U', 'L', 'L', ')', 0 };
155
ap->a.a_u8_string = u8_null_string;
158
case TYPE_U16_STRING:
159
ap->a.a_u16_string = va_arg (args, const uint16_t *);
160
/* A null pointer is an invalid argument for "%lU", but in practice
161
it occurs quite frequently in printf statements that produce
162
debug output. Use a fallback in this case. */
163
if (ap->a.a_u16_string == NULL)
165
static const uint16_t u16_null_string[] =
166
{ '(', 'N', 'U', 'L', 'L', ')', 0 };
167
ap->a.a_u16_string = u16_null_string;
170
case TYPE_U32_STRING:
171
ap->a.a_u32_string = va_arg (args, const uint32_t *);
172
/* A null pointer is an invalid argument for "%llU", but in practice
173
it occurs quite frequently in printf statements that produce
174
debug output. Use a fallback in this case. */
175
if (ap->a.a_u32_string == NULL)
177
static const uint32_t u32_null_string[] =
178
{ '(', 'N', 'U', 'L', 'L', ')', 0 };
179
ap->a.a_u32_string = u32_null_string;
138
184
/* Unknown type. */