15
15
with this program; if not, write to the Free Software Foundation,
16
16
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
/* This file can be parametrized with the following macros:
19
ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
20
PRINTF_FETCHARGS Name of the function to be defined.
21
STATIC Set to 'static' to declare the function static. */
23
#ifndef PRINTF_FETCHARGS
20
27
/* Specification. */
21
#include "printf-args.h"
28
#ifndef PRINTF_FETCHARGS
29
# include "printf-args.h"
27
printf_fetchargs (va_list args, arguments *a)
36
PRINTF_FETCHARGS (va_list args, arguments *a)
68
77
ap->a.a_double = va_arg (args, double);
71
79
case TYPE_LONGDOUBLE:
72
80
ap->a.a_longdouble = va_arg (args, long double);
76
83
ap->a.a_char = va_arg (args, int);
133
140
ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
144
/* The unistdio extensions. */
146
ap->a.a_u8_string = va_arg (args, const uint8_t *);
147
/* A null pointer is an invalid argument for "%U", but in practice
148
it occurs quite frequently in printf statements that produce
149
debug output. Use a fallback in this case. */
150
if (ap->a.a_u8_string == NULL)
152
static const uint8_t u8_null_string[] =
153
{ '(', 'N', 'U', 'L', 'L', ')', 0 };
154
ap->a.a_u8_string = u8_null_string;
157
case TYPE_U16_STRING:
158
ap->a.a_u16_string = va_arg (args, const uint16_t *);
159
/* A null pointer is an invalid argument for "%lU", but in practice
160
it occurs quite frequently in printf statements that produce
161
debug output. Use a fallback in this case. */
162
if (ap->a.a_u16_string == NULL)
164
static const uint16_t u16_null_string[] =
165
{ '(', 'N', 'U', 'L', 'L', ')', 0 };
166
ap->a.a_u16_string = u16_null_string;
169
case TYPE_U32_STRING:
170
ap->a.a_u32_string = va_arg (args, const uint32_t *);
171
/* A null pointer is an invalid argument for "%llU", but in practice
172
it occurs quite frequently in printf statements that produce
173
debug output. Use a fallback in this case. */
174
if (ap->a.a_u32_string == NULL)
176
static const uint32_t u32_null_string[] =
177
{ '(', 'N', 'U', 'L', 'L', ')', 0 };
178
ap->a.a_u32_string = u32_null_string;
137
183
/* Unknown type. */