Zephyr API Documentation 3.7.99
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) { \