1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Decomposed printf argument list.
4 Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2011 Free Software
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21 /* This file can be parametrized with the following macros:
22 ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
23 PRINTF_FETCHARGS Name of the function to be defined.
24 STATIC Set to 'static' to declare the function static. */
26 #ifndef PRINTF_FETCHARGS
31 #ifndef PRINTF_FETCHARGS
32 # include "printf-args.h"
39 PRINTF_FETCHARGS (va_list args
, arguments
*a
)
44 for (i
= 0, ap
= &a
->arg
[0]; i
< a
->count
; i
++, ap
++)
48 ap
->a
.a_schar
= va_arg (args
, /*signed char*/ int);
51 ap
->a
.a_uchar
= va_arg (args
, /*unsigned char*/ int);
54 ap
->a
.a_short
= va_arg (args
, /*short*/ int);
57 ap
->a
.a_ushort
= va_arg (args
, /*unsigned short*/ int);
60 ap
->a
.a_int
= va_arg (args
, int);
63 ap
->a
.a_uint
= va_arg (args
, unsigned int);
66 ap
->a
.a_longint
= va_arg (args
, long int);
69 ap
->a
.a_ulongint
= va_arg (args
, unsigned long int);
71 #if HAVE_LONG_LONG_INT
72 case TYPE_LONGLONGINT
:
73 ap
->a
.a_longlongint
= va_arg (args
, long long int);
75 case TYPE_ULONGLONGINT
:
76 ap
->a
.a_ulonglongint
= va_arg (args
, unsigned long long int);
80 ap
->a
.a_double
= va_arg (args
, double);
83 ap
->a
.a_longdouble
= va_arg (args
, long double);
86 ap
->a
.a_char
= va_arg (args
, int);
90 /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
91 default argument promotions", this is not the case in mingw32,
92 where wint_t is 'unsigned short'. */
94 (sizeof (wint_t) < sizeof (int)
95 ? (wint_t) va_arg (args
, int)
96 : va_arg (args
, wint_t));
100 ap
->a
.a_string
= va_arg (args
, const char *);
101 /* A null pointer is an invalid argument for "%s", but in practice
102 it occurs quite frequently in printf statements that produce
103 debug output. Use a fallback in this case. */
104 if (ap
->a
.a_string
== NULL
)
105 ap
->a
.a_string
= "(NULL)";
108 case TYPE_WIDE_STRING
:
109 ap
->a
.a_wide_string
= va_arg (args
, const wchar_t *);
110 /* A null pointer is an invalid argument for "%ls", but in practice
111 it occurs quite frequently in printf statements that produce
112 debug output. Use a fallback in this case. */
113 if (ap
->a
.a_wide_string
== NULL
)
115 static const wchar_t wide_null_string
[] =
118 (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
122 ap
->a
.a_wide_string
= wide_null_string
;
127 ap
->a
.a_pointer
= va_arg (args
, void *);
129 case TYPE_COUNT_SCHAR_POINTER
:
130 ap
->a
.a_count_schar_pointer
= va_arg (args
, signed char *);
132 case TYPE_COUNT_SHORT_POINTER
:
133 ap
->a
.a_count_short_pointer
= va_arg (args
, short *);
135 case TYPE_COUNT_INT_POINTER
:
136 ap
->a
.a_count_int_pointer
= va_arg (args
, int *);
138 case TYPE_COUNT_LONGINT_POINTER
:
139 ap
->a
.a_count_longint_pointer
= va_arg (args
, long int *);
141 #if HAVE_LONG_LONG_INT
142 case TYPE_COUNT_LONGLONGINT_POINTER
:
143 ap
->a
.a_count_longlongint_pointer
= va_arg (args
, long long int *);
147 /* The unistdio extensions. */
149 ap
->a
.a_u8_string
= va_arg (args
, const uint8_t *);
150 /* A null pointer is an invalid argument for "%U", but in practice
151 it occurs quite frequently in printf statements that produce
152 debug output. Use a fallback in this case. */
153 if (ap
->a
.a_u8_string
== NULL
)
155 static const uint8_t u8_null_string
[] =
156 { '(', 'N', 'U', 'L', 'L', ')', 0 };
157 ap
->a
.a_u8_string
= u8_null_string
;
160 case TYPE_U16_STRING
:
161 ap
->a
.a_u16_string
= va_arg (args
, const uint16_t *);
162 /* A null pointer is an invalid argument for "%lU", but in practice
163 it occurs quite frequently in printf statements that produce
164 debug output. Use a fallback in this case. */
165 if (ap
->a
.a_u16_string
== NULL
)
167 static const uint16_t u16_null_string
[] =
168 { '(', 'N', 'U', 'L', 'L', ')', 0 };
169 ap
->a
.a_u16_string
= u16_null_string
;
172 case TYPE_U32_STRING
:
173 ap
->a
.a_u32_string
= va_arg (args
, const uint32_t *);
174 /* A null pointer is an invalid argument for "%llU", but in practice
175 it occurs quite frequently in printf statements that produce
176 debug output. Use a fallback in this case. */
177 if (ap
->a
.a_u32_string
== NULL
)
179 static const uint32_t u32_null_string
[] =
180 { '(', 'N', 'U', 'L', 'L', ')', 0 };
181 ap
->a
.a_u32_string
= u32_null_string
;