Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
fff.h
Go to the documentation of this file.
1/*
2LICENSE
3
4The MIT License (MIT)
5
6Copyright (c) 2010 Michael Long
7
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in all
16copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24SOFTWARE.
25*/
26#ifndef FAKE_FUNCTIONS
27#define FAKE_FUNCTIONS
28
29#include <stdarg.h>
30#include <string.h> /* For memset and memcpy */
31
32#define FFF_MAX_ARGS (20u)
33#ifndef FFF_ARG_HISTORY_LEN
34#define FFF_ARG_HISTORY_LEN (50u)
35#endif
36#ifndef FFF_CALL_HISTORY_LEN
37#define FFF_CALL_HISTORY_LEN (50u)
38#endif
39#ifndef FFF_GCC_FUNCTION_ATTRIBUTES
40#define FFF_GCC_FUNCTION_ATTRIBUTES
41#endif
42#ifndef CUSTOM_FFF_FUNCTION_TEMPLATE
43#define CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN, FUNCNAME, ...) RETURN (*FUNCNAME)(__VA_ARGS__)
44#endif /* CUSTOM_FFF_FUNCTION_TEMPLATE */
45/* -- INTERNAL HELPER MACROS -- */
46#define SET_RETURN_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
47 FUNCNAME##_fake.return_val_seq = ARRAY_POINTER; \
48 FUNCNAME##_fake.return_val_seq_len = ARRAY_LEN;
49#define SET_CUSTOM_FAKE_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
50 FUNCNAME##_fake.custom_fake_seq = ARRAY_POINTER; \
51 FUNCNAME##_fake.custom_fake_seq_len = ARRAY_LEN;
52
53/* Defining a function to reset a fake function */
54#define RESET_FAKE(FUNCNAME) \
55 { \
56 FUNCNAME##_reset(); \
57 }
58
59#define DECLARE_ARG(type, n, FUNCNAME) \
60 type arg##n##_val; \
61 type arg##n##_history[FFF_ARG_HISTORY_LEN];
62
63#define DECLARE_ALL_FUNC_COMMON \
64 unsigned int call_count; \
65 unsigned int arg_history_len; \
66 unsigned int arg_histories_dropped;
67
68#define DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
69 RETURN_TYPE return_val_history[FFF_ARG_HISTORY_LEN];
70
71#define SAVE_ARG(FUNCNAME, n) \
72 memcpy((void *)&FUNCNAME##_fake.arg##n##_val, (void *)&arg##n, sizeof(arg##n));
73
74#define ROOM_FOR_MORE_HISTORY(FUNCNAME) FUNCNAME##_fake.call_count < FFF_ARG_HISTORY_LEN
75
76#define SAVE_RET_HISTORY(FUNCNAME, RETVAL) \
77 if ((FUNCNAME##_fake.call_count - 1) < FFF_ARG_HISTORY_LEN) \
78 memcpy((void *)&FUNCNAME##_fake \
79 .return_val_history[FUNCNAME##_fake.call_count - 1], \
80 (const void *)&RETVAL, sizeof(RETVAL));
81
82#define SAVE_ARG_HISTORY(FUNCNAME, ARGN) \
83 memcpy((void *)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], \
84 (void *)&arg##ARGN, sizeof(arg##ARGN));
85
86#define HISTORY_DROPPED(FUNCNAME) FUNCNAME##_fake.arg_histories_dropped++
87
88#define DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
89 RETURN_TYPE return_val; \
90 int return_val_seq_len; \
91 int return_val_seq_idx; \
92 RETURN_TYPE *return_val_seq;
93
94#define DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
95 int custom_fake_seq_len; \
96 int custom_fake_seq_idx;
97
98#define INCREMENT_CALL_COUNT(FUNCNAME) FUNCNAME##_fake.call_count++
99
100#define RETURN_FAKE_RESULT(FUNCNAME) \
101 if (FUNCNAME##_fake.return_val_seq_len) { /* then its a sequence */ \
102 if (FUNCNAME##_fake.return_val_seq_idx < FUNCNAME##_fake.return_val_seq_len) { \
103 SAVE_RET_HISTORY( \
104 FUNCNAME, \
105 FUNCNAME##_fake \
106 .return_val_seq[FUNCNAME##_fake.return_val_seq_idx]) \
107 return FUNCNAME##_fake \
108 .return_val_seq[FUNCNAME##_fake.return_val_seq_idx++]; \
109 } \
110 SAVE_RET_HISTORY( \
111 FUNCNAME, \
112 FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len - 1]) \
113 return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len - \
114 1]; /* return last element */ \
115 } \
116 SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val) \
117 return FUNCNAME##_fake.return_val;
118
119#ifdef __cplusplus
120#define FFF_EXTERN_C extern "C" {
121#define FFF_END_EXTERN_C }
122#else /* ansi c */
123#define FFF_EXTERN_C
124#define FFF_END_EXTERN_C
125#endif /* cpp/ansi c */
126
127#define DEFINE_RESET_FUNCTION(FUNCNAME) \
128 void FUNCNAME##_reset(void) \
129 { \
130 memset((void *)&FUNCNAME##_fake, 0, \
131 sizeof(FUNCNAME##_fake) - sizeof(FUNCNAME##_fake.custom_fake) - \
132 sizeof(FUNCNAME##_fake.custom_fake_seq)); \
133 FUNCNAME##_fake.custom_fake = NULL; \
134 FUNCNAME##_fake.custom_fake_seq = NULL; \
135 FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN; \
136 }
137/* -- END INTERNAL HELPER MACROS -- */
138
139typedef void (*fff_function_t)(void);
140typedef struct {
142 unsigned int call_history_idx;
144
146extern fff_globals_t fff;
148
149#define DEFINE_FFF_GLOBALS \
150 FFF_EXTERN_C \
151 fff_globals_t fff; \
152 FFF_END_EXTERN_C
153
154#define FFF_RESET_HISTORY() \
155 fff.call_history_idx = 0; \
156 memset(fff.call_history, 0, sizeof(fff.call_history));
157
158#define REGISTER_CALL(function) \
159 if (fff.call_history_idx < FFF_CALL_HISTORY_LEN) \
160 fff.call_history[fff.call_history_idx++] = (fff_function_t)function;
161
162#define DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
163 typedef struct FUNCNAME##_Fake { \
164 DECLARE_ALL_FUNC_COMMON \
165 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
166 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, void); \
167 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, void); \
168 } FUNCNAME##_Fake; \
169 extern FUNCNAME##_Fake FUNCNAME##_fake; \
170 void FUNCNAME##_reset(void); \
171 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void);
172
173#define DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
174 FUNCNAME##_Fake FUNCNAME##_fake; \
175 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void) \
176 { \
177 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
178 } else { \
179 HISTORY_DROPPED(FUNCNAME); \
180 } \
181 INCREMENT_CALL_COUNT(FUNCNAME); \
182 REGISTER_CALL(FUNCNAME); \
183 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
184 if (FUNCNAME##_fake.custom_fake_seq_idx < \
185 FUNCNAME##_fake.custom_fake_seq_len) { \
186 FUNCNAME##_fake \
187 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
188 } else { \
189 FUNCNAME##_fake \
190 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - \
191 1](); \
192 } \
193 } \
194 if (FUNCNAME##_fake.custom_fake != NULL) { \
195 FUNCNAME##_fake.custom_fake(); \
196 } \
197 } \
198 DEFINE_RESET_FUNCTION(FUNCNAME)
199
200#define FAKE_VOID_FUNC0(FUNCNAME) \
201 DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
202 DEFINE_FAKE_VOID_FUNC0(FUNCNAME)
203
204#define DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
205 typedef struct FUNCNAME##_Fake { \
206 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
207 DECLARE_ALL_FUNC_COMMON \
208 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
209 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE); \
210 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE); \
211 } FUNCNAME##_Fake; \
212 extern FUNCNAME##_Fake FUNCNAME##_fake; \
213 void FUNCNAME##_reset(void); \
214 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0);
215
216#define DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
217 FUNCNAME##_Fake FUNCNAME##_fake; \
218 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0) \
219 { \
220 SAVE_ARG(FUNCNAME, 0); \
221 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
222 SAVE_ARG_HISTORY(FUNCNAME, 0); \
223 } else { \
224 HISTORY_DROPPED(FUNCNAME); \
225 } \
226 INCREMENT_CALL_COUNT(FUNCNAME); \
227 REGISTER_CALL(FUNCNAME); \
228 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
229 if (FUNCNAME##_fake.custom_fake_seq_idx < \
230 FUNCNAME##_fake.custom_fake_seq_len) { \
231 FUNCNAME##_fake \
232 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
233 arg0); \
234 } else { \
235 FUNCNAME##_fake \
236 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
237 arg0); \
238 } \
239 } \
240 if (FUNCNAME##_fake.custom_fake != NULL) { \
241 FUNCNAME##_fake.custom_fake(arg0); \
242 } \
243 } \
244 DEFINE_RESET_FUNCTION(FUNCNAME)
245
246#define FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
247 DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
248 DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE)
249
250#define DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
251 typedef struct FUNCNAME##_Fake { \
252 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
253 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
254 DECLARE_ALL_FUNC_COMMON \
255 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
256 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE); \
257 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE); \
258 } FUNCNAME##_Fake; \
259 extern FUNCNAME##_Fake FUNCNAME##_fake; \
260 void FUNCNAME##_reset(void); \
261 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1);
262
263#define DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
264 FUNCNAME##_Fake FUNCNAME##_fake; \
265 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1) \
266 { \
267 SAVE_ARG(FUNCNAME, 0); \
268 SAVE_ARG(FUNCNAME, 1); \
269 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
270 SAVE_ARG_HISTORY(FUNCNAME, 0); \
271 SAVE_ARG_HISTORY(FUNCNAME, 1); \
272 } else { \
273 HISTORY_DROPPED(FUNCNAME); \
274 } \
275 INCREMENT_CALL_COUNT(FUNCNAME); \
276 REGISTER_CALL(FUNCNAME); \
277 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
278 if (FUNCNAME##_fake.custom_fake_seq_idx < \
279 FUNCNAME##_fake.custom_fake_seq_len) { \
280 FUNCNAME##_fake \
281 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
282 arg0, arg1); \
283 } else { \
284 FUNCNAME##_fake \
285 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
286 arg0, arg1); \
287 } \
288 } \
289 if (FUNCNAME##_fake.custom_fake != NULL) { \
290 FUNCNAME##_fake.custom_fake(arg0, arg1); \
291 } \
292 } \
293 DEFINE_RESET_FUNCTION(FUNCNAME)
294
295#define FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
296 DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
297 DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE)
298
299#define DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
300 typedef struct FUNCNAME##_Fake { \
301 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
302 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
303 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
304 DECLARE_ALL_FUNC_COMMON \
305 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
306 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE); \
307 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
308 ARG2_TYPE); \
309 } FUNCNAME##_Fake; \
310 extern FUNCNAME##_Fake FUNCNAME##_fake; \
311 void FUNCNAME##_reset(void); \
312 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2);
313
314#define DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
315 FUNCNAME##_Fake FUNCNAME##_fake; \
316 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2) \
317 { \
318 SAVE_ARG(FUNCNAME, 0); \
319 SAVE_ARG(FUNCNAME, 1); \
320 SAVE_ARG(FUNCNAME, 2); \
321 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
322 SAVE_ARG_HISTORY(FUNCNAME, 0); \
323 SAVE_ARG_HISTORY(FUNCNAME, 1); \
324 SAVE_ARG_HISTORY(FUNCNAME, 2); \
325 } else { \
326 HISTORY_DROPPED(FUNCNAME); \
327 } \
328 INCREMENT_CALL_COUNT(FUNCNAME); \
329 REGISTER_CALL(FUNCNAME); \
330 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
331 if (FUNCNAME##_fake.custom_fake_seq_idx < \
332 FUNCNAME##_fake.custom_fake_seq_len) { \
333 FUNCNAME##_fake \
334 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
335 arg0, arg1, arg2); \
336 } else { \
337 FUNCNAME##_fake \
338 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
339 arg0, arg1, arg2); \
340 } \
341 } \
342 if (FUNCNAME##_fake.custom_fake != NULL) { \
343 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
344 } \
345 } \
346 DEFINE_RESET_FUNCTION(FUNCNAME)
347
348#define FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
349 DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
350 DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE)
351
352#define DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
353 typedef struct FUNCNAME##_Fake { \
354 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
355 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
356 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
357 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
358 DECLARE_ALL_FUNC_COMMON \
359 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
360 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
361 ARG3_TYPE); \
362 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
363 ARG2_TYPE, ARG3_TYPE); \
364 } FUNCNAME##_Fake; \
365 extern FUNCNAME##_Fake FUNCNAME##_fake; \
366 void FUNCNAME##_reset(void); \
367 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
368 ARG3_TYPE arg3);
369
370#define DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
371 FUNCNAME##_Fake FUNCNAME##_fake; \
372 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
373 ARG3_TYPE arg3) \
374 { \
375 SAVE_ARG(FUNCNAME, 0); \
376 SAVE_ARG(FUNCNAME, 1); \
377 SAVE_ARG(FUNCNAME, 2); \
378 SAVE_ARG(FUNCNAME, 3); \
379 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
380 SAVE_ARG_HISTORY(FUNCNAME, 0); \
381 SAVE_ARG_HISTORY(FUNCNAME, 1); \
382 SAVE_ARG_HISTORY(FUNCNAME, 2); \
383 SAVE_ARG_HISTORY(FUNCNAME, 3); \
384 } else { \
385 HISTORY_DROPPED(FUNCNAME); \
386 } \
387 INCREMENT_CALL_COUNT(FUNCNAME); \
388 REGISTER_CALL(FUNCNAME); \
389 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
390 if (FUNCNAME##_fake.custom_fake_seq_idx < \
391 FUNCNAME##_fake.custom_fake_seq_len) { \
392 FUNCNAME##_fake \
393 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
394 arg0, arg1, arg2, arg3); \
395 } else { \
396 FUNCNAME##_fake \
397 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
398 arg0, arg1, arg2, arg3); \
399 } \
400 } \
401 if (FUNCNAME##_fake.custom_fake != NULL) { \
402 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
403 } \
404 } \
405 DEFINE_RESET_FUNCTION(FUNCNAME)
406
407#define FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
408 DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
409 DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE)
410
411#define DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
412 typedef struct FUNCNAME##_Fake { \
413 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
414 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
415 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
416 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
417 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
418 DECLARE_ALL_FUNC_COMMON \
419 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
420 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
421 ARG3_TYPE, ARG4_TYPE); \
422 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
423 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \
424 } FUNCNAME##_Fake; \
425 extern FUNCNAME##_Fake FUNCNAME##_fake; \
426 void FUNCNAME##_reset(void); \
427 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
428 ARG3_TYPE arg3, ARG4_TYPE arg4);
429
430#define DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
431 FUNCNAME##_Fake FUNCNAME##_fake; \
432 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
433 ARG3_TYPE arg3, ARG4_TYPE arg4) \
434 { \
435 SAVE_ARG(FUNCNAME, 0); \
436 SAVE_ARG(FUNCNAME, 1); \
437 SAVE_ARG(FUNCNAME, 2); \
438 SAVE_ARG(FUNCNAME, 3); \
439 SAVE_ARG(FUNCNAME, 4); \
440 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
441 SAVE_ARG_HISTORY(FUNCNAME, 0); \
442 SAVE_ARG_HISTORY(FUNCNAME, 1); \
443 SAVE_ARG_HISTORY(FUNCNAME, 2); \
444 SAVE_ARG_HISTORY(FUNCNAME, 3); \
445 SAVE_ARG_HISTORY(FUNCNAME, 4); \
446 } else { \
447 HISTORY_DROPPED(FUNCNAME); \
448 } \
449 INCREMENT_CALL_COUNT(FUNCNAME); \
450 REGISTER_CALL(FUNCNAME); \
451 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
452 if (FUNCNAME##_fake.custom_fake_seq_idx < \
453 FUNCNAME##_fake.custom_fake_seq_len) { \
454 FUNCNAME##_fake \
455 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
456 arg0, arg1, arg2, arg3, arg4); \
457 } else { \
458 FUNCNAME##_fake \
459 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
460 arg0, arg1, arg2, arg3, arg4); \
461 } \
462 } \
463 if (FUNCNAME##_fake.custom_fake != NULL) { \
464 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
465 } \
466 } \
467 DEFINE_RESET_FUNCTION(FUNCNAME)
468
469#define FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
470 DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
471 DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE)
472
473#define DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
474 ARG5_TYPE) \
475 typedef struct FUNCNAME##_Fake { \
476 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
477 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
478 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
479 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
480 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
481 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
482 DECLARE_ALL_FUNC_COMMON \
483 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
484 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
485 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
486 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
487 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
488 } FUNCNAME##_Fake; \
489 extern FUNCNAME##_Fake FUNCNAME##_fake; \
490 void FUNCNAME##_reset(void); \
491 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
492 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5);
493
494#define DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
495 ARG5_TYPE) \
496 FUNCNAME##_Fake FUNCNAME##_fake; \
497 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
498 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5) \
499 { \
500 SAVE_ARG(FUNCNAME, 0); \
501 SAVE_ARG(FUNCNAME, 1); \
502 SAVE_ARG(FUNCNAME, 2); \
503 SAVE_ARG(FUNCNAME, 3); \
504 SAVE_ARG(FUNCNAME, 4); \
505 SAVE_ARG(FUNCNAME, 5); \
506 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
507 SAVE_ARG_HISTORY(FUNCNAME, 0); \
508 SAVE_ARG_HISTORY(FUNCNAME, 1); \
509 SAVE_ARG_HISTORY(FUNCNAME, 2); \
510 SAVE_ARG_HISTORY(FUNCNAME, 3); \
511 SAVE_ARG_HISTORY(FUNCNAME, 4); \
512 SAVE_ARG_HISTORY(FUNCNAME, 5); \
513 } else { \
514 HISTORY_DROPPED(FUNCNAME); \
515 } \
516 INCREMENT_CALL_COUNT(FUNCNAME); \
517 REGISTER_CALL(FUNCNAME); \
518 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
519 if (FUNCNAME##_fake.custom_fake_seq_idx < \
520 FUNCNAME##_fake.custom_fake_seq_len) { \
521 FUNCNAME##_fake \
522 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
523 arg0, arg1, arg2, arg3, arg4, arg5); \
524 } else { \
525 FUNCNAME##_fake \
526 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
527 arg0, arg1, arg2, arg3, arg4, arg5); \
528 } \
529 } \
530 if (FUNCNAME##_fake.custom_fake != NULL) { \
531 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
532 } \
533 } \
534 DEFINE_RESET_FUNCTION(FUNCNAME)
535
536#define FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
537 ARG5_TYPE) \
538 DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
539 ARG5_TYPE) \
540 DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
541 ARG5_TYPE)
542
543#define DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
544 ARG5_TYPE, ARG6_TYPE) \
545 typedef struct FUNCNAME##_Fake { \
546 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
547 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
548 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
549 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
550 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
551 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
552 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
553 DECLARE_ALL_FUNC_COMMON \
554 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
555 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
556 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE); \
557 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
558 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
559 ARG6_TYPE); \
560 } FUNCNAME##_Fake; \
561 extern FUNCNAME##_Fake FUNCNAME##_fake; \
562 void FUNCNAME##_reset(void); \
563 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
564 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
565 ARG6_TYPE arg6);
566
567#define DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
568 ARG5_TYPE, ARG6_TYPE) \
569 FUNCNAME##_Fake FUNCNAME##_fake; \
570 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
571 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
572 ARG6_TYPE arg6) \
573 { \
574 SAVE_ARG(FUNCNAME, 0); \
575 SAVE_ARG(FUNCNAME, 1); \
576 SAVE_ARG(FUNCNAME, 2); \
577 SAVE_ARG(FUNCNAME, 3); \
578 SAVE_ARG(FUNCNAME, 4); \
579 SAVE_ARG(FUNCNAME, 5); \
580 SAVE_ARG(FUNCNAME, 6); \
581 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
582 SAVE_ARG_HISTORY(FUNCNAME, 0); \
583 SAVE_ARG_HISTORY(FUNCNAME, 1); \
584 SAVE_ARG_HISTORY(FUNCNAME, 2); \
585 SAVE_ARG_HISTORY(FUNCNAME, 3); \
586 SAVE_ARG_HISTORY(FUNCNAME, 4); \
587 SAVE_ARG_HISTORY(FUNCNAME, 5); \
588 SAVE_ARG_HISTORY(FUNCNAME, 6); \
589 } else { \
590 HISTORY_DROPPED(FUNCNAME); \
591 } \
592 INCREMENT_CALL_COUNT(FUNCNAME); \
593 REGISTER_CALL(FUNCNAME); \
594 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
595 if (FUNCNAME##_fake.custom_fake_seq_idx < \
596 FUNCNAME##_fake.custom_fake_seq_len) { \
597 FUNCNAME##_fake \
598 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
599 arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
600 } else { \
601 FUNCNAME##_fake \
602 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
603 arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
604 } \
605 } \
606 if (FUNCNAME##_fake.custom_fake != NULL) { \
607 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
608 } \
609 } \
610 DEFINE_RESET_FUNCTION(FUNCNAME)
611
612#define FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
613 ARG5_TYPE, ARG6_TYPE) \
614 DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
615 ARG5_TYPE, ARG6_TYPE) \
616 DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
617 ARG5_TYPE, ARG6_TYPE)
618
619#define DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
620 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
621 typedef struct FUNCNAME##_Fake { \
622 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
623 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
624 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
625 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
626 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
627 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
628 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
629 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
630 DECLARE_ALL_FUNC_COMMON \
631 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
632 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
633 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
634 ARG7_TYPE); \
635 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
636 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
637 ARG6_TYPE, ARG7_TYPE); \
638 } FUNCNAME##_Fake; \
639 extern FUNCNAME##_Fake FUNCNAME##_fake; \
640 void FUNCNAME##_reset(void); \
641 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
642 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
643 ARG6_TYPE arg6, ARG7_TYPE arg7);
644
645#define DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
646 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
647 FUNCNAME##_Fake FUNCNAME##_fake; \
648 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
649 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
650 ARG6_TYPE arg6, ARG7_TYPE arg7) \
651 { \
652 SAVE_ARG(FUNCNAME, 0); \
653 SAVE_ARG(FUNCNAME, 1); \
654 SAVE_ARG(FUNCNAME, 2); \
655 SAVE_ARG(FUNCNAME, 3); \
656 SAVE_ARG(FUNCNAME, 4); \
657 SAVE_ARG(FUNCNAME, 5); \
658 SAVE_ARG(FUNCNAME, 6); \
659 SAVE_ARG(FUNCNAME, 7); \
660 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
661 SAVE_ARG_HISTORY(FUNCNAME, 0); \
662 SAVE_ARG_HISTORY(FUNCNAME, 1); \
663 SAVE_ARG_HISTORY(FUNCNAME, 2); \
664 SAVE_ARG_HISTORY(FUNCNAME, 3); \
665 SAVE_ARG_HISTORY(FUNCNAME, 4); \
666 SAVE_ARG_HISTORY(FUNCNAME, 5); \
667 SAVE_ARG_HISTORY(FUNCNAME, 6); \
668 SAVE_ARG_HISTORY(FUNCNAME, 7); \
669 } else { \
670 HISTORY_DROPPED(FUNCNAME); \
671 } \
672 INCREMENT_CALL_COUNT(FUNCNAME); \
673 REGISTER_CALL(FUNCNAME); \
674 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
675 if (FUNCNAME##_fake.custom_fake_seq_idx < \
676 FUNCNAME##_fake.custom_fake_seq_len) { \
677 FUNCNAME##_fake \
678 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
679 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
680 } else { \
681 FUNCNAME##_fake \
682 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
683 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
684 } \
685 } \
686 if (FUNCNAME##_fake.custom_fake != NULL) { \
687 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
688 arg7); \
689 } \
690 } \
691 DEFINE_RESET_FUNCTION(FUNCNAME)
692
693#define FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
694 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
695 DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
696 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
697 DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
698 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE)
699
700#define DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
701 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
702 typedef struct FUNCNAME##_Fake { \
703 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
704 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
705 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
706 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
707 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
708 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
709 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
710 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
711 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
712 DECLARE_ALL_FUNC_COMMON \
713 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
714 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
715 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
716 ARG7_TYPE, ARG8_TYPE); \
717 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
718 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
719 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE); \
720 } FUNCNAME##_Fake; \
721 extern FUNCNAME##_Fake FUNCNAME##_fake; \
722 void FUNCNAME##_reset(void); \
723 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
724 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
725 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8);
726
727#define DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
728 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
729 FUNCNAME##_Fake FUNCNAME##_fake; \
730 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
731 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
732 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8) \
733 { \
734 SAVE_ARG(FUNCNAME, 0); \
735 SAVE_ARG(FUNCNAME, 1); \
736 SAVE_ARG(FUNCNAME, 2); \
737 SAVE_ARG(FUNCNAME, 3); \
738 SAVE_ARG(FUNCNAME, 4); \
739 SAVE_ARG(FUNCNAME, 5); \
740 SAVE_ARG(FUNCNAME, 6); \
741 SAVE_ARG(FUNCNAME, 7); \
742 SAVE_ARG(FUNCNAME, 8); \
743 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
744 SAVE_ARG_HISTORY(FUNCNAME, 0); \
745 SAVE_ARG_HISTORY(FUNCNAME, 1); \
746 SAVE_ARG_HISTORY(FUNCNAME, 2); \
747 SAVE_ARG_HISTORY(FUNCNAME, 3); \
748 SAVE_ARG_HISTORY(FUNCNAME, 4); \
749 SAVE_ARG_HISTORY(FUNCNAME, 5); \
750 SAVE_ARG_HISTORY(FUNCNAME, 6); \
751 SAVE_ARG_HISTORY(FUNCNAME, 7); \
752 SAVE_ARG_HISTORY(FUNCNAME, 8); \
753 } else { \
754 HISTORY_DROPPED(FUNCNAME); \
755 } \
756 INCREMENT_CALL_COUNT(FUNCNAME); \
757 REGISTER_CALL(FUNCNAME); \
758 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
759 if (FUNCNAME##_fake.custom_fake_seq_idx < \
760 FUNCNAME##_fake.custom_fake_seq_len) { \
761 FUNCNAME##_fake \
762 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
763 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
764 arg8); \
765 } else { \
766 FUNCNAME##_fake \
767 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
768 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
769 arg8); \
770 } \
771 } \
772 if (FUNCNAME##_fake.custom_fake != NULL) { \
773 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
774 arg7, arg8); \
775 } \
776 } \
777 DEFINE_RESET_FUNCTION(FUNCNAME)
778
779#define FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
780 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
781 DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
782 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
783 DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
784 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE)
785
786#define DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
787 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
788 typedef struct FUNCNAME##_Fake { \
789 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
790 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
791 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
792 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
793 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
794 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
795 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
796 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
797 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
798 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
799 DECLARE_ALL_FUNC_COMMON \
800 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
801 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
802 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
803 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
804 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
805 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
806 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
807 } FUNCNAME##_Fake; \
808 extern FUNCNAME##_Fake FUNCNAME##_fake; \
809 void FUNCNAME##_reset(void); \
810 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
811 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
812 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9);
813
814#define DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
815 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
816 FUNCNAME##_Fake FUNCNAME##_fake; \
817 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
818 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
819 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9) \
820 { \
821 SAVE_ARG(FUNCNAME, 0); \
822 SAVE_ARG(FUNCNAME, 1); \
823 SAVE_ARG(FUNCNAME, 2); \
824 SAVE_ARG(FUNCNAME, 3); \
825 SAVE_ARG(FUNCNAME, 4); \
826 SAVE_ARG(FUNCNAME, 5); \
827 SAVE_ARG(FUNCNAME, 6); \
828 SAVE_ARG(FUNCNAME, 7); \
829 SAVE_ARG(FUNCNAME, 8); \
830 SAVE_ARG(FUNCNAME, 9); \
831 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
832 SAVE_ARG_HISTORY(FUNCNAME, 0); \
833 SAVE_ARG_HISTORY(FUNCNAME, 1); \
834 SAVE_ARG_HISTORY(FUNCNAME, 2); \
835 SAVE_ARG_HISTORY(FUNCNAME, 3); \
836 SAVE_ARG_HISTORY(FUNCNAME, 4); \
837 SAVE_ARG_HISTORY(FUNCNAME, 5); \
838 SAVE_ARG_HISTORY(FUNCNAME, 6); \
839 SAVE_ARG_HISTORY(FUNCNAME, 7); \
840 SAVE_ARG_HISTORY(FUNCNAME, 8); \
841 SAVE_ARG_HISTORY(FUNCNAME, 9); \
842 } else { \
843 HISTORY_DROPPED(FUNCNAME); \
844 } \
845 INCREMENT_CALL_COUNT(FUNCNAME); \
846 REGISTER_CALL(FUNCNAME); \
847 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
848 if (FUNCNAME##_fake.custom_fake_seq_idx < \
849 FUNCNAME##_fake.custom_fake_seq_len) { \
850 FUNCNAME##_fake \
851 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
852 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
853 arg8, arg9); \
854 } else { \
855 FUNCNAME##_fake \
856 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
857 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
858 arg8, arg9); \
859 } \
860 } \
861 if (FUNCNAME##_fake.custom_fake != NULL) { \
862 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
863 arg7, arg8, arg9); \
864 } \
865 } \
866 DEFINE_RESET_FUNCTION(FUNCNAME)
867
868#define FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
869 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
870 DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
871 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
872 DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
873 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE)
874
875#define DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
876 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
877 ARG10_TYPE) \
878 typedef struct FUNCNAME##_Fake { \
879 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
880 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
881 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
882 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
883 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
884 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
885 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
886 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
887 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
888 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
889 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
890 DECLARE_ALL_FUNC_COMMON \
891 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
892 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
893 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
894 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE); \
895 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
896 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
897 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
898 ARG10_TYPE); \
899 } FUNCNAME##_Fake; \
900 extern FUNCNAME##_Fake FUNCNAME##_fake; \
901 void FUNCNAME##_reset(void); \
902 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
903 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
904 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, \
905 ARG9_TYPE arg9, ARG10_TYPE arg10);
906
907#define DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
908 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
909 FUNCNAME##_Fake FUNCNAME##_fake; \
910 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
911 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
912 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, \
913 ARG9_TYPE arg9, ARG10_TYPE arg10) \
914 { \
915 SAVE_ARG(FUNCNAME, 0); \
916 SAVE_ARG(FUNCNAME, 1); \
917 SAVE_ARG(FUNCNAME, 2); \
918 SAVE_ARG(FUNCNAME, 3); \
919 SAVE_ARG(FUNCNAME, 4); \
920 SAVE_ARG(FUNCNAME, 5); \
921 SAVE_ARG(FUNCNAME, 6); \
922 SAVE_ARG(FUNCNAME, 7); \
923 SAVE_ARG(FUNCNAME, 8); \
924 SAVE_ARG(FUNCNAME, 9); \
925 SAVE_ARG(FUNCNAME, 10); \
926 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
927 SAVE_ARG_HISTORY(FUNCNAME, 0); \
928 SAVE_ARG_HISTORY(FUNCNAME, 1); \
929 SAVE_ARG_HISTORY(FUNCNAME, 2); \
930 SAVE_ARG_HISTORY(FUNCNAME, 3); \
931 SAVE_ARG_HISTORY(FUNCNAME, 4); \
932 SAVE_ARG_HISTORY(FUNCNAME, 5); \
933 SAVE_ARG_HISTORY(FUNCNAME, 6); \
934 SAVE_ARG_HISTORY(FUNCNAME, 7); \
935 SAVE_ARG_HISTORY(FUNCNAME, 8); \
936 SAVE_ARG_HISTORY(FUNCNAME, 9); \
937 SAVE_ARG_HISTORY(FUNCNAME, 10); \
938 } else { \
939 HISTORY_DROPPED(FUNCNAME); \
940 } \
941 INCREMENT_CALL_COUNT(FUNCNAME); \
942 REGISTER_CALL(FUNCNAME); \
943 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
944 if (FUNCNAME##_fake.custom_fake_seq_idx < \
945 FUNCNAME##_fake.custom_fake_seq_len) { \
946 FUNCNAME##_fake \
947 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
948 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
949 arg8, arg9, arg10); \
950 } else { \
951 FUNCNAME##_fake \
952 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
953 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
954 arg8, arg9, arg10); \
955 } \
956 } \
957 if (FUNCNAME##_fake.custom_fake != NULL) { \
958 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
959 arg7, arg8, arg9, arg10); \
960 } \
961 } \
962 DEFINE_RESET_FUNCTION(FUNCNAME)
963
964#define FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
965 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
966 DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
967 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
968 ARG10_TYPE) \
969 DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
970 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE)
971
972#define DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
973 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
974 ARG10_TYPE, ARG11_TYPE) \
975 typedef struct FUNCNAME##_Fake { \
976 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
977 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
978 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
979 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
980 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
981 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
982 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
983 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
984 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
985 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
986 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
987 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
988 DECLARE_ALL_FUNC_COMMON \
989 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
990 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
991 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
992 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
993 ARG11_TYPE); \
994 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
995 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
996 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
997 ARG10_TYPE, ARG11_TYPE); \
998 } FUNCNAME##_Fake; \
999 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1000 void FUNCNAME##_reset(void); \
1001 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1002 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1003 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1004 ARG10_TYPE arg10, ARG11_TYPE arg11);
1005
1006#define DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1007 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1008 ARG11_TYPE) \
1009 FUNCNAME##_Fake FUNCNAME##_fake; \
1010 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1011 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1012 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1013 ARG10_TYPE arg10, ARG11_TYPE arg11) \
1014 { \
1015 SAVE_ARG(FUNCNAME, 0); \
1016 SAVE_ARG(FUNCNAME, 1); \
1017 SAVE_ARG(FUNCNAME, 2); \
1018 SAVE_ARG(FUNCNAME, 3); \
1019 SAVE_ARG(FUNCNAME, 4); \
1020 SAVE_ARG(FUNCNAME, 5); \
1021 SAVE_ARG(FUNCNAME, 6); \
1022 SAVE_ARG(FUNCNAME, 7); \
1023 SAVE_ARG(FUNCNAME, 8); \
1024 SAVE_ARG(FUNCNAME, 9); \
1025 SAVE_ARG(FUNCNAME, 10); \
1026 SAVE_ARG(FUNCNAME, 11); \
1027 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1028 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1029 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1030 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1031 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1032 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1033 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1034 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1035 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1036 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1037 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1038 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1039 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1040 } else { \
1041 HISTORY_DROPPED(FUNCNAME); \
1042 } \
1043 INCREMENT_CALL_COUNT(FUNCNAME); \
1044 REGISTER_CALL(FUNCNAME); \
1045 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1046 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1047 FUNCNAME##_fake.custom_fake_seq_len) { \
1048 FUNCNAME##_fake \
1049 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1050 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1051 arg8, arg9, arg10, arg11); \
1052 } else { \
1053 FUNCNAME##_fake \
1054 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1055 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1056 arg8, arg9, arg10, arg11); \
1057 } \
1058 } \
1059 if (FUNCNAME##_fake.custom_fake != NULL) { \
1060 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1061 arg7, arg8, arg9, arg10, arg11); \
1062 } \
1063 } \
1064 DEFINE_RESET_FUNCTION(FUNCNAME)
1065
1066#define FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1067 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1068 ARG11_TYPE) \
1069 DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1070 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1071 ARG10_TYPE, ARG11_TYPE) \
1072 DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1073 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1074 ARG11_TYPE)
1075
1076#define DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1077 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1078 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
1079 typedef struct FUNCNAME##_Fake { \
1080 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1081 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1082 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1083 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1084 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1085 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1086 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1087 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1088 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1089 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1090 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1091 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1092 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1093 DECLARE_ALL_FUNC_COMMON \
1094 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1095 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1096 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1097 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1098 ARG11_TYPE, ARG12_TYPE); \
1099 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1100 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1101 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1102 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE); \
1103 } FUNCNAME##_Fake; \
1104 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1105 void FUNCNAME##_reset(void); \
1106 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1107 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1108 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1109 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12);
1110
1111#define DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1112 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1113 ARG11_TYPE, ARG12_TYPE) \
1114 FUNCNAME##_Fake FUNCNAME##_fake; \
1115 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1116 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1117 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1118 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12) \
1119 { \
1120 SAVE_ARG(FUNCNAME, 0); \
1121 SAVE_ARG(FUNCNAME, 1); \
1122 SAVE_ARG(FUNCNAME, 2); \
1123 SAVE_ARG(FUNCNAME, 3); \
1124 SAVE_ARG(FUNCNAME, 4); \
1125 SAVE_ARG(FUNCNAME, 5); \
1126 SAVE_ARG(FUNCNAME, 6); \
1127 SAVE_ARG(FUNCNAME, 7); \
1128 SAVE_ARG(FUNCNAME, 8); \
1129 SAVE_ARG(FUNCNAME, 9); \
1130 SAVE_ARG(FUNCNAME, 10); \
1131 SAVE_ARG(FUNCNAME, 11); \
1132 SAVE_ARG(FUNCNAME, 12); \
1133 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1134 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1135 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1136 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1137 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1138 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1139 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1140 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1141 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1142 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1143 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1144 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1145 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1146 SAVE_ARG_HISTORY(FUNCNAME, 12); \
1147 } else { \
1148 HISTORY_DROPPED(FUNCNAME); \
1149 } \
1150 INCREMENT_CALL_COUNT(FUNCNAME); \
1151 REGISTER_CALL(FUNCNAME); \
1152 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1153 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1154 FUNCNAME##_fake.custom_fake_seq_len) { \
1155 FUNCNAME##_fake \
1156 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1157 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1158 arg8, arg9, arg10, arg11, arg12); \
1159 } else { \
1160 FUNCNAME##_fake \
1161 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1162 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1163 arg8, arg9, arg10, arg11, arg12); \
1164 } \
1165 } \
1166 if (FUNCNAME##_fake.custom_fake != NULL) { \
1167 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1168 arg7, arg8, arg9, arg10, arg11, arg12); \
1169 } \
1170 } \
1171 DEFINE_RESET_FUNCTION(FUNCNAME)
1172
1173#define FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1174 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1175 ARG11_TYPE, ARG12_TYPE) \
1176 DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1177 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1178 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
1179 DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1180 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1181 ARG11_TYPE, ARG12_TYPE)
1182
1183#define DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1184 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1185 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
1186 typedef struct FUNCNAME##_Fake { \
1187 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1188 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1189 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1190 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1191 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1192 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1193 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1194 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1195 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1196 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1197 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1198 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1199 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1200 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
1201 DECLARE_ALL_FUNC_COMMON \
1202 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1203 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1204 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1205 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1206 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
1207 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1208 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1209 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1210 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
1211 } FUNCNAME##_Fake; \
1212 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1213 void FUNCNAME##_reset(void); \
1214 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1215 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1216 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1217 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13);
1218
1219#define DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1220 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1221 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
1222 FUNCNAME##_Fake FUNCNAME##_fake; \
1223 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1224 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1225 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1226 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13) \
1227 { \
1228 SAVE_ARG(FUNCNAME, 0); \
1229 SAVE_ARG(FUNCNAME, 1); \
1230 SAVE_ARG(FUNCNAME, 2); \
1231 SAVE_ARG(FUNCNAME, 3); \
1232 SAVE_ARG(FUNCNAME, 4); \
1233 SAVE_ARG(FUNCNAME, 5); \
1234 SAVE_ARG(FUNCNAME, 6); \
1235 SAVE_ARG(FUNCNAME, 7); \
1236 SAVE_ARG(FUNCNAME, 8); \
1237 SAVE_ARG(FUNCNAME, 9); \
1238 SAVE_ARG(FUNCNAME, 10); \
1239 SAVE_ARG(FUNCNAME, 11); \
1240 SAVE_ARG(FUNCNAME, 12); \
1241 SAVE_ARG(FUNCNAME, 13); \
1242 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1243 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1244 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1245 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1246 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1247 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1248 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1249 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1250 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1251 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1252 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1253 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1254 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1255 SAVE_ARG_HISTORY(FUNCNAME, 12); \
1256 SAVE_ARG_HISTORY(FUNCNAME, 13); \
1257 } else { \
1258 HISTORY_DROPPED(FUNCNAME); \
1259 } \
1260 INCREMENT_CALL_COUNT(FUNCNAME); \
1261 REGISTER_CALL(FUNCNAME); \
1262 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1263 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1264 FUNCNAME##_fake.custom_fake_seq_len) { \
1265 FUNCNAME##_fake \
1266 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1267 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1268 arg8, arg9, arg10, arg11, arg12, arg13); \
1269 } else { \
1270 FUNCNAME##_fake \
1271 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1272 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1273 arg8, arg9, arg10, arg11, arg12, arg13); \
1274 } \
1275 } \
1276 if (FUNCNAME##_fake.custom_fake != NULL) { \
1277 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1278 arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
1279 } \
1280 } \
1281 DEFINE_RESET_FUNCTION(FUNCNAME)
1282
1283#define FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1284 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1285 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
1286 DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1287 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1288 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
1289 DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1290 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1291 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE)
1292
1293#define DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1294 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1295 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
1296 typedef struct FUNCNAME##_Fake { \
1297 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1298 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1299 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1300 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1301 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1302 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1303 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1304 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1305 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1306 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1307 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1308 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1309 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1310 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
1311 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
1312 DECLARE_ALL_FUNC_COMMON \
1313 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1314 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1315 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1316 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1317 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE); \
1318 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1319 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1320 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1321 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
1322 ARG14_TYPE); \
1323 } FUNCNAME##_Fake; \
1324 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1325 void FUNCNAME##_reset(void); \
1326 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1327 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1328 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1329 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1330 ARG14_TYPE arg14);
1331
1332#define DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1333 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1334 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
1335 FUNCNAME##_Fake FUNCNAME##_fake; \
1336 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1337 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1338 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1339 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1340 ARG14_TYPE arg14) \
1341 { \
1342 SAVE_ARG(FUNCNAME, 0); \
1343 SAVE_ARG(FUNCNAME, 1); \
1344 SAVE_ARG(FUNCNAME, 2); \
1345 SAVE_ARG(FUNCNAME, 3); \
1346 SAVE_ARG(FUNCNAME, 4); \
1347 SAVE_ARG(FUNCNAME, 5); \
1348 SAVE_ARG(FUNCNAME, 6); \
1349 SAVE_ARG(FUNCNAME, 7); \
1350 SAVE_ARG(FUNCNAME, 8); \
1351 SAVE_ARG(FUNCNAME, 9); \
1352 SAVE_ARG(FUNCNAME, 10); \
1353 SAVE_ARG(FUNCNAME, 11); \
1354 SAVE_ARG(FUNCNAME, 12); \
1355 SAVE_ARG(FUNCNAME, 13); \
1356 SAVE_ARG(FUNCNAME, 14); \
1357 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1358 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1359 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1360 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1361 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1362 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1363 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1364 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1365 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1366 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1367 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1368 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1369 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1370 SAVE_ARG_HISTORY(FUNCNAME, 12); \
1371 SAVE_ARG_HISTORY(FUNCNAME, 13); \
1372 SAVE_ARG_HISTORY(FUNCNAME, 14); \
1373 } else { \
1374 HISTORY_DROPPED(FUNCNAME); \
1375 } \
1376 INCREMENT_CALL_COUNT(FUNCNAME); \
1377 REGISTER_CALL(FUNCNAME); \
1378 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1379 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1380 FUNCNAME##_fake.custom_fake_seq_len) { \
1381 FUNCNAME##_fake \
1382 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1383 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1384 arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
1385 } else { \
1386 FUNCNAME##_fake \
1387 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1388 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1389 arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
1390 } \
1391 } \
1392 if (FUNCNAME##_fake.custom_fake != NULL) { \
1393 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1394 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
1395 arg14); \
1396 } \
1397 } \
1398 DEFINE_RESET_FUNCTION(FUNCNAME)
1399
1400#define FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1401 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1402 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
1403 DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1404 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1405 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
1406 DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1407 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1408 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE)
1409
1410#define DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1411 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1412 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1413 ARG15_TYPE) \
1414 typedef struct FUNCNAME##_Fake { \
1415 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1416 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1417 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1418 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1419 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1420 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1421 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1422 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1423 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1424 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1425 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1426 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1427 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1428 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
1429 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
1430 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
1431 DECLARE_ALL_FUNC_COMMON \
1432 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1433 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1434 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1435 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1436 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1437 ARG15_TYPE); \
1438 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1439 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1440 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1441 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
1442 ARG14_TYPE, ARG15_TYPE); \
1443 } FUNCNAME##_Fake; \
1444 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1445 void FUNCNAME##_reset(void); \
1446 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1447 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1448 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1449 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1450 ARG14_TYPE arg14, ARG15_TYPE arg15);
1451
1452#define DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1453 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1454 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
1455 FUNCNAME##_Fake FUNCNAME##_fake; \
1456 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1457 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1458 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1459 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1460 ARG14_TYPE arg14, ARG15_TYPE arg15) \
1461 { \
1462 SAVE_ARG(FUNCNAME, 0); \
1463 SAVE_ARG(FUNCNAME, 1); \
1464 SAVE_ARG(FUNCNAME, 2); \
1465 SAVE_ARG(FUNCNAME, 3); \
1466 SAVE_ARG(FUNCNAME, 4); \
1467 SAVE_ARG(FUNCNAME, 5); \
1468 SAVE_ARG(FUNCNAME, 6); \
1469 SAVE_ARG(FUNCNAME, 7); \
1470 SAVE_ARG(FUNCNAME, 8); \
1471 SAVE_ARG(FUNCNAME, 9); \
1472 SAVE_ARG(FUNCNAME, 10); \
1473 SAVE_ARG(FUNCNAME, 11); \
1474 SAVE_ARG(FUNCNAME, 12); \
1475 SAVE_ARG(FUNCNAME, 13); \
1476 SAVE_ARG(FUNCNAME, 14); \
1477 SAVE_ARG(FUNCNAME, 15); \
1478 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1479 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1480 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1481 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1482 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1483 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1484 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1485 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1486 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1487 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1488 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1489 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1490 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1491 SAVE_ARG_HISTORY(FUNCNAME, 12); \
1492 SAVE_ARG_HISTORY(FUNCNAME, 13); \
1493 SAVE_ARG_HISTORY(FUNCNAME, 14); \
1494 SAVE_ARG_HISTORY(FUNCNAME, 15); \
1495 } else { \
1496 HISTORY_DROPPED(FUNCNAME); \
1497 } \
1498 INCREMENT_CALL_COUNT(FUNCNAME); \
1499 REGISTER_CALL(FUNCNAME); \
1500 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1501 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1502 FUNCNAME##_fake.custom_fake_seq_len) { \
1503 FUNCNAME##_fake \
1504 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1505 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1506 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1507 arg15); \
1508 } else { \
1509 FUNCNAME##_fake \
1510 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1511 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1512 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1513 arg15); \
1514 } \
1515 } \
1516 if (FUNCNAME##_fake.custom_fake != NULL) { \
1517 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1518 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
1519 arg14, arg15); \
1520 } \
1521 } \
1522 DEFINE_RESET_FUNCTION(FUNCNAME)
1523
1524#define FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1525 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1526 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
1527 DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1528 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1529 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1530 ARG15_TYPE) \
1531 DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1532 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1533 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE)
1534
1535#define DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1536 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1537 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1538 ARG15_TYPE, ARG16_TYPE) \
1539 typedef struct FUNCNAME##_Fake { \
1540 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1541 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1542 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1543 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1544 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1545 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1546 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1547 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1548 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1549 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1550 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1551 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1552 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1553 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
1554 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
1555 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
1556 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
1557 DECLARE_ALL_FUNC_COMMON \
1558 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1559 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1560 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1561 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1562 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1563 ARG15_TYPE, ARG16_TYPE); \
1564 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1565 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1566 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1567 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
1568 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE); \
1569 } FUNCNAME##_Fake; \
1570 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1571 void FUNCNAME##_reset(void); \
1572 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1573 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1574 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1575 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1576 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16);
1577
1578#define DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1579 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1580 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
1581 ARG16_TYPE) \
1582 FUNCNAME##_Fake FUNCNAME##_fake; \
1583 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1584 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1585 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1586 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1587 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16) \
1588 { \
1589 SAVE_ARG(FUNCNAME, 0); \
1590 SAVE_ARG(FUNCNAME, 1); \
1591 SAVE_ARG(FUNCNAME, 2); \
1592 SAVE_ARG(FUNCNAME, 3); \
1593 SAVE_ARG(FUNCNAME, 4); \
1594 SAVE_ARG(FUNCNAME, 5); \
1595 SAVE_ARG(FUNCNAME, 6); \
1596 SAVE_ARG(FUNCNAME, 7); \
1597 SAVE_ARG(FUNCNAME, 8); \
1598 SAVE_ARG(FUNCNAME, 9); \
1599 SAVE_ARG(FUNCNAME, 10); \
1600 SAVE_ARG(FUNCNAME, 11); \
1601 SAVE_ARG(FUNCNAME, 12); \
1602 SAVE_ARG(FUNCNAME, 13); \
1603 SAVE_ARG(FUNCNAME, 14); \
1604 SAVE_ARG(FUNCNAME, 15); \
1605 SAVE_ARG(FUNCNAME, 16); \
1606 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1607 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1608 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1609 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1610 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1611 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1612 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1613 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1614 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1615 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1616 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1617 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1618 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1619 SAVE_ARG_HISTORY(FUNCNAME, 12); \
1620 SAVE_ARG_HISTORY(FUNCNAME, 13); \
1621 SAVE_ARG_HISTORY(FUNCNAME, 14); \
1622 SAVE_ARG_HISTORY(FUNCNAME, 15); \
1623 SAVE_ARG_HISTORY(FUNCNAME, 16); \
1624 } else { \
1625 HISTORY_DROPPED(FUNCNAME); \
1626 } \
1627 INCREMENT_CALL_COUNT(FUNCNAME); \
1628 REGISTER_CALL(FUNCNAME); \
1629 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1630 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1631 FUNCNAME##_fake.custom_fake_seq_len) { \
1632 FUNCNAME##_fake \
1633 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1634 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1635 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1636 arg15, arg16); \
1637 } else { \
1638 FUNCNAME##_fake \
1639 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1640 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1641 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1642 arg15, arg16); \
1643 } \
1644 } \
1645 if (FUNCNAME##_fake.custom_fake != NULL) { \
1646 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1647 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
1648 arg14, arg15, arg16); \
1649 } \
1650 } \
1651 DEFINE_RESET_FUNCTION(FUNCNAME)
1652
1653#define FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1654 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1655 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
1656 DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1657 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1658 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1659 ARG15_TYPE, ARG16_TYPE) \
1660 DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1661 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1662 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
1663 ARG16_TYPE)
1664
1665#define DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1666 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1667 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1668 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
1669 typedef struct FUNCNAME##_Fake { \
1670 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1671 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1672 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1673 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1674 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1675 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1676 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1677 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1678 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1679 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1680 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1681 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1682 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1683 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
1684 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
1685 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
1686 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
1687 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
1688 DECLARE_ALL_FUNC_COMMON \
1689 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1690 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1691 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1692 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1693 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1694 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
1695 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1696 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1697 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1698 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
1699 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
1700 } FUNCNAME##_Fake; \
1701 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1702 void FUNCNAME##_reset(void); \
1703 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1704 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1705 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1706 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1707 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17);
1708
1709#define DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1710 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1711 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
1712 ARG16_TYPE, ARG17_TYPE) \
1713 FUNCNAME##_Fake FUNCNAME##_fake; \
1714 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1715 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1716 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1717 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1718 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17) \
1719 { \
1720 SAVE_ARG(FUNCNAME, 0); \
1721 SAVE_ARG(FUNCNAME, 1); \
1722 SAVE_ARG(FUNCNAME, 2); \
1723 SAVE_ARG(FUNCNAME, 3); \
1724 SAVE_ARG(FUNCNAME, 4); \
1725 SAVE_ARG(FUNCNAME, 5); \
1726 SAVE_ARG(FUNCNAME, 6); \
1727 SAVE_ARG(FUNCNAME, 7); \
1728 SAVE_ARG(FUNCNAME, 8); \
1729 SAVE_ARG(FUNCNAME, 9); \
1730 SAVE_ARG(FUNCNAME, 10); \
1731 SAVE_ARG(FUNCNAME, 11); \
1732 SAVE_ARG(FUNCNAME, 12); \
1733 SAVE_ARG(FUNCNAME, 13); \
1734 SAVE_ARG(FUNCNAME, 14); \
1735 SAVE_ARG(FUNCNAME, 15); \
1736 SAVE_ARG(FUNCNAME, 16); \
1737 SAVE_ARG(FUNCNAME, 17); \
1738 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1739 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1740 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1741 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1742 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1743 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1744 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1745 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1746 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1747 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1748 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1749 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1750 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1751 SAVE_ARG_HISTORY(FUNCNAME, 12); \
1752 SAVE_ARG_HISTORY(FUNCNAME, 13); \
1753 SAVE_ARG_HISTORY(FUNCNAME, 14); \
1754 SAVE_ARG_HISTORY(FUNCNAME, 15); \
1755 SAVE_ARG_HISTORY(FUNCNAME, 16); \
1756 SAVE_ARG_HISTORY(FUNCNAME, 17); \
1757 } else { \
1758 HISTORY_DROPPED(FUNCNAME); \
1759 } \
1760 INCREMENT_CALL_COUNT(FUNCNAME); \
1761 REGISTER_CALL(FUNCNAME); \
1762 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1763 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1764 FUNCNAME##_fake.custom_fake_seq_len) { \
1765 FUNCNAME##_fake \
1766 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1767 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1768 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1769 arg15, arg16, arg17); \
1770 } else { \
1771 FUNCNAME##_fake \
1772 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1773 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1774 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1775 arg15, arg16, arg17); \
1776 } \
1777 } \
1778 if (FUNCNAME##_fake.custom_fake != NULL) { \
1779 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1780 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
1781 arg14, arg15, arg16, arg17); \
1782 } \
1783 } \
1784 DEFINE_RESET_FUNCTION(FUNCNAME)
1785
1786#define FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1787 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1788 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, \
1789 ARG17_TYPE) \
1790 DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1791 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1792 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1793 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
1794 DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1795 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1796 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
1797 ARG16_TYPE, ARG17_TYPE)
1798
1799#define DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1800 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1801 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1802 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
1803 typedef struct FUNCNAME##_Fake { \
1804 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1805 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1806 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1807 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1808 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1809 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1810 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1811 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1812 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1813 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1814 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1815 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1816 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1817 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
1818 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
1819 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
1820 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
1821 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
1822 DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
1823 DECLARE_ALL_FUNC_COMMON \
1824 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1825 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1826 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1827 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1828 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1829 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE); \
1830 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1831 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1832 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1833 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
1834 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
1835 ARG18_TYPE); \
1836 } FUNCNAME##_Fake; \
1837 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1838 void FUNCNAME##_reset(void); \
1839 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1840 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1841 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1842 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1843 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
1844 ARG18_TYPE arg18);
1845
1846#define DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1847 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1848 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
1849 ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
1850 FUNCNAME##_Fake FUNCNAME##_fake; \
1851 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1852 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1853 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1854 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1855 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
1856 ARG18_TYPE arg18) \
1857 { \
1858 SAVE_ARG(FUNCNAME, 0); \
1859 SAVE_ARG(FUNCNAME, 1); \
1860 SAVE_ARG(FUNCNAME, 2); \
1861 SAVE_ARG(FUNCNAME, 3); \
1862 SAVE_ARG(FUNCNAME, 4); \
1863 SAVE_ARG(FUNCNAME, 5); \
1864 SAVE_ARG(FUNCNAME, 6); \
1865 SAVE_ARG(FUNCNAME, 7); \
1866 SAVE_ARG(FUNCNAME, 8); \
1867 SAVE_ARG(FUNCNAME, 9); \
1868 SAVE_ARG(FUNCNAME, 10); \
1869 SAVE_ARG(FUNCNAME, 11); \
1870 SAVE_ARG(FUNCNAME, 12); \
1871 SAVE_ARG(FUNCNAME, 13); \
1872 SAVE_ARG(FUNCNAME, 14); \
1873 SAVE_ARG(FUNCNAME, 15); \
1874 SAVE_ARG(FUNCNAME, 16); \
1875 SAVE_ARG(FUNCNAME, 17); \
1876 SAVE_ARG(FUNCNAME, 18); \
1877 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
1878 SAVE_ARG_HISTORY(FUNCNAME, 0); \
1879 SAVE_ARG_HISTORY(FUNCNAME, 1); \
1880 SAVE_ARG_HISTORY(FUNCNAME, 2); \
1881 SAVE_ARG_HISTORY(FUNCNAME, 3); \
1882 SAVE_ARG_HISTORY(FUNCNAME, 4); \
1883 SAVE_ARG_HISTORY(FUNCNAME, 5); \
1884 SAVE_ARG_HISTORY(FUNCNAME, 6); \
1885 SAVE_ARG_HISTORY(FUNCNAME, 7); \
1886 SAVE_ARG_HISTORY(FUNCNAME, 8); \
1887 SAVE_ARG_HISTORY(FUNCNAME, 9); \
1888 SAVE_ARG_HISTORY(FUNCNAME, 10); \
1889 SAVE_ARG_HISTORY(FUNCNAME, 11); \
1890 SAVE_ARG_HISTORY(FUNCNAME, 12); \
1891 SAVE_ARG_HISTORY(FUNCNAME, 13); \
1892 SAVE_ARG_HISTORY(FUNCNAME, 14); \
1893 SAVE_ARG_HISTORY(FUNCNAME, 15); \
1894 SAVE_ARG_HISTORY(FUNCNAME, 16); \
1895 SAVE_ARG_HISTORY(FUNCNAME, 17); \
1896 SAVE_ARG_HISTORY(FUNCNAME, 18); \
1897 } else { \
1898 HISTORY_DROPPED(FUNCNAME); \
1899 } \
1900 INCREMENT_CALL_COUNT(FUNCNAME); \
1901 REGISTER_CALL(FUNCNAME); \
1902 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
1903 if (FUNCNAME##_fake.custom_fake_seq_idx < \
1904 FUNCNAME##_fake.custom_fake_seq_len) { \
1905 FUNCNAME##_fake \
1906 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
1907 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1908 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1909 arg15, arg16, arg17, arg18); \
1910 } else { \
1911 FUNCNAME##_fake \
1912 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
1913 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
1914 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
1915 arg15, arg16, arg17, arg18); \
1916 } \
1917 } \
1918 if (FUNCNAME##_fake.custom_fake != NULL) { \
1919 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
1920 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
1921 arg14, arg15, arg16, arg17, arg18); \
1922 } \
1923 } \
1924 DEFINE_RESET_FUNCTION(FUNCNAME)
1925
1926#define FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1927 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1928 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, \
1929 ARG17_TYPE, ARG18_TYPE) \
1930 DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1931 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1932 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1933 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
1934 DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1935 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1936 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
1937 ARG16_TYPE, ARG17_TYPE, ARG18_TYPE)
1938
1939#define DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1940 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1941 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1942 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
1943 typedef struct FUNCNAME##_Fake { \
1944 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
1945 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
1946 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
1947 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
1948 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
1949 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
1950 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
1951 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
1952 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
1953 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
1954 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
1955 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
1956 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
1957 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
1958 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
1959 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
1960 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
1961 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
1962 DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
1963 DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
1964 DECLARE_ALL_FUNC_COMMON \
1965 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
1966 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
1967 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
1968 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1969 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
1970 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, \
1971 ARG19_TYPE); \
1972 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
1973 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
1974 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
1975 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
1976 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
1977 ARG18_TYPE, ARG19_TYPE); \
1978 } FUNCNAME##_Fake; \
1979 extern FUNCNAME##_Fake FUNCNAME##_fake; \
1980 void FUNCNAME##_reset(void); \
1981 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1982 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1983 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1984 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1985 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
1986 ARG18_TYPE arg18, ARG19_TYPE arg19);
1987
1988#define DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
1989 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
1990 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
1991 ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
1992 FUNCNAME##_Fake FUNCNAME##_fake; \
1993 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
1994 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
1995 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
1996 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
1997 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
1998 ARG18_TYPE arg18, ARG19_TYPE arg19) \
1999 { \
2000 SAVE_ARG(FUNCNAME, 0); \
2001 SAVE_ARG(FUNCNAME, 1); \
2002 SAVE_ARG(FUNCNAME, 2); \
2003 SAVE_ARG(FUNCNAME, 3); \
2004 SAVE_ARG(FUNCNAME, 4); \
2005 SAVE_ARG(FUNCNAME, 5); \
2006 SAVE_ARG(FUNCNAME, 6); \
2007 SAVE_ARG(FUNCNAME, 7); \
2008 SAVE_ARG(FUNCNAME, 8); \
2009 SAVE_ARG(FUNCNAME, 9); \
2010 SAVE_ARG(FUNCNAME, 10); \
2011 SAVE_ARG(FUNCNAME, 11); \
2012 SAVE_ARG(FUNCNAME, 12); \
2013 SAVE_ARG(FUNCNAME, 13); \
2014 SAVE_ARG(FUNCNAME, 14); \
2015 SAVE_ARG(FUNCNAME, 15); \
2016 SAVE_ARG(FUNCNAME, 16); \
2017 SAVE_ARG(FUNCNAME, 17); \
2018 SAVE_ARG(FUNCNAME, 18); \
2019 SAVE_ARG(FUNCNAME, 19); \
2020 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2021 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2022 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2023 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2024 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2025 SAVE_ARG_HISTORY(FUNCNAME, 4); \
2026 SAVE_ARG_HISTORY(FUNCNAME, 5); \
2027 SAVE_ARG_HISTORY(FUNCNAME, 6); \
2028 SAVE_ARG_HISTORY(FUNCNAME, 7); \
2029 SAVE_ARG_HISTORY(FUNCNAME, 8); \
2030 SAVE_ARG_HISTORY(FUNCNAME, 9); \
2031 SAVE_ARG_HISTORY(FUNCNAME, 10); \
2032 SAVE_ARG_HISTORY(FUNCNAME, 11); \
2033 SAVE_ARG_HISTORY(FUNCNAME, 12); \
2034 SAVE_ARG_HISTORY(FUNCNAME, 13); \
2035 SAVE_ARG_HISTORY(FUNCNAME, 14); \
2036 SAVE_ARG_HISTORY(FUNCNAME, 15); \
2037 SAVE_ARG_HISTORY(FUNCNAME, 16); \
2038 SAVE_ARG_HISTORY(FUNCNAME, 17); \
2039 SAVE_ARG_HISTORY(FUNCNAME, 18); \
2040 SAVE_ARG_HISTORY(FUNCNAME, 19); \
2041 } else { \
2042 HISTORY_DROPPED(FUNCNAME); \
2043 } \
2044 INCREMENT_CALL_COUNT(FUNCNAME); \
2045 REGISTER_CALL(FUNCNAME); \
2046 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2047 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2048 FUNCNAME##_fake.custom_fake_seq_len) { \
2049 FUNCNAME##_fake \
2050 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
2051 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
2052 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
2053 arg15, arg16, arg17, arg18, arg19); \
2054 } else { \
2055 FUNCNAME##_fake \
2056 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2057 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
2058 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
2059 arg15, arg16, arg17, arg18, arg19); \
2060 } \
2061 } \
2062 if (FUNCNAME##_fake.custom_fake != NULL) { \
2063 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
2064 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
2065 arg14, arg15, arg16, arg17, arg18, arg19); \
2066 } \
2067 } \
2068 DEFINE_RESET_FUNCTION(FUNCNAME)
2069
2070#define FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
2071 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
2072 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, \
2073 ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
2074 DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
2075 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
2076 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
2077 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
2078 DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
2079 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
2080 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
2081 ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE)
2082
2083#define DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
2084 typedef struct FUNCNAME##_Fake { \
2085 DECLARE_ALL_FUNC_COMMON \
2086 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2087 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2088 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2089 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, void); \
2090 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, void); \
2091 } FUNCNAME##_Fake; \
2092 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2093 void FUNCNAME##_reset(void); \
2094 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void);
2095
2096#define DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
2097 FUNCNAME##_Fake FUNCNAME##_fake; \
2098 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void) \
2099 { \
2100 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2101 } else { \
2102 HISTORY_DROPPED(FUNCNAME); \
2103 } \
2104 INCREMENT_CALL_COUNT(FUNCNAME); \
2105 REGISTER_CALL(FUNCNAME); \
2106 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2107 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2108 FUNCNAME##_fake.custom_fake_seq_len) { \
2109 RETURN_TYPE ret = \
2110 FUNCNAME##_fake.custom_fake_seq \
2111 [FUNCNAME##_fake.custom_fake_seq_idx++](); \
2112 SAVE_RET_HISTORY(FUNCNAME, ret); \
2113 return ret; \
2114 } else { \
2115 RETURN_TYPE ret = \
2116 FUNCNAME##_fake.custom_fake_seq \
2117 [FUNCNAME##_fake.custom_fake_seq_len - 1](); \
2118 SAVE_RET_HISTORY(FUNCNAME, ret); \
2119 return ret; \
2120 return FUNCNAME##_fake \
2121 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - \
2122 1](); \
2123 } \
2124 } \
2125 if (FUNCNAME##_fake.custom_fake != NULL) { \
2126 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(); \
2127 SAVE_RET_HISTORY(FUNCNAME, ret); \
2128 return ret; \
2129 return FUNCNAME##_fake.custom_fake(); \
2130 } \
2131 RETURN_FAKE_RESULT(FUNCNAME) \
2132 } \
2133 DEFINE_RESET_FUNCTION(FUNCNAME)
2134
2135#define FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
2136 DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
2137 DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME)
2138
2139#define DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
2140 typedef struct FUNCNAME##_Fake { \
2141 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2142 DECLARE_ALL_FUNC_COMMON \
2143 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2144 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2145 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2146 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE); \
2147 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE); \
2148 } FUNCNAME##_Fake; \
2149 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2150 void FUNCNAME##_reset(void); \
2151 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0);
2152
2153#define DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
2154 FUNCNAME##_Fake FUNCNAME##_fake; \
2155 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0) \
2156 { \
2157 SAVE_ARG(FUNCNAME, 0); \
2158 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2159 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2160 } else { \
2161 HISTORY_DROPPED(FUNCNAME); \
2162 } \
2163 INCREMENT_CALL_COUNT(FUNCNAME); \
2164 REGISTER_CALL(FUNCNAME); \
2165 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2166 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2167 FUNCNAME##_fake.custom_fake_seq_len) { \
2168 RETURN_TYPE ret = \
2169 FUNCNAME##_fake.custom_fake_seq \
2170 [FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
2171 SAVE_RET_HISTORY(FUNCNAME, ret); \
2172 return ret; \
2173 } else { \
2174 RETURN_TYPE ret = \
2175 FUNCNAME##_fake.custom_fake_seq \
2176 [FUNCNAME##_fake.custom_fake_seq_len - 1](arg0); \
2177 SAVE_RET_HISTORY(FUNCNAME, ret); \
2178 return ret; \
2179 return FUNCNAME##_fake \
2180 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2181 arg0); \
2182 } \
2183 } \
2184 if (FUNCNAME##_fake.custom_fake != NULL) { \
2185 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0); \
2186 SAVE_RET_HISTORY(FUNCNAME, ret); \
2187 return ret; \
2188 return FUNCNAME##_fake.custom_fake(arg0); \
2189 } \
2190 RETURN_FAKE_RESULT(FUNCNAME) \
2191 } \
2192 DEFINE_RESET_FUNCTION(FUNCNAME)
2193
2194#define FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
2195 DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
2196 DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE)
2197
2198#define DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
2199 typedef struct FUNCNAME##_Fake { \
2200 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2201 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2202 DECLARE_ALL_FUNC_COMMON \
2203 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2204 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2205 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2206 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE); \
2207 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE); \
2208 } FUNCNAME##_Fake; \
2209 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2210 void FUNCNAME##_reset(void); \
2211 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1);
2212
2213#define DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
2214 FUNCNAME##_Fake FUNCNAME##_fake; \
2215 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1) \
2216 { \
2217 SAVE_ARG(FUNCNAME, 0); \
2218 SAVE_ARG(FUNCNAME, 1); \
2219 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2220 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2221 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2222 } else { \
2223 HISTORY_DROPPED(FUNCNAME); \
2224 } \
2225 INCREMENT_CALL_COUNT(FUNCNAME); \
2226 REGISTER_CALL(FUNCNAME); \
2227 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2228 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2229 FUNCNAME##_fake.custom_fake_seq_len) { \
2230 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
2231 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2232 arg0, arg1); \
2233 SAVE_RET_HISTORY(FUNCNAME, ret); \
2234 return ret; \
2235 } else { \
2236 RETURN_TYPE ret = \
2237 FUNCNAME##_fake.custom_fake_seq \
2238 [FUNCNAME##_fake.custom_fake_seq_len - 1](arg0, \
2239 arg1); \
2240 SAVE_RET_HISTORY(FUNCNAME, ret); \
2241 return ret; \
2242 return FUNCNAME##_fake \
2243 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2244 arg0, arg1); \
2245 } \
2246 } \
2247 if (FUNCNAME##_fake.custom_fake != NULL) { \
2248 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1); \
2249 SAVE_RET_HISTORY(FUNCNAME, ret); \
2250 return ret; \
2251 return FUNCNAME##_fake.custom_fake(arg0, arg1); \
2252 } \
2253 RETURN_FAKE_RESULT(FUNCNAME) \
2254 } \
2255 DEFINE_RESET_FUNCTION(FUNCNAME)
2256
2257#define FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
2258 DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
2259 DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE)
2260
2261#define DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
2262 typedef struct FUNCNAME##_Fake { \
2263 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2264 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2265 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2266 DECLARE_ALL_FUNC_COMMON \
2267 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2268 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2269 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2270 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2271 ARG2_TYPE); \
2272 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2273 ARG2_TYPE); \
2274 } FUNCNAME##_Fake; \
2275 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2276 void FUNCNAME##_reset(void); \
2277 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
2278 ARG2_TYPE arg2);
2279
2280#define DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
2281 FUNCNAME##_Fake FUNCNAME##_fake; \
2282 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
2283 ARG2_TYPE arg2) \
2284 { \
2285 SAVE_ARG(FUNCNAME, 0); \
2286 SAVE_ARG(FUNCNAME, 1); \
2287 SAVE_ARG(FUNCNAME, 2); \
2288 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2289 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2290 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2291 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2292 } else { \
2293 HISTORY_DROPPED(FUNCNAME); \
2294 } \
2295 INCREMENT_CALL_COUNT(FUNCNAME); \
2296 REGISTER_CALL(FUNCNAME); \
2297 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2298 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2299 FUNCNAME##_fake.custom_fake_seq_len) { \
2300 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
2301 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2302 arg0, arg1, arg2); \
2303 SAVE_RET_HISTORY(FUNCNAME, ret); \
2304 return ret; \
2305 } else { \
2306 RETURN_TYPE ret = \
2307 FUNCNAME##_fake.custom_fake_seq \
2308 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2309 arg0, arg1, arg2); \
2310 SAVE_RET_HISTORY(FUNCNAME, ret); \
2311 return ret; \
2312 return FUNCNAME##_fake \
2313 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2314 arg0, arg1, arg2); \
2315 } \
2316 } \
2317 if (FUNCNAME##_fake.custom_fake != NULL) { \
2318 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
2319 SAVE_RET_HISTORY(FUNCNAME, ret); \
2320 return ret; \
2321 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
2322 } \
2323 RETURN_FAKE_RESULT(FUNCNAME) \
2324 } \
2325 DEFINE_RESET_FUNCTION(FUNCNAME)
2326
2327#define FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
2328 DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
2329 DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE)
2330
2331#define DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2332 ARG3_TYPE) \
2333 typedef struct FUNCNAME##_Fake { \
2334 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2335 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2336 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2337 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2338 DECLARE_ALL_FUNC_COMMON \
2339 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2340 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2341 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2342 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2343 ARG2_TYPE, ARG3_TYPE); \
2344 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2345 ARG2_TYPE, ARG3_TYPE); \
2346 } FUNCNAME##_Fake; \
2347 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2348 void FUNCNAME##_reset(void); \
2349 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
2350 ARG2_TYPE arg2, ARG3_TYPE arg3);
2351
2352#define DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
2353 FUNCNAME##_Fake FUNCNAME##_fake; \
2354 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
2355 ARG2_TYPE arg2, ARG3_TYPE arg3) \
2356 { \
2357 SAVE_ARG(FUNCNAME, 0); \
2358 SAVE_ARG(FUNCNAME, 1); \
2359 SAVE_ARG(FUNCNAME, 2); \
2360 SAVE_ARG(FUNCNAME, 3); \
2361 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2362 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2363 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2364 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2365 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2366 } else { \
2367 HISTORY_DROPPED(FUNCNAME); \
2368 } \
2369 INCREMENT_CALL_COUNT(FUNCNAME); \
2370 REGISTER_CALL(FUNCNAME); \
2371 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2372 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2373 FUNCNAME##_fake.custom_fake_seq_len) { \
2374 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
2375 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2376 arg0, arg1, arg2, arg3); \
2377 SAVE_RET_HISTORY(FUNCNAME, ret); \
2378 return ret; \
2379 } else { \
2380 RETURN_TYPE ret = \
2381 FUNCNAME##_fake.custom_fake_seq \
2382 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2383 arg0, arg1, arg2, arg3); \
2384 SAVE_RET_HISTORY(FUNCNAME, ret); \
2385 return ret; \
2386 return FUNCNAME##_fake \
2387 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2388 arg0, arg1, arg2, arg3); \
2389 } \
2390 } \
2391 if (FUNCNAME##_fake.custom_fake != NULL) { \
2392 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
2393 SAVE_RET_HISTORY(FUNCNAME, ret); \
2394 return ret; \
2395 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
2396 } \
2397 RETURN_FAKE_RESULT(FUNCNAME) \
2398 } \
2399 DEFINE_RESET_FUNCTION(FUNCNAME)
2400
2401#define FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
2402 DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2403 ARG3_TYPE) \
2404 DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE)
2405
2406#define DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2407 ARG3_TYPE, ARG4_TYPE) \
2408 typedef struct FUNCNAME##_Fake { \
2409 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2410 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2411 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2412 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2413 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
2414 DECLARE_ALL_FUNC_COMMON \
2415 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2416 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2417 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2418 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2419 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \
2420 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2421 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \
2422 } FUNCNAME##_Fake; \
2423 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2424 void FUNCNAME##_reset(void); \
2425 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2426 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4);
2427
2428#define DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2429 ARG4_TYPE) \
2430 FUNCNAME##_Fake FUNCNAME##_fake; \
2431 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2432 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4) \
2433 { \
2434 SAVE_ARG(FUNCNAME, 0); \
2435 SAVE_ARG(FUNCNAME, 1); \
2436 SAVE_ARG(FUNCNAME, 2); \
2437 SAVE_ARG(FUNCNAME, 3); \
2438 SAVE_ARG(FUNCNAME, 4); \
2439 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2440 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2441 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2442 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2443 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2444 SAVE_ARG_HISTORY(FUNCNAME, 4); \
2445 } else { \
2446 HISTORY_DROPPED(FUNCNAME); \
2447 } \
2448 INCREMENT_CALL_COUNT(FUNCNAME); \
2449 REGISTER_CALL(FUNCNAME); \
2450 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2451 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2452 FUNCNAME##_fake.custom_fake_seq_len) { \
2453 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
2454 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2455 arg0, arg1, arg2, arg3, arg4); \
2456 SAVE_RET_HISTORY(FUNCNAME, ret); \
2457 return ret; \
2458 } else { \
2459 RETURN_TYPE ret = \
2460 FUNCNAME##_fake.custom_fake_seq \
2461 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2462 arg0, arg1, arg2, arg3, arg4); \
2463 SAVE_RET_HISTORY(FUNCNAME, ret); \
2464 return ret; \
2465 return FUNCNAME##_fake \
2466 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2467 arg0, arg1, arg2, arg3, arg4); \
2468 } \
2469 } \
2470 if (FUNCNAME##_fake.custom_fake != NULL) { \
2471 RETURN_TYPE ret = \
2472 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
2473 SAVE_RET_HISTORY(FUNCNAME, ret); \
2474 return ret; \
2475 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
2476 } \
2477 RETURN_FAKE_RESULT(FUNCNAME) \
2478 } \
2479 DEFINE_RESET_FUNCTION(FUNCNAME)
2480
2481#define FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2482 ARG4_TYPE) \
2483 DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2484 ARG3_TYPE, ARG4_TYPE) \
2485 DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2486 ARG4_TYPE)
2487
2488#define DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2489 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
2490 typedef struct FUNCNAME##_Fake { \
2491 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2492 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2493 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2494 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2495 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
2496 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
2497 DECLARE_ALL_FUNC_COMMON \
2498 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2499 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2500 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2501 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2502 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
2503 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2504 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
2505 } FUNCNAME##_Fake; \
2506 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2507 void FUNCNAME##_reset(void); \
2508 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
2509 ARG2_TYPE arg2, ARG3_TYPE arg3, \
2510 ARG4_TYPE arg4, ARG5_TYPE arg5);
2511
2512#define DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2513 ARG4_TYPE, ARG5_TYPE) \
2514 FUNCNAME##_Fake FUNCNAME##_fake; \
2515 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
2516 ARG2_TYPE arg2, ARG3_TYPE arg3, \
2517 ARG4_TYPE arg4, ARG5_TYPE arg5) \
2518 { \
2519 SAVE_ARG(FUNCNAME, 0); \
2520 SAVE_ARG(FUNCNAME, 1); \
2521 SAVE_ARG(FUNCNAME, 2); \
2522 SAVE_ARG(FUNCNAME, 3); \
2523 SAVE_ARG(FUNCNAME, 4); \
2524 SAVE_ARG(FUNCNAME, 5); \
2525 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2526 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2527 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2528 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2529 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2530 SAVE_ARG_HISTORY(FUNCNAME, 4); \
2531 SAVE_ARG_HISTORY(FUNCNAME, 5); \
2532 } else { \
2533 HISTORY_DROPPED(FUNCNAME); \
2534 } \
2535 INCREMENT_CALL_COUNT(FUNCNAME); \
2536 REGISTER_CALL(FUNCNAME); \
2537 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2538 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2539 FUNCNAME##_fake.custom_fake_seq_len) { \
2540 RETURN_TYPE ret = \
2541 FUNCNAME##_fake.custom_fake_seq \
2542 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2543 arg0, arg1, arg2, arg3, arg4, arg5); \
2544 SAVE_RET_HISTORY(FUNCNAME, ret); \
2545 return ret; \
2546 } else { \
2547 RETURN_TYPE ret = \
2548 FUNCNAME##_fake.custom_fake_seq \
2549 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2550 arg0, arg1, arg2, arg3, arg4, arg5); \
2551 SAVE_RET_HISTORY(FUNCNAME, ret); \
2552 return ret; \
2553 return FUNCNAME##_fake \
2554 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2555 arg0, arg1, arg2, arg3, arg4, arg5); \
2556 } \
2557 } \
2558 if (FUNCNAME##_fake.custom_fake != NULL) { \
2559 RETURN_TYPE ret = \
2560 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
2561 SAVE_RET_HISTORY(FUNCNAME, ret); \
2562 return ret; \
2563 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
2564 } \
2565 RETURN_FAKE_RESULT(FUNCNAME) \
2566 } \
2567 DEFINE_RESET_FUNCTION(FUNCNAME)
2568
2569#define FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2570 ARG4_TYPE, ARG5_TYPE) \
2571 DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2572 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
2573 DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2574 ARG4_TYPE, ARG5_TYPE)
2575
2576#define DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2577 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
2578 typedef struct FUNCNAME##_Fake { \
2579 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2580 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2581 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2582 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2583 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
2584 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
2585 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
2586 DECLARE_ALL_FUNC_COMMON \
2587 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2588 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2589 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2590 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2591 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2592 ARG6_TYPE); \
2593 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2594 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2595 ARG6_TYPE); \
2596 } FUNCNAME##_Fake; \
2597 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2598 void FUNCNAME##_reset(void); \
2599 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2600 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2601 ARG5_TYPE arg5, ARG6_TYPE arg6);
2602
2603#define DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2604 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
2605 FUNCNAME##_Fake FUNCNAME##_fake; \
2606 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2607 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2608 ARG5_TYPE arg5, ARG6_TYPE arg6) \
2609 { \
2610 SAVE_ARG(FUNCNAME, 0); \
2611 SAVE_ARG(FUNCNAME, 1); \
2612 SAVE_ARG(FUNCNAME, 2); \
2613 SAVE_ARG(FUNCNAME, 3); \
2614 SAVE_ARG(FUNCNAME, 4); \
2615 SAVE_ARG(FUNCNAME, 5); \
2616 SAVE_ARG(FUNCNAME, 6); \
2617 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2618 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2619 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2620 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2621 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2622 SAVE_ARG_HISTORY(FUNCNAME, 4); \
2623 SAVE_ARG_HISTORY(FUNCNAME, 5); \
2624 SAVE_ARG_HISTORY(FUNCNAME, 6); \
2625 } else { \
2626 HISTORY_DROPPED(FUNCNAME); \
2627 } \
2628 INCREMENT_CALL_COUNT(FUNCNAME); \
2629 REGISTER_CALL(FUNCNAME); \
2630 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2631 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2632 FUNCNAME##_fake.custom_fake_seq_len) { \
2633 RETURN_TYPE ret = \
2634 FUNCNAME##_fake.custom_fake_seq \
2635 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2636 arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
2637 SAVE_RET_HISTORY(FUNCNAME, ret); \
2638 return ret; \
2639 } else { \
2640 RETURN_TYPE ret = \
2641 FUNCNAME##_fake.custom_fake_seq \
2642 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2643 arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
2644 SAVE_RET_HISTORY(FUNCNAME, ret); \
2645 return ret; \
2646 return FUNCNAME##_fake \
2647 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2648 arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
2649 } \
2650 } \
2651 if (FUNCNAME##_fake.custom_fake != NULL) { \
2652 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, \
2653 arg4, arg5, arg6); \
2654 SAVE_RET_HISTORY(FUNCNAME, ret); \
2655 return ret; \
2656 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
2657 arg6); \
2658 } \
2659 RETURN_FAKE_RESULT(FUNCNAME) \
2660 } \
2661 DEFINE_RESET_FUNCTION(FUNCNAME)
2662
2663#define FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2664 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
2665 DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2666 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
2667 DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2668 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE)
2669
2670#define DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2671 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
2672 typedef struct FUNCNAME##_Fake { \
2673 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2674 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2675 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2676 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2677 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
2678 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
2679 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
2680 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
2681 DECLARE_ALL_FUNC_COMMON \
2682 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2683 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2684 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2685 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2686 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2687 ARG6_TYPE, ARG7_TYPE); \
2688 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2689 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2690 ARG6_TYPE, ARG7_TYPE); \
2691 } FUNCNAME##_Fake; \
2692 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2693 void FUNCNAME##_reset(void); \
2694 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2695 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2696 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7);
2697
2698#define DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2699 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
2700 FUNCNAME##_Fake FUNCNAME##_fake; \
2701 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2702 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2703 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7) \
2704 { \
2705 SAVE_ARG(FUNCNAME, 0); \
2706 SAVE_ARG(FUNCNAME, 1); \
2707 SAVE_ARG(FUNCNAME, 2); \
2708 SAVE_ARG(FUNCNAME, 3); \
2709 SAVE_ARG(FUNCNAME, 4); \
2710 SAVE_ARG(FUNCNAME, 5); \
2711 SAVE_ARG(FUNCNAME, 6); \
2712 SAVE_ARG(FUNCNAME, 7); \
2713 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2714 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2715 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2716 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2717 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2718 SAVE_ARG_HISTORY(FUNCNAME, 4); \
2719 SAVE_ARG_HISTORY(FUNCNAME, 5); \
2720 SAVE_ARG_HISTORY(FUNCNAME, 6); \
2721 SAVE_ARG_HISTORY(FUNCNAME, 7); \
2722 } else { \
2723 HISTORY_DROPPED(FUNCNAME); \
2724 } \
2725 INCREMENT_CALL_COUNT(FUNCNAME); \
2726 REGISTER_CALL(FUNCNAME); \
2727 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2728 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2729 FUNCNAME##_fake.custom_fake_seq_len) { \
2730 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
2731 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2732 arg0, arg1, arg2, arg3, arg4, \
2733 arg5, arg6, arg7); \
2734 SAVE_RET_HISTORY(FUNCNAME, ret); \
2735 return ret; \
2736 } else { \
2737 RETURN_TYPE ret = \
2738 FUNCNAME##_fake.custom_fake_seq \
2739 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2740 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
2741 arg7); \
2742 SAVE_RET_HISTORY(FUNCNAME, ret); \
2743 return ret; \
2744 return FUNCNAME##_fake \
2745 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2746 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
2747 } \
2748 } \
2749 if (FUNCNAME##_fake.custom_fake != NULL) { \
2750 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, \
2751 arg4, arg5, arg6, arg7); \
2752 SAVE_RET_HISTORY(FUNCNAME, ret); \
2753 return ret; \
2754 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
2755 arg6, arg7); \
2756 } \
2757 RETURN_FAKE_RESULT(FUNCNAME) \
2758 } \
2759 DEFINE_RESET_FUNCTION(FUNCNAME)
2760
2761#define FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2762 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
2763 DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2764 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
2765 DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2766 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE)
2767
2768#define DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2769 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
2770 typedef struct FUNCNAME##_Fake { \
2771 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2772 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2773 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2774 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2775 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
2776 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
2777 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
2778 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
2779 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
2780 DECLARE_ALL_FUNC_COMMON \
2781 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2782 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2783 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2784 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2785 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2786 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE); \
2787 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2788 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2789 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE); \
2790 } FUNCNAME##_Fake; \
2791 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2792 void FUNCNAME##_reset(void); \
2793 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2794 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2795 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8);
2796
2797#define DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2798 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
2799 FUNCNAME##_Fake FUNCNAME##_fake; \
2800 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2801 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2802 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8) \
2803 { \
2804 SAVE_ARG(FUNCNAME, 0); \
2805 SAVE_ARG(FUNCNAME, 1); \
2806 SAVE_ARG(FUNCNAME, 2); \
2807 SAVE_ARG(FUNCNAME, 3); \
2808 SAVE_ARG(FUNCNAME, 4); \
2809 SAVE_ARG(FUNCNAME, 5); \
2810 SAVE_ARG(FUNCNAME, 6); \
2811 SAVE_ARG(FUNCNAME, 7); \
2812 SAVE_ARG(FUNCNAME, 8); \
2813 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2814 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2815 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2816 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2817 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2818 SAVE_ARG_HISTORY(FUNCNAME, 4); \
2819 SAVE_ARG_HISTORY(FUNCNAME, 5); \
2820 SAVE_ARG_HISTORY(FUNCNAME, 6); \
2821 SAVE_ARG_HISTORY(FUNCNAME, 7); \
2822 SAVE_ARG_HISTORY(FUNCNAME, 8); \
2823 } else { \
2824 HISTORY_DROPPED(FUNCNAME); \
2825 } \
2826 INCREMENT_CALL_COUNT(FUNCNAME); \
2827 REGISTER_CALL(FUNCNAME); \
2828 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2829 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2830 FUNCNAME##_fake.custom_fake_seq_len) { \
2831 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
2832 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2833 arg0, arg1, arg2, arg3, arg4, \
2834 arg5, arg6, arg7, arg8); \
2835 SAVE_RET_HISTORY(FUNCNAME, ret); \
2836 return ret; \
2837 } else { \
2838 RETURN_TYPE ret = \
2839 FUNCNAME##_fake.custom_fake_seq \
2840 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2841 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
2842 arg7, arg8); \
2843 SAVE_RET_HISTORY(FUNCNAME, ret); \
2844 return ret; \
2845 return FUNCNAME##_fake \
2846 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2847 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
2848 arg8); \
2849 } \
2850 } \
2851 if (FUNCNAME##_fake.custom_fake != NULL) { \
2852 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
2853 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
2854 SAVE_RET_HISTORY(FUNCNAME, ret); \
2855 return ret; \
2856 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
2857 arg6, arg7, arg8); \
2858 } \
2859 RETURN_FAKE_RESULT(FUNCNAME) \
2860 } \
2861 DEFINE_RESET_FUNCTION(FUNCNAME)
2862
2863#define FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2864 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
2865 DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2866 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
2867 DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2868 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE)
2869
2870#define DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2871 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
2872 ARG8_TYPE, ARG9_TYPE) \
2873 typedef struct FUNCNAME##_Fake { \
2874 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2875 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2876 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2877 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2878 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
2879 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
2880 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
2881 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
2882 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
2883 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
2884 DECLARE_ALL_FUNC_COMMON \
2885 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2886 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2887 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2888 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2889 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2890 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
2891 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
2892 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
2893 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
2894 } FUNCNAME##_Fake; \
2895 extern FUNCNAME##_Fake FUNCNAME##_fake; \
2896 void FUNCNAME##_reset(void); \
2897 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2898 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2899 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9);
2900
2901#define DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2902 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
2903 ARG9_TYPE) \
2904 FUNCNAME##_Fake FUNCNAME##_fake; \
2905 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
2906 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
2907 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9) \
2908 { \
2909 SAVE_ARG(FUNCNAME, 0); \
2910 SAVE_ARG(FUNCNAME, 1); \
2911 SAVE_ARG(FUNCNAME, 2); \
2912 SAVE_ARG(FUNCNAME, 3); \
2913 SAVE_ARG(FUNCNAME, 4); \
2914 SAVE_ARG(FUNCNAME, 5); \
2915 SAVE_ARG(FUNCNAME, 6); \
2916 SAVE_ARG(FUNCNAME, 7); \
2917 SAVE_ARG(FUNCNAME, 8); \
2918 SAVE_ARG(FUNCNAME, 9); \
2919 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
2920 SAVE_ARG_HISTORY(FUNCNAME, 0); \
2921 SAVE_ARG_HISTORY(FUNCNAME, 1); \
2922 SAVE_ARG_HISTORY(FUNCNAME, 2); \
2923 SAVE_ARG_HISTORY(FUNCNAME, 3); \
2924 SAVE_ARG_HISTORY(FUNCNAME, 4); \
2925 SAVE_ARG_HISTORY(FUNCNAME, 5); \
2926 SAVE_ARG_HISTORY(FUNCNAME, 6); \
2927 SAVE_ARG_HISTORY(FUNCNAME, 7); \
2928 SAVE_ARG_HISTORY(FUNCNAME, 8); \
2929 SAVE_ARG_HISTORY(FUNCNAME, 9); \
2930 } else { \
2931 HISTORY_DROPPED(FUNCNAME); \
2932 } \
2933 INCREMENT_CALL_COUNT(FUNCNAME); \
2934 REGISTER_CALL(FUNCNAME); \
2935 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
2936 if (FUNCNAME##_fake.custom_fake_seq_idx < \
2937 FUNCNAME##_fake.custom_fake_seq_len) { \
2938 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
2939 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
2940 arg0, arg1, arg2, arg3, arg4, \
2941 arg5, arg6, arg7, arg8, arg9); \
2942 SAVE_RET_HISTORY(FUNCNAME, ret); \
2943 return ret; \
2944 } else { \
2945 RETURN_TYPE ret = \
2946 FUNCNAME##_fake.custom_fake_seq \
2947 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2948 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
2949 arg7, arg8, arg9); \
2950 SAVE_RET_HISTORY(FUNCNAME, ret); \
2951 return ret; \
2952 return FUNCNAME##_fake \
2953 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
2954 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
2955 arg8, arg9); \
2956 } \
2957 } \
2958 if (FUNCNAME##_fake.custom_fake != NULL) { \
2959 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
2960 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
2961 SAVE_RET_HISTORY(FUNCNAME, ret); \
2962 return ret; \
2963 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
2964 arg6, arg7, arg8, arg9); \
2965 } \
2966 RETURN_FAKE_RESULT(FUNCNAME) \
2967 } \
2968 DEFINE_RESET_FUNCTION(FUNCNAME)
2969
2970#define FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
2971 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
2972 DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2973 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
2974 ARG8_TYPE, ARG9_TYPE) \
2975 DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2976 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
2977 ARG9_TYPE)
2978
2979#define DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
2980 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
2981 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
2982 typedef struct FUNCNAME##_Fake { \
2983 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
2984 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
2985 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
2986 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
2987 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
2988 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
2989 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
2990 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
2991 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
2992 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
2993 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
2994 DECLARE_ALL_FUNC_COMMON \
2995 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
2996 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
2997 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
2998 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
2999 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3000 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3001 ARG10_TYPE); \
3002 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3003 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3004 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3005 ARG10_TYPE); \
3006 } FUNCNAME##_Fake; \
3007 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3008 void FUNCNAME##_reset(void); \
3009 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3010 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3011 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3012 ARG10_TYPE arg10);
3013
3014#define DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3015 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3016 ARG9_TYPE, ARG10_TYPE) \
3017 FUNCNAME##_Fake FUNCNAME##_fake; \
3018 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3019 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3020 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3021 ARG10_TYPE arg10) \
3022 { \
3023 SAVE_ARG(FUNCNAME, 0); \
3024 SAVE_ARG(FUNCNAME, 1); \
3025 SAVE_ARG(FUNCNAME, 2); \
3026 SAVE_ARG(FUNCNAME, 3); \
3027 SAVE_ARG(FUNCNAME, 4); \
3028 SAVE_ARG(FUNCNAME, 5); \
3029 SAVE_ARG(FUNCNAME, 6); \
3030 SAVE_ARG(FUNCNAME, 7); \
3031 SAVE_ARG(FUNCNAME, 8); \
3032 SAVE_ARG(FUNCNAME, 9); \
3033 SAVE_ARG(FUNCNAME, 10); \
3034 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3035 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3036 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3037 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3038 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3039 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3040 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3041 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3042 SAVE_ARG_HISTORY(FUNCNAME, 7); \
3043 SAVE_ARG_HISTORY(FUNCNAME, 8); \
3044 SAVE_ARG_HISTORY(FUNCNAME, 9); \
3045 SAVE_ARG_HISTORY(FUNCNAME, 10); \
3046 } else { \
3047 HISTORY_DROPPED(FUNCNAME); \
3048 } \
3049 INCREMENT_CALL_COUNT(FUNCNAME); \
3050 REGISTER_CALL(FUNCNAME); \
3051 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
3052 if (FUNCNAME##_fake.custom_fake_seq_idx < \
3053 FUNCNAME##_fake.custom_fake_seq_len) { \
3054 RETURN_TYPE ret = \
3055 FUNCNAME##_fake.custom_fake_seq \
3056 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
3057 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3058 arg7, arg8, arg9, arg10); \
3059 SAVE_RET_HISTORY(FUNCNAME, ret); \
3060 return ret; \
3061 } else { \
3062 RETURN_TYPE ret = \
3063 FUNCNAME##_fake.custom_fake_seq \
3064 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3065 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3066 arg7, arg8, arg9, arg10); \
3067 SAVE_RET_HISTORY(FUNCNAME, ret); \
3068 return ret; \
3069 return FUNCNAME##_fake \
3070 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3071 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
3072 arg8, arg9, arg10); \
3073 } \
3074 } \
3075 if (FUNCNAME##_fake.custom_fake != NULL) { \
3076 RETURN_TYPE ret = \
3077 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3078 arg6, arg7, arg8, arg9, arg10); \
3079 SAVE_RET_HISTORY(FUNCNAME, ret); \
3080 return ret; \
3081 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3082 arg6, arg7, arg8, arg9, arg10); \
3083 } \
3084 RETURN_FAKE_RESULT(FUNCNAME) \
3085 } \
3086 DEFINE_RESET_FUNCTION(FUNCNAME)
3087
3088#define FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
3089 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3090 ARG10_TYPE) \
3091 DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3092 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3093 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
3094 DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3095 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3096 ARG9_TYPE, ARG10_TYPE)
3097
3098#define DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3099 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3100 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
3101 typedef struct FUNCNAME##_Fake { \
3102 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
3103 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
3104 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
3105 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
3106 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
3107 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
3108 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
3109 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
3110 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
3111 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
3112 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
3113 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
3114 DECLARE_ALL_FUNC_COMMON \
3115 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
3116 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
3117 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
3118 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
3119 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3120 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3121 ARG10_TYPE, ARG11_TYPE); \
3122 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3123 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3124 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3125 ARG10_TYPE, ARG11_TYPE); \
3126 } FUNCNAME##_Fake; \
3127 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3128 void FUNCNAME##_reset(void); \
3129 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3130 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3131 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3132 ARG10_TYPE arg10, ARG11_TYPE arg11);
3133
3134#define DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3135 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3136 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
3137 FUNCNAME##_Fake FUNCNAME##_fake; \
3138 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3139 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3140 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3141 ARG10_TYPE arg10, ARG11_TYPE arg11) \
3142 { \
3143 SAVE_ARG(FUNCNAME, 0); \
3144 SAVE_ARG(FUNCNAME, 1); \
3145 SAVE_ARG(FUNCNAME, 2); \
3146 SAVE_ARG(FUNCNAME, 3); \
3147 SAVE_ARG(FUNCNAME, 4); \
3148 SAVE_ARG(FUNCNAME, 5); \
3149 SAVE_ARG(FUNCNAME, 6); \
3150 SAVE_ARG(FUNCNAME, 7); \
3151 SAVE_ARG(FUNCNAME, 8); \
3152 SAVE_ARG(FUNCNAME, 9); \
3153 SAVE_ARG(FUNCNAME, 10); \
3154 SAVE_ARG(FUNCNAME, 11); \
3155 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3156 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3157 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3158 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3159 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3160 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3161 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3162 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3163 SAVE_ARG_HISTORY(FUNCNAME, 7); \
3164 SAVE_ARG_HISTORY(FUNCNAME, 8); \
3165 SAVE_ARG_HISTORY(FUNCNAME, 9); \
3166 SAVE_ARG_HISTORY(FUNCNAME, 10); \
3167 SAVE_ARG_HISTORY(FUNCNAME, 11); \
3168 } else { \
3169 HISTORY_DROPPED(FUNCNAME); \
3170 } \
3171 INCREMENT_CALL_COUNT(FUNCNAME); \
3172 REGISTER_CALL(FUNCNAME); \
3173 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
3174 if (FUNCNAME##_fake.custom_fake_seq_idx < \
3175 FUNCNAME##_fake.custom_fake_seq_len) { \
3176 RETURN_TYPE ret = \
3177 FUNCNAME##_fake.custom_fake_seq \
3178 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
3179 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3180 arg7, arg8, arg9, arg10, arg11); \
3181 SAVE_RET_HISTORY(FUNCNAME, ret); \
3182 return ret; \
3183 } else { \
3184 RETURN_TYPE ret = \
3185 FUNCNAME##_fake.custom_fake_seq \
3186 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3187 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3188 arg7, arg8, arg9, arg10, arg11); \
3189 SAVE_RET_HISTORY(FUNCNAME, ret); \
3190 return ret; \
3191 return FUNCNAME##_fake \
3192 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3193 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
3194 arg8, arg9, arg10, arg11); \
3195 } \
3196 } \
3197 if (FUNCNAME##_fake.custom_fake != NULL) { \
3198 RETURN_TYPE ret = \
3199 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3200 arg6, arg7, arg8, arg9, arg10, arg11); \
3201 SAVE_RET_HISTORY(FUNCNAME, ret); \
3202 return ret; \
3203 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3204 arg6, arg7, arg8, arg9, arg10, arg11); \
3205 } \
3206 RETURN_FAKE_RESULT(FUNCNAME) \
3207 } \
3208 DEFINE_RESET_FUNCTION(FUNCNAME)
3209
3210#define FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
3211 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3212 ARG10_TYPE, ARG11_TYPE) \
3213 DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3214 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3215 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
3216 DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3217 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3218 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE)
3219
3220#define DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3221 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3222 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
3223 typedef struct FUNCNAME##_Fake { \
3224 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
3225 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
3226 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
3227 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
3228 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
3229 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
3230 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
3231 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
3232 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
3233 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
3234 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
3235 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
3236 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
3237 DECLARE_ALL_FUNC_COMMON \
3238 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
3239 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
3240 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
3241 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
3242 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3243 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3244 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE); \
3245 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3246 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3247 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3248 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE); \
3249 } FUNCNAME##_Fake; \
3250 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3251 void FUNCNAME##_reset(void); \
3252 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3253 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3254 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3255 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12);
3256
3257#define DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3258 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3259 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
3260 FUNCNAME##_Fake FUNCNAME##_fake; \
3261 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3262 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3263 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3264 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12) \
3265 { \
3266 SAVE_ARG(FUNCNAME, 0); \
3267 SAVE_ARG(FUNCNAME, 1); \
3268 SAVE_ARG(FUNCNAME, 2); \
3269 SAVE_ARG(FUNCNAME, 3); \
3270 SAVE_ARG(FUNCNAME, 4); \
3271 SAVE_ARG(FUNCNAME, 5); \
3272 SAVE_ARG(FUNCNAME, 6); \
3273 SAVE_ARG(FUNCNAME, 7); \
3274 SAVE_ARG(FUNCNAME, 8); \
3275 SAVE_ARG(FUNCNAME, 9); \
3276 SAVE_ARG(FUNCNAME, 10); \
3277 SAVE_ARG(FUNCNAME, 11); \
3278 SAVE_ARG(FUNCNAME, 12); \
3279 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3280 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3281 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3282 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3283 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3284 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3285 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3286 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3287 SAVE_ARG_HISTORY(FUNCNAME, 7); \
3288 SAVE_ARG_HISTORY(FUNCNAME, 8); \
3289 SAVE_ARG_HISTORY(FUNCNAME, 9); \
3290 SAVE_ARG_HISTORY(FUNCNAME, 10); \
3291 SAVE_ARG_HISTORY(FUNCNAME, 11); \
3292 SAVE_ARG_HISTORY(FUNCNAME, 12); \
3293 } else { \
3294 HISTORY_DROPPED(FUNCNAME); \
3295 } \
3296 INCREMENT_CALL_COUNT(FUNCNAME); \
3297 REGISTER_CALL(FUNCNAME); \
3298 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
3299 if (FUNCNAME##_fake.custom_fake_seq_idx < \
3300 FUNCNAME##_fake.custom_fake_seq_len) { \
3301 RETURN_TYPE ret = \
3302 FUNCNAME##_fake.custom_fake_seq \
3303 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
3304 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3305 arg7, arg8, arg9, arg10, arg11, arg12); \
3306 SAVE_RET_HISTORY(FUNCNAME, ret); \
3307 return ret; \
3308 } else { \
3309 RETURN_TYPE ret = \
3310 FUNCNAME##_fake.custom_fake_seq \
3311 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3312 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3313 arg7, arg8, arg9, arg10, arg11, arg12); \
3314 SAVE_RET_HISTORY(FUNCNAME, ret); \
3315 return ret; \
3316 return FUNCNAME##_fake \
3317 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3318 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
3319 arg8, arg9, arg10, arg11, arg12); \
3320 } \
3321 } \
3322 if (FUNCNAME##_fake.custom_fake != NULL) { \
3323 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
3324 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
3325 arg11, arg12); \
3326 SAVE_RET_HISTORY(FUNCNAME, ret); \
3327 return ret; \
3328 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3329 arg6, arg7, arg8, arg9, arg10, arg11, \
3330 arg12); \
3331 } \
3332 RETURN_FAKE_RESULT(FUNCNAME) \
3333 } \
3334 DEFINE_RESET_FUNCTION(FUNCNAME)
3335
3336#define FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
3337 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3338 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
3339 DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3340 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3341 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
3342 DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3343 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3344 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE)
3345
3346#define DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3347 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3348 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3349 ARG13_TYPE) \
3350 typedef struct FUNCNAME##_Fake { \
3351 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
3352 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
3353 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
3354 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
3355 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
3356 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
3357 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
3358 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
3359 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
3360 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
3361 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
3362 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
3363 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
3364 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
3365 DECLARE_ALL_FUNC_COMMON \
3366 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
3367 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
3368 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
3369 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
3370 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3371 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3372 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
3373 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3374 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3375 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3376 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
3377 } FUNCNAME##_Fake; \
3378 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3379 void FUNCNAME##_reset(void); \
3380 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3381 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3382 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3383 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13);
3384
3385#define DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3386 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3387 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
3388 FUNCNAME##_Fake FUNCNAME##_fake; \
3389 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3390 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3391 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3392 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13) \
3393 { \
3394 SAVE_ARG(FUNCNAME, 0); \
3395 SAVE_ARG(FUNCNAME, 1); \
3396 SAVE_ARG(FUNCNAME, 2); \
3397 SAVE_ARG(FUNCNAME, 3); \
3398 SAVE_ARG(FUNCNAME, 4); \
3399 SAVE_ARG(FUNCNAME, 5); \
3400 SAVE_ARG(FUNCNAME, 6); \
3401 SAVE_ARG(FUNCNAME, 7); \
3402 SAVE_ARG(FUNCNAME, 8); \
3403 SAVE_ARG(FUNCNAME, 9); \
3404 SAVE_ARG(FUNCNAME, 10); \
3405 SAVE_ARG(FUNCNAME, 11); \
3406 SAVE_ARG(FUNCNAME, 12); \
3407 SAVE_ARG(FUNCNAME, 13); \
3408 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3409 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3410 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3411 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3412 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3413 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3414 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3415 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3416 SAVE_ARG_HISTORY(FUNCNAME, 7); \
3417 SAVE_ARG_HISTORY(FUNCNAME, 8); \
3418 SAVE_ARG_HISTORY(FUNCNAME, 9); \
3419 SAVE_ARG_HISTORY(FUNCNAME, 10); \
3420 SAVE_ARG_HISTORY(FUNCNAME, 11); \
3421 SAVE_ARG_HISTORY(FUNCNAME, 12); \
3422 SAVE_ARG_HISTORY(FUNCNAME, 13); \
3423 } else { \
3424 HISTORY_DROPPED(FUNCNAME); \
3425 } \
3426 INCREMENT_CALL_COUNT(FUNCNAME); \
3427 REGISTER_CALL(FUNCNAME); \
3428 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
3429 if (FUNCNAME##_fake.custom_fake_seq_idx < \
3430 FUNCNAME##_fake.custom_fake_seq_len) { \
3431 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
3432 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
3433 arg0, arg1, arg2, arg3, arg4, \
3434 arg5, arg6, arg7, arg8, arg9, \
3435 arg10, arg11, arg12, arg13); \
3436 SAVE_RET_HISTORY(FUNCNAME, ret); \
3437 return ret; \
3438 } else { \
3439 RETURN_TYPE ret = \
3440 FUNCNAME##_fake.custom_fake_seq \
3441 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3442 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3443 arg7, arg8, arg9, arg10, arg11, arg12, \
3444 arg13); \
3445 SAVE_RET_HISTORY(FUNCNAME, ret); \
3446 return ret; \
3447 return FUNCNAME##_fake \
3448 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3449 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
3450 arg8, arg9, arg10, arg11, arg12, arg13); \
3451 } \
3452 } \
3453 if (FUNCNAME##_fake.custom_fake != NULL) { \
3454 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
3455 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
3456 arg11, arg12, arg13); \
3457 SAVE_RET_HISTORY(FUNCNAME, ret); \
3458 return ret; \
3459 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3460 arg6, arg7, arg8, arg9, arg10, arg11, \
3461 arg12, arg13); \
3462 } \
3463 RETURN_FAKE_RESULT(FUNCNAME) \
3464 } \
3465 DEFINE_RESET_FUNCTION(FUNCNAME)
3466
3467#define FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
3468 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3469 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
3470 DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3471 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3472 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3473 ARG13_TYPE) \
3474 DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3475 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3476 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE)
3477
3478#define DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3479 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3480 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3481 ARG13_TYPE, ARG14_TYPE) \
3482 typedef struct FUNCNAME##_Fake { \
3483 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
3484 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
3485 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
3486 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
3487 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
3488 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
3489 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
3490 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
3491 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
3492 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
3493 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
3494 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
3495 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
3496 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
3497 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
3498 DECLARE_ALL_FUNC_COMMON \
3499 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
3500 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
3501 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
3502 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
3503 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3504 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3505 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3506 ARG14_TYPE); \
3507 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3508 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3509 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3510 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3511 ARG14_TYPE); \
3512 } FUNCNAME##_Fake; \
3513 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3514 void FUNCNAME##_reset(void); \
3515 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3516 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3517 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3518 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3519 ARG14_TYPE arg14);
3520
3521#define DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3522 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3523 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3524 ARG14_TYPE) \
3525 FUNCNAME##_Fake FUNCNAME##_fake; \
3526 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3527 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3528 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3529 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3530 ARG14_TYPE arg14) \
3531 { \
3532 SAVE_ARG(FUNCNAME, 0); \
3533 SAVE_ARG(FUNCNAME, 1); \
3534 SAVE_ARG(FUNCNAME, 2); \
3535 SAVE_ARG(FUNCNAME, 3); \
3536 SAVE_ARG(FUNCNAME, 4); \
3537 SAVE_ARG(FUNCNAME, 5); \
3538 SAVE_ARG(FUNCNAME, 6); \
3539 SAVE_ARG(FUNCNAME, 7); \
3540 SAVE_ARG(FUNCNAME, 8); \
3541 SAVE_ARG(FUNCNAME, 9); \
3542 SAVE_ARG(FUNCNAME, 10); \
3543 SAVE_ARG(FUNCNAME, 11); \
3544 SAVE_ARG(FUNCNAME, 12); \
3545 SAVE_ARG(FUNCNAME, 13); \
3546 SAVE_ARG(FUNCNAME, 14); \
3547 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3548 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3549 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3550 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3551 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3552 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3553 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3554 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3555 SAVE_ARG_HISTORY(FUNCNAME, 7); \
3556 SAVE_ARG_HISTORY(FUNCNAME, 8); \
3557 SAVE_ARG_HISTORY(FUNCNAME, 9); \
3558 SAVE_ARG_HISTORY(FUNCNAME, 10); \
3559 SAVE_ARG_HISTORY(FUNCNAME, 11); \
3560 SAVE_ARG_HISTORY(FUNCNAME, 12); \
3561 SAVE_ARG_HISTORY(FUNCNAME, 13); \
3562 SAVE_ARG_HISTORY(FUNCNAME, 14); \
3563 } else { \
3564 HISTORY_DROPPED(FUNCNAME); \
3565 } \
3566 INCREMENT_CALL_COUNT(FUNCNAME); \
3567 REGISTER_CALL(FUNCNAME); \
3568 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
3569 if (FUNCNAME##_fake.custom_fake_seq_idx < \
3570 FUNCNAME##_fake.custom_fake_seq_len) { \
3571 RETURN_TYPE ret = \
3572 FUNCNAME##_fake.custom_fake_seq \
3573 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
3574 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3575 arg7, arg8, arg9, arg10, arg11, arg12, \
3576 arg13, arg14); \
3577 SAVE_RET_HISTORY(FUNCNAME, ret); \
3578 return ret; \
3579 } else { \
3580 RETURN_TYPE ret = \
3581 FUNCNAME##_fake.custom_fake_seq \
3582 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3583 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3584 arg7, arg8, arg9, arg10, arg11, arg12, \
3585 arg13, arg14); \
3586 SAVE_RET_HISTORY(FUNCNAME, ret); \
3587 return ret; \
3588 return FUNCNAME##_fake \
3589 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3590 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
3591 arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
3592 } \
3593 } \
3594 if (FUNCNAME##_fake.custom_fake != NULL) { \
3595 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
3596 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
3597 arg11, arg12, arg13, arg14); \
3598 SAVE_RET_HISTORY(FUNCNAME, ret); \
3599 return ret; \
3600 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3601 arg6, arg7, arg8, arg9, arg10, arg11, \
3602 arg12, arg13, arg14); \
3603 } \
3604 RETURN_FAKE_RESULT(FUNCNAME) \
3605 } \
3606 DEFINE_RESET_FUNCTION(FUNCNAME)
3607
3608#define FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
3609 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3610 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
3611 DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3612 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3613 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3614 ARG13_TYPE, ARG14_TYPE) \
3615 DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3616 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3617 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3618 ARG14_TYPE)
3619
3620#define DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3621 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3622 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3623 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
3624 typedef struct FUNCNAME##_Fake { \
3625 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
3626 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
3627 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
3628 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
3629 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
3630 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
3631 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
3632 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
3633 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
3634 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
3635 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
3636 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
3637 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
3638 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
3639 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
3640 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
3641 DECLARE_ALL_FUNC_COMMON \
3642 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
3643 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
3644 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
3645 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
3646 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3647 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3648 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3649 ARG14_TYPE, ARG15_TYPE); \
3650 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3651 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3652 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3653 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3654 ARG14_TYPE, ARG15_TYPE); \
3655 } FUNCNAME##_Fake; \
3656 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3657 void FUNCNAME##_reset(void); \
3658 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3659 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3660 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3661 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3662 ARG14_TYPE arg14, ARG15_TYPE arg15);
3663
3664#define DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3665 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3666 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3667 ARG14_TYPE, ARG15_TYPE) \
3668 FUNCNAME##_Fake FUNCNAME##_fake; \
3669 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3670 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3671 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3672 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3673 ARG14_TYPE arg14, ARG15_TYPE arg15) \
3674 { \
3675 SAVE_ARG(FUNCNAME, 0); \
3676 SAVE_ARG(FUNCNAME, 1); \
3677 SAVE_ARG(FUNCNAME, 2); \
3678 SAVE_ARG(FUNCNAME, 3); \
3679 SAVE_ARG(FUNCNAME, 4); \
3680 SAVE_ARG(FUNCNAME, 5); \
3681 SAVE_ARG(FUNCNAME, 6); \
3682 SAVE_ARG(FUNCNAME, 7); \
3683 SAVE_ARG(FUNCNAME, 8); \
3684 SAVE_ARG(FUNCNAME, 9); \
3685 SAVE_ARG(FUNCNAME, 10); \
3686 SAVE_ARG(FUNCNAME, 11); \
3687 SAVE_ARG(FUNCNAME, 12); \
3688 SAVE_ARG(FUNCNAME, 13); \
3689 SAVE_ARG(FUNCNAME, 14); \
3690 SAVE_ARG(FUNCNAME, 15); \
3691 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3692 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3693 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3694 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3695 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3696 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3697 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3698 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3699 SAVE_ARG_HISTORY(FUNCNAME, 7); \
3700 SAVE_ARG_HISTORY(FUNCNAME, 8); \
3701 SAVE_ARG_HISTORY(FUNCNAME, 9); \
3702 SAVE_ARG_HISTORY(FUNCNAME, 10); \
3703 SAVE_ARG_HISTORY(FUNCNAME, 11); \
3704 SAVE_ARG_HISTORY(FUNCNAME, 12); \
3705 SAVE_ARG_HISTORY(FUNCNAME, 13); \
3706 SAVE_ARG_HISTORY(FUNCNAME, 14); \
3707 SAVE_ARG_HISTORY(FUNCNAME, 15); \
3708 } else { \
3709 HISTORY_DROPPED(FUNCNAME); \
3710 } \
3711 INCREMENT_CALL_COUNT(FUNCNAME); \
3712 REGISTER_CALL(FUNCNAME); \
3713 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
3714 if (FUNCNAME##_fake.custom_fake_seq_idx < \
3715 FUNCNAME##_fake.custom_fake_seq_len) { \
3716 RETURN_TYPE ret = \
3717 FUNCNAME##_fake.custom_fake_seq \
3718 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
3719 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3720 arg7, arg8, arg9, arg10, arg11, arg12, \
3721 arg13, arg14, arg15); \
3722 SAVE_RET_HISTORY(FUNCNAME, ret); \
3723 return ret; \
3724 } else { \
3725 RETURN_TYPE ret = \
3726 FUNCNAME##_fake.custom_fake_seq \
3727 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3728 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3729 arg7, arg8, arg9, arg10, arg11, arg12, \
3730 arg13, arg14, arg15); \
3731 SAVE_RET_HISTORY(FUNCNAME, ret); \
3732 return ret; \
3733 return FUNCNAME##_fake \
3734 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3735 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
3736 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
3737 arg15); \
3738 } \
3739 } \
3740 if (FUNCNAME##_fake.custom_fake != NULL) { \
3741 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
3742 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
3743 arg11, arg12, arg13, arg14, arg15); \
3744 SAVE_RET_HISTORY(FUNCNAME, ret); \
3745 return ret; \
3746 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3747 arg6, arg7, arg8, arg9, arg10, arg11, \
3748 arg12, arg13, arg14, arg15); \
3749 } \
3750 RETURN_FAKE_RESULT(FUNCNAME) \
3751 } \
3752 DEFINE_RESET_FUNCTION(FUNCNAME)
3753
3754#define FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
3755 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3756 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
3757 DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3758 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3759 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3760 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
3761 DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3762 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3763 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3764 ARG14_TYPE, ARG15_TYPE)
3765
3766#define DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3767 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3768 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3769 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
3770 typedef struct FUNCNAME##_Fake { \
3771 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
3772 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
3773 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
3774 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
3775 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
3776 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
3777 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
3778 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
3779 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
3780 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
3781 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
3782 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
3783 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
3784 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
3785 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
3786 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
3787 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
3788 DECLARE_ALL_FUNC_COMMON \
3789 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
3790 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
3791 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
3792 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
3793 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3794 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3795 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3796 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE); \
3797 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3798 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3799 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3800 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3801 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE); \
3802 } FUNCNAME##_Fake; \
3803 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3804 void FUNCNAME##_reset(void); \
3805 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3806 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3807 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3808 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3809 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16);
3810
3811#define DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3812 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3813 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3814 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
3815 FUNCNAME##_Fake FUNCNAME##_fake; \
3816 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3817 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3818 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3819 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3820 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16) \
3821 { \
3822 SAVE_ARG(FUNCNAME, 0); \
3823 SAVE_ARG(FUNCNAME, 1); \
3824 SAVE_ARG(FUNCNAME, 2); \
3825 SAVE_ARG(FUNCNAME, 3); \
3826 SAVE_ARG(FUNCNAME, 4); \
3827 SAVE_ARG(FUNCNAME, 5); \
3828 SAVE_ARG(FUNCNAME, 6); \
3829 SAVE_ARG(FUNCNAME, 7); \
3830 SAVE_ARG(FUNCNAME, 8); \
3831 SAVE_ARG(FUNCNAME, 9); \
3832 SAVE_ARG(FUNCNAME, 10); \
3833 SAVE_ARG(FUNCNAME, 11); \
3834 SAVE_ARG(FUNCNAME, 12); \
3835 SAVE_ARG(FUNCNAME, 13); \
3836 SAVE_ARG(FUNCNAME, 14); \
3837 SAVE_ARG(FUNCNAME, 15); \
3838 SAVE_ARG(FUNCNAME, 16); \
3839 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3840 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3841 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3842 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3843 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3844 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3845 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3846 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3847 SAVE_ARG_HISTORY(FUNCNAME, 7); \
3848 SAVE_ARG_HISTORY(FUNCNAME, 8); \
3849 SAVE_ARG_HISTORY(FUNCNAME, 9); \
3850 SAVE_ARG_HISTORY(FUNCNAME, 10); \
3851 SAVE_ARG_HISTORY(FUNCNAME, 11); \
3852 SAVE_ARG_HISTORY(FUNCNAME, 12); \
3853 SAVE_ARG_HISTORY(FUNCNAME, 13); \
3854 SAVE_ARG_HISTORY(FUNCNAME, 14); \
3855 SAVE_ARG_HISTORY(FUNCNAME, 15); \
3856 SAVE_ARG_HISTORY(FUNCNAME, 16); \
3857 } else { \
3858 HISTORY_DROPPED(FUNCNAME); \
3859 } \
3860 INCREMENT_CALL_COUNT(FUNCNAME); \
3861 REGISTER_CALL(FUNCNAME); \
3862 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
3863 if (FUNCNAME##_fake.custom_fake_seq_idx < \
3864 FUNCNAME##_fake.custom_fake_seq_len) { \
3865 RETURN_TYPE ret = \
3866 FUNCNAME##_fake.custom_fake_seq \
3867 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
3868 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3869 arg7, arg8, arg9, arg10, arg11, arg12, \
3870 arg13, arg14, arg15, arg16); \
3871 SAVE_RET_HISTORY(FUNCNAME, ret); \
3872 return ret; \
3873 } else { \
3874 RETURN_TYPE ret = \
3875 FUNCNAME##_fake.custom_fake_seq \
3876 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3877 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
3878 arg7, arg8, arg9, arg10, arg11, arg12, \
3879 arg13, arg14, arg15, arg16); \
3880 SAVE_RET_HISTORY(FUNCNAME, ret); \
3881 return ret; \
3882 return FUNCNAME##_fake \
3883 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
3884 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
3885 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
3886 arg15, arg16); \
3887 } \
3888 } \
3889 if (FUNCNAME##_fake.custom_fake != NULL) { \
3890 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
3891 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
3892 arg11, arg12, arg13, arg14, arg15, arg16); \
3893 SAVE_RET_HISTORY(FUNCNAME, ret); \
3894 return ret; \
3895 return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
3896 arg6, arg7, arg8, arg9, arg10, arg11, \
3897 arg12, arg13, arg14, arg15, arg16); \
3898 } \
3899 RETURN_FAKE_RESULT(FUNCNAME) \
3900 } \
3901 DEFINE_RESET_FUNCTION(FUNCNAME)
3902
3903#define FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
3904 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3905 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
3906 ARG16_TYPE) \
3907 DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3908 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3909 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3910 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
3911 DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3912 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3913 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3914 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE)
3915
3916#define DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3917 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
3918 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
3919 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
3920 typedef struct FUNCNAME##_Fake { \
3921 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
3922 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
3923 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
3924 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
3925 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
3926 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
3927 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
3928 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
3929 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
3930 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
3931 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
3932 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
3933 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
3934 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
3935 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
3936 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
3937 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
3938 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
3939 DECLARE_ALL_FUNC_COMMON \
3940 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
3941 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
3942 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
3943 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
3944 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3945 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3946 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3947 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
3948 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
3949 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
3950 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
3951 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3952 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
3953 } FUNCNAME##_Fake; \
3954 extern FUNCNAME##_Fake FUNCNAME##_fake; \
3955 void FUNCNAME##_reset(void); \
3956 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3957 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3958 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3959 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3960 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17);
3961
3962#define DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
3963 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
3964 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
3965 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
3966 FUNCNAME##_Fake FUNCNAME##_fake; \
3967 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
3968 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
3969 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
3970 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
3971 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17) \
3972 { \
3973 SAVE_ARG(FUNCNAME, 0); \
3974 SAVE_ARG(FUNCNAME, 1); \
3975 SAVE_ARG(FUNCNAME, 2); \
3976 SAVE_ARG(FUNCNAME, 3); \
3977 SAVE_ARG(FUNCNAME, 4); \
3978 SAVE_ARG(FUNCNAME, 5); \
3979 SAVE_ARG(FUNCNAME, 6); \
3980 SAVE_ARG(FUNCNAME, 7); \
3981 SAVE_ARG(FUNCNAME, 8); \
3982 SAVE_ARG(FUNCNAME, 9); \
3983 SAVE_ARG(FUNCNAME, 10); \
3984 SAVE_ARG(FUNCNAME, 11); \
3985 SAVE_ARG(FUNCNAME, 12); \
3986 SAVE_ARG(FUNCNAME, 13); \
3987 SAVE_ARG(FUNCNAME, 14); \
3988 SAVE_ARG(FUNCNAME, 15); \
3989 SAVE_ARG(FUNCNAME, 16); \
3990 SAVE_ARG(FUNCNAME, 17); \
3991 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
3992 SAVE_ARG_HISTORY(FUNCNAME, 0); \
3993 SAVE_ARG_HISTORY(FUNCNAME, 1); \
3994 SAVE_ARG_HISTORY(FUNCNAME, 2); \
3995 SAVE_ARG_HISTORY(FUNCNAME, 3); \
3996 SAVE_ARG_HISTORY(FUNCNAME, 4); \
3997 SAVE_ARG_HISTORY(FUNCNAME, 5); \
3998 SAVE_ARG_HISTORY(FUNCNAME, 6); \
3999 SAVE_ARG_HISTORY(FUNCNAME, 7); \
4000 SAVE_ARG_HISTORY(FUNCNAME, 8); \
4001 SAVE_ARG_HISTORY(FUNCNAME, 9); \
4002 SAVE_ARG_HISTORY(FUNCNAME, 10); \
4003 SAVE_ARG_HISTORY(FUNCNAME, 11); \
4004 SAVE_ARG_HISTORY(FUNCNAME, 12); \
4005 SAVE_ARG_HISTORY(FUNCNAME, 13); \
4006 SAVE_ARG_HISTORY(FUNCNAME, 14); \
4007 SAVE_ARG_HISTORY(FUNCNAME, 15); \
4008 SAVE_ARG_HISTORY(FUNCNAME, 16); \
4009 SAVE_ARG_HISTORY(FUNCNAME, 17); \
4010 } else { \
4011 HISTORY_DROPPED(FUNCNAME); \
4012 } \
4013 INCREMENT_CALL_COUNT(FUNCNAME); \
4014 REGISTER_CALL(FUNCNAME); \
4015 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4016 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4017 FUNCNAME##_fake.custom_fake_seq_len) { \
4018 RETURN_TYPE ret = \
4019 FUNCNAME##_fake.custom_fake_seq \
4020 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
4021 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
4022 arg7, arg8, arg9, arg10, arg11, arg12, \
4023 arg13, arg14, arg15, arg16, arg17); \
4024 SAVE_RET_HISTORY(FUNCNAME, ret); \
4025 return ret; \
4026 } else { \
4027 RETURN_TYPE ret = \
4028 FUNCNAME##_fake.custom_fake_seq \
4029 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4030 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
4031 arg7, arg8, arg9, arg10, arg11, arg12, \
4032 arg13, arg14, arg15, arg16, arg17); \
4033 SAVE_RET_HISTORY(FUNCNAME, ret); \
4034 return ret; \
4035 return FUNCNAME##_fake \
4036 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4037 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
4038 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
4039 arg15, arg16, arg17); \
4040 } \
4041 } \
4042 if (FUNCNAME##_fake.custom_fake != NULL) { \
4043 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
4044 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
4045 arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
4046 SAVE_RET_HISTORY(FUNCNAME, ret); \
4047 return ret; \
4048 return FUNCNAME##_fake.custom_fake( \
4049 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
4050 arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
4051 } \
4052 RETURN_FAKE_RESULT(FUNCNAME) \
4053 } \
4054 DEFINE_RESET_FUNCTION(FUNCNAME)
4055
4056#define FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4057 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
4058 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
4059 ARG16_TYPE, ARG17_TYPE) \
4060 DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4061 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
4062 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
4063 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
4064 DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4065 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
4066 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4067 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE)
4068
4069#define DECLARE_FAKE_VALUE_FUNC19( \
4070 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4071 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
4072 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
4073 typedef struct FUNCNAME##_Fake { \
4074 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4075 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4076 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4077 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4078 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
4079 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
4080 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
4081 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
4082 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
4083 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
4084 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
4085 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
4086 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
4087 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
4088 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
4089 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
4090 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
4091 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
4092 DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
4093 DECLARE_ALL_FUNC_COMMON \
4094 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
4095 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
4096 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4097 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
4098 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4099 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
4100 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4101 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
4102 ARG18_TYPE); \
4103 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4104 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4105 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
4106 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4107 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
4108 ARG18_TYPE); \
4109 } FUNCNAME##_Fake; \
4110 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4111 void FUNCNAME##_reset(void); \
4112 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
4113 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
4114 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
4115 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
4116 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
4117 ARG18_TYPE arg18);
4118
4119#define DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4120 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
4121 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4122 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
4123 FUNCNAME##_Fake FUNCNAME##_fake; \
4124 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
4125 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
4126 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
4127 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
4128 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
4129 ARG18_TYPE arg18) \
4130 { \
4131 SAVE_ARG(FUNCNAME, 0); \
4132 SAVE_ARG(FUNCNAME, 1); \
4133 SAVE_ARG(FUNCNAME, 2); \
4134 SAVE_ARG(FUNCNAME, 3); \
4135 SAVE_ARG(FUNCNAME, 4); \
4136 SAVE_ARG(FUNCNAME, 5); \
4137 SAVE_ARG(FUNCNAME, 6); \
4138 SAVE_ARG(FUNCNAME, 7); \
4139 SAVE_ARG(FUNCNAME, 8); \
4140 SAVE_ARG(FUNCNAME, 9); \
4141 SAVE_ARG(FUNCNAME, 10); \
4142 SAVE_ARG(FUNCNAME, 11); \
4143 SAVE_ARG(FUNCNAME, 12); \
4144 SAVE_ARG(FUNCNAME, 13); \
4145 SAVE_ARG(FUNCNAME, 14); \
4146 SAVE_ARG(FUNCNAME, 15); \
4147 SAVE_ARG(FUNCNAME, 16); \
4148 SAVE_ARG(FUNCNAME, 17); \
4149 SAVE_ARG(FUNCNAME, 18); \
4150 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4151 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4152 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4153 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4154 SAVE_ARG_HISTORY(FUNCNAME, 3); \
4155 SAVE_ARG_HISTORY(FUNCNAME, 4); \
4156 SAVE_ARG_HISTORY(FUNCNAME, 5); \
4157 SAVE_ARG_HISTORY(FUNCNAME, 6); \
4158 SAVE_ARG_HISTORY(FUNCNAME, 7); \
4159 SAVE_ARG_HISTORY(FUNCNAME, 8); \
4160 SAVE_ARG_HISTORY(FUNCNAME, 9); \
4161 SAVE_ARG_HISTORY(FUNCNAME, 10); \
4162 SAVE_ARG_HISTORY(FUNCNAME, 11); \
4163 SAVE_ARG_HISTORY(FUNCNAME, 12); \
4164 SAVE_ARG_HISTORY(FUNCNAME, 13); \
4165 SAVE_ARG_HISTORY(FUNCNAME, 14); \
4166 SAVE_ARG_HISTORY(FUNCNAME, 15); \
4167 SAVE_ARG_HISTORY(FUNCNAME, 16); \
4168 SAVE_ARG_HISTORY(FUNCNAME, 17); \
4169 SAVE_ARG_HISTORY(FUNCNAME, 18); \
4170 } else { \
4171 HISTORY_DROPPED(FUNCNAME); \
4172 } \
4173 INCREMENT_CALL_COUNT(FUNCNAME); \
4174 REGISTER_CALL(FUNCNAME); \
4175 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4176 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4177 FUNCNAME##_fake.custom_fake_seq_len) { \
4178 RETURN_TYPE ret = \
4179 FUNCNAME##_fake.custom_fake_seq \
4180 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
4181 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
4182 arg7, arg8, arg9, arg10, arg11, arg12, \
4183 arg13, arg14, arg15, arg16, arg17, arg18); \
4184 SAVE_RET_HISTORY(FUNCNAME, ret); \
4185 return ret; \
4186 } else { \
4187 RETURN_TYPE ret = \
4188 FUNCNAME##_fake.custom_fake_seq \
4189 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4190 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
4191 arg7, arg8, arg9, arg10, arg11, arg12, \
4192 arg13, arg14, arg15, arg16, arg17, arg18); \
4193 SAVE_RET_HISTORY(FUNCNAME, ret); \
4194 return ret; \
4195 return FUNCNAME##_fake \
4196 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4197 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
4198 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
4199 arg15, arg16, arg17, arg18); \
4200 } \
4201 } \
4202 if (FUNCNAME##_fake.custom_fake != NULL) { \
4203 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
4204 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
4205 arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
4206 SAVE_RET_HISTORY(FUNCNAME, ret); \
4207 return ret; \
4208 return FUNCNAME##_fake.custom_fake( \
4209 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
4210 arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
4211 } \
4212 RETURN_FAKE_RESULT(FUNCNAME) \
4213 } \
4214 DEFINE_RESET_FUNCTION(FUNCNAME)
4215
4216#define FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4217 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
4218 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
4219 ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
4220 DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4221 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
4222 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
4223 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
4224 ARG18_TYPE) \
4225 DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4226 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
4227 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4228 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE)
4229
4230#define DECLARE_FAKE_VALUE_FUNC20( \
4231 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4232 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
4233 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
4234 typedef struct FUNCNAME##_Fake { \
4235 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4236 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4237 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4238 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4239 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
4240 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
4241 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
4242 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
4243 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
4244 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
4245 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
4246 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
4247 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
4248 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
4249 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
4250 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
4251 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
4252 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
4253 DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
4254 DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
4255 DECLARE_ALL_FUNC_COMMON \
4256 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
4257 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
4258 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4259 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
4260 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4261 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
4262 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4263 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
4264 ARG18_TYPE, ARG19_TYPE); \
4265 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4266 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4267 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
4268 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4269 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
4270 ARG18_TYPE, ARG19_TYPE); \
4271 } FUNCNAME##_Fake; \
4272 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4273 void FUNCNAME##_reset(void); \
4274 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
4275 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
4276 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
4277 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
4278 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
4279 ARG18_TYPE arg18, ARG19_TYPE arg19);
4280
4281#define DEFINE_FAKE_VALUE_FUNC20( \
4282 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4283 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
4284 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
4285 FUNCNAME##_Fake FUNCNAME##_fake; \
4286 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
4287 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
4288 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
4289 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
4290 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
4291 ARG18_TYPE arg18, ARG19_TYPE arg19) \
4292 { \
4293 SAVE_ARG(FUNCNAME, 0); \
4294 SAVE_ARG(FUNCNAME, 1); \
4295 SAVE_ARG(FUNCNAME, 2); \
4296 SAVE_ARG(FUNCNAME, 3); \
4297 SAVE_ARG(FUNCNAME, 4); \
4298 SAVE_ARG(FUNCNAME, 5); \
4299 SAVE_ARG(FUNCNAME, 6); \
4300 SAVE_ARG(FUNCNAME, 7); \
4301 SAVE_ARG(FUNCNAME, 8); \
4302 SAVE_ARG(FUNCNAME, 9); \
4303 SAVE_ARG(FUNCNAME, 10); \
4304 SAVE_ARG(FUNCNAME, 11); \
4305 SAVE_ARG(FUNCNAME, 12); \
4306 SAVE_ARG(FUNCNAME, 13); \
4307 SAVE_ARG(FUNCNAME, 14); \
4308 SAVE_ARG(FUNCNAME, 15); \
4309 SAVE_ARG(FUNCNAME, 16); \
4310 SAVE_ARG(FUNCNAME, 17); \
4311 SAVE_ARG(FUNCNAME, 18); \
4312 SAVE_ARG(FUNCNAME, 19); \
4313 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4314 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4315 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4316 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4317 SAVE_ARG_HISTORY(FUNCNAME, 3); \
4318 SAVE_ARG_HISTORY(FUNCNAME, 4); \
4319 SAVE_ARG_HISTORY(FUNCNAME, 5); \
4320 SAVE_ARG_HISTORY(FUNCNAME, 6); \
4321 SAVE_ARG_HISTORY(FUNCNAME, 7); \
4322 SAVE_ARG_HISTORY(FUNCNAME, 8); \
4323 SAVE_ARG_HISTORY(FUNCNAME, 9); \
4324 SAVE_ARG_HISTORY(FUNCNAME, 10); \
4325 SAVE_ARG_HISTORY(FUNCNAME, 11); \
4326 SAVE_ARG_HISTORY(FUNCNAME, 12); \
4327 SAVE_ARG_HISTORY(FUNCNAME, 13); \
4328 SAVE_ARG_HISTORY(FUNCNAME, 14); \
4329 SAVE_ARG_HISTORY(FUNCNAME, 15); \
4330 SAVE_ARG_HISTORY(FUNCNAME, 16); \
4331 SAVE_ARG_HISTORY(FUNCNAME, 17); \
4332 SAVE_ARG_HISTORY(FUNCNAME, 18); \
4333 SAVE_ARG_HISTORY(FUNCNAME, 19); \
4334 } else { \
4335 HISTORY_DROPPED(FUNCNAME); \
4336 } \
4337 INCREMENT_CALL_COUNT(FUNCNAME); \
4338 REGISTER_CALL(FUNCNAME); \
4339 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4340 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4341 FUNCNAME##_fake.custom_fake_seq_len) { \
4342 RETURN_TYPE ret = \
4343 FUNCNAME##_fake.custom_fake_seq \
4344 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
4345 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
4346 arg7, arg8, arg9, arg10, arg11, arg12, \
4347 arg13, arg14, arg15, arg16, arg17, arg18, \
4348 arg19); \
4349 SAVE_RET_HISTORY(FUNCNAME, ret); \
4350 return ret; \
4351 } else { \
4352 RETURN_TYPE ret = \
4353 FUNCNAME##_fake.custom_fake_seq \
4354 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4355 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
4356 arg7, arg8, arg9, arg10, arg11, arg12, \
4357 arg13, arg14, arg15, arg16, arg17, arg18, \
4358 arg19); \
4359 SAVE_RET_HISTORY(FUNCNAME, ret); \
4360 return ret; \
4361 return FUNCNAME##_fake \
4362 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4363 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
4364 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
4365 arg15, arg16, arg17, arg18, arg19); \
4366 } \
4367 } \
4368 if (FUNCNAME##_fake.custom_fake != NULL) { \
4369 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake( \
4370 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
4371 arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
4372 SAVE_RET_HISTORY(FUNCNAME, ret); \
4373 return ret; \
4374 return FUNCNAME##_fake.custom_fake( \
4375 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
4376 arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
4377 } \
4378 RETURN_FAKE_RESULT(FUNCNAME) \
4379 } \
4380 DEFINE_RESET_FUNCTION(FUNCNAME)
4381
4382#define FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4383 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
4384 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
4385 ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
4386 DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4387 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
4388 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
4389 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
4390 ARG18_TYPE, ARG19_TYPE) \
4391 DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4392 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
4393 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
4394 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, \
4395 ARG19_TYPE)
4396
4397#define DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
4398 typedef struct FUNCNAME##_Fake { \
4399 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4400 DECLARE_ALL_FUNC_COMMON \
4401 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4402 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, va_list ap); \
4403 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, va_list ap); \
4404 } FUNCNAME##_Fake; \
4405 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4406 void FUNCNAME##_reset(void); \
4407 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...);
4408
4409#define DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
4410 FUNCNAME##_Fake FUNCNAME##_fake; \
4411 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...) \
4412 { \
4413 SAVE_ARG(FUNCNAME, 0); \
4414 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4415 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4416 } else { \
4417 HISTORY_DROPPED(FUNCNAME); \
4418 } \
4419 INCREMENT_CALL_COUNT(FUNCNAME); \
4420 REGISTER_CALL(FUNCNAME); \
4421 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4422 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4423 FUNCNAME##_fake.custom_fake_seq_len) { \
4424 va_list ap; \
4425 va_start(ap, arg0); \
4426 FUNCNAME##_fake \
4427 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4428 arg0, ap); \
4429 va_end(ap); \
4430 } else { \
4431 va_list ap; \
4432 va_start(ap, arg0); \
4433 FUNCNAME##_fake \
4434 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4435 arg0, ap); \
4436 va_end(ap); \
4437 } \
4438 } \
4439 if (FUNCNAME##_fake.custom_fake) { \
4440 va_list ap; \
4441 va_start(ap, arg0); \
4442 FUNCNAME##_fake.custom_fake(arg0, ap); \
4443 va_end(ap); \
4444 } \
4445 } \
4446 DEFINE_RESET_FUNCTION(FUNCNAME)
4447
4448#define FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
4449 DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
4450 DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...)
4451
4452#define DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
4453 typedef struct FUNCNAME##_Fake { \
4454 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4455 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4456 DECLARE_ALL_FUNC_COMMON \
4457 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4458 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, va_list ap); \
4459 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4460 va_list ap); \
4461 } FUNCNAME##_Fake; \
4462 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4463 void FUNCNAME##_reset(void); \
4464 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...);
4465
4466#define DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
4467 FUNCNAME##_Fake FUNCNAME##_fake; \
4468 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...) \
4469 { \
4470 SAVE_ARG(FUNCNAME, 0); \
4471 SAVE_ARG(FUNCNAME, 1); \
4472 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4473 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4474 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4475 } else { \
4476 HISTORY_DROPPED(FUNCNAME); \
4477 } \
4478 INCREMENT_CALL_COUNT(FUNCNAME); \
4479 REGISTER_CALL(FUNCNAME); \
4480 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4481 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4482 FUNCNAME##_fake.custom_fake_seq_len) { \
4483 va_list ap; \
4484 va_start(ap, arg1); \
4485 FUNCNAME##_fake \
4486 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4487 arg0, arg1, ap); \
4488 va_end(ap); \
4489 } else { \
4490 va_list ap; \
4491 va_start(ap, arg1); \
4492 FUNCNAME##_fake \
4493 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4494 arg0, arg1, ap); \
4495 va_end(ap); \
4496 } \
4497 } \
4498 if (FUNCNAME##_fake.custom_fake) { \
4499 va_list ap; \
4500 va_start(ap, arg1); \
4501 FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
4502 va_end(ap); \
4503 } \
4504 } \
4505 DEFINE_RESET_FUNCTION(FUNCNAME)
4506
4507#define FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
4508 DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
4509 DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...)
4510
4511#define DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
4512 typedef struct FUNCNAME##_Fake { \
4513 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4514 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4515 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4516 DECLARE_ALL_FUNC_COMMON \
4517 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4518 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4519 va_list ap); \
4520 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4521 ARG2_TYPE, va_list ap); \
4522 } FUNCNAME##_Fake; \
4523 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4524 void FUNCNAME##_reset(void); \
4525 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4526 ...);
4527
4528#define DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
4529 FUNCNAME##_Fake FUNCNAME##_fake; \
4530 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4531 ...) \
4532 { \
4533 SAVE_ARG(FUNCNAME, 0); \
4534 SAVE_ARG(FUNCNAME, 1); \
4535 SAVE_ARG(FUNCNAME, 2); \
4536 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4537 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4538 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4539 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4540 } else { \
4541 HISTORY_DROPPED(FUNCNAME); \
4542 } \
4543 INCREMENT_CALL_COUNT(FUNCNAME); \
4544 REGISTER_CALL(FUNCNAME); \
4545 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4546 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4547 FUNCNAME##_fake.custom_fake_seq_len) { \
4548 va_list ap; \
4549 va_start(ap, arg2); \
4550 FUNCNAME##_fake \
4551 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4552 arg0, arg1, arg2, ap); \
4553 va_end(ap); \
4554 } else { \
4555 va_list ap; \
4556 va_start(ap, arg2); \
4557 FUNCNAME##_fake \
4558 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4559 arg0, arg1, arg2, ap); \
4560 va_end(ap); \
4561 } \
4562 } \
4563 if (FUNCNAME##_fake.custom_fake) { \
4564 va_list ap; \
4565 va_start(ap, arg2); \
4566 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
4567 va_end(ap); \
4568 } \
4569 } \
4570 DEFINE_RESET_FUNCTION(FUNCNAME)
4571
4572#define FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
4573 DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
4574 DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...)
4575
4576#define DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
4577 typedef struct FUNCNAME##_Fake { \
4578 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4579 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4580 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4581 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4582 DECLARE_ALL_FUNC_COMMON \
4583 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4584 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4585 ARG3_TYPE, va_list ap); \
4586 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4587 ARG2_TYPE, ARG3_TYPE, va_list ap); \
4588 } FUNCNAME##_Fake; \
4589 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4590 void FUNCNAME##_reset(void); \
4591 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4592 ARG3_TYPE arg3, ...);
4593
4594#define DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
4595 FUNCNAME##_Fake FUNCNAME##_fake; \
4596 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4597 ARG3_TYPE arg3, ...) \
4598 { \
4599 SAVE_ARG(FUNCNAME, 0); \
4600 SAVE_ARG(FUNCNAME, 1); \
4601 SAVE_ARG(FUNCNAME, 2); \
4602 SAVE_ARG(FUNCNAME, 3); \
4603 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4604 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4605 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4606 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4607 SAVE_ARG_HISTORY(FUNCNAME, 3); \
4608 } else { \
4609 HISTORY_DROPPED(FUNCNAME); \
4610 } \
4611 INCREMENT_CALL_COUNT(FUNCNAME); \
4612 REGISTER_CALL(FUNCNAME); \
4613 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4614 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4615 FUNCNAME##_fake.custom_fake_seq_len) { \
4616 va_list ap; \
4617 va_start(ap, arg3); \
4618 FUNCNAME##_fake \
4619 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4620 arg0, arg1, arg2, arg3, ap); \
4621 va_end(ap); \
4622 } else { \
4623 va_list ap; \
4624 va_start(ap, arg3); \
4625 FUNCNAME##_fake \
4626 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4627 arg0, arg1, arg2, arg3, ap); \
4628 va_end(ap); \
4629 } \
4630 } \
4631 if (FUNCNAME##_fake.custom_fake) { \
4632 va_list ap; \
4633 va_start(ap, arg3); \
4634 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
4635 va_end(ap); \
4636 } \
4637 } \
4638 DEFINE_RESET_FUNCTION(FUNCNAME)
4639
4640#define FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
4641 DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
4642 DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...)
4643
4644#define DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4645 ARG4_TYPE, ...) \
4646 typedef struct FUNCNAME##_Fake { \
4647 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4648 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4649 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4650 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4651 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
4652 DECLARE_ALL_FUNC_COMMON \
4653 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4654 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4655 ARG3_TYPE, ARG4_TYPE, va_list ap); \
4656 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4657 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, va_list ap); \
4658 } FUNCNAME##_Fake; \
4659 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4660 void FUNCNAME##_reset(void); \
4661 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4662 ARG3_TYPE arg3, ARG4_TYPE arg4, ...);
4663
4664#define DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4665 ARG4_TYPE, ...) \
4666 FUNCNAME##_Fake FUNCNAME##_fake; \
4667 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4668 ARG3_TYPE arg3, ARG4_TYPE arg4, ...) \
4669 { \
4670 SAVE_ARG(FUNCNAME, 0); \
4671 SAVE_ARG(FUNCNAME, 1); \
4672 SAVE_ARG(FUNCNAME, 2); \
4673 SAVE_ARG(FUNCNAME, 3); \
4674 SAVE_ARG(FUNCNAME, 4); \
4675 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4676 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4677 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4678 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4679 SAVE_ARG_HISTORY(FUNCNAME, 3); \
4680 SAVE_ARG_HISTORY(FUNCNAME, 4); \
4681 } else { \
4682 HISTORY_DROPPED(FUNCNAME); \
4683 } \
4684 INCREMENT_CALL_COUNT(FUNCNAME); \
4685 REGISTER_CALL(FUNCNAME); \
4686 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4687 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4688 FUNCNAME##_fake.custom_fake_seq_len) { \
4689 va_list ap; \
4690 va_start(ap, arg4); \
4691 FUNCNAME##_fake \
4692 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4693 arg0, arg1, arg2, arg3, arg4, ap); \
4694 va_end(ap); \
4695 } else { \
4696 va_list ap; \
4697 va_start(ap, arg4); \
4698 FUNCNAME##_fake \
4699 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4700 arg0, arg1, arg2, arg3, arg4, ap); \
4701 va_end(ap); \
4702 } \
4703 } \
4704 if (FUNCNAME##_fake.custom_fake) { \
4705 va_list ap; \
4706 va_start(ap, arg4); \
4707 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
4708 va_end(ap); \
4709 } \
4710 } \
4711 DEFINE_RESET_FUNCTION(FUNCNAME)
4712
4713#define FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
4714 ...) \
4715 DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4716 ARG4_TYPE, ...) \
4717 DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4718 ARG4_TYPE, ...)
4719
4720#define DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4721 ARG4_TYPE, ARG5_TYPE, ...) \
4722 typedef struct FUNCNAME##_Fake { \
4723 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4724 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4725 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4726 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4727 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
4728 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
4729 DECLARE_ALL_FUNC_COMMON \
4730 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4731 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4732 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, va_list ap); \
4733 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4734 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4735 va_list ap); \
4736 } FUNCNAME##_Fake; \
4737 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4738 void FUNCNAME##_reset(void); \
4739 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4740 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
4741 ...);
4742
4743#define DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4744 ARG4_TYPE, ARG5_TYPE, ...) \
4745 FUNCNAME##_Fake FUNCNAME##_fake; \
4746 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4747 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
4748 ...) \
4749 { \
4750 SAVE_ARG(FUNCNAME, 0); \
4751 SAVE_ARG(FUNCNAME, 1); \
4752 SAVE_ARG(FUNCNAME, 2); \
4753 SAVE_ARG(FUNCNAME, 3); \
4754 SAVE_ARG(FUNCNAME, 4); \
4755 SAVE_ARG(FUNCNAME, 5); \
4756 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4757 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4758 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4759 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4760 SAVE_ARG_HISTORY(FUNCNAME, 3); \
4761 SAVE_ARG_HISTORY(FUNCNAME, 4); \
4762 SAVE_ARG_HISTORY(FUNCNAME, 5); \
4763 } else { \
4764 HISTORY_DROPPED(FUNCNAME); \
4765 } \
4766 INCREMENT_CALL_COUNT(FUNCNAME); \
4767 REGISTER_CALL(FUNCNAME); \
4768 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4769 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4770 FUNCNAME##_fake.custom_fake_seq_len) { \
4771 va_list ap; \
4772 va_start(ap, arg5); \
4773 FUNCNAME##_fake \
4774 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4775 arg0, arg1, arg2, arg3, arg4, arg5, ap); \
4776 va_end(ap); \
4777 } else { \
4778 va_list ap; \
4779 va_start(ap, arg5); \
4780 FUNCNAME##_fake \
4781 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4782 arg0, arg1, arg2, arg3, arg4, arg5, ap); \
4783 va_end(ap); \
4784 } \
4785 } \
4786 if (FUNCNAME##_fake.custom_fake) { \
4787 va_list ap; \
4788 va_start(ap, arg5); \
4789 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
4790 va_end(ap); \
4791 } \
4792 } \
4793 DEFINE_RESET_FUNCTION(FUNCNAME)
4794
4795#define FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
4796 ARG5_TYPE, ...) \
4797 DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4798 ARG4_TYPE, ARG5_TYPE, ...) \
4799 DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4800 ARG4_TYPE, ARG5_TYPE, ...)
4801
4802#define DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4803 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
4804 typedef struct FUNCNAME##_Fake { \
4805 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4806 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4807 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4808 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4809 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
4810 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
4811 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
4812 DECLARE_ALL_FUNC_COMMON \
4813 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4814 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4815 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
4816 va_list ap); \
4817 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4818 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4819 ARG6_TYPE, va_list ap); \
4820 } FUNCNAME##_Fake; \
4821 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4822 void FUNCNAME##_reset(void); \
4823 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4824 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
4825 ARG6_TYPE arg6, ...);
4826
4827#define DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4828 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
4829 FUNCNAME##_Fake FUNCNAME##_fake; \
4830 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4831 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
4832 ARG6_TYPE arg6, ...) \
4833 { \
4834 SAVE_ARG(FUNCNAME, 0); \
4835 SAVE_ARG(FUNCNAME, 1); \
4836 SAVE_ARG(FUNCNAME, 2); \
4837 SAVE_ARG(FUNCNAME, 3); \
4838 SAVE_ARG(FUNCNAME, 4); \
4839 SAVE_ARG(FUNCNAME, 5); \
4840 SAVE_ARG(FUNCNAME, 6); \
4841 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4842 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4843 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4844 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4845 SAVE_ARG_HISTORY(FUNCNAME, 3); \
4846 SAVE_ARG_HISTORY(FUNCNAME, 4); \
4847 SAVE_ARG_HISTORY(FUNCNAME, 5); \
4848 SAVE_ARG_HISTORY(FUNCNAME, 6); \
4849 } else { \
4850 HISTORY_DROPPED(FUNCNAME); \
4851 } \
4852 INCREMENT_CALL_COUNT(FUNCNAME); \
4853 REGISTER_CALL(FUNCNAME); \
4854 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4855 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4856 FUNCNAME##_fake.custom_fake_seq_len) { \
4857 va_list ap; \
4858 va_start(ap, arg6); \
4859 FUNCNAME##_fake \
4860 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4861 arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
4862 va_end(ap); \
4863 } else { \
4864 va_list ap; \
4865 va_start(ap, arg6); \
4866 FUNCNAME##_fake \
4867 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4868 arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
4869 va_end(ap); \
4870 } \
4871 } \
4872 if (FUNCNAME##_fake.custom_fake) { \
4873 va_list ap; \
4874 va_start(ap, arg6); \
4875 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
4876 va_end(ap); \
4877 } \
4878 } \
4879 DEFINE_RESET_FUNCTION(FUNCNAME)
4880
4881#define FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
4882 ARG5_TYPE, ARG6_TYPE, ...) \
4883 DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4884 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
4885 DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4886 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...)
4887
4888#define DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4889 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
4890 typedef struct FUNCNAME##_Fake { \
4891 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4892 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4893 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4894 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4895 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
4896 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
4897 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
4898 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
4899 DECLARE_ALL_FUNC_COMMON \
4900 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4901 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4902 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
4903 ARG7_TYPE, va_list ap); \
4904 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4905 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
4906 ARG6_TYPE, ARG7_TYPE, va_list ap); \
4907 } FUNCNAME##_Fake; \
4908 extern FUNCNAME##_Fake FUNCNAME##_fake; \
4909 void FUNCNAME##_reset(void); \
4910 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4911 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
4912 ARG6_TYPE arg6, ARG7_TYPE arg7, ...);
4913
4914#define DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4915 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
4916 FUNCNAME##_Fake FUNCNAME##_fake; \
4917 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
4918 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
4919 ARG6_TYPE arg6, ARG7_TYPE arg7, ...) \
4920 { \
4921 SAVE_ARG(FUNCNAME, 0); \
4922 SAVE_ARG(FUNCNAME, 1); \
4923 SAVE_ARG(FUNCNAME, 2); \
4924 SAVE_ARG(FUNCNAME, 3); \
4925 SAVE_ARG(FUNCNAME, 4); \
4926 SAVE_ARG(FUNCNAME, 5); \
4927 SAVE_ARG(FUNCNAME, 6); \
4928 SAVE_ARG(FUNCNAME, 7); \
4929 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
4930 SAVE_ARG_HISTORY(FUNCNAME, 0); \
4931 SAVE_ARG_HISTORY(FUNCNAME, 1); \
4932 SAVE_ARG_HISTORY(FUNCNAME, 2); \
4933 SAVE_ARG_HISTORY(FUNCNAME, 3); \
4934 SAVE_ARG_HISTORY(FUNCNAME, 4); \
4935 SAVE_ARG_HISTORY(FUNCNAME, 5); \
4936 SAVE_ARG_HISTORY(FUNCNAME, 6); \
4937 SAVE_ARG_HISTORY(FUNCNAME, 7); \
4938 } else { \
4939 HISTORY_DROPPED(FUNCNAME); \
4940 } \
4941 INCREMENT_CALL_COUNT(FUNCNAME); \
4942 REGISTER_CALL(FUNCNAME); \
4943 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
4944 if (FUNCNAME##_fake.custom_fake_seq_idx < \
4945 FUNCNAME##_fake.custom_fake_seq_len) { \
4946 va_list ap; \
4947 va_start(ap, arg7); \
4948 FUNCNAME##_fake \
4949 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
4950 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
4951 ap); \
4952 va_end(ap); \
4953 } else { \
4954 va_list ap; \
4955 va_start(ap, arg7); \
4956 FUNCNAME##_fake \
4957 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
4958 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
4959 ap); \
4960 va_end(ap); \
4961 } \
4962 } \
4963 if (FUNCNAME##_fake.custom_fake) { \
4964 va_list ap; \
4965 va_start(ap, arg7); \
4966 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
4967 arg7, ap); \
4968 va_end(ap); \
4969 } \
4970 } \
4971 DEFINE_RESET_FUNCTION(FUNCNAME)
4972
4973#define FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
4974 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
4975 DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4976 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
4977 DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4978 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...)
4979
4980#define DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
4981 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
4982 ...) \
4983 typedef struct FUNCNAME##_Fake { \
4984 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
4985 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
4986 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
4987 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
4988 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
4989 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
4990 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
4991 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
4992 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
4993 DECLARE_ALL_FUNC_COMMON \
4994 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
4995 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
4996 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
4997 ARG7_TYPE, ARG8_TYPE, va_list ap); \
4998 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
4999 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5000 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, va_list ap); \
5001 } FUNCNAME##_Fake; \
5002 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5003 void FUNCNAME##_reset(void); \
5004 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5005 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5006 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...);
5007
5008#define DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5009 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
5010 FUNCNAME##_Fake FUNCNAME##_fake; \
5011 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5012 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5013 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...) \
5014 { \
5015 SAVE_ARG(FUNCNAME, 0); \
5016 SAVE_ARG(FUNCNAME, 1); \
5017 SAVE_ARG(FUNCNAME, 2); \
5018 SAVE_ARG(FUNCNAME, 3); \
5019 SAVE_ARG(FUNCNAME, 4); \
5020 SAVE_ARG(FUNCNAME, 5); \
5021 SAVE_ARG(FUNCNAME, 6); \
5022 SAVE_ARG(FUNCNAME, 7); \
5023 SAVE_ARG(FUNCNAME, 8); \
5024 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5025 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5026 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5027 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5028 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5029 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5030 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5031 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5032 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5033 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5034 } else { \
5035 HISTORY_DROPPED(FUNCNAME); \
5036 } \
5037 INCREMENT_CALL_COUNT(FUNCNAME); \
5038 REGISTER_CALL(FUNCNAME); \
5039 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5040 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5041 FUNCNAME##_fake.custom_fake_seq_len) { \
5042 va_list ap; \
5043 va_start(ap, arg8); \
5044 FUNCNAME##_fake \
5045 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5046 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5047 arg8, ap); \
5048 va_end(ap); \
5049 } else { \
5050 va_list ap; \
5051 va_start(ap, arg8); \
5052 FUNCNAME##_fake \
5053 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5054 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5055 arg8, ap); \
5056 va_end(ap); \
5057 } \
5058 } \
5059 if (FUNCNAME##_fake.custom_fake) { \
5060 va_list ap; \
5061 va_start(ap, arg8); \
5062 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5063 arg7, arg8, ap); \
5064 va_end(ap); \
5065 } \
5066 } \
5067 DEFINE_RESET_FUNCTION(FUNCNAME)
5068
5069#define FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5070 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
5071 DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5072 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5073 ...) \
5074 DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5075 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...)
5076
5077#define DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5078 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5079 ARG9_TYPE, ...) \
5080 typedef struct FUNCNAME##_Fake { \
5081 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5082 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5083 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5084 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5085 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5086 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5087 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5088 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5089 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5090 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5091 DECLARE_ALL_FUNC_COMMON \
5092 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5093 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5094 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5095 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, va_list ap); \
5096 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5097 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5098 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5099 va_list ap); \
5100 } FUNCNAME##_Fake; \
5101 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5102 void FUNCNAME##_reset(void); \
5103 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
5104 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
5105 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, \
5106 ARG9_TYPE arg9, ...);
5107
5108#define DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5109 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5110 ARG9_TYPE, ...) \
5111 FUNCNAME##_Fake FUNCNAME##_fake; \
5112 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
5113 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
5114 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, \
5115 ARG9_TYPE arg9, ...) \
5116 { \
5117 SAVE_ARG(FUNCNAME, 0); \
5118 SAVE_ARG(FUNCNAME, 1); \
5119 SAVE_ARG(FUNCNAME, 2); \
5120 SAVE_ARG(FUNCNAME, 3); \
5121 SAVE_ARG(FUNCNAME, 4); \
5122 SAVE_ARG(FUNCNAME, 5); \
5123 SAVE_ARG(FUNCNAME, 6); \
5124 SAVE_ARG(FUNCNAME, 7); \
5125 SAVE_ARG(FUNCNAME, 8); \
5126 SAVE_ARG(FUNCNAME, 9); \
5127 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5128 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5129 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5130 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5131 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5132 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5133 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5134 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5135 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5136 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5137 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5138 } else { \
5139 HISTORY_DROPPED(FUNCNAME); \
5140 } \
5141 INCREMENT_CALL_COUNT(FUNCNAME); \
5142 REGISTER_CALL(FUNCNAME); \
5143 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5144 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5145 FUNCNAME##_fake.custom_fake_seq_len) { \
5146 va_list ap; \
5147 va_start(ap, arg9); \
5148 FUNCNAME##_fake \
5149 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5150 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5151 arg8, arg9, ap); \
5152 va_end(ap); \
5153 } else { \
5154 va_list ap; \
5155 va_start(ap, arg9); \
5156 FUNCNAME##_fake \
5157 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5158 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5159 arg8, arg9, ap); \
5160 va_end(ap); \
5161 } \
5162 } \
5163 if (FUNCNAME##_fake.custom_fake) { \
5164 va_list ap; \
5165 va_start(ap, arg9); \
5166 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5167 arg7, arg8, arg9, ap); \
5168 va_end(ap); \
5169 } \
5170 } \
5171 DEFINE_RESET_FUNCTION(FUNCNAME)
5172
5173#define FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5174 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
5175 DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5176 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5177 ARG9_TYPE, ...) \
5178 DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5179 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5180 ARG9_TYPE, ...)
5181
5182#define DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5183 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5184 ARG9_TYPE, ARG10_TYPE, ...) \
5185 typedef struct FUNCNAME##_Fake { \
5186 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5187 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5188 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5189 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5190 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5191 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5192 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5193 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5194 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5195 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5196 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
5197 DECLARE_ALL_FUNC_COMMON \
5198 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5199 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5200 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5201 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5202 va_list ap); \
5203 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5204 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5205 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5206 ARG10_TYPE, va_list ap); \
5207 } FUNCNAME##_Fake; \
5208 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5209 void FUNCNAME##_reset(void); \
5210 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
5211 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
5212 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, \
5213 ARG9_TYPE arg9, ARG10_TYPE arg10, ...);
5214
5215#define DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5216 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5217 ARG9_TYPE, ARG10_TYPE, ...) \
5218 FUNCNAME##_Fake FUNCNAME##_fake; \
5219 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, \
5220 ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, \
5221 ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, \
5222 ARG9_TYPE arg9, ARG10_TYPE arg10, ...) \
5223 { \
5224 SAVE_ARG(FUNCNAME, 0); \
5225 SAVE_ARG(FUNCNAME, 1); \
5226 SAVE_ARG(FUNCNAME, 2); \
5227 SAVE_ARG(FUNCNAME, 3); \
5228 SAVE_ARG(FUNCNAME, 4); \
5229 SAVE_ARG(FUNCNAME, 5); \
5230 SAVE_ARG(FUNCNAME, 6); \
5231 SAVE_ARG(FUNCNAME, 7); \
5232 SAVE_ARG(FUNCNAME, 8); \
5233 SAVE_ARG(FUNCNAME, 9); \
5234 SAVE_ARG(FUNCNAME, 10); \
5235 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5236 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5237 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5238 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5239 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5240 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5241 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5242 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5243 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5244 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5245 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5246 SAVE_ARG_HISTORY(FUNCNAME, 10); \
5247 } else { \
5248 HISTORY_DROPPED(FUNCNAME); \
5249 } \
5250 INCREMENT_CALL_COUNT(FUNCNAME); \
5251 REGISTER_CALL(FUNCNAME); \
5252 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5253 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5254 FUNCNAME##_fake.custom_fake_seq_len) { \
5255 va_list ap; \
5256 va_start(ap, arg10); \
5257 FUNCNAME##_fake \
5258 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5259 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5260 arg8, arg9, arg10, ap); \
5261 va_end(ap); \
5262 } else { \
5263 va_list ap; \
5264 va_start(ap, arg10); \
5265 FUNCNAME##_fake \
5266 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5267 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5268 arg8, arg9, arg10, ap); \
5269 va_end(ap); \
5270 } \
5271 } \
5272 if (FUNCNAME##_fake.custom_fake) { \
5273 va_list ap; \
5274 va_start(ap, arg10); \
5275 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5276 arg7, arg8, arg9, arg10, ap); \
5277 va_end(ap); \
5278 } \
5279 } \
5280 DEFINE_RESET_FUNCTION(FUNCNAME)
5281
5282#define FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5283 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5284 ...) \
5285 DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5286 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5287 ARG9_TYPE, ARG10_TYPE, ...) \
5288 DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5289 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5290 ARG9_TYPE, ARG10_TYPE, ...)
5291
5292#define DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5293 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5294 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
5295 typedef struct FUNCNAME##_Fake { \
5296 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5297 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5298 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5299 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5300 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5301 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5302 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5303 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5304 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5305 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5306 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
5307 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
5308 DECLARE_ALL_FUNC_COMMON \
5309 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5310 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5311 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5312 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5313 ARG11_TYPE, va_list ap); \
5314 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5315 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5316 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5317 ARG10_TYPE, ARG11_TYPE, va_list ap); \
5318 } FUNCNAME##_Fake; \
5319 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5320 void FUNCNAME##_reset(void); \
5321 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5322 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5323 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5324 ARG10_TYPE arg10, ARG11_TYPE arg11, ...);
5325
5326#define DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5327 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5328 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
5329 FUNCNAME##_Fake FUNCNAME##_fake; \
5330 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5331 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5332 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5333 ARG10_TYPE arg10, ARG11_TYPE arg11, ...) \
5334 { \
5335 SAVE_ARG(FUNCNAME, 0); \
5336 SAVE_ARG(FUNCNAME, 1); \
5337 SAVE_ARG(FUNCNAME, 2); \
5338 SAVE_ARG(FUNCNAME, 3); \
5339 SAVE_ARG(FUNCNAME, 4); \
5340 SAVE_ARG(FUNCNAME, 5); \
5341 SAVE_ARG(FUNCNAME, 6); \
5342 SAVE_ARG(FUNCNAME, 7); \
5343 SAVE_ARG(FUNCNAME, 8); \
5344 SAVE_ARG(FUNCNAME, 9); \
5345 SAVE_ARG(FUNCNAME, 10); \
5346 SAVE_ARG(FUNCNAME, 11); \
5347 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5348 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5349 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5350 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5351 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5352 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5353 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5354 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5355 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5356 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5357 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5358 SAVE_ARG_HISTORY(FUNCNAME, 10); \
5359 SAVE_ARG_HISTORY(FUNCNAME, 11); \
5360 } else { \
5361 HISTORY_DROPPED(FUNCNAME); \
5362 } \
5363 INCREMENT_CALL_COUNT(FUNCNAME); \
5364 REGISTER_CALL(FUNCNAME); \
5365 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5366 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5367 FUNCNAME##_fake.custom_fake_seq_len) { \
5368 va_list ap; \
5369 va_start(ap, arg11); \
5370 FUNCNAME##_fake \
5371 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5372 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5373 arg8, arg9, arg10, arg11, ap); \
5374 va_end(ap); \
5375 } else { \
5376 va_list ap; \
5377 va_start(ap, arg11); \
5378 FUNCNAME##_fake \
5379 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5380 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5381 arg8, arg9, arg10, arg11, ap); \
5382 va_end(ap); \
5383 } \
5384 } \
5385 if (FUNCNAME##_fake.custom_fake) { \
5386 va_list ap; \
5387 va_start(ap, arg11); \
5388 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5389 arg7, arg8, arg9, arg10, arg11, ap); \
5390 va_end(ap); \
5391 } \
5392 } \
5393 DEFINE_RESET_FUNCTION(FUNCNAME)
5394
5395#define FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5396 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5397 ARG11_TYPE, ...) \
5398 DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5399 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5400 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
5401 DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5402 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5403 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...)
5404
5405#define DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5406 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5407 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
5408 typedef struct FUNCNAME##_Fake { \
5409 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5410 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5411 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5412 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5413 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5414 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5415 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5416 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5417 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5418 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5419 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
5420 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
5421 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
5422 DECLARE_ALL_FUNC_COMMON \
5423 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5424 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5425 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5426 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5427 ARG11_TYPE, ARG12_TYPE, va_list ap); \
5428 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5429 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5430 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5431 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, va_list ap); \
5432 } FUNCNAME##_Fake; \
5433 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5434 void FUNCNAME##_reset(void); \
5435 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5436 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5437 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5438 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...);
5439
5440#define DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5441 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5442 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
5443 FUNCNAME##_Fake FUNCNAME##_fake; \
5444 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5445 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5446 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5447 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...) \
5448 { \
5449 SAVE_ARG(FUNCNAME, 0); \
5450 SAVE_ARG(FUNCNAME, 1); \
5451 SAVE_ARG(FUNCNAME, 2); \
5452 SAVE_ARG(FUNCNAME, 3); \
5453 SAVE_ARG(FUNCNAME, 4); \
5454 SAVE_ARG(FUNCNAME, 5); \
5455 SAVE_ARG(FUNCNAME, 6); \
5456 SAVE_ARG(FUNCNAME, 7); \
5457 SAVE_ARG(FUNCNAME, 8); \
5458 SAVE_ARG(FUNCNAME, 9); \
5459 SAVE_ARG(FUNCNAME, 10); \
5460 SAVE_ARG(FUNCNAME, 11); \
5461 SAVE_ARG(FUNCNAME, 12); \
5462 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5463 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5464 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5465 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5466 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5467 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5468 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5469 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5470 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5471 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5472 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5473 SAVE_ARG_HISTORY(FUNCNAME, 10); \
5474 SAVE_ARG_HISTORY(FUNCNAME, 11); \
5475 SAVE_ARG_HISTORY(FUNCNAME, 12); \
5476 } else { \
5477 HISTORY_DROPPED(FUNCNAME); \
5478 } \
5479 INCREMENT_CALL_COUNT(FUNCNAME); \
5480 REGISTER_CALL(FUNCNAME); \
5481 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5482 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5483 FUNCNAME##_fake.custom_fake_seq_len) { \
5484 va_list ap; \
5485 va_start(ap, arg12); \
5486 FUNCNAME##_fake \
5487 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5488 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5489 arg8, arg9, arg10, arg11, arg12, ap); \
5490 va_end(ap); \
5491 } else { \
5492 va_list ap; \
5493 va_start(ap, arg12); \
5494 FUNCNAME##_fake \
5495 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5496 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5497 arg8, arg9, arg10, arg11, arg12, ap); \
5498 va_end(ap); \
5499 } \
5500 } \
5501 if (FUNCNAME##_fake.custom_fake) { \
5502 va_list ap; \
5503 va_start(ap, arg12); \
5504 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5505 arg7, arg8, arg9, arg10, arg11, arg12, ap); \
5506 va_end(ap); \
5507 } \
5508 } \
5509 DEFINE_RESET_FUNCTION(FUNCNAME)
5510
5511#define FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5512 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5513 ARG11_TYPE, ARG12_TYPE, ...) \
5514 DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5515 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5516 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
5517 DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5518 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5519 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...)
5520
5521#define DECLARE_FAKE_VOID_FUNC15_VARARG( \
5522 FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5523 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
5524 typedef struct FUNCNAME##_Fake { \
5525 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5526 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5527 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5528 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5529 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5530 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5531 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5532 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5533 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5534 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5535 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
5536 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
5537 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
5538 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
5539 DECLARE_ALL_FUNC_COMMON \
5540 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5541 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5542 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5543 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5544 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, va_list ap); \
5545 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5546 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5547 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5548 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5549 va_list ap); \
5550 } FUNCNAME##_Fake; \
5551 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5552 void FUNCNAME##_reset(void); \
5553 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5554 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5555 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5556 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...);
5557
5558#define DEFINE_FAKE_VOID_FUNC15_VARARG( \
5559 FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5560 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
5561 FUNCNAME##_Fake FUNCNAME##_fake; \
5562 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5563 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5564 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5565 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...) \
5566 { \
5567 SAVE_ARG(FUNCNAME, 0); \
5568 SAVE_ARG(FUNCNAME, 1); \
5569 SAVE_ARG(FUNCNAME, 2); \
5570 SAVE_ARG(FUNCNAME, 3); \
5571 SAVE_ARG(FUNCNAME, 4); \
5572 SAVE_ARG(FUNCNAME, 5); \
5573 SAVE_ARG(FUNCNAME, 6); \
5574 SAVE_ARG(FUNCNAME, 7); \
5575 SAVE_ARG(FUNCNAME, 8); \
5576 SAVE_ARG(FUNCNAME, 9); \
5577 SAVE_ARG(FUNCNAME, 10); \
5578 SAVE_ARG(FUNCNAME, 11); \
5579 SAVE_ARG(FUNCNAME, 12); \
5580 SAVE_ARG(FUNCNAME, 13); \
5581 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5582 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5583 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5584 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5585 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5586 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5587 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5588 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5589 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5590 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5591 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5592 SAVE_ARG_HISTORY(FUNCNAME, 10); \
5593 SAVE_ARG_HISTORY(FUNCNAME, 11); \
5594 SAVE_ARG_HISTORY(FUNCNAME, 12); \
5595 SAVE_ARG_HISTORY(FUNCNAME, 13); \
5596 } else { \
5597 HISTORY_DROPPED(FUNCNAME); \
5598 } \
5599 INCREMENT_CALL_COUNT(FUNCNAME); \
5600 REGISTER_CALL(FUNCNAME); \
5601 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5602 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5603 FUNCNAME##_fake.custom_fake_seq_len) { \
5604 va_list ap; \
5605 va_start(ap, arg13); \
5606 FUNCNAME##_fake \
5607 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5608 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5609 arg8, arg9, arg10, arg11, arg12, arg13, ap); \
5610 va_end(ap); \
5611 } else { \
5612 va_list ap; \
5613 va_start(ap, arg13); \
5614 FUNCNAME##_fake \
5615 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5616 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5617 arg8, arg9, arg10, arg11, arg12, arg13, ap); \
5618 va_end(ap); \
5619 } \
5620 } \
5621 if (FUNCNAME##_fake.custom_fake) { \
5622 va_list ap; \
5623 va_start(ap, arg13); \
5624 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5625 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
5626 ap); \
5627 va_end(ap); \
5628 } \
5629 } \
5630 DEFINE_RESET_FUNCTION(FUNCNAME)
5631
5632#define FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5633 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5634 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
5635 DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5636 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5637 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5638 ...) \
5639 DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5640 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5641 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5642 ...)
5643
5644#define DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5645 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5646 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5647 ARG14_TYPE, ...) \
5648 typedef struct FUNCNAME##_Fake { \
5649 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5650 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5651 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5652 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5653 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5654 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5655 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5656 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5657 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5658 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5659 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
5660 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
5661 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
5662 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
5663 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
5664 DECLARE_ALL_FUNC_COMMON \
5665 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5666 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5667 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5668 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5669 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
5670 va_list ap); \
5671 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5672 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5673 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5674 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5675 ARG14_TYPE, va_list ap); \
5676 } FUNCNAME##_Fake; \
5677 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5678 void FUNCNAME##_reset(void); \
5679 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5680 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5681 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5682 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
5683 ARG14_TYPE arg14, ...);
5684
5685#define DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5686 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5687 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5688 ARG14_TYPE, ...) \
5689 FUNCNAME##_Fake FUNCNAME##_fake; \
5690 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5691 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5692 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5693 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
5694 ARG14_TYPE arg14, ...) \
5695 { \
5696 SAVE_ARG(FUNCNAME, 0); \
5697 SAVE_ARG(FUNCNAME, 1); \
5698 SAVE_ARG(FUNCNAME, 2); \
5699 SAVE_ARG(FUNCNAME, 3); \
5700 SAVE_ARG(FUNCNAME, 4); \
5701 SAVE_ARG(FUNCNAME, 5); \
5702 SAVE_ARG(FUNCNAME, 6); \
5703 SAVE_ARG(FUNCNAME, 7); \
5704 SAVE_ARG(FUNCNAME, 8); \
5705 SAVE_ARG(FUNCNAME, 9); \
5706 SAVE_ARG(FUNCNAME, 10); \
5707 SAVE_ARG(FUNCNAME, 11); \
5708 SAVE_ARG(FUNCNAME, 12); \
5709 SAVE_ARG(FUNCNAME, 13); \
5710 SAVE_ARG(FUNCNAME, 14); \
5711 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5712 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5713 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5714 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5715 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5716 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5717 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5718 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5719 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5720 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5721 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5722 SAVE_ARG_HISTORY(FUNCNAME, 10); \
5723 SAVE_ARG_HISTORY(FUNCNAME, 11); \
5724 SAVE_ARG_HISTORY(FUNCNAME, 12); \
5725 SAVE_ARG_HISTORY(FUNCNAME, 13); \
5726 SAVE_ARG_HISTORY(FUNCNAME, 14); \
5727 } else { \
5728 HISTORY_DROPPED(FUNCNAME); \
5729 } \
5730 INCREMENT_CALL_COUNT(FUNCNAME); \
5731 REGISTER_CALL(FUNCNAME); \
5732 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5733 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5734 FUNCNAME##_fake.custom_fake_seq_len) { \
5735 va_list ap; \
5736 va_start(ap, arg14); \
5737 FUNCNAME##_fake \
5738 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5739 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5740 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
5741 ap); \
5742 va_end(ap); \
5743 } else { \
5744 va_list ap; \
5745 va_start(ap, arg14); \
5746 FUNCNAME##_fake \
5747 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5748 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5749 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
5750 ap); \
5751 va_end(ap); \
5752 } \
5753 } \
5754 if (FUNCNAME##_fake.custom_fake) { \
5755 va_list ap; \
5756 va_start(ap, arg14); \
5757 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5758 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
5759 arg14, ap); \
5760 va_end(ap); \
5761 } \
5762 } \
5763 DEFINE_RESET_FUNCTION(FUNCNAME)
5764
5765#define FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5766 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5767 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
5768 DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5769 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5770 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5771 ARG14_TYPE, ...) \
5772 DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5773 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5774 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5775 ARG14_TYPE, ...)
5776
5777#define DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5778 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5779 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5780 ARG14_TYPE, ARG15_TYPE, ...) \
5781 typedef struct FUNCNAME##_Fake { \
5782 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5783 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5784 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5785 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5786 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5787 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5788 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5789 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5790 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5791 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5792 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
5793 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
5794 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
5795 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
5796 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
5797 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
5798 DECLARE_ALL_FUNC_COMMON \
5799 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5800 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5801 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5802 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5803 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
5804 ARG15_TYPE, va_list ap); \
5805 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5806 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5807 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5808 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5809 ARG14_TYPE, ARG15_TYPE, va_list ap); \
5810 } FUNCNAME##_Fake; \
5811 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5812 void FUNCNAME##_reset(void); \
5813 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5814 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5815 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5816 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
5817 ARG14_TYPE arg14, ARG15_TYPE arg15, ...);
5818
5819#define DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5820 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5821 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5822 ARG14_TYPE, ARG15_TYPE, ...) \
5823 FUNCNAME##_Fake FUNCNAME##_fake; \
5824 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5825 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5826 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5827 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
5828 ARG14_TYPE arg14, ARG15_TYPE arg15, ...) \
5829 { \
5830 SAVE_ARG(FUNCNAME, 0); \
5831 SAVE_ARG(FUNCNAME, 1); \
5832 SAVE_ARG(FUNCNAME, 2); \
5833 SAVE_ARG(FUNCNAME, 3); \
5834 SAVE_ARG(FUNCNAME, 4); \
5835 SAVE_ARG(FUNCNAME, 5); \
5836 SAVE_ARG(FUNCNAME, 6); \
5837 SAVE_ARG(FUNCNAME, 7); \
5838 SAVE_ARG(FUNCNAME, 8); \
5839 SAVE_ARG(FUNCNAME, 9); \
5840 SAVE_ARG(FUNCNAME, 10); \
5841 SAVE_ARG(FUNCNAME, 11); \
5842 SAVE_ARG(FUNCNAME, 12); \
5843 SAVE_ARG(FUNCNAME, 13); \
5844 SAVE_ARG(FUNCNAME, 14); \
5845 SAVE_ARG(FUNCNAME, 15); \
5846 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5847 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5848 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5849 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5850 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5851 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5852 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5853 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5854 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5855 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5856 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5857 SAVE_ARG_HISTORY(FUNCNAME, 10); \
5858 SAVE_ARG_HISTORY(FUNCNAME, 11); \
5859 SAVE_ARG_HISTORY(FUNCNAME, 12); \
5860 SAVE_ARG_HISTORY(FUNCNAME, 13); \
5861 SAVE_ARG_HISTORY(FUNCNAME, 14); \
5862 SAVE_ARG_HISTORY(FUNCNAME, 15); \
5863 } else { \
5864 HISTORY_DROPPED(FUNCNAME); \
5865 } \
5866 INCREMENT_CALL_COUNT(FUNCNAME); \
5867 REGISTER_CALL(FUNCNAME); \
5868 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
5869 if (FUNCNAME##_fake.custom_fake_seq_idx < \
5870 FUNCNAME##_fake.custom_fake_seq_len) { \
5871 va_list ap; \
5872 va_start(ap, arg15); \
5873 FUNCNAME##_fake \
5874 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
5875 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5876 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
5877 arg15, ap); \
5878 va_end(ap); \
5879 } else { \
5880 va_list ap; \
5881 va_start(ap, arg15); \
5882 FUNCNAME##_fake \
5883 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
5884 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
5885 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
5886 arg15, ap); \
5887 va_end(ap); \
5888 } \
5889 } \
5890 if (FUNCNAME##_fake.custom_fake) { \
5891 va_list ap; \
5892 va_start(ap, arg15); \
5893 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
5894 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
5895 arg14, arg15, ap); \
5896 va_end(ap); \
5897 } \
5898 } \
5899 DEFINE_RESET_FUNCTION(FUNCNAME)
5900
5901#define FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
5902 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5903 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
5904 DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5905 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5906 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5907 ARG14_TYPE, ARG15_TYPE, ...) \
5908 DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5909 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5910 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5911 ARG14_TYPE, ARG15_TYPE, ...)
5912
5913#define DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5914 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5915 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5916 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
5917 typedef struct FUNCNAME##_Fake { \
5918 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
5919 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
5920 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
5921 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
5922 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
5923 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
5924 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
5925 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
5926 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
5927 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
5928 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
5929 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
5930 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
5931 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
5932 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
5933 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
5934 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
5935 DECLARE_ALL_FUNC_COMMON \
5936 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
5937 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
5938 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
5939 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
5940 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
5941 ARG15_TYPE, ARG16_TYPE, va_list ap); \
5942 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
5943 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
5944 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
5945 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5946 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, va_list ap); \
5947 } FUNCNAME##_Fake; \
5948 extern FUNCNAME##_Fake FUNCNAME##_fake; \
5949 void FUNCNAME##_reset(void); \
5950 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5951 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5952 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5953 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
5954 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...);
5955
5956#define DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
5957 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
5958 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
5959 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
5960 FUNCNAME##_Fake FUNCNAME##_fake; \
5961 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
5962 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
5963 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
5964 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
5965 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...) \
5966 { \
5967 SAVE_ARG(FUNCNAME, 0); \
5968 SAVE_ARG(FUNCNAME, 1); \
5969 SAVE_ARG(FUNCNAME, 2); \
5970 SAVE_ARG(FUNCNAME, 3); \
5971 SAVE_ARG(FUNCNAME, 4); \
5972 SAVE_ARG(FUNCNAME, 5); \
5973 SAVE_ARG(FUNCNAME, 6); \
5974 SAVE_ARG(FUNCNAME, 7); \
5975 SAVE_ARG(FUNCNAME, 8); \
5976 SAVE_ARG(FUNCNAME, 9); \
5977 SAVE_ARG(FUNCNAME, 10); \
5978 SAVE_ARG(FUNCNAME, 11); \
5979 SAVE_ARG(FUNCNAME, 12); \
5980 SAVE_ARG(FUNCNAME, 13); \
5981 SAVE_ARG(FUNCNAME, 14); \
5982 SAVE_ARG(FUNCNAME, 15); \
5983 SAVE_ARG(FUNCNAME, 16); \
5984 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
5985 SAVE_ARG_HISTORY(FUNCNAME, 0); \
5986 SAVE_ARG_HISTORY(FUNCNAME, 1); \
5987 SAVE_ARG_HISTORY(FUNCNAME, 2); \
5988 SAVE_ARG_HISTORY(FUNCNAME, 3); \
5989 SAVE_ARG_HISTORY(FUNCNAME, 4); \
5990 SAVE_ARG_HISTORY(FUNCNAME, 5); \
5991 SAVE_ARG_HISTORY(FUNCNAME, 6); \
5992 SAVE_ARG_HISTORY(FUNCNAME, 7); \
5993 SAVE_ARG_HISTORY(FUNCNAME, 8); \
5994 SAVE_ARG_HISTORY(FUNCNAME, 9); \
5995 SAVE_ARG_HISTORY(FUNCNAME, 10); \
5996 SAVE_ARG_HISTORY(FUNCNAME, 11); \
5997 SAVE_ARG_HISTORY(FUNCNAME, 12); \
5998 SAVE_ARG_HISTORY(FUNCNAME, 13); \
5999 SAVE_ARG_HISTORY(FUNCNAME, 14); \
6000 SAVE_ARG_HISTORY(FUNCNAME, 15); \
6001 SAVE_ARG_HISTORY(FUNCNAME, 16); \
6002 } else { \
6003 HISTORY_DROPPED(FUNCNAME); \
6004 } \
6005 INCREMENT_CALL_COUNT(FUNCNAME); \
6006 REGISTER_CALL(FUNCNAME); \
6007 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6008 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6009 FUNCNAME##_fake.custom_fake_seq_len) { \
6010 va_list ap; \
6011 va_start(ap, arg16); \
6012 FUNCNAME##_fake \
6013 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
6014 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
6015 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
6016 arg15, arg16, ap); \
6017 va_end(ap); \
6018 } else { \
6019 va_list ap; \
6020 va_start(ap, arg16); \
6021 FUNCNAME##_fake \
6022 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6023 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
6024 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
6025 arg15, arg16, ap); \
6026 va_end(ap); \
6027 } \
6028 } \
6029 if (FUNCNAME##_fake.custom_fake) { \
6030 va_list ap; \
6031 va_start(ap, arg16); \
6032 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
6033 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
6034 arg14, arg15, arg16, ap); \
6035 va_end(ap); \
6036 } \
6037 } \
6038 DEFINE_RESET_FUNCTION(FUNCNAME)
6039
6040#define FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
6041 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
6042 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
6043 ARG16_TYPE, ...) \
6044 DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6045 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
6046 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6047 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
6048 DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6049 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
6050 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6051 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...)
6052
6053#define DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6054 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
6055 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6056 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
6057 typedef struct FUNCNAME##_Fake { \
6058 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6059 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6060 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6061 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
6062 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
6063 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
6064 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
6065 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
6066 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
6067 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
6068 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
6069 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
6070 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
6071 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
6072 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
6073 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
6074 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
6075 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
6076 DECLARE_ALL_FUNC_COMMON \
6077 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6078 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6079 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
6080 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
6081 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
6082 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, va_list ap); \
6083 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6084 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6085 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
6086 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6087 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
6088 va_list ap); \
6089 } FUNCNAME##_Fake; \
6090 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6091 void FUNCNAME##_reset(void); \
6092 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6093 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6094 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
6095 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
6096 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...);
6097
6098#define DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6099 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
6100 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6101 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
6102 FUNCNAME##_Fake FUNCNAME##_fake; \
6103 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6104 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6105 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
6106 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
6107 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...) \
6108 { \
6109 SAVE_ARG(FUNCNAME, 0); \
6110 SAVE_ARG(FUNCNAME, 1); \
6111 SAVE_ARG(FUNCNAME, 2); \
6112 SAVE_ARG(FUNCNAME, 3); \
6113 SAVE_ARG(FUNCNAME, 4); \
6114 SAVE_ARG(FUNCNAME, 5); \
6115 SAVE_ARG(FUNCNAME, 6); \
6116 SAVE_ARG(FUNCNAME, 7); \
6117 SAVE_ARG(FUNCNAME, 8); \
6118 SAVE_ARG(FUNCNAME, 9); \
6119 SAVE_ARG(FUNCNAME, 10); \
6120 SAVE_ARG(FUNCNAME, 11); \
6121 SAVE_ARG(FUNCNAME, 12); \
6122 SAVE_ARG(FUNCNAME, 13); \
6123 SAVE_ARG(FUNCNAME, 14); \
6124 SAVE_ARG(FUNCNAME, 15); \
6125 SAVE_ARG(FUNCNAME, 16); \
6126 SAVE_ARG(FUNCNAME, 17); \
6127 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6128 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6129 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6130 SAVE_ARG_HISTORY(FUNCNAME, 2); \
6131 SAVE_ARG_HISTORY(FUNCNAME, 3); \
6132 SAVE_ARG_HISTORY(FUNCNAME, 4); \
6133 SAVE_ARG_HISTORY(FUNCNAME, 5); \
6134 SAVE_ARG_HISTORY(FUNCNAME, 6); \
6135 SAVE_ARG_HISTORY(FUNCNAME, 7); \
6136 SAVE_ARG_HISTORY(FUNCNAME, 8); \
6137 SAVE_ARG_HISTORY(FUNCNAME, 9); \
6138 SAVE_ARG_HISTORY(FUNCNAME, 10); \
6139 SAVE_ARG_HISTORY(FUNCNAME, 11); \
6140 SAVE_ARG_HISTORY(FUNCNAME, 12); \
6141 SAVE_ARG_HISTORY(FUNCNAME, 13); \
6142 SAVE_ARG_HISTORY(FUNCNAME, 14); \
6143 SAVE_ARG_HISTORY(FUNCNAME, 15); \
6144 SAVE_ARG_HISTORY(FUNCNAME, 16); \
6145 SAVE_ARG_HISTORY(FUNCNAME, 17); \
6146 } else { \
6147 HISTORY_DROPPED(FUNCNAME); \
6148 } \
6149 INCREMENT_CALL_COUNT(FUNCNAME); \
6150 REGISTER_CALL(FUNCNAME); \
6151 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6152 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6153 FUNCNAME##_fake.custom_fake_seq_len) { \
6154 va_list ap; \
6155 va_start(ap, arg17); \
6156 FUNCNAME##_fake \
6157 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
6158 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
6159 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
6160 arg15, arg16, arg17, ap); \
6161 va_end(ap); \
6162 } else { \
6163 va_list ap; \
6164 va_start(ap, arg17); \
6165 FUNCNAME##_fake \
6166 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6167 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
6168 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
6169 arg15, arg16, arg17, ap); \
6170 va_end(ap); \
6171 } \
6172 } \
6173 if (FUNCNAME##_fake.custom_fake) { \
6174 va_list ap; \
6175 va_start(ap, arg17); \
6176 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
6177 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
6178 arg14, arg15, arg16, arg17, ap); \
6179 va_end(ap); \
6180 } \
6181 } \
6182 DEFINE_RESET_FUNCTION(FUNCNAME)
6183
6184#define FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
6185 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
6186 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
6187 ARG16_TYPE, ARG17_TYPE, ...) \
6188 DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6189 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
6190 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6191 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
6192 DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6193 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
6194 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6195 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...)
6196
6197#define DECLARE_FAKE_VOID_FUNC20_VARARG( \
6198 FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
6199 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6200 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
6201 typedef struct FUNCNAME##_Fake { \
6202 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6203 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6204 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6205 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
6206 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
6207 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
6208 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
6209 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
6210 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
6211 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
6212 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
6213 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
6214 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
6215 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
6216 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
6217 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
6218 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
6219 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
6220 DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
6221 DECLARE_ALL_FUNC_COMMON \
6222 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6223 CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6224 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
6225 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
6226 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, \
6227 ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, \
6228 va_list ap); \
6229 CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6230 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6231 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
6232 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6233 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
6234 ARG18_TYPE, va_list ap); \
6235 } FUNCNAME##_Fake; \
6236 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6237 void FUNCNAME##_reset(void); \
6238 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6239 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6240 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
6241 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
6242 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
6243 ARG18_TYPE arg18, ...);
6244
6245#define DEFINE_FAKE_VOID_FUNC20_VARARG( \
6246 FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, \
6247 ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
6248 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
6249 FUNCNAME##_Fake FUNCNAME##_fake; \
6250 void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6251 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6252 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
6253 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
6254 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
6255 ARG18_TYPE arg18, ...) \
6256 { \
6257 SAVE_ARG(FUNCNAME, 0); \
6258 SAVE_ARG(FUNCNAME, 1); \
6259 SAVE_ARG(FUNCNAME, 2); \
6260 SAVE_ARG(FUNCNAME, 3); \
6261 SAVE_ARG(FUNCNAME, 4); \
6262 SAVE_ARG(FUNCNAME, 5); \
6263 SAVE_ARG(FUNCNAME, 6); \
6264 SAVE_ARG(FUNCNAME, 7); \
6265 SAVE_ARG(FUNCNAME, 8); \
6266 SAVE_ARG(FUNCNAME, 9); \
6267 SAVE_ARG(FUNCNAME, 10); \
6268 SAVE_ARG(FUNCNAME, 11); \
6269 SAVE_ARG(FUNCNAME, 12); \
6270 SAVE_ARG(FUNCNAME, 13); \
6271 SAVE_ARG(FUNCNAME, 14); \
6272 SAVE_ARG(FUNCNAME, 15); \
6273 SAVE_ARG(FUNCNAME, 16); \
6274 SAVE_ARG(FUNCNAME, 17); \
6275 SAVE_ARG(FUNCNAME, 18); \
6276 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6277 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6278 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6279 SAVE_ARG_HISTORY(FUNCNAME, 2); \
6280 SAVE_ARG_HISTORY(FUNCNAME, 3); \
6281 SAVE_ARG_HISTORY(FUNCNAME, 4); \
6282 SAVE_ARG_HISTORY(FUNCNAME, 5); \
6283 SAVE_ARG_HISTORY(FUNCNAME, 6); \
6284 SAVE_ARG_HISTORY(FUNCNAME, 7); \
6285 SAVE_ARG_HISTORY(FUNCNAME, 8); \
6286 SAVE_ARG_HISTORY(FUNCNAME, 9); \
6287 SAVE_ARG_HISTORY(FUNCNAME, 10); \
6288 SAVE_ARG_HISTORY(FUNCNAME, 11); \
6289 SAVE_ARG_HISTORY(FUNCNAME, 12); \
6290 SAVE_ARG_HISTORY(FUNCNAME, 13); \
6291 SAVE_ARG_HISTORY(FUNCNAME, 14); \
6292 SAVE_ARG_HISTORY(FUNCNAME, 15); \
6293 SAVE_ARG_HISTORY(FUNCNAME, 16); \
6294 SAVE_ARG_HISTORY(FUNCNAME, 17); \
6295 SAVE_ARG_HISTORY(FUNCNAME, 18); \
6296 } else { \
6297 HISTORY_DROPPED(FUNCNAME); \
6298 } \
6299 INCREMENT_CALL_COUNT(FUNCNAME); \
6300 REGISTER_CALL(FUNCNAME); \
6301 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6302 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6303 FUNCNAME##_fake.custom_fake_seq_len) { \
6304 va_list ap; \
6305 va_start(ap, arg18); \
6306 FUNCNAME##_fake \
6307 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++]( \
6308 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
6309 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
6310 arg15, arg16, arg17, arg18, ap); \
6311 va_end(ap); \
6312 } else { \
6313 va_list ap; \
6314 va_start(ap, arg18); \
6315 FUNCNAME##_fake \
6316 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6317 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
6318 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
6319 arg15, arg16, arg17, arg18, ap); \
6320 va_end(ap); \
6321 } \
6322 } \
6323 if (FUNCNAME##_fake.custom_fake) { \
6324 va_list ap; \
6325 va_start(ap, arg18); \
6326 FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
6327 arg7, arg8, arg9, arg10, arg11, arg12, arg13, \
6328 arg14, arg15, arg16, arg17, arg18, ap); \
6329 va_end(ap); \
6330 } \
6331 } \
6332 DEFINE_RESET_FUNCTION(FUNCNAME)
6333
6334#define FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
6335 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, \
6336 ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, \
6337 ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
6338 DECLARE_FAKE_VOID_FUNC20_VARARG( \
6339 FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6340 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
6341 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
6342 DEFINE_FAKE_VOID_FUNC20_VARARG( \
6343 FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6344 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
6345 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...)
6346
6347#define DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
6348 typedef struct FUNCNAME##_Fake { \
6349 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6350 DECLARE_ALL_FUNC_COMMON \
6351 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6352 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6353 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6354 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, va_list ap); \
6355 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, \
6356 va_list ap); \
6357 } FUNCNAME##_Fake; \
6358 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6359 void FUNCNAME##_reset(void); \
6360 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...);
6361
6362#define DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
6363 FUNCNAME##_Fake FUNCNAME##_fake; \
6364 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...) \
6365 { \
6366 SAVE_ARG(FUNCNAME, 0); \
6367 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6368 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6369 } else { \
6370 HISTORY_DROPPED(FUNCNAME); \
6371 } \
6372 INCREMENT_CALL_COUNT(FUNCNAME); \
6373 REGISTER_CALL(FUNCNAME); \
6374 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6375 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6376 FUNCNAME##_fake.custom_fake_seq_len) { \
6377 va_list ap; \
6378 va_start(ap, arg0); \
6379 RETURN_TYPE ret = \
6380 FUNCNAME##_fake.custom_fake_seq \
6381 [FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
6382 SAVE_RET_HISTORY(FUNCNAME, ret); \
6383 va_end(ap); \
6384 return ret; \
6385 } else { \
6386 va_list ap; \
6387 va_start(ap, arg0); \
6388 RETURN_TYPE ret = \
6389 FUNCNAME##_fake.custom_fake_seq \
6390 [FUNCNAME##_fake.custom_fake_seq_len - 1](arg0, \
6391 ap); \
6392 SAVE_RET_HISTORY(FUNCNAME, ret); \
6393 va_end(ap); \
6394 return ret; \
6395 return FUNCNAME##_fake \
6396 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6397 arg0, ap); \
6398 } \
6399 } \
6400 if (FUNCNAME##_fake.custom_fake) { \
6401 RETURN_TYPE ret; \
6402 va_list ap; \
6403 va_start(ap, arg0); \
6404 ret = FUNCNAME##_fake.custom_fake(arg0, ap); \
6405 va_end(ap); \
6406 SAVE_RET_HISTORY(FUNCNAME, ret); \
6407 return ret; \
6408 } \
6409 RETURN_FAKE_RESULT(FUNCNAME) \
6410 } \
6411 DEFINE_RESET_FUNCTION(FUNCNAME)
6412
6413#define FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
6414 DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
6415 DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...)
6416
6417#define DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
6418 typedef struct FUNCNAME##_Fake { \
6419 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6420 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6421 DECLARE_ALL_FUNC_COMMON \
6422 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6423 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6424 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6425 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
6426 va_list ap); \
6427 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6428 va_list ap); \
6429 } FUNCNAME##_Fake; \
6430 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6431 void FUNCNAME##_reset(void); \
6432 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...);
6433
6434#define DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
6435 FUNCNAME##_Fake FUNCNAME##_fake; \
6436 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...) \
6437 { \
6438 SAVE_ARG(FUNCNAME, 0); \
6439 SAVE_ARG(FUNCNAME, 1); \
6440 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6441 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6442 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6443 } else { \
6444 HISTORY_DROPPED(FUNCNAME); \
6445 } \
6446 INCREMENT_CALL_COUNT(FUNCNAME); \
6447 REGISTER_CALL(FUNCNAME); \
6448 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6449 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6450 FUNCNAME##_fake.custom_fake_seq_len) { \
6451 va_list ap; \
6452 va_start(ap, arg1); \
6453 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
6454 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
6455 arg0, arg1, ap); \
6456 SAVE_RET_HISTORY(FUNCNAME, ret); \
6457 va_end(ap); \
6458 return ret; \
6459 } else { \
6460 va_list ap; \
6461 va_start(ap, arg1); \
6462 RETURN_TYPE ret = \
6463 FUNCNAME##_fake.custom_fake_seq \
6464 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6465 arg0, arg1, ap); \
6466 SAVE_RET_HISTORY(FUNCNAME, ret); \
6467 va_end(ap); \
6468 return ret; \
6469 return FUNCNAME##_fake \
6470 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6471 arg0, arg1, ap); \
6472 } \
6473 } \
6474 if (FUNCNAME##_fake.custom_fake) { \
6475 RETURN_TYPE ret; \
6476 va_list ap; \
6477 va_start(ap, arg1); \
6478 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
6479 va_end(ap); \
6480 SAVE_RET_HISTORY(FUNCNAME, ret); \
6481 return ret; \
6482 } \
6483 RETURN_FAKE_RESULT(FUNCNAME) \
6484 } \
6485 DEFINE_RESET_FUNCTION(FUNCNAME)
6486
6487#define FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
6488 DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
6489 DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...)
6490
6491#define DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6492 ...) \
6493 typedef struct FUNCNAME##_Fake { \
6494 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6495 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6496 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6497 DECLARE_ALL_FUNC_COMMON \
6498 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6499 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6500 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6501 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
6502 ARG2_TYPE, va_list ap); \
6503 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6504 ARG2_TYPE, va_list ap); \
6505 } FUNCNAME##_Fake; \
6506 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6507 void FUNCNAME##_reset(void); \
6508 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6509 ARG2_TYPE arg2, ...);
6510
6511#define DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6512 ...) \
6513 FUNCNAME##_Fake FUNCNAME##_fake; \
6514 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6515 ARG2_TYPE arg2, ...) \
6516 { \
6517 SAVE_ARG(FUNCNAME, 0); \
6518 SAVE_ARG(FUNCNAME, 1); \
6519 SAVE_ARG(FUNCNAME, 2); \
6520 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6521 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6522 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6523 SAVE_ARG_HISTORY(FUNCNAME, 2); \
6524 } else { \
6525 HISTORY_DROPPED(FUNCNAME); \
6526 } \
6527 INCREMENT_CALL_COUNT(FUNCNAME); \
6528 REGISTER_CALL(FUNCNAME); \
6529 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6530 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6531 FUNCNAME##_fake.custom_fake_seq_len) { \
6532 va_list ap; \
6533 va_start(ap, arg2); \
6534 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
6535 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
6536 arg0, arg1, arg2, ap); \
6537 SAVE_RET_HISTORY(FUNCNAME, ret); \
6538 va_end(ap); \
6539 return ret; \
6540 } else { \
6541 va_list ap; \
6542 va_start(ap, arg2); \
6543 RETURN_TYPE ret = \
6544 FUNCNAME##_fake.custom_fake_seq \
6545 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6546 arg0, arg1, arg2, ap); \
6547 SAVE_RET_HISTORY(FUNCNAME, ret); \
6548 va_end(ap); \
6549 return ret; \
6550 return FUNCNAME##_fake \
6551 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6552 arg0, arg1, arg2, ap); \
6553 } \
6554 } \
6555 if (FUNCNAME##_fake.custom_fake) { \
6556 RETURN_TYPE ret; \
6557 va_list ap; \
6558 va_start(ap, arg2); \
6559 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
6560 va_end(ap); \
6561 SAVE_RET_HISTORY(FUNCNAME, ret); \
6562 return ret; \
6563 } \
6564 RETURN_FAKE_RESULT(FUNCNAME) \
6565 } \
6566 DEFINE_RESET_FUNCTION(FUNCNAME)
6567
6568#define FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
6569 DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6570 ...) \
6571 DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...)
6572
6573#define DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6574 ARG3_TYPE, ...) \
6575 typedef struct FUNCNAME##_Fake { \
6576 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6577 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6578 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6579 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
6580 DECLARE_ALL_FUNC_COMMON \
6581 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6582 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6583 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6584 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
6585 ARG2_TYPE, ARG3_TYPE, va_list ap); \
6586 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6587 ARG2_TYPE, ARG3_TYPE, va_list ap); \
6588 } FUNCNAME##_Fake; \
6589 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6590 void FUNCNAME##_reset(void); \
6591 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6592 ARG2_TYPE arg2, ARG3_TYPE arg3, ...);
6593
6594#define DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6595 ARG3_TYPE, ...) \
6596 FUNCNAME##_Fake FUNCNAME##_fake; \
6597 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6598 ARG2_TYPE arg2, ARG3_TYPE arg3, ...) \
6599 { \
6600 SAVE_ARG(FUNCNAME, 0); \
6601 SAVE_ARG(FUNCNAME, 1); \
6602 SAVE_ARG(FUNCNAME, 2); \
6603 SAVE_ARG(FUNCNAME, 3); \
6604 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6605 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6606 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6607 SAVE_ARG_HISTORY(FUNCNAME, 2); \
6608 SAVE_ARG_HISTORY(FUNCNAME, 3); \
6609 } else { \
6610 HISTORY_DROPPED(FUNCNAME); \
6611 } \
6612 INCREMENT_CALL_COUNT(FUNCNAME); \
6613 REGISTER_CALL(FUNCNAME); \
6614 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6615 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6616 FUNCNAME##_fake.custom_fake_seq_len) { \
6617 va_list ap; \
6618 va_start(ap, arg3); \
6619 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
6620 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
6621 arg0, arg1, arg2, arg3, ap); \
6622 SAVE_RET_HISTORY(FUNCNAME, ret); \
6623 va_end(ap); \
6624 return ret; \
6625 } else { \
6626 va_list ap; \
6627 va_start(ap, arg3); \
6628 RETURN_TYPE ret = \
6629 FUNCNAME##_fake.custom_fake_seq \
6630 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6631 arg0, arg1, arg2, arg3, ap); \
6632 SAVE_RET_HISTORY(FUNCNAME, ret); \
6633 va_end(ap); \
6634 return ret; \
6635 return FUNCNAME##_fake \
6636 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6637 arg0, arg1, arg2, arg3, ap); \
6638 } \
6639 } \
6640 if (FUNCNAME##_fake.custom_fake) { \
6641 RETURN_TYPE ret; \
6642 va_list ap; \
6643 va_start(ap, arg3); \
6644 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
6645 va_end(ap); \
6646 SAVE_RET_HISTORY(FUNCNAME, ret); \
6647 return ret; \
6648 } \
6649 RETURN_FAKE_RESULT(FUNCNAME) \
6650 } \
6651 DEFINE_RESET_FUNCTION(FUNCNAME)
6652
6653#define FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6654 ...) \
6655 DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6656 ARG3_TYPE, ...) \
6657 DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6658 ARG3_TYPE, ...)
6659
6660#define DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6661 ARG3_TYPE, ARG4_TYPE, ...) \
6662 typedef struct FUNCNAME##_Fake { \
6663 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6664 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6665 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6666 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
6667 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
6668 DECLARE_ALL_FUNC_COMMON \
6669 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6670 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6671 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6672 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
6673 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, va_list ap); \
6674 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6675 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, va_list ap); \
6676 } FUNCNAME##_Fake; \
6677 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6678 void FUNCNAME##_reset(void); \
6679 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6680 ARG2_TYPE arg2, ARG3_TYPE arg3, \
6681 ARG4_TYPE arg4, ...);
6682
6683#define DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6684 ARG3_TYPE, ARG4_TYPE, ...) \
6685 FUNCNAME##_Fake FUNCNAME##_fake; \
6686 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6687 ARG2_TYPE arg2, ARG3_TYPE arg3, \
6688 ARG4_TYPE arg4, ...) \
6689 { \
6690 SAVE_ARG(FUNCNAME, 0); \
6691 SAVE_ARG(FUNCNAME, 1); \
6692 SAVE_ARG(FUNCNAME, 2); \
6693 SAVE_ARG(FUNCNAME, 3); \
6694 SAVE_ARG(FUNCNAME, 4); \
6695 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6696 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6697 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6698 SAVE_ARG_HISTORY(FUNCNAME, 2); \
6699 SAVE_ARG_HISTORY(FUNCNAME, 3); \
6700 SAVE_ARG_HISTORY(FUNCNAME, 4); \
6701 } else { \
6702 HISTORY_DROPPED(FUNCNAME); \
6703 } \
6704 INCREMENT_CALL_COUNT(FUNCNAME); \
6705 REGISTER_CALL(FUNCNAME); \
6706 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6707 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6708 FUNCNAME##_fake.custom_fake_seq_len) { \
6709 va_list ap; \
6710 va_start(ap, arg4); \
6711 RETURN_TYPE ret = \
6712 FUNCNAME##_fake.custom_fake_seq \
6713 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
6714 arg0, arg1, arg2, arg3, arg4, ap); \
6715 SAVE_RET_HISTORY(FUNCNAME, ret); \
6716 va_end(ap); \
6717 return ret; \
6718 } else { \
6719 va_list ap; \
6720 va_start(ap, arg4); \
6721 RETURN_TYPE ret = \
6722 FUNCNAME##_fake.custom_fake_seq \
6723 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6724 arg0, arg1, arg2, arg3, arg4, ap); \
6725 SAVE_RET_HISTORY(FUNCNAME, ret); \
6726 va_end(ap); \
6727 return ret; \
6728 return FUNCNAME##_fake \
6729 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6730 arg0, arg1, arg2, arg3, arg4, ap); \
6731 } \
6732 } \
6733 if (FUNCNAME##_fake.custom_fake) { \
6734 RETURN_TYPE ret; \
6735 va_list ap; \
6736 va_start(ap, arg4); \
6737 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
6738 va_end(ap); \
6739 SAVE_RET_HISTORY(FUNCNAME, ret); \
6740 return ret; \
6741 } \
6742 RETURN_FAKE_RESULT(FUNCNAME) \
6743 } \
6744 DEFINE_RESET_FUNCTION(FUNCNAME)
6745
6746#define FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6747 ARG4_TYPE, ...) \
6748 DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6749 ARG3_TYPE, ARG4_TYPE, ...) \
6750 DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6751 ARG3_TYPE, ARG4_TYPE, ...)
6752
6753#define DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6754 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
6755 typedef struct FUNCNAME##_Fake { \
6756 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6757 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6758 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6759 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
6760 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
6761 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
6762 DECLARE_ALL_FUNC_COMMON \
6763 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6764 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6765 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6766 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
6767 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6768 va_list ap); \
6769 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6770 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6771 va_list ap); \
6772 } FUNCNAME##_Fake; \
6773 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6774 void FUNCNAME##_reset(void); \
6775 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6776 ARG2_TYPE arg2, ARG3_TYPE arg3, \
6777 ARG4_TYPE arg4, ARG5_TYPE arg5, ...);
6778
6779#define DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6780 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
6781 FUNCNAME##_Fake FUNCNAME##_fake; \
6782 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, \
6783 ARG2_TYPE arg2, ARG3_TYPE arg3, \
6784 ARG4_TYPE arg4, ARG5_TYPE arg5, ...) \
6785 { \
6786 SAVE_ARG(FUNCNAME, 0); \
6787 SAVE_ARG(FUNCNAME, 1); \
6788 SAVE_ARG(FUNCNAME, 2); \
6789 SAVE_ARG(FUNCNAME, 3); \
6790 SAVE_ARG(FUNCNAME, 4); \
6791 SAVE_ARG(FUNCNAME, 5); \
6792 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6793 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6794 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6795 SAVE_ARG_HISTORY(FUNCNAME, 2); \
6796 SAVE_ARG_HISTORY(FUNCNAME, 3); \
6797 SAVE_ARG_HISTORY(FUNCNAME, 4); \
6798 SAVE_ARG_HISTORY(FUNCNAME, 5); \
6799 } else { \
6800 HISTORY_DROPPED(FUNCNAME); \
6801 } \
6802 INCREMENT_CALL_COUNT(FUNCNAME); \
6803 REGISTER_CALL(FUNCNAME); \
6804 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6805 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6806 FUNCNAME##_fake.custom_fake_seq_len) { \
6807 va_list ap; \
6808 va_start(ap, arg5); \
6809 RETURN_TYPE ret = \
6810 FUNCNAME##_fake.custom_fake_seq \
6811 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
6812 arg0, arg1, arg2, arg3, arg4, arg5, ap); \
6813 SAVE_RET_HISTORY(FUNCNAME, ret); \
6814 va_end(ap); \
6815 return ret; \
6816 } else { \
6817 va_list ap; \
6818 va_start(ap, arg5); \
6819 RETURN_TYPE ret = \
6820 FUNCNAME##_fake.custom_fake_seq \
6821 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6822 arg0, arg1, arg2, arg3, arg4, arg5, ap); \
6823 SAVE_RET_HISTORY(FUNCNAME, ret); \
6824 va_end(ap); \
6825 return ret; \
6826 return FUNCNAME##_fake \
6827 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6828 arg0, arg1, arg2, arg3, arg4, arg5, ap); \
6829 } \
6830 } \
6831 if (FUNCNAME##_fake.custom_fake) { \
6832 RETURN_TYPE ret; \
6833 va_list ap; \
6834 va_start(ap, arg5); \
6835 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
6836 va_end(ap); \
6837 SAVE_RET_HISTORY(FUNCNAME, ret); \
6838 return ret; \
6839 } \
6840 RETURN_FAKE_RESULT(FUNCNAME) \
6841 } \
6842 DEFINE_RESET_FUNCTION(FUNCNAME)
6843
6844#define FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6845 ARG4_TYPE, ARG5_TYPE, ...) \
6846 DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6847 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
6848 DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6849 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...)
6850
6851#define DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6852 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
6853 typedef struct FUNCNAME##_Fake { \
6854 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6855 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6856 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6857 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
6858 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
6859 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
6860 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
6861 DECLARE_ALL_FUNC_COMMON \
6862 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6863 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6864 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6865 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
6866 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6867 ARG6_TYPE, va_list ap); \
6868 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6869 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6870 ARG6_TYPE, va_list ap); \
6871 } FUNCNAME##_Fake; \
6872 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6873 void FUNCNAME##_reset(void); \
6874 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6875 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6876 ARG5_TYPE arg5, ARG6_TYPE arg6, ...);
6877
6878#define DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6879 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
6880 FUNCNAME##_Fake FUNCNAME##_fake; \
6881 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6882 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6883 ARG5_TYPE arg5, ARG6_TYPE arg6, ...) \
6884 { \
6885 SAVE_ARG(FUNCNAME, 0); \
6886 SAVE_ARG(FUNCNAME, 1); \
6887 SAVE_ARG(FUNCNAME, 2); \
6888 SAVE_ARG(FUNCNAME, 3); \
6889 SAVE_ARG(FUNCNAME, 4); \
6890 SAVE_ARG(FUNCNAME, 5); \
6891 SAVE_ARG(FUNCNAME, 6); \
6892 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6893 SAVE_ARG_HISTORY(FUNCNAME, 0); \
6894 SAVE_ARG_HISTORY(FUNCNAME, 1); \
6895 SAVE_ARG_HISTORY(FUNCNAME, 2); \
6896 SAVE_ARG_HISTORY(FUNCNAME, 3); \
6897 SAVE_ARG_HISTORY(FUNCNAME, 4); \
6898 SAVE_ARG_HISTORY(FUNCNAME, 5); \
6899 SAVE_ARG_HISTORY(FUNCNAME, 6); \
6900 } else { \
6901 HISTORY_DROPPED(FUNCNAME); \
6902 } \
6903 INCREMENT_CALL_COUNT(FUNCNAME); \
6904 REGISTER_CALL(FUNCNAME); \
6905 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
6906 if (FUNCNAME##_fake.custom_fake_seq_idx < \
6907 FUNCNAME##_fake.custom_fake_seq_len) { \
6908 va_list ap; \
6909 va_start(ap, arg6); \
6910 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
6911 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
6912 arg0, arg1, arg2, arg3, arg4, \
6913 arg5, arg6, ap); \
6914 SAVE_RET_HISTORY(FUNCNAME, ret); \
6915 va_end(ap); \
6916 return ret; \
6917 } else { \
6918 va_list ap; \
6919 va_start(ap, arg6); \
6920 RETURN_TYPE ret = \
6921 FUNCNAME##_fake.custom_fake_seq \
6922 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6923 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
6924 ap); \
6925 SAVE_RET_HISTORY(FUNCNAME, ret); \
6926 va_end(ap); \
6927 return ret; \
6928 return FUNCNAME##_fake \
6929 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
6930 arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
6931 } \
6932 } \
6933 if (FUNCNAME##_fake.custom_fake) { \
6934 RETURN_TYPE ret; \
6935 va_list ap; \
6936 va_start(ap, arg6); \
6937 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
6938 arg6, ap); \
6939 va_end(ap); \
6940 SAVE_RET_HISTORY(FUNCNAME, ret); \
6941 return ret; \
6942 } \
6943 RETURN_FAKE_RESULT(FUNCNAME) \
6944 } \
6945 DEFINE_RESET_FUNCTION(FUNCNAME)
6946
6947#define FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
6948 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
6949 DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6950 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
6951 DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6952 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...)
6953
6954#define DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6955 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
6956 ...) \
6957 typedef struct FUNCNAME##_Fake { \
6958 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
6959 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
6960 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
6961 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
6962 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
6963 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
6964 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
6965 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
6966 DECLARE_ALL_FUNC_COMMON \
6967 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
6968 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
6969 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
6970 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
6971 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6972 ARG6_TYPE, ARG7_TYPE, va_list ap); \
6973 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
6974 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
6975 ARG6_TYPE, ARG7_TYPE, va_list ap); \
6976 } FUNCNAME##_Fake; \
6977 extern FUNCNAME##_Fake FUNCNAME##_fake; \
6978 void FUNCNAME##_reset(void); \
6979 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6980 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6981 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...);
6982
6983#define DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
6984 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
6985 FUNCNAME##_Fake FUNCNAME##_fake; \
6986 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
6987 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
6988 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...) \
6989 { \
6990 SAVE_ARG(FUNCNAME, 0); \
6991 SAVE_ARG(FUNCNAME, 1); \
6992 SAVE_ARG(FUNCNAME, 2); \
6993 SAVE_ARG(FUNCNAME, 3); \
6994 SAVE_ARG(FUNCNAME, 4); \
6995 SAVE_ARG(FUNCNAME, 5); \
6996 SAVE_ARG(FUNCNAME, 6); \
6997 SAVE_ARG(FUNCNAME, 7); \
6998 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
6999 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7000 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7001 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7002 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7003 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7004 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7005 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7006 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7007 } else { \
7008 HISTORY_DROPPED(FUNCNAME); \
7009 } \
7010 INCREMENT_CALL_COUNT(FUNCNAME); \
7011 REGISTER_CALL(FUNCNAME); \
7012 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7013 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7014 FUNCNAME##_fake.custom_fake_seq_len) { \
7015 va_list ap; \
7016 va_start(ap, arg7); \
7017 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
7018 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7019 arg0, arg1, arg2, arg3, arg4, \
7020 arg5, arg6, arg7, ap); \
7021 SAVE_RET_HISTORY(FUNCNAME, ret); \
7022 va_end(ap); \
7023 return ret; \
7024 } else { \
7025 va_list ap; \
7026 va_start(ap, arg7); \
7027 RETURN_TYPE ret = \
7028 FUNCNAME##_fake.custom_fake_seq \
7029 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7030 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7031 arg7, ap); \
7032 SAVE_RET_HISTORY(FUNCNAME, ret); \
7033 va_end(ap); \
7034 return ret; \
7035 return FUNCNAME##_fake \
7036 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7037 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7038 ap); \
7039 } \
7040 } \
7041 if (FUNCNAME##_fake.custom_fake) { \
7042 RETURN_TYPE ret; \
7043 va_list ap; \
7044 va_start(ap, arg7); \
7045 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7046 arg6, arg7, ap); \
7047 va_end(ap); \
7048 SAVE_RET_HISTORY(FUNCNAME, ret); \
7049 return ret; \
7050 } \
7051 RETURN_FAKE_RESULT(FUNCNAME) \
7052 } \
7053 DEFINE_RESET_FUNCTION(FUNCNAME)
7054
7055#define FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, \
7056 ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
7057 DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7058 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7059 ...) \
7060 DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7061 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...)
7062
7063#define DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7064 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7065 ARG8_TYPE, ...) \
7066 typedef struct FUNCNAME##_Fake { \
7067 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7068 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7069 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7070 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7071 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7072 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7073 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7074 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
7075 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
7076 DECLARE_ALL_FUNC_COMMON \
7077 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
7078 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
7079 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
7080 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
7081 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7082 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, va_list ap); \
7083 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
7084 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7085 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, va_list ap); \
7086 } FUNCNAME##_Fake; \
7087 extern FUNCNAME##_Fake FUNCNAME##_fake; \
7088 void FUNCNAME##_reset(void); \
7089 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7090 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7091 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...);
7092
7093#define DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7094 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7095 ARG8_TYPE, ...) \
7096 FUNCNAME##_Fake FUNCNAME##_fake; \
7097 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7098 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7099 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...) \
7100 { \
7101 SAVE_ARG(FUNCNAME, 0); \
7102 SAVE_ARG(FUNCNAME, 1); \
7103 SAVE_ARG(FUNCNAME, 2); \
7104 SAVE_ARG(FUNCNAME, 3); \
7105 SAVE_ARG(FUNCNAME, 4); \
7106 SAVE_ARG(FUNCNAME, 5); \
7107 SAVE_ARG(FUNCNAME, 6); \
7108 SAVE_ARG(FUNCNAME, 7); \
7109 SAVE_ARG(FUNCNAME, 8); \
7110 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
7111 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7112 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7113 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7114 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7115 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7116 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7117 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7118 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7119 SAVE_ARG_HISTORY(FUNCNAME, 8); \
7120 } else { \
7121 HISTORY_DROPPED(FUNCNAME); \
7122 } \
7123 INCREMENT_CALL_COUNT(FUNCNAME); \
7124 REGISTER_CALL(FUNCNAME); \
7125 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7126 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7127 FUNCNAME##_fake.custom_fake_seq_len) { \
7128 va_list ap; \
7129 va_start(ap, arg8); \
7130 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
7131 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7132 arg0, arg1, arg2, arg3, arg4, \
7133 arg5, arg6, arg7, arg8, ap); \
7134 SAVE_RET_HISTORY(FUNCNAME, ret); \
7135 va_end(ap); \
7136 return ret; \
7137 } else { \
7138 va_list ap; \
7139 va_start(ap, arg8); \
7140 RETURN_TYPE ret = \
7141 FUNCNAME##_fake.custom_fake_seq \
7142 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7143 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7144 arg7, arg8, ap); \
7145 SAVE_RET_HISTORY(FUNCNAME, ret); \
7146 va_end(ap); \
7147 return ret; \
7148 return FUNCNAME##_fake \
7149 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7150 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7151 arg8, ap); \
7152 } \
7153 } \
7154 if (FUNCNAME##_fake.custom_fake) { \
7155 RETURN_TYPE ret; \
7156 va_list ap; \
7157 va_start(ap, arg8); \
7158 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7159 arg6, arg7, arg8, ap); \
7160 va_end(ap); \
7161 SAVE_RET_HISTORY(FUNCNAME, ret); \
7162 return ret; \
7163 } \
7164 RETURN_FAKE_RESULT(FUNCNAME) \
7165 } \
7166 DEFINE_RESET_FUNCTION(FUNCNAME)
7167
7168#define FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7169 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
7170 ...) \
7171 DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7172 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7173 ARG8_TYPE, ...) \
7174 DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7175 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7176 ARG8_TYPE, ...)
7177
7178#define DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7179 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7180 ARG8_TYPE, ARG9_TYPE, ...) \
7181 typedef struct FUNCNAME##_Fake { \
7182 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7183 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7184 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7185 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7186 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7187 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7188 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7189 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
7190 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
7191 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
7192 DECLARE_ALL_FUNC_COMMON \
7193 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
7194 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
7195 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
7196 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
7197 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7198 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7199 va_list ap); \
7200 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
7201 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7202 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7203 va_list ap); \
7204 } FUNCNAME##_Fake; \
7205 extern FUNCNAME##_Fake FUNCNAME##_fake; \
7206 void FUNCNAME##_reset(void); \
7207 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7208 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7209 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7210 ...);
7211
7212#define DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7213 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7214 ARG8_TYPE, ARG9_TYPE, ...) \
7215 FUNCNAME##_Fake FUNCNAME##_fake; \
7216 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7217 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7218 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7219 ...) \
7220 { \
7221 SAVE_ARG(FUNCNAME, 0); \
7222 SAVE_ARG(FUNCNAME, 1); \
7223 SAVE_ARG(FUNCNAME, 2); \
7224 SAVE_ARG(FUNCNAME, 3); \
7225 SAVE_ARG(FUNCNAME, 4); \
7226 SAVE_ARG(FUNCNAME, 5); \
7227 SAVE_ARG(FUNCNAME, 6); \
7228 SAVE_ARG(FUNCNAME, 7); \
7229 SAVE_ARG(FUNCNAME, 8); \
7230 SAVE_ARG(FUNCNAME, 9); \
7231 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
7232 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7233 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7234 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7235 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7236 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7237 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7238 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7239 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7240 SAVE_ARG_HISTORY(FUNCNAME, 8); \
7241 SAVE_ARG_HISTORY(FUNCNAME, 9); \
7242 } else { \
7243 HISTORY_DROPPED(FUNCNAME); \
7244 } \
7245 INCREMENT_CALL_COUNT(FUNCNAME); \
7246 REGISTER_CALL(FUNCNAME); \
7247 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7248 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7249 FUNCNAME##_fake.custom_fake_seq_len) { \
7250 va_list ap; \
7251 va_start(ap, arg9); \
7252 RETURN_TYPE ret = \
7253 FUNCNAME##_fake.custom_fake_seq \
7254 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7255 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7256 arg7, arg8, arg9, ap); \
7257 SAVE_RET_HISTORY(FUNCNAME, ret); \
7258 va_end(ap); \
7259 return ret; \
7260 } else { \
7261 va_list ap; \
7262 va_start(ap, arg9); \
7263 RETURN_TYPE ret = \
7264 FUNCNAME##_fake.custom_fake_seq \
7265 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7266 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7267 arg7, arg8, arg9, ap); \
7268 SAVE_RET_HISTORY(FUNCNAME, ret); \
7269 va_end(ap); \
7270 return ret; \
7271 return FUNCNAME##_fake \
7272 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7273 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7274 arg8, arg9, ap); \
7275 } \
7276 } \
7277 if (FUNCNAME##_fake.custom_fake) { \
7278 RETURN_TYPE ret; \
7279 va_list ap; \
7280 va_start(ap, arg9); \
7281 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7282 arg6, arg7, arg8, arg9, ap); \
7283 va_end(ap); \
7284 SAVE_RET_HISTORY(FUNCNAME, ret); \
7285 return ret; \
7286 } \
7287 RETURN_FAKE_RESULT(FUNCNAME) \
7288 } \
7289 DEFINE_RESET_FUNCTION(FUNCNAME)
7290
7291#define FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7292 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
7293 ARG9_TYPE, ...) \
7294 DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7295 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7296 ARG8_TYPE, ARG9_TYPE, ...) \
7297 DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7298 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7299 ARG8_TYPE, ARG9_TYPE, ...)
7300
7301#define DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7302 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7303 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
7304 typedef struct FUNCNAME##_Fake { \
7305 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7306 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7307 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7308 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7309 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7310 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7311 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7312 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
7313 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
7314 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
7315 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
7316 DECLARE_ALL_FUNC_COMMON \
7317 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
7318 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
7319 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
7320 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
7321 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7322 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7323 ARG10_TYPE, va_list ap); \
7324 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
7325 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7326 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7327 ARG10_TYPE, va_list ap); \
7328 } FUNCNAME##_Fake; \
7329 extern FUNCNAME##_Fake FUNCNAME##_fake; \
7330 void FUNCNAME##_reset(void); \
7331 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7332 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7333 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7334 ARG10_TYPE arg10, ...);
7335
7336#define DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7337 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7338 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
7339 FUNCNAME##_Fake FUNCNAME##_fake; \
7340 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7341 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7342 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7343 ARG10_TYPE arg10, ...) \
7344 { \
7345 SAVE_ARG(FUNCNAME, 0); \
7346 SAVE_ARG(FUNCNAME, 1); \
7347 SAVE_ARG(FUNCNAME, 2); \
7348 SAVE_ARG(FUNCNAME, 3); \
7349 SAVE_ARG(FUNCNAME, 4); \
7350 SAVE_ARG(FUNCNAME, 5); \
7351 SAVE_ARG(FUNCNAME, 6); \
7352 SAVE_ARG(FUNCNAME, 7); \
7353 SAVE_ARG(FUNCNAME, 8); \
7354 SAVE_ARG(FUNCNAME, 9); \
7355 SAVE_ARG(FUNCNAME, 10); \
7356 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
7357 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7358 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7359 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7360 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7361 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7362 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7363 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7364 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7365 SAVE_ARG_HISTORY(FUNCNAME, 8); \
7366 SAVE_ARG_HISTORY(FUNCNAME, 9); \
7367 SAVE_ARG_HISTORY(FUNCNAME, 10); \
7368 } else { \
7369 HISTORY_DROPPED(FUNCNAME); \
7370 } \
7371 INCREMENT_CALL_COUNT(FUNCNAME); \
7372 REGISTER_CALL(FUNCNAME); \
7373 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7374 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7375 FUNCNAME##_fake.custom_fake_seq_len) { \
7376 va_list ap; \
7377 va_start(ap, arg10); \
7378 RETURN_TYPE ret = \
7379 FUNCNAME##_fake.custom_fake_seq \
7380 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7381 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7382 arg7, arg8, arg9, arg10, ap); \
7383 SAVE_RET_HISTORY(FUNCNAME, ret); \
7384 va_end(ap); \
7385 return ret; \
7386 } else { \
7387 va_list ap; \
7388 va_start(ap, arg10); \
7389 RETURN_TYPE ret = \
7390 FUNCNAME##_fake.custom_fake_seq \
7391 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7392 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7393 arg7, arg8, arg9, arg10, ap); \
7394 SAVE_RET_HISTORY(FUNCNAME, ret); \
7395 va_end(ap); \
7396 return ret; \
7397 return FUNCNAME##_fake \
7398 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7399 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7400 arg8, arg9, arg10, ap); \
7401 } \
7402 } \
7403 if (FUNCNAME##_fake.custom_fake) { \
7404 RETURN_TYPE ret; \
7405 va_list ap; \
7406 va_start(ap, arg10); \
7407 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7408 arg6, arg7, arg8, arg9, arg10, ap); \
7409 va_end(ap); \
7410 SAVE_RET_HISTORY(FUNCNAME, ret); \
7411 return ret; \
7412 } \
7413 RETURN_FAKE_RESULT(FUNCNAME) \
7414 } \
7415 DEFINE_RESET_FUNCTION(FUNCNAME)
7416
7417#define FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7418 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
7419 ARG9_TYPE, ARG10_TYPE, ...) \
7420 DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7421 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7422 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
7423 DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7424 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7425 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...)
7426
7427#define DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7428 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7429 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
7430 typedef struct FUNCNAME##_Fake { \
7431 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7432 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7433 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7434 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7435 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7436 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7437 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7438 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
7439 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
7440 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
7441 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
7442 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
7443 DECLARE_ALL_FUNC_COMMON \
7444 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
7445 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
7446 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
7447 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
7448 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7449 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7450 ARG10_TYPE, ARG11_TYPE, va_list ap); \
7451 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
7452 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7453 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7454 ARG10_TYPE, ARG11_TYPE, va_list ap); \
7455 } FUNCNAME##_Fake; \
7456 extern FUNCNAME##_Fake FUNCNAME##_fake; \
7457 void FUNCNAME##_reset(void); \
7458 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7459 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7460 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7461 ARG10_TYPE arg10, ARG11_TYPE arg11, ...);
7462
7463#define DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7464 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7465 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
7466 FUNCNAME##_Fake FUNCNAME##_fake; \
7467 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7468 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7469 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7470 ARG10_TYPE arg10, ARG11_TYPE arg11, ...) \
7471 { \
7472 SAVE_ARG(FUNCNAME, 0); \
7473 SAVE_ARG(FUNCNAME, 1); \
7474 SAVE_ARG(FUNCNAME, 2); \
7475 SAVE_ARG(FUNCNAME, 3); \
7476 SAVE_ARG(FUNCNAME, 4); \
7477 SAVE_ARG(FUNCNAME, 5); \
7478 SAVE_ARG(FUNCNAME, 6); \
7479 SAVE_ARG(FUNCNAME, 7); \
7480 SAVE_ARG(FUNCNAME, 8); \
7481 SAVE_ARG(FUNCNAME, 9); \
7482 SAVE_ARG(FUNCNAME, 10); \
7483 SAVE_ARG(FUNCNAME, 11); \
7484 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
7485 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7486 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7487 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7488 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7489 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7490 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7491 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7492 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7493 SAVE_ARG_HISTORY(FUNCNAME, 8); \
7494 SAVE_ARG_HISTORY(FUNCNAME, 9); \
7495 SAVE_ARG_HISTORY(FUNCNAME, 10); \
7496 SAVE_ARG_HISTORY(FUNCNAME, 11); \
7497 } else { \
7498 HISTORY_DROPPED(FUNCNAME); \
7499 } \
7500 INCREMENT_CALL_COUNT(FUNCNAME); \
7501 REGISTER_CALL(FUNCNAME); \
7502 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7503 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7504 FUNCNAME##_fake.custom_fake_seq_len) { \
7505 va_list ap; \
7506 va_start(ap, arg11); \
7507 RETURN_TYPE ret = \
7508 FUNCNAME##_fake.custom_fake_seq \
7509 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7510 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7511 arg7, arg8, arg9, arg10, arg11, ap); \
7512 SAVE_RET_HISTORY(FUNCNAME, ret); \
7513 va_end(ap); \
7514 return ret; \
7515 } else { \
7516 va_list ap; \
7517 va_start(ap, arg11); \
7518 RETURN_TYPE ret = \
7519 FUNCNAME##_fake.custom_fake_seq \
7520 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7521 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7522 arg7, arg8, arg9, arg10, arg11, ap); \
7523 SAVE_RET_HISTORY(FUNCNAME, ret); \
7524 va_end(ap); \
7525 return ret; \
7526 return FUNCNAME##_fake \
7527 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7528 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7529 arg8, arg9, arg10, arg11, ap); \
7530 } \
7531 } \
7532 if (FUNCNAME##_fake.custom_fake) { \
7533 RETURN_TYPE ret; \
7534 va_list ap; \
7535 va_start(ap, arg11); \
7536 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7537 arg6, arg7, arg8, arg9, arg10, arg11, \
7538 ap); \
7539 va_end(ap); \
7540 SAVE_RET_HISTORY(FUNCNAME, ret); \
7541 return ret; \
7542 } \
7543 RETURN_FAKE_RESULT(FUNCNAME) \
7544 } \
7545 DEFINE_RESET_FUNCTION(FUNCNAME)
7546
7547#define FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7548 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
7549 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
7550 DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7551 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7552 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
7553 DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7554 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7555 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...)
7556
7557#define DECLARE_FAKE_VALUE_FUNC14_VARARG( \
7558 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7559 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
7560 typedef struct FUNCNAME##_Fake { \
7561 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7562 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7563 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7564 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7565 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7566 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7567 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7568 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
7569 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
7570 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
7571 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
7572 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
7573 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
7574 DECLARE_ALL_FUNC_COMMON \
7575 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
7576 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
7577 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
7578 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
7579 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7580 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7581 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, va_list ap); \
7582 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
7583 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7584 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7585 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, va_list ap); \
7586 } FUNCNAME##_Fake; \
7587 extern FUNCNAME##_Fake FUNCNAME##_fake; \
7588 void FUNCNAME##_reset(void); \
7589 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7590 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7591 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7592 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...);
7593
7594#define DEFINE_FAKE_VALUE_FUNC14_VARARG( \
7595 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7596 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
7597 FUNCNAME##_Fake FUNCNAME##_fake; \
7598 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7599 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7600 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7601 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...) \
7602 { \
7603 SAVE_ARG(FUNCNAME, 0); \
7604 SAVE_ARG(FUNCNAME, 1); \
7605 SAVE_ARG(FUNCNAME, 2); \
7606 SAVE_ARG(FUNCNAME, 3); \
7607 SAVE_ARG(FUNCNAME, 4); \
7608 SAVE_ARG(FUNCNAME, 5); \
7609 SAVE_ARG(FUNCNAME, 6); \
7610 SAVE_ARG(FUNCNAME, 7); \
7611 SAVE_ARG(FUNCNAME, 8); \
7612 SAVE_ARG(FUNCNAME, 9); \
7613 SAVE_ARG(FUNCNAME, 10); \
7614 SAVE_ARG(FUNCNAME, 11); \
7615 SAVE_ARG(FUNCNAME, 12); \
7616 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
7617 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7618 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7619 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7620 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7621 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7622 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7623 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7624 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7625 SAVE_ARG_HISTORY(FUNCNAME, 8); \
7626 SAVE_ARG_HISTORY(FUNCNAME, 9); \
7627 SAVE_ARG_HISTORY(FUNCNAME, 10); \
7628 SAVE_ARG_HISTORY(FUNCNAME, 11); \
7629 SAVE_ARG_HISTORY(FUNCNAME, 12); \
7630 } else { \
7631 HISTORY_DROPPED(FUNCNAME); \
7632 } \
7633 INCREMENT_CALL_COUNT(FUNCNAME); \
7634 REGISTER_CALL(FUNCNAME); \
7635 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7636 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7637 FUNCNAME##_fake.custom_fake_seq_len) { \
7638 va_list ap; \
7639 va_start(ap, arg12); \
7640 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
7641 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7642 arg0, arg1, arg2, arg3, arg4, \
7643 arg5, arg6, arg7, arg8, arg9, \
7644 arg10, arg11, arg12, ap); \
7645 SAVE_RET_HISTORY(FUNCNAME, ret); \
7646 va_end(ap); \
7647 return ret; \
7648 } else { \
7649 va_list ap; \
7650 va_start(ap, arg12); \
7651 RETURN_TYPE ret = \
7652 FUNCNAME##_fake.custom_fake_seq \
7653 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7654 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7655 arg7, arg8, arg9, arg10, arg11, arg12, \
7656 ap); \
7657 SAVE_RET_HISTORY(FUNCNAME, ret); \
7658 va_end(ap); \
7659 return ret; \
7660 return FUNCNAME##_fake \
7661 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7662 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7663 arg8, arg9, arg10, arg11, arg12, ap); \
7664 } \
7665 } \
7666 if (FUNCNAME##_fake.custom_fake) { \
7667 RETURN_TYPE ret; \
7668 va_list ap; \
7669 va_start(ap, arg12); \
7670 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7671 arg6, arg7, arg8, arg9, arg10, arg11, \
7672 arg12, ap); \
7673 va_end(ap); \
7674 SAVE_RET_HISTORY(FUNCNAME, ret); \
7675 return ret; \
7676 } \
7677 RETURN_FAKE_RESULT(FUNCNAME) \
7678 } \
7679 DEFINE_RESET_FUNCTION(FUNCNAME)
7680
7681#define FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7682 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
7683 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
7684 DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7685 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7686 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7687 ...) \
7688 DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7689 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7690 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7691 ...)
7692
7693#define DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7694 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7695 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7696 ARG13_TYPE, ...) \
7697 typedef struct FUNCNAME##_Fake { \
7698 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7699 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7700 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7701 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7702 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7703 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7704 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7705 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
7706 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
7707 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
7708 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
7709 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
7710 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
7711 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
7712 DECLARE_ALL_FUNC_COMMON \
7713 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
7714 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
7715 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
7716 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
7717 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7718 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7719 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
7720 va_list ap); \
7721 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
7722 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7723 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7724 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
7725 va_list ap); \
7726 } FUNCNAME##_Fake; \
7727 extern FUNCNAME##_Fake FUNCNAME##_fake; \
7728 void FUNCNAME##_reset(void); \
7729 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7730 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7731 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7732 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...);
7733
7734#define DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7735 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7736 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7737 ARG13_TYPE, ...) \
7738 FUNCNAME##_Fake FUNCNAME##_fake; \
7739 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7740 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7741 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7742 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...) \
7743 { \
7744 SAVE_ARG(FUNCNAME, 0); \
7745 SAVE_ARG(FUNCNAME, 1); \
7746 SAVE_ARG(FUNCNAME, 2); \
7747 SAVE_ARG(FUNCNAME, 3); \
7748 SAVE_ARG(FUNCNAME, 4); \
7749 SAVE_ARG(FUNCNAME, 5); \
7750 SAVE_ARG(FUNCNAME, 6); \
7751 SAVE_ARG(FUNCNAME, 7); \
7752 SAVE_ARG(FUNCNAME, 8); \
7753 SAVE_ARG(FUNCNAME, 9); \
7754 SAVE_ARG(FUNCNAME, 10); \
7755 SAVE_ARG(FUNCNAME, 11); \
7756 SAVE_ARG(FUNCNAME, 12); \
7757 SAVE_ARG(FUNCNAME, 13); \
7758 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
7759 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7760 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7761 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7762 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7763 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7764 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7765 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7766 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7767 SAVE_ARG_HISTORY(FUNCNAME, 8); \
7768 SAVE_ARG_HISTORY(FUNCNAME, 9); \
7769 SAVE_ARG_HISTORY(FUNCNAME, 10); \
7770 SAVE_ARG_HISTORY(FUNCNAME, 11); \
7771 SAVE_ARG_HISTORY(FUNCNAME, 12); \
7772 SAVE_ARG_HISTORY(FUNCNAME, 13); \
7773 } else { \
7774 HISTORY_DROPPED(FUNCNAME); \
7775 } \
7776 INCREMENT_CALL_COUNT(FUNCNAME); \
7777 REGISTER_CALL(FUNCNAME); \
7778 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7779 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7780 FUNCNAME##_fake.custom_fake_seq_len) { \
7781 va_list ap; \
7782 va_start(ap, arg13); \
7783 RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq \
7784 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7785 arg0, arg1, arg2, arg3, arg4, \
7786 arg5, arg6, arg7, arg8, arg9, \
7787 arg10, arg11, arg12, arg13, ap); \
7788 SAVE_RET_HISTORY(FUNCNAME, ret); \
7789 va_end(ap); \
7790 return ret; \
7791 } else { \
7792 va_list ap; \
7793 va_start(ap, arg13); \
7794 RETURN_TYPE ret = \
7795 FUNCNAME##_fake.custom_fake_seq \
7796 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7797 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7798 arg7, arg8, arg9, arg10, arg11, arg12, \
7799 arg13, ap); \
7800 SAVE_RET_HISTORY(FUNCNAME, ret); \
7801 va_end(ap); \
7802 return ret; \
7803 return FUNCNAME##_fake \
7804 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7805 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7806 arg8, arg9, arg10, arg11, arg12, arg13, ap); \
7807 } \
7808 } \
7809 if (FUNCNAME##_fake.custom_fake) { \
7810 RETURN_TYPE ret; \
7811 va_list ap; \
7812 va_start(ap, arg13); \
7813 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7814 arg6, arg7, arg8, arg9, arg10, arg11, \
7815 arg12, arg13, ap); \
7816 va_end(ap); \
7817 SAVE_RET_HISTORY(FUNCNAME, ret); \
7818 return ret; \
7819 } \
7820 RETURN_FAKE_RESULT(FUNCNAME) \
7821 } \
7822 DEFINE_RESET_FUNCTION(FUNCNAME)
7823
7824#define FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7825 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
7826 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
7827 DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7828 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7829 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7830 ARG13_TYPE, ...) \
7831 DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7832 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7833 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7834 ARG13_TYPE, ...)
7835
7836#define DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7837 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7838 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7839 ARG13_TYPE, ARG14_TYPE, ...) \
7840 typedef struct FUNCNAME##_Fake { \
7841 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7842 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7843 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7844 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7845 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7846 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7847 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7848 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
7849 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
7850 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
7851 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
7852 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
7853 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
7854 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
7855 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
7856 DECLARE_ALL_FUNC_COMMON \
7857 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
7858 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
7859 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
7860 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
7861 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7862 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7863 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
7864 ARG14_TYPE, va_list ap); \
7865 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
7866 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
7867 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
7868 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
7869 ARG14_TYPE, va_list ap); \
7870 } FUNCNAME##_Fake; \
7871 extern FUNCNAME##_Fake FUNCNAME##_fake; \
7872 void FUNCNAME##_reset(void); \
7873 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7874 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7875 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7876 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
7877 ARG14_TYPE arg14, ...);
7878
7879#define DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7880 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7881 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7882 ARG13_TYPE, ARG14_TYPE, ...) \
7883 FUNCNAME##_Fake FUNCNAME##_fake; \
7884 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
7885 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
7886 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
7887 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
7888 ARG14_TYPE arg14, ...) \
7889 { \
7890 SAVE_ARG(FUNCNAME, 0); \
7891 SAVE_ARG(FUNCNAME, 1); \
7892 SAVE_ARG(FUNCNAME, 2); \
7893 SAVE_ARG(FUNCNAME, 3); \
7894 SAVE_ARG(FUNCNAME, 4); \
7895 SAVE_ARG(FUNCNAME, 5); \
7896 SAVE_ARG(FUNCNAME, 6); \
7897 SAVE_ARG(FUNCNAME, 7); \
7898 SAVE_ARG(FUNCNAME, 8); \
7899 SAVE_ARG(FUNCNAME, 9); \
7900 SAVE_ARG(FUNCNAME, 10); \
7901 SAVE_ARG(FUNCNAME, 11); \
7902 SAVE_ARG(FUNCNAME, 12); \
7903 SAVE_ARG(FUNCNAME, 13); \
7904 SAVE_ARG(FUNCNAME, 14); \
7905 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
7906 SAVE_ARG_HISTORY(FUNCNAME, 0); \
7907 SAVE_ARG_HISTORY(FUNCNAME, 1); \
7908 SAVE_ARG_HISTORY(FUNCNAME, 2); \
7909 SAVE_ARG_HISTORY(FUNCNAME, 3); \
7910 SAVE_ARG_HISTORY(FUNCNAME, 4); \
7911 SAVE_ARG_HISTORY(FUNCNAME, 5); \
7912 SAVE_ARG_HISTORY(FUNCNAME, 6); \
7913 SAVE_ARG_HISTORY(FUNCNAME, 7); \
7914 SAVE_ARG_HISTORY(FUNCNAME, 8); \
7915 SAVE_ARG_HISTORY(FUNCNAME, 9); \
7916 SAVE_ARG_HISTORY(FUNCNAME, 10); \
7917 SAVE_ARG_HISTORY(FUNCNAME, 11); \
7918 SAVE_ARG_HISTORY(FUNCNAME, 12); \
7919 SAVE_ARG_HISTORY(FUNCNAME, 13); \
7920 SAVE_ARG_HISTORY(FUNCNAME, 14); \
7921 } else { \
7922 HISTORY_DROPPED(FUNCNAME); \
7923 } \
7924 INCREMENT_CALL_COUNT(FUNCNAME); \
7925 REGISTER_CALL(FUNCNAME); \
7926 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
7927 if (FUNCNAME##_fake.custom_fake_seq_idx < \
7928 FUNCNAME##_fake.custom_fake_seq_len) { \
7929 va_list ap; \
7930 va_start(ap, arg14); \
7931 RETURN_TYPE ret = \
7932 FUNCNAME##_fake.custom_fake_seq \
7933 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
7934 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7935 arg7, arg8, arg9, arg10, arg11, arg12, \
7936 arg13, arg14, ap); \
7937 SAVE_RET_HISTORY(FUNCNAME, ret); \
7938 va_end(ap); \
7939 return ret; \
7940 } else { \
7941 va_list ap; \
7942 va_start(ap, arg14); \
7943 RETURN_TYPE ret = \
7944 FUNCNAME##_fake.custom_fake_seq \
7945 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7946 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
7947 arg7, arg8, arg9, arg10, arg11, arg12, \
7948 arg13, arg14, ap); \
7949 SAVE_RET_HISTORY(FUNCNAME, ret); \
7950 va_end(ap); \
7951 return ret; \
7952 return FUNCNAME##_fake \
7953 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
7954 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
7955 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
7956 ap); \
7957 } \
7958 } \
7959 if (FUNCNAME##_fake.custom_fake) { \
7960 RETURN_TYPE ret; \
7961 va_list ap; \
7962 va_start(ap, arg14); \
7963 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
7964 arg6, arg7, arg8, arg9, arg10, arg11, \
7965 arg12, arg13, arg14, ap); \
7966 va_end(ap); \
7967 SAVE_RET_HISTORY(FUNCNAME, ret); \
7968 return ret; \
7969 } \
7970 RETURN_FAKE_RESULT(FUNCNAME) \
7971 } \
7972 DEFINE_RESET_FUNCTION(FUNCNAME)
7973
7974#define FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7975 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
7976 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
7977 ARG14_TYPE, ...) \
7978 DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7979 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7980 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7981 ARG13_TYPE, ARG14_TYPE, ...) \
7982 DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7983 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7984 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7985 ARG13_TYPE, ARG14_TYPE, ...)
7986
7987#define DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
7988 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
7989 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
7990 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
7991 typedef struct FUNCNAME##_Fake { \
7992 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
7993 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
7994 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
7995 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
7996 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
7997 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
7998 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
7999 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
8000 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
8001 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
8002 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
8003 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
8004 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
8005 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
8006 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
8007 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
8008 DECLARE_ALL_FUNC_COMMON \
8009 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
8010 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
8011 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
8012 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
8013 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8014 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8015 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8016 ARG14_TYPE, ARG15_TYPE, va_list ap); \
8017 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
8018 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8019 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8020 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8021 ARG14_TYPE, ARG15_TYPE, va_list ap); \
8022 } FUNCNAME##_Fake; \
8023 extern FUNCNAME##_Fake FUNCNAME##_fake; \
8024 void FUNCNAME##_reset(void); \
8025 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8026 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8027 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8028 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8029 ARG14_TYPE arg14, ARG15_TYPE arg15, ...);
8030
8031#define DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8032 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8033 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8034 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
8035 FUNCNAME##_Fake FUNCNAME##_fake; \
8036 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8037 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8038 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8039 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8040 ARG14_TYPE arg14, ARG15_TYPE arg15, ...) \
8041 { \
8042 SAVE_ARG(FUNCNAME, 0); \
8043 SAVE_ARG(FUNCNAME, 1); \
8044 SAVE_ARG(FUNCNAME, 2); \
8045 SAVE_ARG(FUNCNAME, 3); \
8046 SAVE_ARG(FUNCNAME, 4); \
8047 SAVE_ARG(FUNCNAME, 5); \
8048 SAVE_ARG(FUNCNAME, 6); \
8049 SAVE_ARG(FUNCNAME, 7); \
8050 SAVE_ARG(FUNCNAME, 8); \
8051 SAVE_ARG(FUNCNAME, 9); \
8052 SAVE_ARG(FUNCNAME, 10); \
8053 SAVE_ARG(FUNCNAME, 11); \
8054 SAVE_ARG(FUNCNAME, 12); \
8055 SAVE_ARG(FUNCNAME, 13); \
8056 SAVE_ARG(FUNCNAME, 14); \
8057 SAVE_ARG(FUNCNAME, 15); \
8058 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
8059 SAVE_ARG_HISTORY(FUNCNAME, 0); \
8060 SAVE_ARG_HISTORY(FUNCNAME, 1); \
8061 SAVE_ARG_HISTORY(FUNCNAME, 2); \
8062 SAVE_ARG_HISTORY(FUNCNAME, 3); \
8063 SAVE_ARG_HISTORY(FUNCNAME, 4); \
8064 SAVE_ARG_HISTORY(FUNCNAME, 5); \
8065 SAVE_ARG_HISTORY(FUNCNAME, 6); \
8066 SAVE_ARG_HISTORY(FUNCNAME, 7); \
8067 SAVE_ARG_HISTORY(FUNCNAME, 8); \
8068 SAVE_ARG_HISTORY(FUNCNAME, 9); \
8069 SAVE_ARG_HISTORY(FUNCNAME, 10); \
8070 SAVE_ARG_HISTORY(FUNCNAME, 11); \
8071 SAVE_ARG_HISTORY(FUNCNAME, 12); \
8072 SAVE_ARG_HISTORY(FUNCNAME, 13); \
8073 SAVE_ARG_HISTORY(FUNCNAME, 14); \
8074 SAVE_ARG_HISTORY(FUNCNAME, 15); \
8075 } else { \
8076 HISTORY_DROPPED(FUNCNAME); \
8077 } \
8078 INCREMENT_CALL_COUNT(FUNCNAME); \
8079 REGISTER_CALL(FUNCNAME); \
8080 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
8081 if (FUNCNAME##_fake.custom_fake_seq_idx < \
8082 FUNCNAME##_fake.custom_fake_seq_len) { \
8083 va_list ap; \
8084 va_start(ap, arg15); \
8085 RETURN_TYPE ret = \
8086 FUNCNAME##_fake.custom_fake_seq \
8087 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
8088 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8089 arg7, arg8, arg9, arg10, arg11, arg12, \
8090 arg13, arg14, arg15, ap); \
8091 SAVE_RET_HISTORY(FUNCNAME, ret); \
8092 va_end(ap); \
8093 return ret; \
8094 } else { \
8095 va_list ap; \
8096 va_start(ap, arg15); \
8097 RETURN_TYPE ret = \
8098 FUNCNAME##_fake.custom_fake_seq \
8099 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8100 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8101 arg7, arg8, arg9, arg10, arg11, arg12, \
8102 arg13, arg14, arg15, ap); \
8103 SAVE_RET_HISTORY(FUNCNAME, ret); \
8104 va_end(ap); \
8105 return ret; \
8106 return FUNCNAME##_fake \
8107 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8108 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
8109 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
8110 arg15, ap); \
8111 } \
8112 } \
8113 if (FUNCNAME##_fake.custom_fake) { \
8114 RETURN_TYPE ret; \
8115 va_list ap; \
8116 va_start(ap, arg15); \
8117 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
8118 arg6, arg7, arg8, arg9, arg10, arg11, \
8119 arg12, arg13, arg14, arg15, ap); \
8120 va_end(ap); \
8121 SAVE_RET_HISTORY(FUNCNAME, ret); \
8122 return ret; \
8123 } \
8124 RETURN_FAKE_RESULT(FUNCNAME) \
8125 } \
8126 DEFINE_RESET_FUNCTION(FUNCNAME)
8127
8128#define FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8129 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
8130 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8131 ARG14_TYPE, ARG15_TYPE, ...) \
8132 DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8133 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8134 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8135 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
8136 DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8137 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8138 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8139 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...)
8140
8141#define DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8142 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8143 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8144 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
8145 typedef struct FUNCNAME##_Fake { \
8146 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
8147 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
8148 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
8149 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
8150 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
8151 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
8152 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
8153 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
8154 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
8155 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
8156 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
8157 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
8158 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
8159 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
8160 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
8161 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
8162 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
8163 DECLARE_ALL_FUNC_COMMON \
8164 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
8165 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
8166 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
8167 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
8168 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8169 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8170 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8171 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, va_list ap); \
8172 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
8173 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8174 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8175 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8176 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, va_list ap); \
8177 } FUNCNAME##_Fake; \
8178 extern FUNCNAME##_Fake FUNCNAME##_fake; \
8179 void FUNCNAME##_reset(void); \
8180 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8181 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8182 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8183 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8184 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...);
8185
8186#define DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8187 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8188 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8189 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
8190 FUNCNAME##_Fake FUNCNAME##_fake; \
8191 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8192 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8193 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8194 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8195 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...) \
8196 { \
8197 SAVE_ARG(FUNCNAME, 0); \
8198 SAVE_ARG(FUNCNAME, 1); \
8199 SAVE_ARG(FUNCNAME, 2); \
8200 SAVE_ARG(FUNCNAME, 3); \
8201 SAVE_ARG(FUNCNAME, 4); \
8202 SAVE_ARG(FUNCNAME, 5); \
8203 SAVE_ARG(FUNCNAME, 6); \
8204 SAVE_ARG(FUNCNAME, 7); \
8205 SAVE_ARG(FUNCNAME, 8); \
8206 SAVE_ARG(FUNCNAME, 9); \
8207 SAVE_ARG(FUNCNAME, 10); \
8208 SAVE_ARG(FUNCNAME, 11); \
8209 SAVE_ARG(FUNCNAME, 12); \
8210 SAVE_ARG(FUNCNAME, 13); \
8211 SAVE_ARG(FUNCNAME, 14); \
8212 SAVE_ARG(FUNCNAME, 15); \
8213 SAVE_ARG(FUNCNAME, 16); \
8214 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
8215 SAVE_ARG_HISTORY(FUNCNAME, 0); \
8216 SAVE_ARG_HISTORY(FUNCNAME, 1); \
8217 SAVE_ARG_HISTORY(FUNCNAME, 2); \
8218 SAVE_ARG_HISTORY(FUNCNAME, 3); \
8219 SAVE_ARG_HISTORY(FUNCNAME, 4); \
8220 SAVE_ARG_HISTORY(FUNCNAME, 5); \
8221 SAVE_ARG_HISTORY(FUNCNAME, 6); \
8222 SAVE_ARG_HISTORY(FUNCNAME, 7); \
8223 SAVE_ARG_HISTORY(FUNCNAME, 8); \
8224 SAVE_ARG_HISTORY(FUNCNAME, 9); \
8225 SAVE_ARG_HISTORY(FUNCNAME, 10); \
8226 SAVE_ARG_HISTORY(FUNCNAME, 11); \
8227 SAVE_ARG_HISTORY(FUNCNAME, 12); \
8228 SAVE_ARG_HISTORY(FUNCNAME, 13); \
8229 SAVE_ARG_HISTORY(FUNCNAME, 14); \
8230 SAVE_ARG_HISTORY(FUNCNAME, 15); \
8231 SAVE_ARG_HISTORY(FUNCNAME, 16); \
8232 } else { \
8233 HISTORY_DROPPED(FUNCNAME); \
8234 } \
8235 INCREMENT_CALL_COUNT(FUNCNAME); \
8236 REGISTER_CALL(FUNCNAME); \
8237 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
8238 if (FUNCNAME##_fake.custom_fake_seq_idx < \
8239 FUNCNAME##_fake.custom_fake_seq_len) { \
8240 va_list ap; \
8241 va_start(ap, arg16); \
8242 RETURN_TYPE ret = \
8243 FUNCNAME##_fake.custom_fake_seq \
8244 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
8245 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8246 arg7, arg8, arg9, arg10, arg11, arg12, \
8247 arg13, arg14, arg15, arg16, ap); \
8248 SAVE_RET_HISTORY(FUNCNAME, ret); \
8249 va_end(ap); \
8250 return ret; \
8251 } else { \
8252 va_list ap; \
8253 va_start(ap, arg16); \
8254 RETURN_TYPE ret = \
8255 FUNCNAME##_fake.custom_fake_seq \
8256 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8257 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8258 arg7, arg8, arg9, arg10, arg11, arg12, \
8259 arg13, arg14, arg15, arg16, ap); \
8260 SAVE_RET_HISTORY(FUNCNAME, ret); \
8261 va_end(ap); \
8262 return ret; \
8263 return FUNCNAME##_fake \
8264 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8265 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
8266 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
8267 arg15, arg16, ap); \
8268 } \
8269 } \
8270 if (FUNCNAME##_fake.custom_fake) { \
8271 RETURN_TYPE ret; \
8272 va_list ap; \
8273 va_start(ap, arg16); \
8274 ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, \
8275 arg6, arg7, arg8, arg9, arg10, arg11, \
8276 arg12, arg13, arg14, arg15, arg16, ap); \
8277 va_end(ap); \
8278 SAVE_RET_HISTORY(FUNCNAME, ret); \
8279 return ret; \
8280 } \
8281 RETURN_FAKE_RESULT(FUNCNAME) \
8282 } \
8283 DEFINE_RESET_FUNCTION(FUNCNAME)
8284
8285#define FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8286 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
8287 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8288 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
8289 DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8290 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8291 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8292 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
8293 DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8294 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8295 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8296 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...)
8297
8298#define DECLARE_FAKE_VALUE_FUNC19_VARARG( \
8299 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8300 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8301 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
8302 typedef struct FUNCNAME##_Fake { \
8303 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
8304 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
8305 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
8306 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
8307 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
8308 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
8309 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
8310 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
8311 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
8312 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
8313 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
8314 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
8315 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
8316 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
8317 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
8318 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
8319 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
8320 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
8321 DECLARE_ALL_FUNC_COMMON \
8322 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
8323 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
8324 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
8325 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
8326 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8327 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8328 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8329 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
8330 va_list ap); \
8331 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
8332 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8333 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8334 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8335 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
8336 va_list ap); \
8337 } FUNCNAME##_Fake; \
8338 extern FUNCNAME##_Fake FUNCNAME##_fake; \
8339 void FUNCNAME##_reset(void); \
8340 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8341 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8342 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8343 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8344 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...);
8345
8346#define DEFINE_FAKE_VALUE_FUNC19_VARARG( \
8347 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8348 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8349 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
8350 FUNCNAME##_Fake FUNCNAME##_fake; \
8351 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8352 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8353 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8354 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8355 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...) \
8356 { \
8357 SAVE_ARG(FUNCNAME, 0); \
8358 SAVE_ARG(FUNCNAME, 1); \
8359 SAVE_ARG(FUNCNAME, 2); \
8360 SAVE_ARG(FUNCNAME, 3); \
8361 SAVE_ARG(FUNCNAME, 4); \
8362 SAVE_ARG(FUNCNAME, 5); \
8363 SAVE_ARG(FUNCNAME, 6); \
8364 SAVE_ARG(FUNCNAME, 7); \
8365 SAVE_ARG(FUNCNAME, 8); \
8366 SAVE_ARG(FUNCNAME, 9); \
8367 SAVE_ARG(FUNCNAME, 10); \
8368 SAVE_ARG(FUNCNAME, 11); \
8369 SAVE_ARG(FUNCNAME, 12); \
8370 SAVE_ARG(FUNCNAME, 13); \
8371 SAVE_ARG(FUNCNAME, 14); \
8372 SAVE_ARG(FUNCNAME, 15); \
8373 SAVE_ARG(FUNCNAME, 16); \
8374 SAVE_ARG(FUNCNAME, 17); \
8375 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
8376 SAVE_ARG_HISTORY(FUNCNAME, 0); \
8377 SAVE_ARG_HISTORY(FUNCNAME, 1); \
8378 SAVE_ARG_HISTORY(FUNCNAME, 2); \
8379 SAVE_ARG_HISTORY(FUNCNAME, 3); \
8380 SAVE_ARG_HISTORY(FUNCNAME, 4); \
8381 SAVE_ARG_HISTORY(FUNCNAME, 5); \
8382 SAVE_ARG_HISTORY(FUNCNAME, 6); \
8383 SAVE_ARG_HISTORY(FUNCNAME, 7); \
8384 SAVE_ARG_HISTORY(FUNCNAME, 8); \
8385 SAVE_ARG_HISTORY(FUNCNAME, 9); \
8386 SAVE_ARG_HISTORY(FUNCNAME, 10); \
8387 SAVE_ARG_HISTORY(FUNCNAME, 11); \
8388 SAVE_ARG_HISTORY(FUNCNAME, 12); \
8389 SAVE_ARG_HISTORY(FUNCNAME, 13); \
8390 SAVE_ARG_HISTORY(FUNCNAME, 14); \
8391 SAVE_ARG_HISTORY(FUNCNAME, 15); \
8392 SAVE_ARG_HISTORY(FUNCNAME, 16); \
8393 SAVE_ARG_HISTORY(FUNCNAME, 17); \
8394 } else { \
8395 HISTORY_DROPPED(FUNCNAME); \
8396 } \
8397 INCREMENT_CALL_COUNT(FUNCNAME); \
8398 REGISTER_CALL(FUNCNAME); \
8399 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
8400 if (FUNCNAME##_fake.custom_fake_seq_idx < \
8401 FUNCNAME##_fake.custom_fake_seq_len) { \
8402 va_list ap; \
8403 va_start(ap, arg17); \
8404 RETURN_TYPE ret = \
8405 FUNCNAME##_fake.custom_fake_seq \
8406 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
8407 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8408 arg7, arg8, arg9, arg10, arg11, arg12, \
8409 arg13, arg14, arg15, arg16, arg17, ap); \
8410 SAVE_RET_HISTORY(FUNCNAME, ret); \
8411 va_end(ap); \
8412 return ret; \
8413 } else { \
8414 va_list ap; \
8415 va_start(ap, arg17); \
8416 RETURN_TYPE ret = \
8417 FUNCNAME##_fake.custom_fake_seq \
8418 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8419 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8420 arg7, arg8, arg9, arg10, arg11, arg12, \
8421 arg13, arg14, arg15, arg16, arg17, ap); \
8422 SAVE_RET_HISTORY(FUNCNAME, ret); \
8423 va_end(ap); \
8424 return ret; \
8425 return FUNCNAME##_fake \
8426 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8427 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
8428 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
8429 arg15, arg16, arg17, ap); \
8430 } \
8431 } \
8432 if (FUNCNAME##_fake.custom_fake) { \
8433 RETURN_TYPE ret; \
8434 va_list ap; \
8435 va_start(ap, arg17); \
8436 ret = FUNCNAME##_fake.custom_fake( \
8437 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
8438 arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
8439 va_end(ap); \
8440 SAVE_RET_HISTORY(FUNCNAME, ret); \
8441 return ret; \
8442 } \
8443 RETURN_FAKE_RESULT(FUNCNAME) \
8444 } \
8445 DEFINE_RESET_FUNCTION(FUNCNAME)
8446
8447#define FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8448 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
8449 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8450 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
8451 DECLARE_FAKE_VALUE_FUNC19_VARARG( \
8452 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
8453 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, \
8454 ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
8455 DEFINE_FAKE_VALUE_FUNC19_VARARG( \
8456 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, \
8457 ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, \
8458 ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...)
8459
8460#define DECLARE_FAKE_VALUE_FUNC20_VARARG( \
8461 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8462 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8463 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
8464 typedef struct FUNCNAME##_Fake { \
8465 DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
8466 DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
8467 DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
8468 DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
8469 DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
8470 DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
8471 DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
8472 DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
8473 DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
8474 DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
8475 DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
8476 DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
8477 DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
8478 DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
8479 DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
8480 DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
8481 DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
8482 DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
8483 DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
8484 DECLARE_ALL_FUNC_COMMON \
8485 DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
8486 DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
8487 DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
8488 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, \
8489 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8490 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8491 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8492 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
8493 ARG18_TYPE, va_list ap); \
8494 CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, \
8495 ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8496 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, \
8497 ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8498 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, \
8499 ARG18_TYPE, va_list ap); \
8500 } FUNCNAME##_Fake; \
8501 extern FUNCNAME##_Fake FUNCNAME##_fake; \
8502 void FUNCNAME##_reset(void); \
8503 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8504 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8505 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8506 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8507 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
8508 ARG18_TYPE arg18, ...);
8509
8510#define DEFINE_FAKE_VALUE_FUNC20_VARARG( \
8511 RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, \
8512 ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8513 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
8514 FUNCNAME##_Fake FUNCNAME##_fake; \
8515 RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME( \
8516 ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, \
8517 ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, \
8518 ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, \
8519 ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, \
8520 ARG18_TYPE arg18, ...) \
8521 { \
8522 SAVE_ARG(FUNCNAME, 0); \
8523 SAVE_ARG(FUNCNAME, 1); \
8524 SAVE_ARG(FUNCNAME, 2); \
8525 SAVE_ARG(FUNCNAME, 3); \
8526 SAVE_ARG(FUNCNAME, 4); \
8527 SAVE_ARG(FUNCNAME, 5); \
8528 SAVE_ARG(FUNCNAME, 6); \
8529 SAVE_ARG(FUNCNAME, 7); \
8530 SAVE_ARG(FUNCNAME, 8); \
8531 SAVE_ARG(FUNCNAME, 9); \
8532 SAVE_ARG(FUNCNAME, 10); \
8533 SAVE_ARG(FUNCNAME, 11); \
8534 SAVE_ARG(FUNCNAME, 12); \
8535 SAVE_ARG(FUNCNAME, 13); \
8536 SAVE_ARG(FUNCNAME, 14); \
8537 SAVE_ARG(FUNCNAME, 15); \
8538 SAVE_ARG(FUNCNAME, 16); \
8539 SAVE_ARG(FUNCNAME, 17); \
8540 SAVE_ARG(FUNCNAME, 18); \
8541 if (ROOM_FOR_MORE_HISTORY(FUNCNAME)) { \
8542 SAVE_ARG_HISTORY(FUNCNAME, 0); \
8543 SAVE_ARG_HISTORY(FUNCNAME, 1); \
8544 SAVE_ARG_HISTORY(FUNCNAME, 2); \
8545 SAVE_ARG_HISTORY(FUNCNAME, 3); \
8546 SAVE_ARG_HISTORY(FUNCNAME, 4); \
8547 SAVE_ARG_HISTORY(FUNCNAME, 5); \
8548 SAVE_ARG_HISTORY(FUNCNAME, 6); \
8549 SAVE_ARG_HISTORY(FUNCNAME, 7); \
8550 SAVE_ARG_HISTORY(FUNCNAME, 8); \
8551 SAVE_ARG_HISTORY(FUNCNAME, 9); \
8552 SAVE_ARG_HISTORY(FUNCNAME, 10); \
8553 SAVE_ARG_HISTORY(FUNCNAME, 11); \
8554 SAVE_ARG_HISTORY(FUNCNAME, 12); \
8555 SAVE_ARG_HISTORY(FUNCNAME, 13); \
8556 SAVE_ARG_HISTORY(FUNCNAME, 14); \
8557 SAVE_ARG_HISTORY(FUNCNAME, 15); \
8558 SAVE_ARG_HISTORY(FUNCNAME, 16); \
8559 SAVE_ARG_HISTORY(FUNCNAME, 17); \
8560 SAVE_ARG_HISTORY(FUNCNAME, 18); \
8561 } else { \
8562 HISTORY_DROPPED(FUNCNAME); \
8563 } \
8564 INCREMENT_CALL_COUNT(FUNCNAME); \
8565 REGISTER_CALL(FUNCNAME); \
8566 if (FUNCNAME##_fake.custom_fake_seq_len) { /* a sequence of custom fakes */ \
8567 if (FUNCNAME##_fake.custom_fake_seq_idx < \
8568 FUNCNAME##_fake.custom_fake_seq_len) { \
8569 va_list ap; \
8570 va_start(ap, arg18); \
8571 RETURN_TYPE ret = \
8572 FUNCNAME##_fake.custom_fake_seq \
8573 [FUNCNAME##_fake.custom_fake_seq_idx++]( \
8574 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8575 arg7, arg8, arg9, arg10, arg11, arg12, \
8576 arg13, arg14, arg15, arg16, arg17, arg18, \
8577 ap); \
8578 SAVE_RET_HISTORY(FUNCNAME, ret); \
8579 va_end(ap); \
8580 return ret; \
8581 } else { \
8582 va_list ap; \
8583 va_start(ap, arg18); \
8584 RETURN_TYPE ret = \
8585 FUNCNAME##_fake.custom_fake_seq \
8586 [FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8587 arg0, arg1, arg2, arg3, arg4, arg5, arg6, \
8588 arg7, arg8, arg9, arg10, arg11, arg12, \
8589 arg13, arg14, arg15, arg16, arg17, arg18, \
8590 ap); \
8591 SAVE_RET_HISTORY(FUNCNAME, ret); \
8592 va_end(ap); \
8593 return ret; \
8594 return FUNCNAME##_fake \
8595 .custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len - 1]( \
8596 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
8597 arg8, arg9, arg10, arg11, arg12, arg13, arg14, \
8598 arg15, arg16, arg17, arg18, ap); \
8599 } \
8600 } \
8601 if (FUNCNAME##_fake.custom_fake) { \
8602 RETURN_TYPE ret; \
8603 va_list ap; \
8604 va_start(ap, arg18); \
8605 ret = FUNCNAME##_fake.custom_fake( \
8606 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, \
8607 arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
8608 va_end(ap); \
8609 SAVE_RET_HISTORY(FUNCNAME, ret); \
8610 return ret; \
8611 } \
8612 RETURN_FAKE_RESULT(FUNCNAME) \
8613 } \
8614 DEFINE_RESET_FUNCTION(FUNCNAME)
8615
8616#define FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8617 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, \
8618 ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, \
8619 ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
8620 DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8621 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8622 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8623 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, \
8624 ARG17_TYPE, ARG18_TYPE, ...) \
8625 DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, \
8626 ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, \
8627 ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, \
8628 ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, \
8629 ARG17_TYPE, ARG18_TYPE, ...)
8630
8631/* MSVC expand macro fix */
8632#define EXPAND(x) x
8633
8634#define PP_NARG_MINUS2(...) EXPAND(PP_NARG_MINUS2_(__VA_ARGS__, PP_RSEQ_N_MINUS2()))
8635
8636#define PP_NARG_MINUS2_(...) EXPAND(PP_ARG_MINUS2_N(__VA_ARGS__))
8637
8638#define PP_ARG_MINUS2_N(returnVal, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, \
8639 _14, _15, _16, _17, _18, _19, _20, N, ...) \
8640 N
8641
8642#define PP_RSEQ_N_MINUS2() 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
8643
8644#define PP_NARG_MINUS1(...) EXPAND(PP_NARG_MINUS1_(__VA_ARGS__, PP_RSEQ_N_MINUS1()))
8645
8646#define PP_NARG_MINUS1_(...) EXPAND(PP_ARG_MINUS1_N(__VA_ARGS__))
8647
8648#define PP_ARG_MINUS1_N(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \
8649 _17, _18, _19, _20, N, ...) \
8650 N
8651
8652#define PP_RSEQ_N_MINUS1() 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
8653
8654/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
8655
8656#define FAKE_VALUE_FUNC(...) EXPAND(FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
8657
8658#define FUNC_VALUE_(N, ...) EXPAND(FUNC_VALUE_N(N, __VA_ARGS__))
8659
8660#define FUNC_VALUE_N(N, ...) EXPAND(FAKE_VALUE_FUNC##N(__VA_ARGS__))
8661
8662#define FAKE_VOID_FUNC(...) EXPAND(FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
8663
8664#define FUNC_VOID_(N, ...) EXPAND(FUNC_VOID_N(N, __VA_ARGS__))
8665
8666#define FUNC_VOID_N(N, ...) EXPAND(FAKE_VOID_FUNC##N(__VA_ARGS__))
8667
8668#define FAKE_VALUE_FUNC_VARARG(...) \
8669 EXPAND(FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
8670
8671#define FUNC_VALUE_VARARG_(N, ...) EXPAND(FUNC_VALUE_VARARG_N(N, __VA_ARGS__))
8672
8673#define FUNC_VALUE_VARARG_N(N, ...) EXPAND(FAKE_VALUE_FUNC##N##_VARARG(__VA_ARGS__))
8674
8675#define FAKE_VOID_FUNC_VARARG(...) \
8676 EXPAND(FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
8677
8678#define FUNC_VOID_VARARG_(N, ...) EXPAND(FUNC_VOID_VARARG_N(N, __VA_ARGS__))
8679
8680#define FUNC_VOID_VARARG_N(N, ...) EXPAND(FAKE_VOID_FUNC##N##_VARARG(__VA_ARGS__))
8681
8682/* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
8683
8684#define DECLARE_FAKE_VALUE_FUNC(...) \
8685 EXPAND(DECLARE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
8686
8687#define DECLARE_FUNC_VALUE_(N, ...) EXPAND(DECLARE_FUNC_VALUE_N(N, __VA_ARGS__))
8688
8689#define DECLARE_FUNC_VALUE_N(N, ...) EXPAND(DECLARE_FAKE_VALUE_FUNC##N(__VA_ARGS__))
8690
8691#define DECLARE_FAKE_VOID_FUNC(...) \
8692 EXPAND(DECLARE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
8693
8694#define DECLARE_FUNC_VOID_(N, ...) EXPAND(DECLARE_FUNC_VOID_N(N, __VA_ARGS__))
8695
8696#define DECLARE_FUNC_VOID_N(N, ...) EXPAND(DECLARE_FAKE_VOID_FUNC##N(__VA_ARGS__))
8697
8698#define DECLARE_FAKE_VALUE_FUNC_VARARG(...) \
8699 EXPAND(DECLARE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
8700
8701#define DECLARE_FUNC_VALUE_VARARG_(N, ...) EXPAND(DECLARE_FUNC_VALUE_VARARG_N(N, __VA_ARGS__))
8702
8703#define DECLARE_FUNC_VALUE_VARARG_N(N, ...) EXPAND(DECLARE_FAKE_VALUE_FUNC##N##_VARARG(__VA_ARGS__))
8704
8705#define DECLARE_FAKE_VOID_FUNC_VARARG(...) \
8706 EXPAND(DECLARE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
8707
8708#define DECLARE_FUNC_VOID_VARARG_(N, ...) EXPAND(DECLARE_FUNC_VOID_VARARG_N(N, __VA_ARGS__))
8709
8710#define DECLARE_FUNC_VOID_VARARG_N(N, ...) EXPAND(DECLARE_FAKE_VOID_FUNC##N##_VARARG(__VA_ARGS__))
8711
8712/* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
8713
8714#define DEFINE_FAKE_VALUE_FUNC(...) \
8715 EXPAND(DEFINE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
8716
8717#define DEFINE_FUNC_VALUE_(N, ...) EXPAND(DEFINE_FUNC_VALUE_N(N, __VA_ARGS__))
8718
8719#define DEFINE_FUNC_VALUE_N(N, ...) EXPAND(DEFINE_FAKE_VALUE_FUNC##N(__VA_ARGS__))
8720
8721#define DEFINE_FAKE_VOID_FUNC(...) \
8722 EXPAND(DEFINE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
8723
8724#define DEFINE_FUNC_VOID_(N, ...) EXPAND(DEFINE_FUNC_VOID_N(N, __VA_ARGS__))
8725
8726#define DEFINE_FUNC_VOID_N(N, ...) EXPAND(DEFINE_FAKE_VOID_FUNC##N(__VA_ARGS__))
8727
8728#define DEFINE_FAKE_VALUE_FUNC_VARARG(...) \
8729 EXPAND(DEFINE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
8730
8731#define DEFINE_FUNC_VALUE_VARARG_(N, ...) EXPAND(DEFINE_FUNC_VALUE_VARARG_N(N, __VA_ARGS__))
8732
8733#define DEFINE_FUNC_VALUE_VARARG_N(N, ...) EXPAND(DEFINE_FAKE_VALUE_FUNC##N##_VARARG(__VA_ARGS__))
8734
8735#define DEFINE_FAKE_VOID_FUNC_VARARG(...) \
8736 EXPAND(DEFINE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
8737
8738#define DEFINE_FUNC_VOID_VARARG_(N, ...) EXPAND(DEFINE_FUNC_VOID_VARARG_N(N, __VA_ARGS__))
8739
8740#define DEFINE_FUNC_VOID_VARARG_N(N, ...) EXPAND(DEFINE_FAKE_VOID_FUNC##N##_VARARG(__VA_ARGS__))
8741
8742#endif /* FAKE_FUNCTIONS */
#define FFF_END_EXTERN_C
Definition fff.h:124
fff_globals_t fff
void(* fff_function_t)(void)
Definition fff.h:139
#define FFF_CALL_HISTORY_LEN
Definition fff.h:37
#define FFF_EXTERN_C
Definition fff.h:123
Definition fff.h:140
unsigned int call_history_idx
Definition fff.h:142