fff.h 372 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643
  1. /*
  2. LICENSE
  3. The MIT License (MIT)
  4. Copyright (c) 2010 Michael Long
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in all
  12. copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. SOFTWARE.
  20. */
  21. #ifndef FAKE_FUNCTIONS
  22. #define FAKE_FUNCTIONS
  23. #include <stdarg.h>
  24. #include <string.h> /* For memset and memcpy */
  25. #define FFF_MAX_ARGS (20u)
  26. #ifndef FFF_ARG_HISTORY_LEN
  27. #define FFF_ARG_HISTORY_LEN (50u)
  28. #endif
  29. #ifndef FFF_CALL_HISTORY_LEN
  30. #define FFF_CALL_HISTORY_LEN (50u)
  31. #endif
  32. #ifndef FFF_GCC_FUNCTION_ATTRIBUTES
  33. #define FFF_GCC_FUNCTION_ATTRIBUTES
  34. #endif
  35. /* -- INTERNAL HELPER MACROS -- */
  36. #define SET_RETURN_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
  37. FUNCNAME##_fake.return_val_seq = ARRAY_POINTER; \
  38. FUNCNAME##_fake.return_val_seq_len = ARRAY_LEN;
  39. #define SET_CUSTOM_FAKE_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
  40. FUNCNAME##_fake.custom_fake_seq = ARRAY_POINTER; \
  41. FUNCNAME##_fake.custom_fake_seq_len = ARRAY_LEN;
  42. /* Defining a function to reset a fake function */
  43. #define RESET_FAKE(FUNCNAME) { \
  44. FUNCNAME##_reset(); \
  45. } \
  46. #define DECLARE_ARG(type, n, FUNCNAME) \
  47. type arg##n##_val; \
  48. type arg##n##_history[FFF_ARG_HISTORY_LEN];
  49. #define DECLARE_ALL_FUNC_COMMON \
  50. unsigned int call_count; \
  51. unsigned int arg_history_len; \
  52. unsigned int arg_histories_dropped; \
  53. #define DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  54. RETURN_TYPE return_val_history[FFF_ARG_HISTORY_LEN];
  55. #define SAVE_ARG(FUNCNAME, n) \
  56. memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
  57. #define ROOM_FOR_MORE_HISTORY(FUNCNAME) \
  58. FUNCNAME##_fake.call_count < FFF_ARG_HISTORY_LEN
  59. #define SAVE_RET_HISTORY(FUNCNAME, RETVAL) \
  60. if ((FUNCNAME##_fake.call_count - 1) < FFF_ARG_HISTORY_LEN) \
  61. memcpy((void *)&FUNCNAME##_fake.return_val_history[FUNCNAME##_fake.call_count - 1], (const void *) &RETVAL, sizeof(RETVAL)); \
  62. #define SAVE_ARG_HISTORY(FUNCNAME, ARGN) \
  63. memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
  64. #define HISTORY_DROPPED(FUNCNAME) \
  65. FUNCNAME##_fake.arg_histories_dropped++
  66. #define DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  67. RETURN_TYPE return_val; \
  68. int return_val_seq_len; \
  69. int return_val_seq_idx; \
  70. RETURN_TYPE * return_val_seq; \
  71. #define DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  72. int custom_fake_seq_len; \
  73. int custom_fake_seq_idx; \
  74. #define INCREMENT_CALL_COUNT(FUNCNAME) \
  75. FUNCNAME##_fake.call_count++
  76. #define RETURN_FAKE_RESULT(FUNCNAME) \
  77. if (FUNCNAME##_fake.return_val_seq_len){ /* then its a sequence */ \
  78. if(FUNCNAME##_fake.return_val_seq_idx < FUNCNAME##_fake.return_val_seq_len) { \
  79. SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx]) \
  80. return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx++]; \
  81. } \
  82. SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]) \
  83. return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]; /* return last element */ \
  84. } \
  85. SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val) \
  86. return FUNCNAME##_fake.return_val; \
  87. #ifdef __cplusplus
  88. #define FFF_EXTERN_C extern "C"{
  89. #define FFF_END_EXTERN_C }
  90. #else /* ansi c */
  91. #define FFF_EXTERN_C
  92. #define FFF_END_EXTERN_C
  93. #endif /* cpp/ansi c */
  94. #define DEFINE_RESET_FUNCTION(FUNCNAME) \
  95. void FUNCNAME##_reset(void){ \
  96. memset(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake)); \
  97. FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN; \
  98. }
  99. /* -- END INTERNAL HELPER MACROS -- */
  100. typedef void (*fff_function_t)(void);
  101. typedef struct {
  102. fff_function_t call_history[FFF_CALL_HISTORY_LEN];
  103. unsigned int call_history_idx;
  104. } fff_globals_t;
  105. FFF_EXTERN_C
  106. extern fff_globals_t fff;
  107. FFF_END_EXTERN_C
  108. #define DEFINE_FFF_GLOBALS \
  109. FFF_EXTERN_C \
  110. fff_globals_t fff; \
  111. FFF_END_EXTERN_C
  112. #define FFF_RESET_HISTORY() \
  113. fff.call_history_idx = 0; \
  114. memset(fff.call_history, 0, sizeof(fff.call_history));
  115. #define REGISTER_CALL(function) \
  116. if(fff.call_history_idx < FFF_CALL_HISTORY_LEN) \
  117. fff.call_history[fff.call_history_idx++] = (fff_function_t)function;
  118. #define DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
  119. typedef struct FUNCNAME##_Fake { \
  120. DECLARE_ALL_FUNC_COMMON \
  121. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  122. void(*custom_fake)(void); \
  123. void(**custom_fake_seq)(void); \
  124. } FUNCNAME##_Fake; \
  125. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  126. void FUNCNAME##_reset(void); \
  127. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void); \
  128. #define DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
  129. FUNCNAME##_Fake FUNCNAME##_fake; \
  130. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void){ \
  131. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  132. } \
  133. else{ \
  134. HISTORY_DROPPED(FUNCNAME); \
  135. } \
  136. INCREMENT_CALL_COUNT(FUNCNAME); \
  137. REGISTER_CALL(FUNCNAME); \
  138. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  139. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  140. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
  141. } \
  142. else{ \
  143. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
  144. } \
  145. } \
  146. if (FUNCNAME##_fake.custom_fake){ \
  147. FUNCNAME##_fake.custom_fake(); \
  148. } \
  149. } \
  150. DEFINE_RESET_FUNCTION(FUNCNAME) \
  151. #define FAKE_VOID_FUNC0(FUNCNAME) \
  152. DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
  153. DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
  154. #define DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
  155. typedef struct FUNCNAME##_Fake { \
  156. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  157. DECLARE_ALL_FUNC_COMMON \
  158. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  159. void(*custom_fake)(ARG0_TYPE arg0); \
  160. void(**custom_fake_seq)(ARG0_TYPE arg0); \
  161. } FUNCNAME##_Fake; \
  162. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  163. void FUNCNAME##_reset(void); \
  164. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0); \
  165. #define DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
  166. FUNCNAME##_Fake FUNCNAME##_fake; \
  167. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0){ \
  168. SAVE_ARG(FUNCNAME, 0); \
  169. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  170. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  171. } \
  172. else{ \
  173. HISTORY_DROPPED(FUNCNAME); \
  174. } \
  175. INCREMENT_CALL_COUNT(FUNCNAME); \
  176. REGISTER_CALL(FUNCNAME); \
  177. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  178. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  179. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
  180. } \
  181. else{ \
  182. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
  183. } \
  184. } \
  185. if (FUNCNAME##_fake.custom_fake){ \
  186. FUNCNAME##_fake.custom_fake(arg0); \
  187. } \
  188. } \
  189. DEFINE_RESET_FUNCTION(FUNCNAME) \
  190. #define FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
  191. DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
  192. DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
  193. #define DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  194. typedef struct FUNCNAME##_Fake { \
  195. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  196. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  197. DECLARE_ALL_FUNC_COMMON \
  198. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  199. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
  200. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
  201. } FUNCNAME##_Fake; \
  202. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  203. void FUNCNAME##_reset(void); \
  204. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
  205. #define DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  206. FUNCNAME##_Fake FUNCNAME##_fake; \
  207. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
  208. SAVE_ARG(FUNCNAME, 0); \
  209. SAVE_ARG(FUNCNAME, 1); \
  210. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  211. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  212. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  213. } \
  214. else{ \
  215. HISTORY_DROPPED(FUNCNAME); \
  216. } \
  217. INCREMENT_CALL_COUNT(FUNCNAME); \
  218. REGISTER_CALL(FUNCNAME); \
  219. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  220. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  221. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
  222. } \
  223. else{ \
  224. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
  225. } \
  226. } \
  227. if (FUNCNAME##_fake.custom_fake){ \
  228. FUNCNAME##_fake.custom_fake(arg0, arg1); \
  229. } \
  230. } \
  231. DEFINE_RESET_FUNCTION(FUNCNAME) \
  232. #define FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  233. DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  234. DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  235. #define DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  236. typedef struct FUNCNAME##_Fake { \
  237. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  238. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  239. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  240. DECLARE_ALL_FUNC_COMMON \
  241. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  242. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
  243. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
  244. } FUNCNAME##_Fake; \
  245. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  246. void FUNCNAME##_reset(void); \
  247. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
  248. #define DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  249. FUNCNAME##_Fake FUNCNAME##_fake; \
  250. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
  251. SAVE_ARG(FUNCNAME, 0); \
  252. SAVE_ARG(FUNCNAME, 1); \
  253. SAVE_ARG(FUNCNAME, 2); \
  254. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  255. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  256. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  257. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  258. } \
  259. else{ \
  260. HISTORY_DROPPED(FUNCNAME); \
  261. } \
  262. INCREMENT_CALL_COUNT(FUNCNAME); \
  263. REGISTER_CALL(FUNCNAME); \
  264. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  265. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  266. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
  267. } \
  268. else{ \
  269. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
  270. } \
  271. } \
  272. if (FUNCNAME##_fake.custom_fake){ \
  273. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
  274. } \
  275. } \
  276. DEFINE_RESET_FUNCTION(FUNCNAME) \
  277. #define FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  278. DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  279. DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  280. #define DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  281. typedef struct FUNCNAME##_Fake { \
  282. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  283. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  284. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  285. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  286. DECLARE_ALL_FUNC_COMMON \
  287. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  288. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
  289. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
  290. } FUNCNAME##_Fake; \
  291. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  292. void FUNCNAME##_reset(void); \
  293. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
  294. #define DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  295. FUNCNAME##_Fake FUNCNAME##_fake; \
  296. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
  297. SAVE_ARG(FUNCNAME, 0); \
  298. SAVE_ARG(FUNCNAME, 1); \
  299. SAVE_ARG(FUNCNAME, 2); \
  300. SAVE_ARG(FUNCNAME, 3); \
  301. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  302. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  303. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  304. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  305. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  306. } \
  307. else{ \
  308. HISTORY_DROPPED(FUNCNAME); \
  309. } \
  310. INCREMENT_CALL_COUNT(FUNCNAME); \
  311. REGISTER_CALL(FUNCNAME); \
  312. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  313. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  314. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
  315. } \
  316. else{ \
  317. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
  318. } \
  319. } \
  320. if (FUNCNAME##_fake.custom_fake){ \
  321. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
  322. } \
  323. } \
  324. DEFINE_RESET_FUNCTION(FUNCNAME) \
  325. #define FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  326. DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  327. DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  328. #define DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  329. typedef struct FUNCNAME##_Fake { \
  330. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  331. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  332. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  333. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  334. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  335. DECLARE_ALL_FUNC_COMMON \
  336. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  337. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
  338. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
  339. } FUNCNAME##_Fake; \
  340. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  341. void FUNCNAME##_reset(void); \
  342. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
  343. #define DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  344. FUNCNAME##_Fake FUNCNAME##_fake; \
  345. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
  346. SAVE_ARG(FUNCNAME, 0); \
  347. SAVE_ARG(FUNCNAME, 1); \
  348. SAVE_ARG(FUNCNAME, 2); \
  349. SAVE_ARG(FUNCNAME, 3); \
  350. SAVE_ARG(FUNCNAME, 4); \
  351. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  352. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  353. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  354. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  355. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  356. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  357. } \
  358. else{ \
  359. HISTORY_DROPPED(FUNCNAME); \
  360. } \
  361. INCREMENT_CALL_COUNT(FUNCNAME); \
  362. REGISTER_CALL(FUNCNAME); \
  363. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  364. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  365. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
  366. } \
  367. else{ \
  368. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
  369. } \
  370. } \
  371. if (FUNCNAME##_fake.custom_fake){ \
  372. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
  373. } \
  374. } \
  375. DEFINE_RESET_FUNCTION(FUNCNAME) \
  376. #define FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  377. DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  378. DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  379. #define DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  380. typedef struct FUNCNAME##_Fake { \
  381. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  382. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  383. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  384. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  385. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  386. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  387. DECLARE_ALL_FUNC_COMMON \
  388. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  389. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
  390. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
  391. } FUNCNAME##_Fake; \
  392. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  393. void FUNCNAME##_reset(void); \
  394. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
  395. #define DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  396. FUNCNAME##_Fake FUNCNAME##_fake; \
  397. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
  398. SAVE_ARG(FUNCNAME, 0); \
  399. SAVE_ARG(FUNCNAME, 1); \
  400. SAVE_ARG(FUNCNAME, 2); \
  401. SAVE_ARG(FUNCNAME, 3); \
  402. SAVE_ARG(FUNCNAME, 4); \
  403. SAVE_ARG(FUNCNAME, 5); \
  404. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  405. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  406. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  407. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  408. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  409. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  410. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  411. } \
  412. else{ \
  413. HISTORY_DROPPED(FUNCNAME); \
  414. } \
  415. INCREMENT_CALL_COUNT(FUNCNAME); \
  416. REGISTER_CALL(FUNCNAME); \
  417. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  418. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  419. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
  420. } \
  421. else{ \
  422. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
  423. } \
  424. } \
  425. if (FUNCNAME##_fake.custom_fake){ \
  426. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
  427. } \
  428. } \
  429. DEFINE_RESET_FUNCTION(FUNCNAME) \
  430. #define FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  431. DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  432. DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  433. #define DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  434. typedef struct FUNCNAME##_Fake { \
  435. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  436. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  437. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  438. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  439. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  440. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  441. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  442. DECLARE_ALL_FUNC_COMMON \
  443. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  444. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
  445. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
  446. } FUNCNAME##_Fake; \
  447. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  448. void FUNCNAME##_reset(void); \
  449. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
  450. #define DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  451. FUNCNAME##_Fake FUNCNAME##_fake; \
  452. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
  453. SAVE_ARG(FUNCNAME, 0); \
  454. SAVE_ARG(FUNCNAME, 1); \
  455. SAVE_ARG(FUNCNAME, 2); \
  456. SAVE_ARG(FUNCNAME, 3); \
  457. SAVE_ARG(FUNCNAME, 4); \
  458. SAVE_ARG(FUNCNAME, 5); \
  459. SAVE_ARG(FUNCNAME, 6); \
  460. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  461. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  462. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  463. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  464. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  465. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  466. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  467. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  468. } \
  469. else{ \
  470. HISTORY_DROPPED(FUNCNAME); \
  471. } \
  472. INCREMENT_CALL_COUNT(FUNCNAME); \
  473. REGISTER_CALL(FUNCNAME); \
  474. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  475. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  476. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  477. } \
  478. else{ \
  479. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  480. } \
  481. } \
  482. if (FUNCNAME##_fake.custom_fake){ \
  483. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  484. } \
  485. } \
  486. DEFINE_RESET_FUNCTION(FUNCNAME) \
  487. #define FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  488. DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  489. DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  490. #define DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  491. typedef struct FUNCNAME##_Fake { \
  492. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  493. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  494. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  495. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  496. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  497. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  498. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  499. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  500. DECLARE_ALL_FUNC_COMMON \
  501. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  502. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
  503. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
  504. } FUNCNAME##_Fake; \
  505. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  506. void FUNCNAME##_reset(void); \
  507. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
  508. #define DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  509. FUNCNAME##_Fake FUNCNAME##_fake; \
  510. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
  511. SAVE_ARG(FUNCNAME, 0); \
  512. SAVE_ARG(FUNCNAME, 1); \
  513. SAVE_ARG(FUNCNAME, 2); \
  514. SAVE_ARG(FUNCNAME, 3); \
  515. SAVE_ARG(FUNCNAME, 4); \
  516. SAVE_ARG(FUNCNAME, 5); \
  517. SAVE_ARG(FUNCNAME, 6); \
  518. SAVE_ARG(FUNCNAME, 7); \
  519. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  520. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  521. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  522. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  523. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  524. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  525. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  526. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  527. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  528. } \
  529. else{ \
  530. HISTORY_DROPPED(FUNCNAME); \
  531. } \
  532. INCREMENT_CALL_COUNT(FUNCNAME); \
  533. REGISTER_CALL(FUNCNAME); \
  534. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  535. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  536. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  537. } \
  538. else{ \
  539. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  540. } \
  541. } \
  542. if (FUNCNAME##_fake.custom_fake){ \
  543. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  544. } \
  545. } \
  546. DEFINE_RESET_FUNCTION(FUNCNAME) \
  547. #define FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  548. DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  549. DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  550. #define DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  551. typedef struct FUNCNAME##_Fake { \
  552. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  553. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  554. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  555. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  556. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  557. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  558. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  559. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  560. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  561. DECLARE_ALL_FUNC_COMMON \
  562. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  563. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
  564. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
  565. } FUNCNAME##_Fake; \
  566. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  567. void FUNCNAME##_reset(void); \
  568. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
  569. #define DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  570. FUNCNAME##_Fake FUNCNAME##_fake; \
  571. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
  572. SAVE_ARG(FUNCNAME, 0); \
  573. SAVE_ARG(FUNCNAME, 1); \
  574. SAVE_ARG(FUNCNAME, 2); \
  575. SAVE_ARG(FUNCNAME, 3); \
  576. SAVE_ARG(FUNCNAME, 4); \
  577. SAVE_ARG(FUNCNAME, 5); \
  578. SAVE_ARG(FUNCNAME, 6); \
  579. SAVE_ARG(FUNCNAME, 7); \
  580. SAVE_ARG(FUNCNAME, 8); \
  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. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  590. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  591. } \
  592. else{ \
  593. HISTORY_DROPPED(FUNCNAME); \
  594. } \
  595. INCREMENT_CALL_COUNT(FUNCNAME); \
  596. REGISTER_CALL(FUNCNAME); \
  597. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  598. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  599. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  600. } \
  601. else{ \
  602. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  603. } \
  604. } \
  605. if (FUNCNAME##_fake.custom_fake){ \
  606. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  607. } \
  608. } \
  609. DEFINE_RESET_FUNCTION(FUNCNAME) \
  610. #define FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  611. DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  612. DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  613. #define DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  614. typedef struct FUNCNAME##_Fake { \
  615. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  616. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  617. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  618. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  619. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  620. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  621. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  622. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  623. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  624. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  625. DECLARE_ALL_FUNC_COMMON \
  626. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  627. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
  628. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
  629. } FUNCNAME##_Fake; \
  630. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  631. void FUNCNAME##_reset(void); \
  632. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
  633. #define DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  634. FUNCNAME##_Fake FUNCNAME##_fake; \
  635. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
  636. SAVE_ARG(FUNCNAME, 0); \
  637. SAVE_ARG(FUNCNAME, 1); \
  638. SAVE_ARG(FUNCNAME, 2); \
  639. SAVE_ARG(FUNCNAME, 3); \
  640. SAVE_ARG(FUNCNAME, 4); \
  641. SAVE_ARG(FUNCNAME, 5); \
  642. SAVE_ARG(FUNCNAME, 6); \
  643. SAVE_ARG(FUNCNAME, 7); \
  644. SAVE_ARG(FUNCNAME, 8); \
  645. SAVE_ARG(FUNCNAME, 9); \
  646. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  647. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  648. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  649. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  650. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  651. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  652. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  653. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  654. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  655. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  656. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  657. } \
  658. else{ \
  659. HISTORY_DROPPED(FUNCNAME); \
  660. } \
  661. INCREMENT_CALL_COUNT(FUNCNAME); \
  662. REGISTER_CALL(FUNCNAME); \
  663. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  664. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  665. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  666. } \
  667. else{ \
  668. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  669. } \
  670. } \
  671. if (FUNCNAME##_fake.custom_fake){ \
  672. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  673. } \
  674. } \
  675. DEFINE_RESET_FUNCTION(FUNCNAME) \
  676. #define FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  677. DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  678. DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  679. #define DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  680. typedef struct FUNCNAME##_Fake { \
  681. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  682. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  683. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  684. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  685. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  686. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  687. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  688. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  689. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  690. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  691. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  692. DECLARE_ALL_FUNC_COMMON \
  693. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  694. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
  695. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
  696. } FUNCNAME##_Fake; \
  697. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  698. void FUNCNAME##_reset(void); \
  699. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
  700. #define DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  701. FUNCNAME##_Fake FUNCNAME##_fake; \
  702. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
  703. SAVE_ARG(FUNCNAME, 0); \
  704. SAVE_ARG(FUNCNAME, 1); \
  705. SAVE_ARG(FUNCNAME, 2); \
  706. SAVE_ARG(FUNCNAME, 3); \
  707. SAVE_ARG(FUNCNAME, 4); \
  708. SAVE_ARG(FUNCNAME, 5); \
  709. SAVE_ARG(FUNCNAME, 6); \
  710. SAVE_ARG(FUNCNAME, 7); \
  711. SAVE_ARG(FUNCNAME, 8); \
  712. SAVE_ARG(FUNCNAME, 9); \
  713. SAVE_ARG(FUNCNAME, 10); \
  714. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  715. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  716. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  717. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  718. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  719. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  720. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  721. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  722. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  723. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  724. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  725. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  726. } \
  727. else{ \
  728. HISTORY_DROPPED(FUNCNAME); \
  729. } \
  730. INCREMENT_CALL_COUNT(FUNCNAME); \
  731. REGISTER_CALL(FUNCNAME); \
  732. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  733. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  734. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  735. } \
  736. else{ \
  737. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  738. } \
  739. } \
  740. if (FUNCNAME##_fake.custom_fake){ \
  741. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  742. } \
  743. } \
  744. DEFINE_RESET_FUNCTION(FUNCNAME) \
  745. #define FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  746. DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  747. DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  748. #define DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  749. typedef struct FUNCNAME##_Fake { \
  750. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  751. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  752. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  753. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  754. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  755. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  756. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  757. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  758. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  759. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  760. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  761. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  762. DECLARE_ALL_FUNC_COMMON \
  763. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  764. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
  765. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
  766. } FUNCNAME##_Fake; \
  767. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  768. void FUNCNAME##_reset(void); \
  769. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
  770. #define DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  771. FUNCNAME##_Fake FUNCNAME##_fake; \
  772. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
  773. SAVE_ARG(FUNCNAME, 0); \
  774. SAVE_ARG(FUNCNAME, 1); \
  775. SAVE_ARG(FUNCNAME, 2); \
  776. SAVE_ARG(FUNCNAME, 3); \
  777. SAVE_ARG(FUNCNAME, 4); \
  778. SAVE_ARG(FUNCNAME, 5); \
  779. SAVE_ARG(FUNCNAME, 6); \
  780. SAVE_ARG(FUNCNAME, 7); \
  781. SAVE_ARG(FUNCNAME, 8); \
  782. SAVE_ARG(FUNCNAME, 9); \
  783. SAVE_ARG(FUNCNAME, 10); \
  784. SAVE_ARG(FUNCNAME, 11); \
  785. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  786. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  787. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  788. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  789. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  790. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  791. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  792. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  793. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  794. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  795. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  796. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  797. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  798. } \
  799. else{ \
  800. HISTORY_DROPPED(FUNCNAME); \
  801. } \
  802. INCREMENT_CALL_COUNT(FUNCNAME); \
  803. REGISTER_CALL(FUNCNAME); \
  804. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  805. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  806. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  807. } \
  808. else{ \
  809. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  810. } \
  811. } \
  812. if (FUNCNAME##_fake.custom_fake){ \
  813. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  814. } \
  815. } \
  816. DEFINE_RESET_FUNCTION(FUNCNAME) \
  817. #define FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  818. DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  819. DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  820. #define DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  821. typedef struct FUNCNAME##_Fake { \
  822. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  823. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  824. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  825. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  826. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  827. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  828. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  829. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  830. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  831. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  832. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  833. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  834. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  835. DECLARE_ALL_FUNC_COMMON \
  836. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  837. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
  838. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
  839. } FUNCNAME##_Fake; \
  840. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  841. void FUNCNAME##_reset(void); \
  842. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
  843. #define DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  844. FUNCNAME##_Fake FUNCNAME##_fake; \
  845. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
  846. SAVE_ARG(FUNCNAME, 0); \
  847. SAVE_ARG(FUNCNAME, 1); \
  848. SAVE_ARG(FUNCNAME, 2); \
  849. SAVE_ARG(FUNCNAME, 3); \
  850. SAVE_ARG(FUNCNAME, 4); \
  851. SAVE_ARG(FUNCNAME, 5); \
  852. SAVE_ARG(FUNCNAME, 6); \
  853. SAVE_ARG(FUNCNAME, 7); \
  854. SAVE_ARG(FUNCNAME, 8); \
  855. SAVE_ARG(FUNCNAME, 9); \
  856. SAVE_ARG(FUNCNAME, 10); \
  857. SAVE_ARG(FUNCNAME, 11); \
  858. SAVE_ARG(FUNCNAME, 12); \
  859. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  860. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  861. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  862. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  863. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  864. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  865. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  866. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  867. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  868. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  869. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  870. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  871. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  872. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  873. } \
  874. else{ \
  875. HISTORY_DROPPED(FUNCNAME); \
  876. } \
  877. INCREMENT_CALL_COUNT(FUNCNAME); \
  878. REGISTER_CALL(FUNCNAME); \
  879. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  880. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  881. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  882. } \
  883. else{ \
  884. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  885. } \
  886. } \
  887. if (FUNCNAME##_fake.custom_fake){ \
  888. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  889. } \
  890. } \
  891. DEFINE_RESET_FUNCTION(FUNCNAME) \
  892. #define FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  893. DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  894. DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  895. #define DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  896. typedef struct FUNCNAME##_Fake { \
  897. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  898. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  899. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  900. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  901. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  902. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  903. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  904. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  905. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  906. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  907. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  908. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  909. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  910. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  911. DECLARE_ALL_FUNC_COMMON \
  912. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  913. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
  914. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
  915. } FUNCNAME##_Fake; \
  916. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  917. void FUNCNAME##_reset(void); \
  918. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
  919. #define DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  920. FUNCNAME##_Fake FUNCNAME##_fake; \
  921. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
  922. SAVE_ARG(FUNCNAME, 0); \
  923. SAVE_ARG(FUNCNAME, 1); \
  924. SAVE_ARG(FUNCNAME, 2); \
  925. SAVE_ARG(FUNCNAME, 3); \
  926. SAVE_ARG(FUNCNAME, 4); \
  927. SAVE_ARG(FUNCNAME, 5); \
  928. SAVE_ARG(FUNCNAME, 6); \
  929. SAVE_ARG(FUNCNAME, 7); \
  930. SAVE_ARG(FUNCNAME, 8); \
  931. SAVE_ARG(FUNCNAME, 9); \
  932. SAVE_ARG(FUNCNAME, 10); \
  933. SAVE_ARG(FUNCNAME, 11); \
  934. SAVE_ARG(FUNCNAME, 12); \
  935. SAVE_ARG(FUNCNAME, 13); \
  936. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  937. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  938. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  939. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  940. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  941. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  942. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  943. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  944. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  945. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  946. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  947. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  948. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  949. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  950. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  951. } \
  952. else{ \
  953. HISTORY_DROPPED(FUNCNAME); \
  954. } \
  955. INCREMENT_CALL_COUNT(FUNCNAME); \
  956. REGISTER_CALL(FUNCNAME); \
  957. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  958. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  959. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  960. } \
  961. else{ \
  962. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  963. } \
  964. } \
  965. if (FUNCNAME##_fake.custom_fake){ \
  966. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  967. } \
  968. } \
  969. DEFINE_RESET_FUNCTION(FUNCNAME) \
  970. #define FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  971. DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  972. DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  973. #define DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  974. typedef struct FUNCNAME##_Fake { \
  975. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  976. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  977. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  978. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  979. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  980. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  981. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  982. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  983. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  984. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  985. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  986. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  987. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  988. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  989. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  990. DECLARE_ALL_FUNC_COMMON \
  991. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  992. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
  993. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
  994. } FUNCNAME##_Fake; \
  995. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  996. void FUNCNAME##_reset(void); \
  997. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
  998. #define DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  999. FUNCNAME##_Fake FUNCNAME##_fake; \
  1000. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
  1001. SAVE_ARG(FUNCNAME, 0); \
  1002. SAVE_ARG(FUNCNAME, 1); \
  1003. SAVE_ARG(FUNCNAME, 2); \
  1004. SAVE_ARG(FUNCNAME, 3); \
  1005. SAVE_ARG(FUNCNAME, 4); \
  1006. SAVE_ARG(FUNCNAME, 5); \
  1007. SAVE_ARG(FUNCNAME, 6); \
  1008. SAVE_ARG(FUNCNAME, 7); \
  1009. SAVE_ARG(FUNCNAME, 8); \
  1010. SAVE_ARG(FUNCNAME, 9); \
  1011. SAVE_ARG(FUNCNAME, 10); \
  1012. SAVE_ARG(FUNCNAME, 11); \
  1013. SAVE_ARG(FUNCNAME, 12); \
  1014. SAVE_ARG(FUNCNAME, 13); \
  1015. SAVE_ARG(FUNCNAME, 14); \
  1016. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1017. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1018. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1019. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1020. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1021. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1022. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1023. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  1024. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  1025. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  1026. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  1027. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  1028. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  1029. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  1030. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  1031. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  1032. } \
  1033. else{ \
  1034. HISTORY_DROPPED(FUNCNAME); \
  1035. } \
  1036. INCREMENT_CALL_COUNT(FUNCNAME); \
  1037. REGISTER_CALL(FUNCNAME); \
  1038. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1039. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1040. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  1041. } \
  1042. else{ \
  1043. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  1044. } \
  1045. } \
  1046. if (FUNCNAME##_fake.custom_fake){ \
  1047. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  1048. } \
  1049. } \
  1050. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1051. #define FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  1052. DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  1053. DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  1054. #define DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  1055. typedef struct FUNCNAME##_Fake { \
  1056. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1057. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1058. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1059. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1060. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1061. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1062. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  1063. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  1064. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  1065. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  1066. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  1067. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  1068. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  1069. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  1070. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  1071. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  1072. DECLARE_ALL_FUNC_COMMON \
  1073. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1074. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
  1075. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
  1076. } FUNCNAME##_Fake; \
  1077. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1078. void FUNCNAME##_reset(void); \
  1079. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
  1080. #define DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  1081. FUNCNAME##_Fake FUNCNAME##_fake; \
  1082. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
  1083. SAVE_ARG(FUNCNAME, 0); \
  1084. SAVE_ARG(FUNCNAME, 1); \
  1085. SAVE_ARG(FUNCNAME, 2); \
  1086. SAVE_ARG(FUNCNAME, 3); \
  1087. SAVE_ARG(FUNCNAME, 4); \
  1088. SAVE_ARG(FUNCNAME, 5); \
  1089. SAVE_ARG(FUNCNAME, 6); \
  1090. SAVE_ARG(FUNCNAME, 7); \
  1091. SAVE_ARG(FUNCNAME, 8); \
  1092. SAVE_ARG(FUNCNAME, 9); \
  1093. SAVE_ARG(FUNCNAME, 10); \
  1094. SAVE_ARG(FUNCNAME, 11); \
  1095. SAVE_ARG(FUNCNAME, 12); \
  1096. SAVE_ARG(FUNCNAME, 13); \
  1097. SAVE_ARG(FUNCNAME, 14); \
  1098. SAVE_ARG(FUNCNAME, 15); \
  1099. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1100. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1101. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1102. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1103. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1104. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1105. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1106. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  1107. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  1108. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  1109. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  1110. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  1111. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  1112. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  1113. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  1114. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  1115. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  1116. } \
  1117. else{ \
  1118. HISTORY_DROPPED(FUNCNAME); \
  1119. } \
  1120. INCREMENT_CALL_COUNT(FUNCNAME); \
  1121. REGISTER_CALL(FUNCNAME); \
  1122. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1123. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1124. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  1125. } \
  1126. else{ \
  1127. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  1128. } \
  1129. } \
  1130. if (FUNCNAME##_fake.custom_fake){ \
  1131. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  1132. } \
  1133. } \
  1134. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1135. #define FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  1136. DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  1137. DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  1138. #define DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  1139. typedef struct FUNCNAME##_Fake { \
  1140. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1141. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1142. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1143. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1144. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1145. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1146. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  1147. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  1148. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  1149. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  1150. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  1151. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  1152. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  1153. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  1154. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  1155. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  1156. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  1157. DECLARE_ALL_FUNC_COMMON \
  1158. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1159. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
  1160. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
  1161. } FUNCNAME##_Fake; \
  1162. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1163. void FUNCNAME##_reset(void); \
  1164. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
  1165. #define DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  1166. FUNCNAME##_Fake FUNCNAME##_fake; \
  1167. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
  1168. SAVE_ARG(FUNCNAME, 0); \
  1169. SAVE_ARG(FUNCNAME, 1); \
  1170. SAVE_ARG(FUNCNAME, 2); \
  1171. SAVE_ARG(FUNCNAME, 3); \
  1172. SAVE_ARG(FUNCNAME, 4); \
  1173. SAVE_ARG(FUNCNAME, 5); \
  1174. SAVE_ARG(FUNCNAME, 6); \
  1175. SAVE_ARG(FUNCNAME, 7); \
  1176. SAVE_ARG(FUNCNAME, 8); \
  1177. SAVE_ARG(FUNCNAME, 9); \
  1178. SAVE_ARG(FUNCNAME, 10); \
  1179. SAVE_ARG(FUNCNAME, 11); \
  1180. SAVE_ARG(FUNCNAME, 12); \
  1181. SAVE_ARG(FUNCNAME, 13); \
  1182. SAVE_ARG(FUNCNAME, 14); \
  1183. SAVE_ARG(FUNCNAME, 15); \
  1184. SAVE_ARG(FUNCNAME, 16); \
  1185. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1186. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1187. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1188. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1189. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1190. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1191. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1192. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  1193. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  1194. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  1195. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  1196. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  1197. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  1198. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  1199. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  1200. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  1201. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  1202. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  1203. } \
  1204. else{ \
  1205. HISTORY_DROPPED(FUNCNAME); \
  1206. } \
  1207. INCREMENT_CALL_COUNT(FUNCNAME); \
  1208. REGISTER_CALL(FUNCNAME); \
  1209. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1210. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1211. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  1212. } \
  1213. else{ \
  1214. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  1215. } \
  1216. } \
  1217. if (FUNCNAME##_fake.custom_fake){ \
  1218. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  1219. } \
  1220. } \
  1221. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1222. #define FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  1223. DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  1224. DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  1225. #define DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  1226. typedef struct FUNCNAME##_Fake { \
  1227. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1228. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1229. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1230. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1231. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1232. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1233. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  1234. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  1235. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  1236. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  1237. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  1238. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  1239. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  1240. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  1241. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  1242. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  1243. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  1244. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  1245. DECLARE_ALL_FUNC_COMMON \
  1246. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1247. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
  1248. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
  1249. } FUNCNAME##_Fake; \
  1250. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1251. void FUNCNAME##_reset(void); \
  1252. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
  1253. #define DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  1254. FUNCNAME##_Fake FUNCNAME##_fake; \
  1255. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
  1256. SAVE_ARG(FUNCNAME, 0); \
  1257. SAVE_ARG(FUNCNAME, 1); \
  1258. SAVE_ARG(FUNCNAME, 2); \
  1259. SAVE_ARG(FUNCNAME, 3); \
  1260. SAVE_ARG(FUNCNAME, 4); \
  1261. SAVE_ARG(FUNCNAME, 5); \
  1262. SAVE_ARG(FUNCNAME, 6); \
  1263. SAVE_ARG(FUNCNAME, 7); \
  1264. SAVE_ARG(FUNCNAME, 8); \
  1265. SAVE_ARG(FUNCNAME, 9); \
  1266. SAVE_ARG(FUNCNAME, 10); \
  1267. SAVE_ARG(FUNCNAME, 11); \
  1268. SAVE_ARG(FUNCNAME, 12); \
  1269. SAVE_ARG(FUNCNAME, 13); \
  1270. SAVE_ARG(FUNCNAME, 14); \
  1271. SAVE_ARG(FUNCNAME, 15); \
  1272. SAVE_ARG(FUNCNAME, 16); \
  1273. SAVE_ARG(FUNCNAME, 17); \
  1274. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1275. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1276. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1277. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1278. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1279. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1280. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1281. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  1282. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  1283. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  1284. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  1285. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  1286. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  1287. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  1288. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  1289. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  1290. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  1291. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  1292. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  1293. } \
  1294. else{ \
  1295. HISTORY_DROPPED(FUNCNAME); \
  1296. } \
  1297. INCREMENT_CALL_COUNT(FUNCNAME); \
  1298. REGISTER_CALL(FUNCNAME); \
  1299. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1300. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1301. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  1302. } \
  1303. else{ \
  1304. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  1305. } \
  1306. } \
  1307. if (FUNCNAME##_fake.custom_fake){ \
  1308. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  1309. } \
  1310. } \
  1311. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1312. #define FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  1313. DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  1314. DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  1315. #define DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  1316. typedef struct FUNCNAME##_Fake { \
  1317. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1318. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1319. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1320. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1321. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1322. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1323. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  1324. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  1325. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  1326. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  1327. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  1328. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  1329. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  1330. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  1331. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  1332. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  1333. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  1334. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  1335. DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
  1336. DECLARE_ALL_FUNC_COMMON \
  1337. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1338. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
  1339. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
  1340. } FUNCNAME##_Fake; \
  1341. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1342. void FUNCNAME##_reset(void); \
  1343. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
  1344. #define DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  1345. FUNCNAME##_Fake FUNCNAME##_fake; \
  1346. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
  1347. SAVE_ARG(FUNCNAME, 0); \
  1348. SAVE_ARG(FUNCNAME, 1); \
  1349. SAVE_ARG(FUNCNAME, 2); \
  1350. SAVE_ARG(FUNCNAME, 3); \
  1351. SAVE_ARG(FUNCNAME, 4); \
  1352. SAVE_ARG(FUNCNAME, 5); \
  1353. SAVE_ARG(FUNCNAME, 6); \
  1354. SAVE_ARG(FUNCNAME, 7); \
  1355. SAVE_ARG(FUNCNAME, 8); \
  1356. SAVE_ARG(FUNCNAME, 9); \
  1357. SAVE_ARG(FUNCNAME, 10); \
  1358. SAVE_ARG(FUNCNAME, 11); \
  1359. SAVE_ARG(FUNCNAME, 12); \
  1360. SAVE_ARG(FUNCNAME, 13); \
  1361. SAVE_ARG(FUNCNAME, 14); \
  1362. SAVE_ARG(FUNCNAME, 15); \
  1363. SAVE_ARG(FUNCNAME, 16); \
  1364. SAVE_ARG(FUNCNAME, 17); \
  1365. SAVE_ARG(FUNCNAME, 18); \
  1366. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1367. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1368. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1369. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1370. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1371. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1372. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1373. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  1374. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  1375. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  1376. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  1377. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  1378. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  1379. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  1380. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  1381. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  1382. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  1383. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  1384. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  1385. SAVE_ARG_HISTORY(FUNCNAME, 18); \
  1386. } \
  1387. else{ \
  1388. HISTORY_DROPPED(FUNCNAME); \
  1389. } \
  1390. INCREMENT_CALL_COUNT(FUNCNAME); \
  1391. REGISTER_CALL(FUNCNAME); \
  1392. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1393. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1394. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  1395. } \
  1396. else{ \
  1397. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  1398. } \
  1399. } \
  1400. if (FUNCNAME##_fake.custom_fake){ \
  1401. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  1402. } \
  1403. } \
  1404. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1405. #define FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  1406. DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  1407. DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  1408. #define DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  1409. typedef struct FUNCNAME##_Fake { \
  1410. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1411. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1412. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1413. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1414. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1415. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1416. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  1417. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  1418. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  1419. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  1420. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  1421. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  1422. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  1423. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  1424. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  1425. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  1426. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  1427. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  1428. DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
  1429. DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
  1430. DECLARE_ALL_FUNC_COMMON \
  1431. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1432. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
  1433. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
  1434. } FUNCNAME##_Fake; \
  1435. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1436. void FUNCNAME##_reset(void); \
  1437. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
  1438. #define DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  1439. FUNCNAME##_Fake FUNCNAME##_fake; \
  1440. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
  1441. SAVE_ARG(FUNCNAME, 0); \
  1442. SAVE_ARG(FUNCNAME, 1); \
  1443. SAVE_ARG(FUNCNAME, 2); \
  1444. SAVE_ARG(FUNCNAME, 3); \
  1445. SAVE_ARG(FUNCNAME, 4); \
  1446. SAVE_ARG(FUNCNAME, 5); \
  1447. SAVE_ARG(FUNCNAME, 6); \
  1448. SAVE_ARG(FUNCNAME, 7); \
  1449. SAVE_ARG(FUNCNAME, 8); \
  1450. SAVE_ARG(FUNCNAME, 9); \
  1451. SAVE_ARG(FUNCNAME, 10); \
  1452. SAVE_ARG(FUNCNAME, 11); \
  1453. SAVE_ARG(FUNCNAME, 12); \
  1454. SAVE_ARG(FUNCNAME, 13); \
  1455. SAVE_ARG(FUNCNAME, 14); \
  1456. SAVE_ARG(FUNCNAME, 15); \
  1457. SAVE_ARG(FUNCNAME, 16); \
  1458. SAVE_ARG(FUNCNAME, 17); \
  1459. SAVE_ARG(FUNCNAME, 18); \
  1460. SAVE_ARG(FUNCNAME, 19); \
  1461. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1462. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1463. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1464. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1465. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1466. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1467. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1468. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  1469. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  1470. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  1471. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  1472. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  1473. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  1474. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  1475. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  1476. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  1477. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  1478. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  1479. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  1480. SAVE_ARG_HISTORY(FUNCNAME, 18); \
  1481. SAVE_ARG_HISTORY(FUNCNAME, 19); \
  1482. } \
  1483. else{ \
  1484. HISTORY_DROPPED(FUNCNAME); \
  1485. } \
  1486. INCREMENT_CALL_COUNT(FUNCNAME); \
  1487. REGISTER_CALL(FUNCNAME); \
  1488. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1489. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1490. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  1491. } \
  1492. else{ \
  1493. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  1494. } \
  1495. } \
  1496. if (FUNCNAME##_fake.custom_fake){ \
  1497. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  1498. } \
  1499. } \
  1500. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1501. #define FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  1502. DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  1503. DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  1504. #define DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
  1505. typedef struct FUNCNAME##_Fake { \
  1506. DECLARE_ALL_FUNC_COMMON \
  1507. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1508. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1509. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1510. RETURN_TYPE(*custom_fake)(void); \
  1511. RETURN_TYPE(**custom_fake_seq)(void); \
  1512. } FUNCNAME##_Fake; \
  1513. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1514. void FUNCNAME##_reset(void); \
  1515. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void); \
  1516. #define DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
  1517. FUNCNAME##_Fake FUNCNAME##_fake; \
  1518. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void){ \
  1519. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1520. } \
  1521. else{ \
  1522. HISTORY_DROPPED(FUNCNAME); \
  1523. } \
  1524. INCREMENT_CALL_COUNT(FUNCNAME); \
  1525. REGISTER_CALL(FUNCNAME); \
  1526. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1527. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1528. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
  1529. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1530. return ret; \
  1531. } \
  1532. else{ \
  1533. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
  1534. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1535. return ret; \
  1536. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
  1537. } \
  1538. } \
  1539. if (FUNCNAME##_fake.custom_fake){ \
  1540. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(); \
  1541. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1542. return ret; \
  1543. return FUNCNAME##_fake.custom_fake(); \
  1544. } \
  1545. RETURN_FAKE_RESULT(FUNCNAME) \
  1546. } \
  1547. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1548. #define FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
  1549. DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
  1550. DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
  1551. #define DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
  1552. typedef struct FUNCNAME##_Fake { \
  1553. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1554. DECLARE_ALL_FUNC_COMMON \
  1555. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1556. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1557. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1558. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0); \
  1559. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0); \
  1560. } FUNCNAME##_Fake; \
  1561. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1562. void FUNCNAME##_reset(void); \
  1563. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0); \
  1564. #define DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
  1565. FUNCNAME##_Fake FUNCNAME##_fake; \
  1566. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0){ \
  1567. SAVE_ARG(FUNCNAME, 0); \
  1568. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1569. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1570. } \
  1571. else{ \
  1572. HISTORY_DROPPED(FUNCNAME); \
  1573. } \
  1574. INCREMENT_CALL_COUNT(FUNCNAME); \
  1575. REGISTER_CALL(FUNCNAME); \
  1576. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1577. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1578. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
  1579. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1580. return ret; \
  1581. } \
  1582. else{ \
  1583. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
  1584. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1585. return ret; \
  1586. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
  1587. } \
  1588. } \
  1589. if (FUNCNAME##_fake.custom_fake){ \
  1590. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0); \
  1591. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1592. return ret; \
  1593. return FUNCNAME##_fake.custom_fake(arg0); \
  1594. } \
  1595. RETURN_FAKE_RESULT(FUNCNAME) \
  1596. } \
  1597. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1598. #define FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
  1599. DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
  1600. DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
  1601. #define DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  1602. typedef struct FUNCNAME##_Fake { \
  1603. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1604. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1605. DECLARE_ALL_FUNC_COMMON \
  1606. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1607. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1608. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1609. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
  1610. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
  1611. } FUNCNAME##_Fake; \
  1612. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1613. void FUNCNAME##_reset(void); \
  1614. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
  1615. #define DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  1616. FUNCNAME##_Fake FUNCNAME##_fake; \
  1617. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
  1618. SAVE_ARG(FUNCNAME, 0); \
  1619. SAVE_ARG(FUNCNAME, 1); \
  1620. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1621. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1622. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1623. } \
  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 < FUNCNAME##_fake.custom_fake_seq_len){ \
  1631. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
  1632. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1633. return ret; \
  1634. } \
  1635. else{ \
  1636. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
  1637. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1638. return ret; \
  1639. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
  1640. } \
  1641. } \
  1642. if (FUNCNAME##_fake.custom_fake){ \
  1643. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1); \
  1644. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1645. return ret; \
  1646. return FUNCNAME##_fake.custom_fake(arg0, arg1); \
  1647. } \
  1648. RETURN_FAKE_RESULT(FUNCNAME) \
  1649. } \
  1650. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1651. #define FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  1652. DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  1653. DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
  1654. #define DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  1655. typedef struct FUNCNAME##_Fake { \
  1656. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1657. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1658. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1659. DECLARE_ALL_FUNC_COMMON \
  1660. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1661. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1662. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1663. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
  1664. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
  1665. } FUNCNAME##_Fake; \
  1666. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1667. void FUNCNAME##_reset(void); \
  1668. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
  1669. #define DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  1670. FUNCNAME##_Fake FUNCNAME##_fake; \
  1671. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
  1672. SAVE_ARG(FUNCNAME, 0); \
  1673. SAVE_ARG(FUNCNAME, 1); \
  1674. SAVE_ARG(FUNCNAME, 2); \
  1675. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1676. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1677. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1678. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1679. } \
  1680. else{ \
  1681. HISTORY_DROPPED(FUNCNAME); \
  1682. } \
  1683. INCREMENT_CALL_COUNT(FUNCNAME); \
  1684. REGISTER_CALL(FUNCNAME); \
  1685. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1686. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1687. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
  1688. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1689. return ret; \
  1690. } \
  1691. else{ \
  1692. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
  1693. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1694. return ret; \
  1695. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
  1696. } \
  1697. } \
  1698. if (FUNCNAME##_fake.custom_fake){ \
  1699. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
  1700. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1701. return ret; \
  1702. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
  1703. } \
  1704. RETURN_FAKE_RESULT(FUNCNAME) \
  1705. } \
  1706. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1707. #define FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  1708. DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  1709. DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
  1710. #define DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  1711. typedef struct FUNCNAME##_Fake { \
  1712. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1713. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1714. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1715. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1716. DECLARE_ALL_FUNC_COMMON \
  1717. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1718. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1719. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1720. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
  1721. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
  1722. } FUNCNAME##_Fake; \
  1723. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1724. void FUNCNAME##_reset(void); \
  1725. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
  1726. #define DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  1727. FUNCNAME##_Fake FUNCNAME##_fake; \
  1728. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
  1729. SAVE_ARG(FUNCNAME, 0); \
  1730. SAVE_ARG(FUNCNAME, 1); \
  1731. SAVE_ARG(FUNCNAME, 2); \
  1732. SAVE_ARG(FUNCNAME, 3); \
  1733. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1734. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1735. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1736. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1737. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1738. } \
  1739. else{ \
  1740. HISTORY_DROPPED(FUNCNAME); \
  1741. } \
  1742. INCREMENT_CALL_COUNT(FUNCNAME); \
  1743. REGISTER_CALL(FUNCNAME); \
  1744. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1745. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1746. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
  1747. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1748. return ret; \
  1749. } \
  1750. else{ \
  1751. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
  1752. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1753. return ret; \
  1754. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
  1755. } \
  1756. } \
  1757. if (FUNCNAME##_fake.custom_fake){ \
  1758. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
  1759. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1760. return ret; \
  1761. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
  1762. } \
  1763. RETURN_FAKE_RESULT(FUNCNAME) \
  1764. } \
  1765. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1766. #define FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  1767. DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  1768. DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
  1769. #define DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  1770. typedef struct FUNCNAME##_Fake { \
  1771. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1772. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1773. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1774. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1775. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1776. DECLARE_ALL_FUNC_COMMON \
  1777. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1778. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1779. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1780. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
  1781. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
  1782. } FUNCNAME##_Fake; \
  1783. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1784. void FUNCNAME##_reset(void); \
  1785. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
  1786. #define DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  1787. FUNCNAME##_Fake FUNCNAME##_fake; \
  1788. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
  1789. SAVE_ARG(FUNCNAME, 0); \
  1790. SAVE_ARG(FUNCNAME, 1); \
  1791. SAVE_ARG(FUNCNAME, 2); \
  1792. SAVE_ARG(FUNCNAME, 3); \
  1793. SAVE_ARG(FUNCNAME, 4); \
  1794. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1795. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1796. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1797. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1798. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1799. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1800. } \
  1801. else{ \
  1802. HISTORY_DROPPED(FUNCNAME); \
  1803. } \
  1804. INCREMENT_CALL_COUNT(FUNCNAME); \
  1805. REGISTER_CALL(FUNCNAME); \
  1806. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1807. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1808. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
  1809. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1810. return ret; \
  1811. } \
  1812. else{ \
  1813. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
  1814. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1815. return ret; \
  1816. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
  1817. } \
  1818. } \
  1819. if (FUNCNAME##_fake.custom_fake){ \
  1820. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
  1821. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1822. return ret; \
  1823. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
  1824. } \
  1825. RETURN_FAKE_RESULT(FUNCNAME) \
  1826. } \
  1827. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1828. #define FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  1829. DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  1830. DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
  1831. #define DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  1832. typedef struct FUNCNAME##_Fake { \
  1833. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1834. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1835. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1836. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1837. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1838. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1839. DECLARE_ALL_FUNC_COMMON \
  1840. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1841. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1842. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1843. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
  1844. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
  1845. } FUNCNAME##_Fake; \
  1846. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1847. void FUNCNAME##_reset(void); \
  1848. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
  1849. #define DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  1850. FUNCNAME##_Fake FUNCNAME##_fake; \
  1851. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
  1852. SAVE_ARG(FUNCNAME, 0); \
  1853. SAVE_ARG(FUNCNAME, 1); \
  1854. SAVE_ARG(FUNCNAME, 2); \
  1855. SAVE_ARG(FUNCNAME, 3); \
  1856. SAVE_ARG(FUNCNAME, 4); \
  1857. SAVE_ARG(FUNCNAME, 5); \
  1858. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1859. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1860. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1861. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1862. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1863. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1864. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1865. } \
  1866. else{ \
  1867. HISTORY_DROPPED(FUNCNAME); \
  1868. } \
  1869. INCREMENT_CALL_COUNT(FUNCNAME); \
  1870. REGISTER_CALL(FUNCNAME); \
  1871. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1872. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1873. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
  1874. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1875. return ret; \
  1876. } \
  1877. else{ \
  1878. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
  1879. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1880. return ret; \
  1881. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
  1882. } \
  1883. } \
  1884. if (FUNCNAME##_fake.custom_fake){ \
  1885. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
  1886. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1887. return ret; \
  1888. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
  1889. } \
  1890. RETURN_FAKE_RESULT(FUNCNAME) \
  1891. } \
  1892. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1893. #define FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  1894. DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  1895. DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
  1896. #define DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  1897. typedef struct FUNCNAME##_Fake { \
  1898. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1899. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1900. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1901. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1902. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1903. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1904. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  1905. DECLARE_ALL_FUNC_COMMON \
  1906. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1907. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1908. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1909. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
  1910. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
  1911. } FUNCNAME##_Fake; \
  1912. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1913. void FUNCNAME##_reset(void); \
  1914. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
  1915. #define DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  1916. FUNCNAME##_Fake FUNCNAME##_fake; \
  1917. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
  1918. SAVE_ARG(FUNCNAME, 0); \
  1919. SAVE_ARG(FUNCNAME, 1); \
  1920. SAVE_ARG(FUNCNAME, 2); \
  1921. SAVE_ARG(FUNCNAME, 3); \
  1922. SAVE_ARG(FUNCNAME, 4); \
  1923. SAVE_ARG(FUNCNAME, 5); \
  1924. SAVE_ARG(FUNCNAME, 6); \
  1925. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1926. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1927. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1928. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1929. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  1930. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  1931. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  1932. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  1933. } \
  1934. else{ \
  1935. HISTORY_DROPPED(FUNCNAME); \
  1936. } \
  1937. INCREMENT_CALL_COUNT(FUNCNAME); \
  1938. REGISTER_CALL(FUNCNAME); \
  1939. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  1940. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  1941. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  1942. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1943. return ret; \
  1944. } \
  1945. else{ \
  1946. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  1947. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1948. return ret; \
  1949. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  1950. } \
  1951. } \
  1952. if (FUNCNAME##_fake.custom_fake){ \
  1953. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  1954. SAVE_RET_HISTORY(FUNCNAME, ret); \
  1955. return ret; \
  1956. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
  1957. } \
  1958. RETURN_FAKE_RESULT(FUNCNAME) \
  1959. } \
  1960. DEFINE_RESET_FUNCTION(FUNCNAME) \
  1961. #define FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  1962. DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  1963. DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
  1964. #define DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  1965. typedef struct FUNCNAME##_Fake { \
  1966. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  1967. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  1968. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  1969. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  1970. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  1971. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  1972. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  1973. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  1974. DECLARE_ALL_FUNC_COMMON \
  1975. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  1976. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  1977. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  1978. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
  1979. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
  1980. } FUNCNAME##_Fake; \
  1981. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  1982. void FUNCNAME##_reset(void); \
  1983. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
  1984. #define DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  1985. FUNCNAME##_Fake FUNCNAME##_fake; \
  1986. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
  1987. SAVE_ARG(FUNCNAME, 0); \
  1988. SAVE_ARG(FUNCNAME, 1); \
  1989. SAVE_ARG(FUNCNAME, 2); \
  1990. SAVE_ARG(FUNCNAME, 3); \
  1991. SAVE_ARG(FUNCNAME, 4); \
  1992. SAVE_ARG(FUNCNAME, 5); \
  1993. SAVE_ARG(FUNCNAME, 6); \
  1994. SAVE_ARG(FUNCNAME, 7); \
  1995. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  1996. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  1997. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  1998. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  1999. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2000. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2001. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2002. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2003. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2004. } \
  2005. else{ \
  2006. HISTORY_DROPPED(FUNCNAME); \
  2007. } \
  2008. INCREMENT_CALL_COUNT(FUNCNAME); \
  2009. REGISTER_CALL(FUNCNAME); \
  2010. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2011. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2012. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  2013. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2014. return ret; \
  2015. } \
  2016. else{ \
  2017. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  2018. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2019. return ret; \
  2020. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  2021. } \
  2022. } \
  2023. if (FUNCNAME##_fake.custom_fake){ \
  2024. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  2025. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2026. return ret; \
  2027. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
  2028. } \
  2029. RETURN_FAKE_RESULT(FUNCNAME) \
  2030. } \
  2031. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2032. #define FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  2033. DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  2034. DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
  2035. #define DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  2036. typedef struct FUNCNAME##_Fake { \
  2037. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2038. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2039. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2040. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2041. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2042. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2043. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2044. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2045. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2046. DECLARE_ALL_FUNC_COMMON \
  2047. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2048. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2049. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2050. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
  2051. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
  2052. } FUNCNAME##_Fake; \
  2053. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2054. void FUNCNAME##_reset(void); \
  2055. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
  2056. #define DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  2057. FUNCNAME##_Fake FUNCNAME##_fake; \
  2058. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
  2059. SAVE_ARG(FUNCNAME, 0); \
  2060. SAVE_ARG(FUNCNAME, 1); \
  2061. SAVE_ARG(FUNCNAME, 2); \
  2062. SAVE_ARG(FUNCNAME, 3); \
  2063. SAVE_ARG(FUNCNAME, 4); \
  2064. SAVE_ARG(FUNCNAME, 5); \
  2065. SAVE_ARG(FUNCNAME, 6); \
  2066. SAVE_ARG(FUNCNAME, 7); \
  2067. SAVE_ARG(FUNCNAME, 8); \
  2068. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2069. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2070. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2071. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2072. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2073. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2074. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2075. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2076. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2077. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2078. } \
  2079. else{ \
  2080. HISTORY_DROPPED(FUNCNAME); \
  2081. } \
  2082. INCREMENT_CALL_COUNT(FUNCNAME); \
  2083. REGISTER_CALL(FUNCNAME); \
  2084. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2085. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2086. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  2087. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2088. return ret; \
  2089. } \
  2090. else{ \
  2091. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  2092. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2093. return ret; \
  2094. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  2095. } \
  2096. } \
  2097. if (FUNCNAME##_fake.custom_fake){ \
  2098. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  2099. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2100. return ret; \
  2101. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
  2102. } \
  2103. RETURN_FAKE_RESULT(FUNCNAME) \
  2104. } \
  2105. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2106. #define FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  2107. DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  2108. DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
  2109. #define DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  2110. typedef struct FUNCNAME##_Fake { \
  2111. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2112. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2113. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2114. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2115. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2116. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2117. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2118. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2119. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2120. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2121. DECLARE_ALL_FUNC_COMMON \
  2122. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2123. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2124. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2125. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
  2126. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
  2127. } FUNCNAME##_Fake; \
  2128. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2129. void FUNCNAME##_reset(void); \
  2130. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
  2131. #define DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  2132. FUNCNAME##_Fake FUNCNAME##_fake; \
  2133. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
  2134. SAVE_ARG(FUNCNAME, 0); \
  2135. SAVE_ARG(FUNCNAME, 1); \
  2136. SAVE_ARG(FUNCNAME, 2); \
  2137. SAVE_ARG(FUNCNAME, 3); \
  2138. SAVE_ARG(FUNCNAME, 4); \
  2139. SAVE_ARG(FUNCNAME, 5); \
  2140. SAVE_ARG(FUNCNAME, 6); \
  2141. SAVE_ARG(FUNCNAME, 7); \
  2142. SAVE_ARG(FUNCNAME, 8); \
  2143. SAVE_ARG(FUNCNAME, 9); \
  2144. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2145. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2146. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2147. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2148. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2149. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2150. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2151. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2152. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2153. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2154. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2155. } \
  2156. else{ \
  2157. HISTORY_DROPPED(FUNCNAME); \
  2158. } \
  2159. INCREMENT_CALL_COUNT(FUNCNAME); \
  2160. REGISTER_CALL(FUNCNAME); \
  2161. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2162. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2163. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  2164. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2165. return ret; \
  2166. } \
  2167. else{ \
  2168. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  2169. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2170. return ret; \
  2171. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  2172. } \
  2173. } \
  2174. if (FUNCNAME##_fake.custom_fake){ \
  2175. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  2176. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2177. return ret; \
  2178. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
  2179. } \
  2180. RETURN_FAKE_RESULT(FUNCNAME) \
  2181. } \
  2182. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2183. #define FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  2184. DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  2185. DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
  2186. #define DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  2187. typedef struct FUNCNAME##_Fake { \
  2188. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2189. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2190. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2191. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2192. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2193. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2194. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2195. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2196. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2197. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2198. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2199. DECLARE_ALL_FUNC_COMMON \
  2200. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2201. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2202. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2203. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
  2204. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
  2205. } FUNCNAME##_Fake; \
  2206. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2207. void FUNCNAME##_reset(void); \
  2208. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
  2209. #define DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  2210. FUNCNAME##_Fake FUNCNAME##_fake; \
  2211. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
  2212. SAVE_ARG(FUNCNAME, 0); \
  2213. SAVE_ARG(FUNCNAME, 1); \
  2214. SAVE_ARG(FUNCNAME, 2); \
  2215. SAVE_ARG(FUNCNAME, 3); \
  2216. SAVE_ARG(FUNCNAME, 4); \
  2217. SAVE_ARG(FUNCNAME, 5); \
  2218. SAVE_ARG(FUNCNAME, 6); \
  2219. SAVE_ARG(FUNCNAME, 7); \
  2220. SAVE_ARG(FUNCNAME, 8); \
  2221. SAVE_ARG(FUNCNAME, 9); \
  2222. SAVE_ARG(FUNCNAME, 10); \
  2223. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2224. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2225. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2226. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2227. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2228. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2229. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2230. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2231. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2232. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2233. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2234. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2235. } \
  2236. else{ \
  2237. HISTORY_DROPPED(FUNCNAME); \
  2238. } \
  2239. INCREMENT_CALL_COUNT(FUNCNAME); \
  2240. REGISTER_CALL(FUNCNAME); \
  2241. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2242. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2243. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  2244. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2245. return ret; \
  2246. } \
  2247. else{ \
  2248. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  2249. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2250. return ret; \
  2251. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  2252. } \
  2253. } \
  2254. if (FUNCNAME##_fake.custom_fake){ \
  2255. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  2256. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2257. return ret; \
  2258. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
  2259. } \
  2260. RETURN_FAKE_RESULT(FUNCNAME) \
  2261. } \
  2262. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2263. #define FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  2264. DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  2265. DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
  2266. #define DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  2267. typedef struct FUNCNAME##_Fake { \
  2268. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2269. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2270. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2271. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2272. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2273. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2274. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2275. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2276. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2277. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2278. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2279. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2280. DECLARE_ALL_FUNC_COMMON \
  2281. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2282. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2283. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2284. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
  2285. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
  2286. } FUNCNAME##_Fake; \
  2287. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2288. void FUNCNAME##_reset(void); \
  2289. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
  2290. #define DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  2291. FUNCNAME##_Fake FUNCNAME##_fake; \
  2292. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
  2293. SAVE_ARG(FUNCNAME, 0); \
  2294. SAVE_ARG(FUNCNAME, 1); \
  2295. SAVE_ARG(FUNCNAME, 2); \
  2296. SAVE_ARG(FUNCNAME, 3); \
  2297. SAVE_ARG(FUNCNAME, 4); \
  2298. SAVE_ARG(FUNCNAME, 5); \
  2299. SAVE_ARG(FUNCNAME, 6); \
  2300. SAVE_ARG(FUNCNAME, 7); \
  2301. SAVE_ARG(FUNCNAME, 8); \
  2302. SAVE_ARG(FUNCNAME, 9); \
  2303. SAVE_ARG(FUNCNAME, 10); \
  2304. SAVE_ARG(FUNCNAME, 11); \
  2305. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2306. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2307. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2308. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2309. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2310. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2311. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2312. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2313. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2314. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2315. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2316. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2317. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2318. } \
  2319. else{ \
  2320. HISTORY_DROPPED(FUNCNAME); \
  2321. } \
  2322. INCREMENT_CALL_COUNT(FUNCNAME); \
  2323. REGISTER_CALL(FUNCNAME); \
  2324. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2325. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2326. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  2327. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2328. return ret; \
  2329. } \
  2330. else{ \
  2331. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  2332. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2333. return ret; \
  2334. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  2335. } \
  2336. } \
  2337. if (FUNCNAME##_fake.custom_fake){ \
  2338. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  2339. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2340. return ret; \
  2341. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
  2342. } \
  2343. RETURN_FAKE_RESULT(FUNCNAME) \
  2344. } \
  2345. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2346. #define FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  2347. DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  2348. DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
  2349. #define DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  2350. typedef struct FUNCNAME##_Fake { \
  2351. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2352. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2353. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2354. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2355. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2356. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2357. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2358. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2359. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2360. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2361. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2362. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2363. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  2364. DECLARE_ALL_FUNC_COMMON \
  2365. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2366. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2367. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2368. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
  2369. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
  2370. } FUNCNAME##_Fake; \
  2371. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2372. void FUNCNAME##_reset(void); \
  2373. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
  2374. #define DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  2375. FUNCNAME##_Fake FUNCNAME##_fake; \
  2376. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
  2377. SAVE_ARG(FUNCNAME, 0); \
  2378. SAVE_ARG(FUNCNAME, 1); \
  2379. SAVE_ARG(FUNCNAME, 2); \
  2380. SAVE_ARG(FUNCNAME, 3); \
  2381. SAVE_ARG(FUNCNAME, 4); \
  2382. SAVE_ARG(FUNCNAME, 5); \
  2383. SAVE_ARG(FUNCNAME, 6); \
  2384. SAVE_ARG(FUNCNAME, 7); \
  2385. SAVE_ARG(FUNCNAME, 8); \
  2386. SAVE_ARG(FUNCNAME, 9); \
  2387. SAVE_ARG(FUNCNAME, 10); \
  2388. SAVE_ARG(FUNCNAME, 11); \
  2389. SAVE_ARG(FUNCNAME, 12); \
  2390. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2391. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2392. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2393. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2394. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2395. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2396. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2397. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2398. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2399. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2400. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2401. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2402. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2403. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  2404. } \
  2405. else{ \
  2406. HISTORY_DROPPED(FUNCNAME); \
  2407. } \
  2408. INCREMENT_CALL_COUNT(FUNCNAME); \
  2409. REGISTER_CALL(FUNCNAME); \
  2410. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2411. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2412. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  2413. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2414. return ret; \
  2415. } \
  2416. else{ \
  2417. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  2418. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2419. return ret; \
  2420. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  2421. } \
  2422. } \
  2423. if (FUNCNAME##_fake.custom_fake){ \
  2424. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  2425. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2426. return ret; \
  2427. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
  2428. } \
  2429. RETURN_FAKE_RESULT(FUNCNAME) \
  2430. } \
  2431. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2432. #define FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  2433. DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  2434. DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
  2435. #define DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  2436. typedef struct FUNCNAME##_Fake { \
  2437. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2438. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2439. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2440. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2441. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2442. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2443. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2444. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2445. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2446. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2447. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2448. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2449. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  2450. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  2451. DECLARE_ALL_FUNC_COMMON \
  2452. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2453. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2454. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2455. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
  2456. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
  2457. } FUNCNAME##_Fake; \
  2458. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2459. void FUNCNAME##_reset(void); \
  2460. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
  2461. #define DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  2462. FUNCNAME##_Fake FUNCNAME##_fake; \
  2463. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
  2464. SAVE_ARG(FUNCNAME, 0); \
  2465. SAVE_ARG(FUNCNAME, 1); \
  2466. SAVE_ARG(FUNCNAME, 2); \
  2467. SAVE_ARG(FUNCNAME, 3); \
  2468. SAVE_ARG(FUNCNAME, 4); \
  2469. SAVE_ARG(FUNCNAME, 5); \
  2470. SAVE_ARG(FUNCNAME, 6); \
  2471. SAVE_ARG(FUNCNAME, 7); \
  2472. SAVE_ARG(FUNCNAME, 8); \
  2473. SAVE_ARG(FUNCNAME, 9); \
  2474. SAVE_ARG(FUNCNAME, 10); \
  2475. SAVE_ARG(FUNCNAME, 11); \
  2476. SAVE_ARG(FUNCNAME, 12); \
  2477. SAVE_ARG(FUNCNAME, 13); \
  2478. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2479. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2480. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2481. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2482. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2483. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2484. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2485. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2486. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2487. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2488. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2489. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2490. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2491. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  2492. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  2493. } \
  2494. else{ \
  2495. HISTORY_DROPPED(FUNCNAME); \
  2496. } \
  2497. INCREMENT_CALL_COUNT(FUNCNAME); \
  2498. REGISTER_CALL(FUNCNAME); \
  2499. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2500. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2501. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  2502. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2503. return ret; \
  2504. } \
  2505. else{ \
  2506. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  2507. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2508. return ret; \
  2509. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  2510. } \
  2511. } \
  2512. if (FUNCNAME##_fake.custom_fake){ \
  2513. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  2514. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2515. return ret; \
  2516. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
  2517. } \
  2518. RETURN_FAKE_RESULT(FUNCNAME) \
  2519. } \
  2520. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2521. #define FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  2522. DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  2523. DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
  2524. #define DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  2525. typedef struct FUNCNAME##_Fake { \
  2526. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2527. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2528. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2529. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2530. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2531. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2532. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2533. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2534. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2535. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2536. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2537. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2538. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  2539. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  2540. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  2541. DECLARE_ALL_FUNC_COMMON \
  2542. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2543. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2544. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2545. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
  2546. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
  2547. } FUNCNAME##_Fake; \
  2548. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2549. void FUNCNAME##_reset(void); \
  2550. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
  2551. #define DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  2552. FUNCNAME##_Fake FUNCNAME##_fake; \
  2553. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
  2554. SAVE_ARG(FUNCNAME, 0); \
  2555. SAVE_ARG(FUNCNAME, 1); \
  2556. SAVE_ARG(FUNCNAME, 2); \
  2557. SAVE_ARG(FUNCNAME, 3); \
  2558. SAVE_ARG(FUNCNAME, 4); \
  2559. SAVE_ARG(FUNCNAME, 5); \
  2560. SAVE_ARG(FUNCNAME, 6); \
  2561. SAVE_ARG(FUNCNAME, 7); \
  2562. SAVE_ARG(FUNCNAME, 8); \
  2563. SAVE_ARG(FUNCNAME, 9); \
  2564. SAVE_ARG(FUNCNAME, 10); \
  2565. SAVE_ARG(FUNCNAME, 11); \
  2566. SAVE_ARG(FUNCNAME, 12); \
  2567. SAVE_ARG(FUNCNAME, 13); \
  2568. SAVE_ARG(FUNCNAME, 14); \
  2569. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2570. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2571. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2572. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2573. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2574. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2575. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2576. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2577. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2578. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2579. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2580. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2581. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2582. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  2583. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  2584. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  2585. } \
  2586. else{ \
  2587. HISTORY_DROPPED(FUNCNAME); \
  2588. } \
  2589. INCREMENT_CALL_COUNT(FUNCNAME); \
  2590. REGISTER_CALL(FUNCNAME); \
  2591. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2592. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2593. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  2594. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2595. return ret; \
  2596. } \
  2597. else{ \
  2598. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  2599. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2600. return ret; \
  2601. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  2602. } \
  2603. } \
  2604. if (FUNCNAME##_fake.custom_fake){ \
  2605. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  2606. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2607. return ret; \
  2608. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
  2609. } \
  2610. RETURN_FAKE_RESULT(FUNCNAME) \
  2611. } \
  2612. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2613. #define FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  2614. DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  2615. DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
  2616. #define DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  2617. typedef struct FUNCNAME##_Fake { \
  2618. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2619. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2620. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2621. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2622. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2623. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2624. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2625. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2626. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2627. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2628. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2629. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2630. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  2631. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  2632. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  2633. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  2634. DECLARE_ALL_FUNC_COMMON \
  2635. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2636. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2637. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2638. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
  2639. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
  2640. } FUNCNAME##_Fake; \
  2641. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2642. void FUNCNAME##_reset(void); \
  2643. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
  2644. #define DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  2645. FUNCNAME##_Fake FUNCNAME##_fake; \
  2646. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
  2647. SAVE_ARG(FUNCNAME, 0); \
  2648. SAVE_ARG(FUNCNAME, 1); \
  2649. SAVE_ARG(FUNCNAME, 2); \
  2650. SAVE_ARG(FUNCNAME, 3); \
  2651. SAVE_ARG(FUNCNAME, 4); \
  2652. SAVE_ARG(FUNCNAME, 5); \
  2653. SAVE_ARG(FUNCNAME, 6); \
  2654. SAVE_ARG(FUNCNAME, 7); \
  2655. SAVE_ARG(FUNCNAME, 8); \
  2656. SAVE_ARG(FUNCNAME, 9); \
  2657. SAVE_ARG(FUNCNAME, 10); \
  2658. SAVE_ARG(FUNCNAME, 11); \
  2659. SAVE_ARG(FUNCNAME, 12); \
  2660. SAVE_ARG(FUNCNAME, 13); \
  2661. SAVE_ARG(FUNCNAME, 14); \
  2662. SAVE_ARG(FUNCNAME, 15); \
  2663. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2664. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2665. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2666. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2667. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2668. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2669. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2670. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2671. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2672. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2673. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2674. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2675. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2676. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  2677. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  2678. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  2679. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  2680. } \
  2681. else{ \
  2682. HISTORY_DROPPED(FUNCNAME); \
  2683. } \
  2684. INCREMENT_CALL_COUNT(FUNCNAME); \
  2685. REGISTER_CALL(FUNCNAME); \
  2686. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2687. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2688. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  2689. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2690. return ret; \
  2691. } \
  2692. else{ \
  2693. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  2694. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2695. return ret; \
  2696. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  2697. } \
  2698. } \
  2699. if (FUNCNAME##_fake.custom_fake){ \
  2700. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  2701. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2702. return ret; \
  2703. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
  2704. } \
  2705. RETURN_FAKE_RESULT(FUNCNAME) \
  2706. } \
  2707. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2708. #define FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  2709. DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  2710. DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
  2711. #define DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  2712. typedef struct FUNCNAME##_Fake { \
  2713. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2714. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2715. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2716. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2717. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2718. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2719. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2720. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2721. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2722. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2723. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2724. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2725. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  2726. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  2727. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  2728. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  2729. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  2730. DECLARE_ALL_FUNC_COMMON \
  2731. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2732. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2733. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2734. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
  2735. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
  2736. } FUNCNAME##_Fake; \
  2737. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2738. void FUNCNAME##_reset(void); \
  2739. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
  2740. #define DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  2741. FUNCNAME##_Fake FUNCNAME##_fake; \
  2742. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
  2743. SAVE_ARG(FUNCNAME, 0); \
  2744. SAVE_ARG(FUNCNAME, 1); \
  2745. SAVE_ARG(FUNCNAME, 2); \
  2746. SAVE_ARG(FUNCNAME, 3); \
  2747. SAVE_ARG(FUNCNAME, 4); \
  2748. SAVE_ARG(FUNCNAME, 5); \
  2749. SAVE_ARG(FUNCNAME, 6); \
  2750. SAVE_ARG(FUNCNAME, 7); \
  2751. SAVE_ARG(FUNCNAME, 8); \
  2752. SAVE_ARG(FUNCNAME, 9); \
  2753. SAVE_ARG(FUNCNAME, 10); \
  2754. SAVE_ARG(FUNCNAME, 11); \
  2755. SAVE_ARG(FUNCNAME, 12); \
  2756. SAVE_ARG(FUNCNAME, 13); \
  2757. SAVE_ARG(FUNCNAME, 14); \
  2758. SAVE_ARG(FUNCNAME, 15); \
  2759. SAVE_ARG(FUNCNAME, 16); \
  2760. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2761. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2762. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2763. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2764. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2765. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2766. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2767. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2768. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2769. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2770. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2771. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2772. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2773. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  2774. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  2775. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  2776. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  2777. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  2778. } \
  2779. else{ \
  2780. HISTORY_DROPPED(FUNCNAME); \
  2781. } \
  2782. INCREMENT_CALL_COUNT(FUNCNAME); \
  2783. REGISTER_CALL(FUNCNAME); \
  2784. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2785. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2786. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  2787. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2788. return ret; \
  2789. } \
  2790. else{ \
  2791. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  2792. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2793. return ret; \
  2794. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  2795. } \
  2796. } \
  2797. if (FUNCNAME##_fake.custom_fake){ \
  2798. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  2799. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2800. return ret; \
  2801. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
  2802. } \
  2803. RETURN_FAKE_RESULT(FUNCNAME) \
  2804. } \
  2805. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2806. #define FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  2807. DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  2808. DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
  2809. #define DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  2810. typedef struct FUNCNAME##_Fake { \
  2811. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2812. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2813. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2814. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2815. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2816. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2817. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2818. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2819. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2820. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2821. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2822. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2823. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  2824. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  2825. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  2826. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  2827. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  2828. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  2829. DECLARE_ALL_FUNC_COMMON \
  2830. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2831. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2832. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2833. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
  2834. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
  2835. } FUNCNAME##_Fake; \
  2836. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2837. void FUNCNAME##_reset(void); \
  2838. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
  2839. #define DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  2840. FUNCNAME##_Fake FUNCNAME##_fake; \
  2841. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
  2842. SAVE_ARG(FUNCNAME, 0); \
  2843. SAVE_ARG(FUNCNAME, 1); \
  2844. SAVE_ARG(FUNCNAME, 2); \
  2845. SAVE_ARG(FUNCNAME, 3); \
  2846. SAVE_ARG(FUNCNAME, 4); \
  2847. SAVE_ARG(FUNCNAME, 5); \
  2848. SAVE_ARG(FUNCNAME, 6); \
  2849. SAVE_ARG(FUNCNAME, 7); \
  2850. SAVE_ARG(FUNCNAME, 8); \
  2851. SAVE_ARG(FUNCNAME, 9); \
  2852. SAVE_ARG(FUNCNAME, 10); \
  2853. SAVE_ARG(FUNCNAME, 11); \
  2854. SAVE_ARG(FUNCNAME, 12); \
  2855. SAVE_ARG(FUNCNAME, 13); \
  2856. SAVE_ARG(FUNCNAME, 14); \
  2857. SAVE_ARG(FUNCNAME, 15); \
  2858. SAVE_ARG(FUNCNAME, 16); \
  2859. SAVE_ARG(FUNCNAME, 17); \
  2860. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2861. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2862. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2863. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2864. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2865. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2866. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2867. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2868. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2869. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2870. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2871. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2872. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2873. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  2874. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  2875. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  2876. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  2877. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  2878. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  2879. } \
  2880. else{ \
  2881. HISTORY_DROPPED(FUNCNAME); \
  2882. } \
  2883. INCREMENT_CALL_COUNT(FUNCNAME); \
  2884. REGISTER_CALL(FUNCNAME); \
  2885. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2886. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2887. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  2888. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2889. return ret; \
  2890. } \
  2891. else{ \
  2892. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  2893. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2894. return ret; \
  2895. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  2896. } \
  2897. } \
  2898. if (FUNCNAME##_fake.custom_fake){ \
  2899. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  2900. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2901. return ret; \
  2902. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
  2903. } \
  2904. RETURN_FAKE_RESULT(FUNCNAME) \
  2905. } \
  2906. DEFINE_RESET_FUNCTION(FUNCNAME) \
  2907. #define FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  2908. DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  2909. DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
  2910. #define DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  2911. typedef struct FUNCNAME##_Fake { \
  2912. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  2913. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  2914. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  2915. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  2916. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  2917. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  2918. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  2919. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  2920. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  2921. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  2922. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  2923. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  2924. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  2925. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  2926. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  2927. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  2928. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  2929. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  2930. DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
  2931. DECLARE_ALL_FUNC_COMMON \
  2932. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  2933. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  2934. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  2935. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
  2936. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
  2937. } FUNCNAME##_Fake; \
  2938. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  2939. void FUNCNAME##_reset(void); \
  2940. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
  2941. #define DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  2942. FUNCNAME##_Fake FUNCNAME##_fake; \
  2943. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
  2944. SAVE_ARG(FUNCNAME, 0); \
  2945. SAVE_ARG(FUNCNAME, 1); \
  2946. SAVE_ARG(FUNCNAME, 2); \
  2947. SAVE_ARG(FUNCNAME, 3); \
  2948. SAVE_ARG(FUNCNAME, 4); \
  2949. SAVE_ARG(FUNCNAME, 5); \
  2950. SAVE_ARG(FUNCNAME, 6); \
  2951. SAVE_ARG(FUNCNAME, 7); \
  2952. SAVE_ARG(FUNCNAME, 8); \
  2953. SAVE_ARG(FUNCNAME, 9); \
  2954. SAVE_ARG(FUNCNAME, 10); \
  2955. SAVE_ARG(FUNCNAME, 11); \
  2956. SAVE_ARG(FUNCNAME, 12); \
  2957. SAVE_ARG(FUNCNAME, 13); \
  2958. SAVE_ARG(FUNCNAME, 14); \
  2959. SAVE_ARG(FUNCNAME, 15); \
  2960. SAVE_ARG(FUNCNAME, 16); \
  2961. SAVE_ARG(FUNCNAME, 17); \
  2962. SAVE_ARG(FUNCNAME, 18); \
  2963. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  2964. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  2965. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  2966. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  2967. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  2968. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  2969. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  2970. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  2971. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  2972. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  2973. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  2974. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  2975. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  2976. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  2977. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  2978. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  2979. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  2980. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  2981. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  2982. SAVE_ARG_HISTORY(FUNCNAME, 18); \
  2983. } \
  2984. else{ \
  2985. HISTORY_DROPPED(FUNCNAME); \
  2986. } \
  2987. INCREMENT_CALL_COUNT(FUNCNAME); \
  2988. REGISTER_CALL(FUNCNAME); \
  2989. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  2990. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  2991. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  2992. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2993. return ret; \
  2994. } \
  2995. else{ \
  2996. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  2997. SAVE_RET_HISTORY(FUNCNAME, ret); \
  2998. return ret; \
  2999. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  3000. } \
  3001. } \
  3002. if (FUNCNAME##_fake.custom_fake){ \
  3003. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  3004. SAVE_RET_HISTORY(FUNCNAME, ret); \
  3005. return ret; \
  3006. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
  3007. } \
  3008. RETURN_FAKE_RESULT(FUNCNAME) \
  3009. } \
  3010. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3011. #define FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  3012. DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  3013. DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
  3014. #define DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  3015. typedef struct FUNCNAME##_Fake { \
  3016. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3017. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3018. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3019. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3020. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3021. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3022. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3023. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3024. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  3025. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  3026. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  3027. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  3028. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  3029. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  3030. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  3031. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  3032. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  3033. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  3034. DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
  3035. DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
  3036. DECLARE_ALL_FUNC_COMMON \
  3037. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  3038. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  3039. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3040. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
  3041. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
  3042. } FUNCNAME##_Fake; \
  3043. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3044. void FUNCNAME##_reset(void); \
  3045. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
  3046. #define DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  3047. FUNCNAME##_Fake FUNCNAME##_fake; \
  3048. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
  3049. SAVE_ARG(FUNCNAME, 0); \
  3050. SAVE_ARG(FUNCNAME, 1); \
  3051. SAVE_ARG(FUNCNAME, 2); \
  3052. SAVE_ARG(FUNCNAME, 3); \
  3053. SAVE_ARG(FUNCNAME, 4); \
  3054. SAVE_ARG(FUNCNAME, 5); \
  3055. SAVE_ARG(FUNCNAME, 6); \
  3056. SAVE_ARG(FUNCNAME, 7); \
  3057. SAVE_ARG(FUNCNAME, 8); \
  3058. SAVE_ARG(FUNCNAME, 9); \
  3059. SAVE_ARG(FUNCNAME, 10); \
  3060. SAVE_ARG(FUNCNAME, 11); \
  3061. SAVE_ARG(FUNCNAME, 12); \
  3062. SAVE_ARG(FUNCNAME, 13); \
  3063. SAVE_ARG(FUNCNAME, 14); \
  3064. SAVE_ARG(FUNCNAME, 15); \
  3065. SAVE_ARG(FUNCNAME, 16); \
  3066. SAVE_ARG(FUNCNAME, 17); \
  3067. SAVE_ARG(FUNCNAME, 18); \
  3068. SAVE_ARG(FUNCNAME, 19); \
  3069. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3070. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3071. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3072. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3073. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3074. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3075. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3076. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3077. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  3078. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  3079. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  3080. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  3081. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  3082. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  3083. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  3084. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  3085. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  3086. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  3087. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  3088. SAVE_ARG_HISTORY(FUNCNAME, 18); \
  3089. SAVE_ARG_HISTORY(FUNCNAME, 19); \
  3090. } \
  3091. else{ \
  3092. HISTORY_DROPPED(FUNCNAME); \
  3093. } \
  3094. INCREMENT_CALL_COUNT(FUNCNAME); \
  3095. REGISTER_CALL(FUNCNAME); \
  3096. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3097. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3098. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  3099. SAVE_RET_HISTORY(FUNCNAME, ret); \
  3100. return ret; \
  3101. } \
  3102. else{ \
  3103. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  3104. SAVE_RET_HISTORY(FUNCNAME, ret); \
  3105. return ret; \
  3106. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  3107. } \
  3108. } \
  3109. if (FUNCNAME##_fake.custom_fake){ \
  3110. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  3111. SAVE_RET_HISTORY(FUNCNAME, ret); \
  3112. return ret; \
  3113. return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
  3114. } \
  3115. RETURN_FAKE_RESULT(FUNCNAME) \
  3116. } \
  3117. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3118. #define FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  3119. DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  3120. DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
  3121. #define DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
  3122. typedef struct FUNCNAME##_Fake { \
  3123. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3124. DECLARE_ALL_FUNC_COMMON \
  3125. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3126. void(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
  3127. void(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
  3128. } FUNCNAME##_Fake; \
  3129. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3130. void FUNCNAME##_reset(void); \
  3131. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...); \
  3132. #define DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
  3133. FUNCNAME##_Fake FUNCNAME##_fake; \
  3134. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...){ \
  3135. SAVE_ARG(FUNCNAME, 0); \
  3136. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3137. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3138. } \
  3139. else{ \
  3140. HISTORY_DROPPED(FUNCNAME); \
  3141. } \
  3142. INCREMENT_CALL_COUNT(FUNCNAME); \
  3143. REGISTER_CALL(FUNCNAME); \
  3144. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3145. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3146. va_list ap; \
  3147. va_start(ap, arg0); \
  3148. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
  3149. va_end(ap); \
  3150. } \
  3151. else{ \
  3152. va_list ap; \
  3153. va_start(ap, arg0); \
  3154. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
  3155. va_end(ap); \
  3156. } \
  3157. } \
  3158. if(FUNCNAME##_fake.custom_fake){ \
  3159. va_list ap; \
  3160. va_start(ap, arg0); \
  3161. FUNCNAME##_fake.custom_fake(arg0, ap); \
  3162. va_end(ap); \
  3163. } \
  3164. } \
  3165. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3166. #define FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
  3167. DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
  3168. DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
  3169. #define DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  3170. typedef struct FUNCNAME##_Fake { \
  3171. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3172. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3173. DECLARE_ALL_FUNC_COMMON \
  3174. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3175. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
  3176. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
  3177. } FUNCNAME##_Fake; \
  3178. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3179. void FUNCNAME##_reset(void); \
  3180. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
  3181. #define DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  3182. FUNCNAME##_Fake FUNCNAME##_fake; \
  3183. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
  3184. SAVE_ARG(FUNCNAME, 0); \
  3185. SAVE_ARG(FUNCNAME, 1); \
  3186. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3187. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3188. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3189. } \
  3190. else{ \
  3191. HISTORY_DROPPED(FUNCNAME); \
  3192. } \
  3193. INCREMENT_CALL_COUNT(FUNCNAME); \
  3194. REGISTER_CALL(FUNCNAME); \
  3195. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3196. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3197. va_list ap; \
  3198. va_start(ap, arg1); \
  3199. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
  3200. va_end(ap); \
  3201. } \
  3202. else{ \
  3203. va_list ap; \
  3204. va_start(ap, arg1); \
  3205. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
  3206. va_end(ap); \
  3207. } \
  3208. } \
  3209. if(FUNCNAME##_fake.custom_fake){ \
  3210. va_list ap; \
  3211. va_start(ap, arg1); \
  3212. FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
  3213. va_end(ap); \
  3214. } \
  3215. } \
  3216. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3217. #define FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  3218. DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  3219. DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  3220. #define DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  3221. typedef struct FUNCNAME##_Fake { \
  3222. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3223. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3224. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3225. DECLARE_ALL_FUNC_COMMON \
  3226. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3227. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
  3228. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
  3229. } FUNCNAME##_Fake; \
  3230. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3231. void FUNCNAME##_reset(void); \
  3232. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
  3233. #define DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  3234. FUNCNAME##_Fake FUNCNAME##_fake; \
  3235. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
  3236. SAVE_ARG(FUNCNAME, 0); \
  3237. SAVE_ARG(FUNCNAME, 1); \
  3238. SAVE_ARG(FUNCNAME, 2); \
  3239. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3240. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3241. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3242. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3243. } \
  3244. else{ \
  3245. HISTORY_DROPPED(FUNCNAME); \
  3246. } \
  3247. INCREMENT_CALL_COUNT(FUNCNAME); \
  3248. REGISTER_CALL(FUNCNAME); \
  3249. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3250. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3251. va_list ap; \
  3252. va_start(ap, arg2); \
  3253. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
  3254. va_end(ap); \
  3255. } \
  3256. else{ \
  3257. va_list ap; \
  3258. va_start(ap, arg2); \
  3259. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
  3260. va_end(ap); \
  3261. } \
  3262. } \
  3263. if(FUNCNAME##_fake.custom_fake){ \
  3264. va_list ap; \
  3265. va_start(ap, arg2); \
  3266. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
  3267. va_end(ap); \
  3268. } \
  3269. } \
  3270. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3271. #define FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  3272. DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  3273. DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  3274. #define DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  3275. typedef struct FUNCNAME##_Fake { \
  3276. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3277. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3278. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3279. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3280. DECLARE_ALL_FUNC_COMMON \
  3281. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3282. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
  3283. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
  3284. } FUNCNAME##_Fake; \
  3285. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3286. void FUNCNAME##_reset(void); \
  3287. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
  3288. #define DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  3289. FUNCNAME##_Fake FUNCNAME##_fake; \
  3290. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
  3291. SAVE_ARG(FUNCNAME, 0); \
  3292. SAVE_ARG(FUNCNAME, 1); \
  3293. SAVE_ARG(FUNCNAME, 2); \
  3294. SAVE_ARG(FUNCNAME, 3); \
  3295. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3296. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3297. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3298. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3299. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3300. } \
  3301. else{ \
  3302. HISTORY_DROPPED(FUNCNAME); \
  3303. } \
  3304. INCREMENT_CALL_COUNT(FUNCNAME); \
  3305. REGISTER_CALL(FUNCNAME); \
  3306. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3307. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3308. va_list ap; \
  3309. va_start(ap, arg3); \
  3310. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
  3311. va_end(ap); \
  3312. } \
  3313. else{ \
  3314. va_list ap; \
  3315. va_start(ap, arg3); \
  3316. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
  3317. va_end(ap); \
  3318. } \
  3319. } \
  3320. if(FUNCNAME##_fake.custom_fake){ \
  3321. va_list ap; \
  3322. va_start(ap, arg3); \
  3323. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
  3324. va_end(ap); \
  3325. } \
  3326. } \
  3327. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3328. #define FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  3329. DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  3330. DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  3331. #define DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  3332. typedef struct FUNCNAME##_Fake { \
  3333. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3334. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3335. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3336. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3337. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3338. DECLARE_ALL_FUNC_COMMON \
  3339. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3340. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
  3341. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
  3342. } FUNCNAME##_Fake; \
  3343. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3344. void FUNCNAME##_reset(void); \
  3345. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
  3346. #define DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  3347. FUNCNAME##_Fake FUNCNAME##_fake; \
  3348. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
  3349. SAVE_ARG(FUNCNAME, 0); \
  3350. SAVE_ARG(FUNCNAME, 1); \
  3351. SAVE_ARG(FUNCNAME, 2); \
  3352. SAVE_ARG(FUNCNAME, 3); \
  3353. SAVE_ARG(FUNCNAME, 4); \
  3354. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3355. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3356. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3357. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3358. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3359. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3360. } \
  3361. else{ \
  3362. HISTORY_DROPPED(FUNCNAME); \
  3363. } \
  3364. INCREMENT_CALL_COUNT(FUNCNAME); \
  3365. REGISTER_CALL(FUNCNAME); \
  3366. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3367. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3368. va_list ap; \
  3369. va_start(ap, arg4); \
  3370. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
  3371. va_end(ap); \
  3372. } \
  3373. else{ \
  3374. va_list ap; \
  3375. va_start(ap, arg4); \
  3376. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
  3377. va_end(ap); \
  3378. } \
  3379. } \
  3380. if(FUNCNAME##_fake.custom_fake){ \
  3381. va_list ap; \
  3382. va_start(ap, arg4); \
  3383. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
  3384. va_end(ap); \
  3385. } \
  3386. } \
  3387. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3388. #define FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  3389. DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  3390. DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  3391. #define DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  3392. typedef struct FUNCNAME##_Fake { \
  3393. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3394. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3395. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3396. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3397. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3398. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3399. DECLARE_ALL_FUNC_COMMON \
  3400. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3401. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
  3402. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
  3403. } FUNCNAME##_Fake; \
  3404. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3405. void FUNCNAME##_reset(void); \
  3406. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
  3407. #define DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  3408. FUNCNAME##_Fake FUNCNAME##_fake; \
  3409. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
  3410. SAVE_ARG(FUNCNAME, 0); \
  3411. SAVE_ARG(FUNCNAME, 1); \
  3412. SAVE_ARG(FUNCNAME, 2); \
  3413. SAVE_ARG(FUNCNAME, 3); \
  3414. SAVE_ARG(FUNCNAME, 4); \
  3415. SAVE_ARG(FUNCNAME, 5); \
  3416. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3417. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3418. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3419. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3420. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3421. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3422. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3423. } \
  3424. else{ \
  3425. HISTORY_DROPPED(FUNCNAME); \
  3426. } \
  3427. INCREMENT_CALL_COUNT(FUNCNAME); \
  3428. REGISTER_CALL(FUNCNAME); \
  3429. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3430. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3431. va_list ap; \
  3432. va_start(ap, arg5); \
  3433. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
  3434. va_end(ap); \
  3435. } \
  3436. else{ \
  3437. va_list ap; \
  3438. va_start(ap, arg5); \
  3439. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
  3440. va_end(ap); \
  3441. } \
  3442. } \
  3443. if(FUNCNAME##_fake.custom_fake){ \
  3444. va_list ap; \
  3445. va_start(ap, arg5); \
  3446. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
  3447. va_end(ap); \
  3448. } \
  3449. } \
  3450. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3451. #define FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  3452. DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  3453. DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  3454. #define DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  3455. typedef struct FUNCNAME##_Fake { \
  3456. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3457. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3458. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3459. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3460. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3461. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3462. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3463. DECLARE_ALL_FUNC_COMMON \
  3464. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3465. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
  3466. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
  3467. } FUNCNAME##_Fake; \
  3468. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3469. void FUNCNAME##_reset(void); \
  3470. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
  3471. #define DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  3472. FUNCNAME##_Fake FUNCNAME##_fake; \
  3473. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
  3474. SAVE_ARG(FUNCNAME, 0); \
  3475. SAVE_ARG(FUNCNAME, 1); \
  3476. SAVE_ARG(FUNCNAME, 2); \
  3477. SAVE_ARG(FUNCNAME, 3); \
  3478. SAVE_ARG(FUNCNAME, 4); \
  3479. SAVE_ARG(FUNCNAME, 5); \
  3480. SAVE_ARG(FUNCNAME, 6); \
  3481. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3482. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3483. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3484. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3485. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3486. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3487. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3488. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3489. } \
  3490. else{ \
  3491. HISTORY_DROPPED(FUNCNAME); \
  3492. } \
  3493. INCREMENT_CALL_COUNT(FUNCNAME); \
  3494. REGISTER_CALL(FUNCNAME); \
  3495. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3496. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3497. va_list ap; \
  3498. va_start(ap, arg6); \
  3499. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
  3500. va_end(ap); \
  3501. } \
  3502. else{ \
  3503. va_list ap; \
  3504. va_start(ap, arg6); \
  3505. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
  3506. va_end(ap); \
  3507. } \
  3508. } \
  3509. if(FUNCNAME##_fake.custom_fake){ \
  3510. va_list ap; \
  3511. va_start(ap, arg6); \
  3512. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
  3513. va_end(ap); \
  3514. } \
  3515. } \
  3516. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3517. #define FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  3518. DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  3519. DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  3520. #define DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  3521. typedef struct FUNCNAME##_Fake { \
  3522. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3523. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3524. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3525. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3526. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3527. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3528. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3529. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3530. DECLARE_ALL_FUNC_COMMON \
  3531. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3532. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
  3533. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
  3534. } FUNCNAME##_Fake; \
  3535. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3536. void FUNCNAME##_reset(void); \
  3537. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
  3538. #define DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  3539. FUNCNAME##_Fake FUNCNAME##_fake; \
  3540. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
  3541. SAVE_ARG(FUNCNAME, 0); \
  3542. SAVE_ARG(FUNCNAME, 1); \
  3543. SAVE_ARG(FUNCNAME, 2); \
  3544. SAVE_ARG(FUNCNAME, 3); \
  3545. SAVE_ARG(FUNCNAME, 4); \
  3546. SAVE_ARG(FUNCNAME, 5); \
  3547. SAVE_ARG(FUNCNAME, 6); \
  3548. SAVE_ARG(FUNCNAME, 7); \
  3549. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3550. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3551. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3552. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3553. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3554. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3555. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3556. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3557. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  3558. } \
  3559. else{ \
  3560. HISTORY_DROPPED(FUNCNAME); \
  3561. } \
  3562. INCREMENT_CALL_COUNT(FUNCNAME); \
  3563. REGISTER_CALL(FUNCNAME); \
  3564. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3565. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3566. va_list ap; \
  3567. va_start(ap, arg7); \
  3568. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
  3569. va_end(ap); \
  3570. } \
  3571. else{ \
  3572. va_list ap; \
  3573. va_start(ap, arg7); \
  3574. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
  3575. va_end(ap); \
  3576. } \
  3577. } \
  3578. if(FUNCNAME##_fake.custom_fake){ \
  3579. va_list ap; \
  3580. va_start(ap, arg7); \
  3581. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
  3582. va_end(ap); \
  3583. } \
  3584. } \
  3585. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3586. #define FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  3587. DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  3588. DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  3589. #define DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  3590. typedef struct FUNCNAME##_Fake { \
  3591. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3592. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3593. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3594. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3595. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3596. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3597. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3598. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3599. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  3600. DECLARE_ALL_FUNC_COMMON \
  3601. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3602. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
  3603. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
  3604. } FUNCNAME##_Fake; \
  3605. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3606. void FUNCNAME##_reset(void); \
  3607. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
  3608. #define DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  3609. FUNCNAME##_Fake FUNCNAME##_fake; \
  3610. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
  3611. SAVE_ARG(FUNCNAME, 0); \
  3612. SAVE_ARG(FUNCNAME, 1); \
  3613. SAVE_ARG(FUNCNAME, 2); \
  3614. SAVE_ARG(FUNCNAME, 3); \
  3615. SAVE_ARG(FUNCNAME, 4); \
  3616. SAVE_ARG(FUNCNAME, 5); \
  3617. SAVE_ARG(FUNCNAME, 6); \
  3618. SAVE_ARG(FUNCNAME, 7); \
  3619. SAVE_ARG(FUNCNAME, 8); \
  3620. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3621. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3622. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3623. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3624. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3625. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3626. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3627. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3628. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  3629. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  3630. } \
  3631. else{ \
  3632. HISTORY_DROPPED(FUNCNAME); \
  3633. } \
  3634. INCREMENT_CALL_COUNT(FUNCNAME); \
  3635. REGISTER_CALL(FUNCNAME); \
  3636. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3637. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3638. va_list ap; \
  3639. va_start(ap, arg8); \
  3640. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
  3641. va_end(ap); \
  3642. } \
  3643. else{ \
  3644. va_list ap; \
  3645. va_start(ap, arg8); \
  3646. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
  3647. va_end(ap); \
  3648. } \
  3649. } \
  3650. if(FUNCNAME##_fake.custom_fake){ \
  3651. va_list ap; \
  3652. va_start(ap, arg8); \
  3653. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
  3654. va_end(ap); \
  3655. } \
  3656. } \
  3657. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3658. #define FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  3659. DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  3660. DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  3661. #define DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  3662. typedef struct FUNCNAME##_Fake { \
  3663. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3664. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3665. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3666. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3667. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3668. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3669. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3670. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3671. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  3672. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  3673. DECLARE_ALL_FUNC_COMMON \
  3674. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3675. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
  3676. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
  3677. } FUNCNAME##_Fake; \
  3678. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3679. void FUNCNAME##_reset(void); \
  3680. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
  3681. #define DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  3682. FUNCNAME##_Fake FUNCNAME##_fake; \
  3683. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
  3684. SAVE_ARG(FUNCNAME, 0); \
  3685. SAVE_ARG(FUNCNAME, 1); \
  3686. SAVE_ARG(FUNCNAME, 2); \
  3687. SAVE_ARG(FUNCNAME, 3); \
  3688. SAVE_ARG(FUNCNAME, 4); \
  3689. SAVE_ARG(FUNCNAME, 5); \
  3690. SAVE_ARG(FUNCNAME, 6); \
  3691. SAVE_ARG(FUNCNAME, 7); \
  3692. SAVE_ARG(FUNCNAME, 8); \
  3693. SAVE_ARG(FUNCNAME, 9); \
  3694. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3695. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3696. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3697. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3698. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3699. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3700. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3701. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3702. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  3703. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  3704. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  3705. } \
  3706. else{ \
  3707. HISTORY_DROPPED(FUNCNAME); \
  3708. } \
  3709. INCREMENT_CALL_COUNT(FUNCNAME); \
  3710. REGISTER_CALL(FUNCNAME); \
  3711. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3712. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3713. va_list ap; \
  3714. va_start(ap, arg9); \
  3715. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
  3716. va_end(ap); \
  3717. } \
  3718. else{ \
  3719. va_list ap; \
  3720. va_start(ap, arg9); \
  3721. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
  3722. va_end(ap); \
  3723. } \
  3724. } \
  3725. if(FUNCNAME##_fake.custom_fake){ \
  3726. va_list ap; \
  3727. va_start(ap, arg9); \
  3728. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
  3729. va_end(ap); \
  3730. } \
  3731. } \
  3732. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3733. #define FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  3734. DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  3735. DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  3736. #define DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  3737. typedef struct FUNCNAME##_Fake { \
  3738. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3739. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3740. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3741. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3742. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3743. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3744. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3745. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3746. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  3747. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  3748. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  3749. DECLARE_ALL_FUNC_COMMON \
  3750. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3751. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
  3752. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
  3753. } FUNCNAME##_Fake; \
  3754. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3755. void FUNCNAME##_reset(void); \
  3756. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
  3757. #define DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  3758. FUNCNAME##_Fake FUNCNAME##_fake; \
  3759. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
  3760. SAVE_ARG(FUNCNAME, 0); \
  3761. SAVE_ARG(FUNCNAME, 1); \
  3762. SAVE_ARG(FUNCNAME, 2); \
  3763. SAVE_ARG(FUNCNAME, 3); \
  3764. SAVE_ARG(FUNCNAME, 4); \
  3765. SAVE_ARG(FUNCNAME, 5); \
  3766. SAVE_ARG(FUNCNAME, 6); \
  3767. SAVE_ARG(FUNCNAME, 7); \
  3768. SAVE_ARG(FUNCNAME, 8); \
  3769. SAVE_ARG(FUNCNAME, 9); \
  3770. SAVE_ARG(FUNCNAME, 10); \
  3771. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3772. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3773. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3774. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3775. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3776. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3777. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3778. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3779. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  3780. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  3781. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  3782. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  3783. } \
  3784. else{ \
  3785. HISTORY_DROPPED(FUNCNAME); \
  3786. } \
  3787. INCREMENT_CALL_COUNT(FUNCNAME); \
  3788. REGISTER_CALL(FUNCNAME); \
  3789. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3790. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3791. va_list ap; \
  3792. va_start(ap, arg10); \
  3793. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
  3794. va_end(ap); \
  3795. } \
  3796. else{ \
  3797. va_list ap; \
  3798. va_start(ap, arg10); \
  3799. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
  3800. va_end(ap); \
  3801. } \
  3802. } \
  3803. if(FUNCNAME##_fake.custom_fake){ \
  3804. va_list ap; \
  3805. va_start(ap, arg10); \
  3806. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
  3807. va_end(ap); \
  3808. } \
  3809. } \
  3810. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3811. #define FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  3812. DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  3813. DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  3814. #define DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  3815. typedef struct FUNCNAME##_Fake { \
  3816. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3817. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3818. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3819. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3820. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3821. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3822. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3823. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3824. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  3825. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  3826. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  3827. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  3828. DECLARE_ALL_FUNC_COMMON \
  3829. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3830. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
  3831. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
  3832. } FUNCNAME##_Fake; \
  3833. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3834. void FUNCNAME##_reset(void); \
  3835. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
  3836. #define DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  3837. FUNCNAME##_Fake FUNCNAME##_fake; \
  3838. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
  3839. SAVE_ARG(FUNCNAME, 0); \
  3840. SAVE_ARG(FUNCNAME, 1); \
  3841. SAVE_ARG(FUNCNAME, 2); \
  3842. SAVE_ARG(FUNCNAME, 3); \
  3843. SAVE_ARG(FUNCNAME, 4); \
  3844. SAVE_ARG(FUNCNAME, 5); \
  3845. SAVE_ARG(FUNCNAME, 6); \
  3846. SAVE_ARG(FUNCNAME, 7); \
  3847. SAVE_ARG(FUNCNAME, 8); \
  3848. SAVE_ARG(FUNCNAME, 9); \
  3849. SAVE_ARG(FUNCNAME, 10); \
  3850. SAVE_ARG(FUNCNAME, 11); \
  3851. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3852. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3853. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3854. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3855. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3856. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3857. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3858. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3859. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  3860. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  3861. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  3862. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  3863. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  3864. } \
  3865. else{ \
  3866. HISTORY_DROPPED(FUNCNAME); \
  3867. } \
  3868. INCREMENT_CALL_COUNT(FUNCNAME); \
  3869. REGISTER_CALL(FUNCNAME); \
  3870. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3871. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3872. va_list ap; \
  3873. va_start(ap, arg11); \
  3874. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
  3875. va_end(ap); \
  3876. } \
  3877. else{ \
  3878. va_list ap; \
  3879. va_start(ap, arg11); \
  3880. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
  3881. va_end(ap); \
  3882. } \
  3883. } \
  3884. if(FUNCNAME##_fake.custom_fake){ \
  3885. va_list ap; \
  3886. va_start(ap, arg11); \
  3887. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
  3888. va_end(ap); \
  3889. } \
  3890. } \
  3891. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3892. #define FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  3893. DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  3894. DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  3895. #define DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  3896. typedef struct FUNCNAME##_Fake { \
  3897. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3898. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3899. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3900. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3901. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3902. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3903. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3904. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3905. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  3906. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  3907. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  3908. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  3909. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  3910. DECLARE_ALL_FUNC_COMMON \
  3911. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3912. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
  3913. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
  3914. } FUNCNAME##_Fake; \
  3915. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  3916. void FUNCNAME##_reset(void); \
  3917. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
  3918. #define DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  3919. FUNCNAME##_Fake FUNCNAME##_fake; \
  3920. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
  3921. SAVE_ARG(FUNCNAME, 0); \
  3922. SAVE_ARG(FUNCNAME, 1); \
  3923. SAVE_ARG(FUNCNAME, 2); \
  3924. SAVE_ARG(FUNCNAME, 3); \
  3925. SAVE_ARG(FUNCNAME, 4); \
  3926. SAVE_ARG(FUNCNAME, 5); \
  3927. SAVE_ARG(FUNCNAME, 6); \
  3928. SAVE_ARG(FUNCNAME, 7); \
  3929. SAVE_ARG(FUNCNAME, 8); \
  3930. SAVE_ARG(FUNCNAME, 9); \
  3931. SAVE_ARG(FUNCNAME, 10); \
  3932. SAVE_ARG(FUNCNAME, 11); \
  3933. SAVE_ARG(FUNCNAME, 12); \
  3934. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  3935. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  3936. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  3937. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  3938. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  3939. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  3940. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  3941. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  3942. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  3943. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  3944. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  3945. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  3946. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  3947. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  3948. } \
  3949. else{ \
  3950. HISTORY_DROPPED(FUNCNAME); \
  3951. } \
  3952. INCREMENT_CALL_COUNT(FUNCNAME); \
  3953. REGISTER_CALL(FUNCNAME); \
  3954. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  3955. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  3956. va_list ap; \
  3957. va_start(ap, arg12); \
  3958. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
  3959. va_end(ap); \
  3960. } \
  3961. else{ \
  3962. va_list ap; \
  3963. va_start(ap, arg12); \
  3964. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
  3965. va_end(ap); \
  3966. } \
  3967. } \
  3968. if(FUNCNAME##_fake.custom_fake){ \
  3969. va_list ap; \
  3970. va_start(ap, arg12); \
  3971. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
  3972. va_end(ap); \
  3973. } \
  3974. } \
  3975. DEFINE_RESET_FUNCTION(FUNCNAME) \
  3976. #define FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  3977. DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  3978. DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  3979. #define DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  3980. typedef struct FUNCNAME##_Fake { \
  3981. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  3982. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  3983. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  3984. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  3985. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  3986. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  3987. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  3988. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  3989. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  3990. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  3991. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  3992. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  3993. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  3994. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  3995. DECLARE_ALL_FUNC_COMMON \
  3996. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  3997. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
  3998. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
  3999. } FUNCNAME##_Fake; \
  4000. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4001. void FUNCNAME##_reset(void); \
  4002. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
  4003. #define DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  4004. FUNCNAME##_Fake FUNCNAME##_fake; \
  4005. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
  4006. SAVE_ARG(FUNCNAME, 0); \
  4007. SAVE_ARG(FUNCNAME, 1); \
  4008. SAVE_ARG(FUNCNAME, 2); \
  4009. SAVE_ARG(FUNCNAME, 3); \
  4010. SAVE_ARG(FUNCNAME, 4); \
  4011. SAVE_ARG(FUNCNAME, 5); \
  4012. SAVE_ARG(FUNCNAME, 6); \
  4013. SAVE_ARG(FUNCNAME, 7); \
  4014. SAVE_ARG(FUNCNAME, 8); \
  4015. SAVE_ARG(FUNCNAME, 9); \
  4016. SAVE_ARG(FUNCNAME, 10); \
  4017. SAVE_ARG(FUNCNAME, 11); \
  4018. SAVE_ARG(FUNCNAME, 12); \
  4019. SAVE_ARG(FUNCNAME, 13); \
  4020. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4021. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4022. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4023. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4024. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4025. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4026. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4027. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  4028. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  4029. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  4030. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  4031. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  4032. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  4033. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  4034. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  4035. } \
  4036. else{ \
  4037. HISTORY_DROPPED(FUNCNAME); \
  4038. } \
  4039. INCREMENT_CALL_COUNT(FUNCNAME); \
  4040. REGISTER_CALL(FUNCNAME); \
  4041. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4042. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4043. va_list ap; \
  4044. va_start(ap, arg13); \
  4045. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
  4046. va_end(ap); \
  4047. } \
  4048. else{ \
  4049. va_list ap; \
  4050. va_start(ap, arg13); \
  4051. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
  4052. va_end(ap); \
  4053. } \
  4054. } \
  4055. if(FUNCNAME##_fake.custom_fake){ \
  4056. va_list ap; \
  4057. va_start(ap, arg13); \
  4058. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
  4059. va_end(ap); \
  4060. } \
  4061. } \
  4062. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4063. #define FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  4064. DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  4065. DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  4066. #define DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  4067. typedef struct FUNCNAME##_Fake { \
  4068. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4069. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4070. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4071. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4072. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4073. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  4074. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  4075. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  4076. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  4077. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  4078. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  4079. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  4080. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  4081. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  4082. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  4083. DECLARE_ALL_FUNC_COMMON \
  4084. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4085. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
  4086. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
  4087. } FUNCNAME##_Fake; \
  4088. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4089. void FUNCNAME##_reset(void); \
  4090. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
  4091. #define DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  4092. FUNCNAME##_Fake FUNCNAME##_fake; \
  4093. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
  4094. SAVE_ARG(FUNCNAME, 0); \
  4095. SAVE_ARG(FUNCNAME, 1); \
  4096. SAVE_ARG(FUNCNAME, 2); \
  4097. SAVE_ARG(FUNCNAME, 3); \
  4098. SAVE_ARG(FUNCNAME, 4); \
  4099. SAVE_ARG(FUNCNAME, 5); \
  4100. SAVE_ARG(FUNCNAME, 6); \
  4101. SAVE_ARG(FUNCNAME, 7); \
  4102. SAVE_ARG(FUNCNAME, 8); \
  4103. SAVE_ARG(FUNCNAME, 9); \
  4104. SAVE_ARG(FUNCNAME, 10); \
  4105. SAVE_ARG(FUNCNAME, 11); \
  4106. SAVE_ARG(FUNCNAME, 12); \
  4107. SAVE_ARG(FUNCNAME, 13); \
  4108. SAVE_ARG(FUNCNAME, 14); \
  4109. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4110. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4111. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4112. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4113. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4114. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4115. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4116. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  4117. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  4118. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  4119. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  4120. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  4121. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  4122. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  4123. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  4124. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  4125. } \
  4126. else{ \
  4127. HISTORY_DROPPED(FUNCNAME); \
  4128. } \
  4129. INCREMENT_CALL_COUNT(FUNCNAME); \
  4130. REGISTER_CALL(FUNCNAME); \
  4131. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4132. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4133. va_list ap; \
  4134. va_start(ap, arg14); \
  4135. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
  4136. va_end(ap); \
  4137. } \
  4138. else{ \
  4139. va_list ap; \
  4140. va_start(ap, arg14); \
  4141. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
  4142. va_end(ap); \
  4143. } \
  4144. } \
  4145. if(FUNCNAME##_fake.custom_fake){ \
  4146. va_list ap; \
  4147. va_start(ap, arg14); \
  4148. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
  4149. va_end(ap); \
  4150. } \
  4151. } \
  4152. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4153. #define FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  4154. DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  4155. DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  4156. #define DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  4157. typedef struct FUNCNAME##_Fake { \
  4158. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4159. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4160. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4161. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4162. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4163. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  4164. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  4165. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  4166. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  4167. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  4168. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  4169. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  4170. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  4171. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  4172. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  4173. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  4174. DECLARE_ALL_FUNC_COMMON \
  4175. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4176. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
  4177. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
  4178. } FUNCNAME##_Fake; \
  4179. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4180. void FUNCNAME##_reset(void); \
  4181. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
  4182. #define DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  4183. FUNCNAME##_Fake FUNCNAME##_fake; \
  4184. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
  4185. SAVE_ARG(FUNCNAME, 0); \
  4186. SAVE_ARG(FUNCNAME, 1); \
  4187. SAVE_ARG(FUNCNAME, 2); \
  4188. SAVE_ARG(FUNCNAME, 3); \
  4189. SAVE_ARG(FUNCNAME, 4); \
  4190. SAVE_ARG(FUNCNAME, 5); \
  4191. SAVE_ARG(FUNCNAME, 6); \
  4192. SAVE_ARG(FUNCNAME, 7); \
  4193. SAVE_ARG(FUNCNAME, 8); \
  4194. SAVE_ARG(FUNCNAME, 9); \
  4195. SAVE_ARG(FUNCNAME, 10); \
  4196. SAVE_ARG(FUNCNAME, 11); \
  4197. SAVE_ARG(FUNCNAME, 12); \
  4198. SAVE_ARG(FUNCNAME, 13); \
  4199. SAVE_ARG(FUNCNAME, 14); \
  4200. SAVE_ARG(FUNCNAME, 15); \
  4201. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4202. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4203. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4204. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4205. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4206. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4207. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4208. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  4209. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  4210. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  4211. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  4212. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  4213. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  4214. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  4215. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  4216. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  4217. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  4218. } \
  4219. else{ \
  4220. HISTORY_DROPPED(FUNCNAME); \
  4221. } \
  4222. INCREMENT_CALL_COUNT(FUNCNAME); \
  4223. REGISTER_CALL(FUNCNAME); \
  4224. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4225. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4226. va_list ap; \
  4227. va_start(ap, arg15); \
  4228. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
  4229. va_end(ap); \
  4230. } \
  4231. else{ \
  4232. va_list ap; \
  4233. va_start(ap, arg15); \
  4234. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
  4235. va_end(ap); \
  4236. } \
  4237. } \
  4238. if(FUNCNAME##_fake.custom_fake){ \
  4239. va_list ap; \
  4240. va_start(ap, arg15); \
  4241. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
  4242. va_end(ap); \
  4243. } \
  4244. } \
  4245. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4246. #define FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  4247. DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  4248. DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  4249. #define DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  4250. typedef struct FUNCNAME##_Fake { \
  4251. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4252. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4253. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4254. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4255. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4256. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  4257. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  4258. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  4259. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  4260. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  4261. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  4262. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  4263. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  4264. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  4265. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  4266. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  4267. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  4268. DECLARE_ALL_FUNC_COMMON \
  4269. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4270. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
  4271. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
  4272. } FUNCNAME##_Fake; \
  4273. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4274. void FUNCNAME##_reset(void); \
  4275. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
  4276. #define DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  4277. FUNCNAME##_Fake FUNCNAME##_fake; \
  4278. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
  4279. SAVE_ARG(FUNCNAME, 0); \
  4280. SAVE_ARG(FUNCNAME, 1); \
  4281. SAVE_ARG(FUNCNAME, 2); \
  4282. SAVE_ARG(FUNCNAME, 3); \
  4283. SAVE_ARG(FUNCNAME, 4); \
  4284. SAVE_ARG(FUNCNAME, 5); \
  4285. SAVE_ARG(FUNCNAME, 6); \
  4286. SAVE_ARG(FUNCNAME, 7); \
  4287. SAVE_ARG(FUNCNAME, 8); \
  4288. SAVE_ARG(FUNCNAME, 9); \
  4289. SAVE_ARG(FUNCNAME, 10); \
  4290. SAVE_ARG(FUNCNAME, 11); \
  4291. SAVE_ARG(FUNCNAME, 12); \
  4292. SAVE_ARG(FUNCNAME, 13); \
  4293. SAVE_ARG(FUNCNAME, 14); \
  4294. SAVE_ARG(FUNCNAME, 15); \
  4295. SAVE_ARG(FUNCNAME, 16); \
  4296. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4297. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4298. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4299. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4300. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4301. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4302. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4303. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  4304. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  4305. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  4306. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  4307. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  4308. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  4309. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  4310. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  4311. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  4312. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  4313. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  4314. } \
  4315. else{ \
  4316. HISTORY_DROPPED(FUNCNAME); \
  4317. } \
  4318. INCREMENT_CALL_COUNT(FUNCNAME); \
  4319. REGISTER_CALL(FUNCNAME); \
  4320. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4321. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4322. va_list ap; \
  4323. va_start(ap, arg16); \
  4324. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
  4325. va_end(ap); \
  4326. } \
  4327. else{ \
  4328. va_list ap; \
  4329. va_start(ap, arg16); \
  4330. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
  4331. va_end(ap); \
  4332. } \
  4333. } \
  4334. if(FUNCNAME##_fake.custom_fake){ \
  4335. va_list ap; \
  4336. va_start(ap, arg16); \
  4337. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
  4338. va_end(ap); \
  4339. } \
  4340. } \
  4341. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4342. #define FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  4343. DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  4344. DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  4345. #define DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  4346. typedef struct FUNCNAME##_Fake { \
  4347. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4348. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4349. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4350. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4351. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4352. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  4353. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  4354. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  4355. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  4356. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  4357. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  4358. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  4359. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  4360. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  4361. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  4362. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  4363. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  4364. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  4365. DECLARE_ALL_FUNC_COMMON \
  4366. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4367. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
  4368. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
  4369. } FUNCNAME##_Fake; \
  4370. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4371. void FUNCNAME##_reset(void); \
  4372. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
  4373. #define DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  4374. FUNCNAME##_Fake FUNCNAME##_fake; \
  4375. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
  4376. SAVE_ARG(FUNCNAME, 0); \
  4377. SAVE_ARG(FUNCNAME, 1); \
  4378. SAVE_ARG(FUNCNAME, 2); \
  4379. SAVE_ARG(FUNCNAME, 3); \
  4380. SAVE_ARG(FUNCNAME, 4); \
  4381. SAVE_ARG(FUNCNAME, 5); \
  4382. SAVE_ARG(FUNCNAME, 6); \
  4383. SAVE_ARG(FUNCNAME, 7); \
  4384. SAVE_ARG(FUNCNAME, 8); \
  4385. SAVE_ARG(FUNCNAME, 9); \
  4386. SAVE_ARG(FUNCNAME, 10); \
  4387. SAVE_ARG(FUNCNAME, 11); \
  4388. SAVE_ARG(FUNCNAME, 12); \
  4389. SAVE_ARG(FUNCNAME, 13); \
  4390. SAVE_ARG(FUNCNAME, 14); \
  4391. SAVE_ARG(FUNCNAME, 15); \
  4392. SAVE_ARG(FUNCNAME, 16); \
  4393. SAVE_ARG(FUNCNAME, 17); \
  4394. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4395. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4396. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4397. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4398. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4399. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4400. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4401. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  4402. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  4403. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  4404. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  4405. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  4406. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  4407. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  4408. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  4409. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  4410. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  4411. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  4412. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  4413. } \
  4414. else{ \
  4415. HISTORY_DROPPED(FUNCNAME); \
  4416. } \
  4417. INCREMENT_CALL_COUNT(FUNCNAME); \
  4418. REGISTER_CALL(FUNCNAME); \
  4419. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4420. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4421. va_list ap; \
  4422. va_start(ap, arg17); \
  4423. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
  4424. va_end(ap); \
  4425. } \
  4426. else{ \
  4427. va_list ap; \
  4428. va_start(ap, arg17); \
  4429. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
  4430. va_end(ap); \
  4431. } \
  4432. } \
  4433. if(FUNCNAME##_fake.custom_fake){ \
  4434. va_list ap; \
  4435. va_start(ap, arg17); \
  4436. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
  4437. va_end(ap); \
  4438. } \
  4439. } \
  4440. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4441. #define FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  4442. DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  4443. DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  4444. #define DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  4445. typedef struct FUNCNAME##_Fake { \
  4446. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4447. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4448. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4449. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4450. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4451. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  4452. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  4453. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  4454. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  4455. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  4456. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  4457. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  4458. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  4459. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  4460. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  4461. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  4462. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  4463. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  4464. DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
  4465. DECLARE_ALL_FUNC_COMMON \
  4466. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4467. void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
  4468. void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
  4469. } FUNCNAME##_Fake; \
  4470. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4471. void FUNCNAME##_reset(void); \
  4472. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
  4473. #define DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  4474. FUNCNAME##_Fake FUNCNAME##_fake; \
  4475. void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
  4476. SAVE_ARG(FUNCNAME, 0); \
  4477. SAVE_ARG(FUNCNAME, 1); \
  4478. SAVE_ARG(FUNCNAME, 2); \
  4479. SAVE_ARG(FUNCNAME, 3); \
  4480. SAVE_ARG(FUNCNAME, 4); \
  4481. SAVE_ARG(FUNCNAME, 5); \
  4482. SAVE_ARG(FUNCNAME, 6); \
  4483. SAVE_ARG(FUNCNAME, 7); \
  4484. SAVE_ARG(FUNCNAME, 8); \
  4485. SAVE_ARG(FUNCNAME, 9); \
  4486. SAVE_ARG(FUNCNAME, 10); \
  4487. SAVE_ARG(FUNCNAME, 11); \
  4488. SAVE_ARG(FUNCNAME, 12); \
  4489. SAVE_ARG(FUNCNAME, 13); \
  4490. SAVE_ARG(FUNCNAME, 14); \
  4491. SAVE_ARG(FUNCNAME, 15); \
  4492. SAVE_ARG(FUNCNAME, 16); \
  4493. SAVE_ARG(FUNCNAME, 17); \
  4494. SAVE_ARG(FUNCNAME, 18); \
  4495. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4496. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4497. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4498. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4499. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4500. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4501. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4502. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  4503. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  4504. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  4505. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  4506. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  4507. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  4508. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  4509. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  4510. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  4511. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  4512. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  4513. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  4514. SAVE_ARG_HISTORY(FUNCNAME, 18); \
  4515. } \
  4516. else{ \
  4517. HISTORY_DROPPED(FUNCNAME); \
  4518. } \
  4519. INCREMENT_CALL_COUNT(FUNCNAME); \
  4520. REGISTER_CALL(FUNCNAME); \
  4521. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4522. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4523. va_list ap; \
  4524. va_start(ap, arg18); \
  4525. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
  4526. va_end(ap); \
  4527. } \
  4528. else{ \
  4529. va_list ap; \
  4530. va_start(ap, arg18); \
  4531. FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
  4532. va_end(ap); \
  4533. } \
  4534. } \
  4535. if(FUNCNAME##_fake.custom_fake){ \
  4536. va_list ap; \
  4537. va_start(ap, arg18); \
  4538. FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
  4539. va_end(ap); \
  4540. } \
  4541. } \
  4542. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4543. #define FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  4544. DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  4545. DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  4546. #define DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
  4547. typedef struct FUNCNAME##_Fake { \
  4548. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4549. DECLARE_ALL_FUNC_COMMON \
  4550. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  4551. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  4552. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4553. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
  4554. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
  4555. } FUNCNAME##_Fake; \
  4556. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4557. void FUNCNAME##_reset(void); \
  4558. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...); \
  4559. #define DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
  4560. FUNCNAME##_Fake FUNCNAME##_fake; \
  4561. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...){ \
  4562. SAVE_ARG(FUNCNAME, 0); \
  4563. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4564. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4565. } \
  4566. else{ \
  4567. HISTORY_DROPPED(FUNCNAME); \
  4568. } \
  4569. INCREMENT_CALL_COUNT(FUNCNAME); \
  4570. REGISTER_CALL(FUNCNAME); \
  4571. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4572. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4573. va_list ap; \
  4574. va_start(ap, arg0); \
  4575. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
  4576. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4577. va_end(ap); \
  4578. return ret; \
  4579. } \
  4580. else{ \
  4581. va_list ap; \
  4582. va_start(ap, arg0); \
  4583. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
  4584. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4585. va_end(ap); \
  4586. return ret; \
  4587. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
  4588. } \
  4589. } \
  4590. if(FUNCNAME##_fake.custom_fake){ \
  4591. RETURN_TYPE ret; \
  4592. va_list ap; \
  4593. va_start(ap, arg0); \
  4594. ret = FUNCNAME##_fake.custom_fake(arg0, ap); \
  4595. va_end(ap); \
  4596. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4597. return ret; \
  4598. } \
  4599. RETURN_FAKE_RESULT(FUNCNAME) \
  4600. } \
  4601. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4602. #define FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
  4603. DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
  4604. DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
  4605. #define DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  4606. typedef struct FUNCNAME##_Fake { \
  4607. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4608. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4609. DECLARE_ALL_FUNC_COMMON \
  4610. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  4611. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  4612. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4613. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
  4614. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
  4615. } FUNCNAME##_Fake; \
  4616. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4617. void FUNCNAME##_reset(void); \
  4618. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
  4619. #define DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  4620. FUNCNAME##_Fake FUNCNAME##_fake; \
  4621. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
  4622. SAVE_ARG(FUNCNAME, 0); \
  4623. SAVE_ARG(FUNCNAME, 1); \
  4624. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4625. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4626. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4627. } \
  4628. else{ \
  4629. HISTORY_DROPPED(FUNCNAME); \
  4630. } \
  4631. INCREMENT_CALL_COUNT(FUNCNAME); \
  4632. REGISTER_CALL(FUNCNAME); \
  4633. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4634. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4635. va_list ap; \
  4636. va_start(ap, arg1); \
  4637. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
  4638. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4639. va_end(ap); \
  4640. return ret; \
  4641. } \
  4642. else{ \
  4643. va_list ap; \
  4644. va_start(ap, arg1); \
  4645. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
  4646. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4647. va_end(ap); \
  4648. return ret; \
  4649. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
  4650. } \
  4651. } \
  4652. if(FUNCNAME##_fake.custom_fake){ \
  4653. RETURN_TYPE ret; \
  4654. va_list ap; \
  4655. va_start(ap, arg1); \
  4656. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
  4657. va_end(ap); \
  4658. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4659. return ret; \
  4660. } \
  4661. RETURN_FAKE_RESULT(FUNCNAME) \
  4662. } \
  4663. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4664. #define FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  4665. DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  4666. DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
  4667. #define DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  4668. typedef struct FUNCNAME##_Fake { \
  4669. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4670. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4671. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4672. DECLARE_ALL_FUNC_COMMON \
  4673. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  4674. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  4675. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4676. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
  4677. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
  4678. } FUNCNAME##_Fake; \
  4679. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4680. void FUNCNAME##_reset(void); \
  4681. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
  4682. #define DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  4683. FUNCNAME##_Fake FUNCNAME##_fake; \
  4684. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
  4685. SAVE_ARG(FUNCNAME, 0); \
  4686. SAVE_ARG(FUNCNAME, 1); \
  4687. SAVE_ARG(FUNCNAME, 2); \
  4688. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4689. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4690. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4691. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4692. } \
  4693. else{ \
  4694. HISTORY_DROPPED(FUNCNAME); \
  4695. } \
  4696. INCREMENT_CALL_COUNT(FUNCNAME); \
  4697. REGISTER_CALL(FUNCNAME); \
  4698. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4699. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4700. va_list ap; \
  4701. va_start(ap, arg2); \
  4702. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
  4703. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4704. va_end(ap); \
  4705. return ret; \
  4706. } \
  4707. else{ \
  4708. va_list ap; \
  4709. va_start(ap, arg2); \
  4710. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
  4711. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4712. va_end(ap); \
  4713. return ret; \
  4714. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
  4715. } \
  4716. } \
  4717. if(FUNCNAME##_fake.custom_fake){ \
  4718. RETURN_TYPE ret; \
  4719. va_list ap; \
  4720. va_start(ap, arg2); \
  4721. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
  4722. va_end(ap); \
  4723. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4724. return ret; \
  4725. } \
  4726. RETURN_FAKE_RESULT(FUNCNAME) \
  4727. } \
  4728. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4729. #define FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  4730. DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  4731. DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
  4732. #define DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  4733. typedef struct FUNCNAME##_Fake { \
  4734. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4735. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4736. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4737. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4738. DECLARE_ALL_FUNC_COMMON \
  4739. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  4740. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  4741. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4742. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
  4743. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
  4744. } FUNCNAME##_Fake; \
  4745. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4746. void FUNCNAME##_reset(void); \
  4747. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
  4748. #define DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  4749. FUNCNAME##_Fake FUNCNAME##_fake; \
  4750. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
  4751. SAVE_ARG(FUNCNAME, 0); \
  4752. SAVE_ARG(FUNCNAME, 1); \
  4753. SAVE_ARG(FUNCNAME, 2); \
  4754. SAVE_ARG(FUNCNAME, 3); \
  4755. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4756. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4757. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4758. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4759. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4760. } \
  4761. else{ \
  4762. HISTORY_DROPPED(FUNCNAME); \
  4763. } \
  4764. INCREMENT_CALL_COUNT(FUNCNAME); \
  4765. REGISTER_CALL(FUNCNAME); \
  4766. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4767. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4768. va_list ap; \
  4769. va_start(ap, arg3); \
  4770. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
  4771. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4772. va_end(ap); \
  4773. return ret; \
  4774. } \
  4775. else{ \
  4776. va_list ap; \
  4777. va_start(ap, arg3); \
  4778. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
  4779. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4780. va_end(ap); \
  4781. return ret; \
  4782. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
  4783. } \
  4784. } \
  4785. if(FUNCNAME##_fake.custom_fake){ \
  4786. RETURN_TYPE ret; \
  4787. va_list ap; \
  4788. va_start(ap, arg3); \
  4789. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
  4790. va_end(ap); \
  4791. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4792. return ret; \
  4793. } \
  4794. RETURN_FAKE_RESULT(FUNCNAME) \
  4795. } \
  4796. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4797. #define FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  4798. DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  4799. DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
  4800. #define DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  4801. typedef struct FUNCNAME##_Fake { \
  4802. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4803. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4804. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4805. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4806. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4807. DECLARE_ALL_FUNC_COMMON \
  4808. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  4809. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  4810. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4811. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
  4812. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
  4813. } FUNCNAME##_Fake; \
  4814. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4815. void FUNCNAME##_reset(void); \
  4816. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
  4817. #define DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  4818. FUNCNAME##_Fake FUNCNAME##_fake; \
  4819. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
  4820. SAVE_ARG(FUNCNAME, 0); \
  4821. SAVE_ARG(FUNCNAME, 1); \
  4822. SAVE_ARG(FUNCNAME, 2); \
  4823. SAVE_ARG(FUNCNAME, 3); \
  4824. SAVE_ARG(FUNCNAME, 4); \
  4825. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4826. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4827. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4828. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4829. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4830. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4831. } \
  4832. else{ \
  4833. HISTORY_DROPPED(FUNCNAME); \
  4834. } \
  4835. INCREMENT_CALL_COUNT(FUNCNAME); \
  4836. REGISTER_CALL(FUNCNAME); \
  4837. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4838. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4839. va_list ap; \
  4840. va_start(ap, arg4); \
  4841. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
  4842. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4843. va_end(ap); \
  4844. return ret; \
  4845. } \
  4846. else{ \
  4847. va_list ap; \
  4848. va_start(ap, arg4); \
  4849. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
  4850. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4851. va_end(ap); \
  4852. return ret; \
  4853. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
  4854. } \
  4855. } \
  4856. if(FUNCNAME##_fake.custom_fake){ \
  4857. RETURN_TYPE ret; \
  4858. va_list ap; \
  4859. va_start(ap, arg4); \
  4860. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
  4861. va_end(ap); \
  4862. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4863. return ret; \
  4864. } \
  4865. RETURN_FAKE_RESULT(FUNCNAME) \
  4866. } \
  4867. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4868. #define FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  4869. DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  4870. DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
  4871. #define DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  4872. typedef struct FUNCNAME##_Fake { \
  4873. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4874. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4875. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4876. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4877. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4878. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  4879. DECLARE_ALL_FUNC_COMMON \
  4880. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  4881. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  4882. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4883. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
  4884. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
  4885. } FUNCNAME##_Fake; \
  4886. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4887. void FUNCNAME##_reset(void); \
  4888. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
  4889. #define DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  4890. FUNCNAME##_Fake FUNCNAME##_fake; \
  4891. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
  4892. SAVE_ARG(FUNCNAME, 0); \
  4893. SAVE_ARG(FUNCNAME, 1); \
  4894. SAVE_ARG(FUNCNAME, 2); \
  4895. SAVE_ARG(FUNCNAME, 3); \
  4896. SAVE_ARG(FUNCNAME, 4); \
  4897. SAVE_ARG(FUNCNAME, 5); \
  4898. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4899. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4900. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4901. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4902. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4903. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4904. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4905. } \
  4906. else{ \
  4907. HISTORY_DROPPED(FUNCNAME); \
  4908. } \
  4909. INCREMENT_CALL_COUNT(FUNCNAME); \
  4910. REGISTER_CALL(FUNCNAME); \
  4911. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4912. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4913. va_list ap; \
  4914. va_start(ap, arg5); \
  4915. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
  4916. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4917. va_end(ap); \
  4918. return ret; \
  4919. } \
  4920. else{ \
  4921. va_list ap; \
  4922. va_start(ap, arg5); \
  4923. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
  4924. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4925. va_end(ap); \
  4926. return ret; \
  4927. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
  4928. } \
  4929. } \
  4930. if(FUNCNAME##_fake.custom_fake){ \
  4931. RETURN_TYPE ret; \
  4932. va_list ap; \
  4933. va_start(ap, arg5); \
  4934. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
  4935. va_end(ap); \
  4936. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4937. return ret; \
  4938. } \
  4939. RETURN_FAKE_RESULT(FUNCNAME) \
  4940. } \
  4941. DEFINE_RESET_FUNCTION(FUNCNAME) \
  4942. #define FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  4943. DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  4944. DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
  4945. #define DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  4946. typedef struct FUNCNAME##_Fake { \
  4947. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  4948. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  4949. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  4950. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  4951. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  4952. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  4953. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  4954. DECLARE_ALL_FUNC_COMMON \
  4955. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  4956. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  4957. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  4958. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
  4959. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
  4960. } FUNCNAME##_Fake; \
  4961. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  4962. void FUNCNAME##_reset(void); \
  4963. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
  4964. #define DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  4965. FUNCNAME##_Fake FUNCNAME##_fake; \
  4966. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
  4967. SAVE_ARG(FUNCNAME, 0); \
  4968. SAVE_ARG(FUNCNAME, 1); \
  4969. SAVE_ARG(FUNCNAME, 2); \
  4970. SAVE_ARG(FUNCNAME, 3); \
  4971. SAVE_ARG(FUNCNAME, 4); \
  4972. SAVE_ARG(FUNCNAME, 5); \
  4973. SAVE_ARG(FUNCNAME, 6); \
  4974. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  4975. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  4976. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  4977. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  4978. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  4979. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  4980. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  4981. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  4982. } \
  4983. else{ \
  4984. HISTORY_DROPPED(FUNCNAME); \
  4985. } \
  4986. INCREMENT_CALL_COUNT(FUNCNAME); \
  4987. REGISTER_CALL(FUNCNAME); \
  4988. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  4989. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  4990. va_list ap; \
  4991. va_start(ap, arg6); \
  4992. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
  4993. SAVE_RET_HISTORY(FUNCNAME, ret); \
  4994. va_end(ap); \
  4995. return ret; \
  4996. } \
  4997. else{ \
  4998. va_list ap; \
  4999. va_start(ap, arg6); \
  5000. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
  5001. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5002. va_end(ap); \
  5003. return ret; \
  5004. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
  5005. } \
  5006. } \
  5007. if(FUNCNAME##_fake.custom_fake){ \
  5008. RETURN_TYPE ret; \
  5009. va_list ap; \
  5010. va_start(ap, arg6); \
  5011. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
  5012. va_end(ap); \
  5013. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5014. return ret; \
  5015. } \
  5016. RETURN_FAKE_RESULT(FUNCNAME) \
  5017. } \
  5018. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5019. #define FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  5020. DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  5021. DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
  5022. #define DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  5023. typedef struct FUNCNAME##_Fake { \
  5024. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5025. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5026. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5027. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5028. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5029. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5030. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5031. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5032. DECLARE_ALL_FUNC_COMMON \
  5033. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5034. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5035. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5036. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
  5037. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
  5038. } FUNCNAME##_Fake; \
  5039. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5040. void FUNCNAME##_reset(void); \
  5041. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
  5042. #define DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  5043. FUNCNAME##_Fake FUNCNAME##_fake; \
  5044. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
  5045. SAVE_ARG(FUNCNAME, 0); \
  5046. SAVE_ARG(FUNCNAME, 1); \
  5047. SAVE_ARG(FUNCNAME, 2); \
  5048. SAVE_ARG(FUNCNAME, 3); \
  5049. SAVE_ARG(FUNCNAME, 4); \
  5050. SAVE_ARG(FUNCNAME, 5); \
  5051. SAVE_ARG(FUNCNAME, 6); \
  5052. SAVE_ARG(FUNCNAME, 7); \
  5053. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5054. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5055. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5056. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5057. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5058. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5059. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5060. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5061. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5062. } \
  5063. else{ \
  5064. HISTORY_DROPPED(FUNCNAME); \
  5065. } \
  5066. INCREMENT_CALL_COUNT(FUNCNAME); \
  5067. REGISTER_CALL(FUNCNAME); \
  5068. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5069. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5070. va_list ap; \
  5071. va_start(ap, arg7); \
  5072. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
  5073. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5074. va_end(ap); \
  5075. return ret; \
  5076. } \
  5077. else{ \
  5078. va_list ap; \
  5079. va_start(ap, arg7); \
  5080. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
  5081. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5082. va_end(ap); \
  5083. return ret; \
  5084. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
  5085. } \
  5086. } \
  5087. if(FUNCNAME##_fake.custom_fake){ \
  5088. RETURN_TYPE ret; \
  5089. va_list ap; \
  5090. va_start(ap, arg7); \
  5091. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
  5092. va_end(ap); \
  5093. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5094. return ret; \
  5095. } \
  5096. RETURN_FAKE_RESULT(FUNCNAME) \
  5097. } \
  5098. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5099. #define FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  5100. DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  5101. DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
  5102. #define DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  5103. typedef struct FUNCNAME##_Fake { \
  5104. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5105. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5106. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5107. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5108. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5109. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5110. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5111. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5112. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5113. DECLARE_ALL_FUNC_COMMON \
  5114. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5115. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5116. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5117. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
  5118. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
  5119. } FUNCNAME##_Fake; \
  5120. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5121. void FUNCNAME##_reset(void); \
  5122. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
  5123. #define DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  5124. FUNCNAME##_Fake FUNCNAME##_fake; \
  5125. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
  5126. SAVE_ARG(FUNCNAME, 0); \
  5127. SAVE_ARG(FUNCNAME, 1); \
  5128. SAVE_ARG(FUNCNAME, 2); \
  5129. SAVE_ARG(FUNCNAME, 3); \
  5130. SAVE_ARG(FUNCNAME, 4); \
  5131. SAVE_ARG(FUNCNAME, 5); \
  5132. SAVE_ARG(FUNCNAME, 6); \
  5133. SAVE_ARG(FUNCNAME, 7); \
  5134. SAVE_ARG(FUNCNAME, 8); \
  5135. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5136. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5137. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5138. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5139. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5140. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5141. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5142. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5143. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5144. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5145. } \
  5146. else{ \
  5147. HISTORY_DROPPED(FUNCNAME); \
  5148. } \
  5149. INCREMENT_CALL_COUNT(FUNCNAME); \
  5150. REGISTER_CALL(FUNCNAME); \
  5151. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5152. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5153. va_list ap; \
  5154. va_start(ap, arg8); \
  5155. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
  5156. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5157. va_end(ap); \
  5158. return ret; \
  5159. } \
  5160. else{ \
  5161. va_list ap; \
  5162. va_start(ap, arg8); \
  5163. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
  5164. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5165. va_end(ap); \
  5166. return ret; \
  5167. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
  5168. } \
  5169. } \
  5170. if(FUNCNAME##_fake.custom_fake){ \
  5171. RETURN_TYPE ret; \
  5172. va_list ap; \
  5173. va_start(ap, arg8); \
  5174. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
  5175. va_end(ap); \
  5176. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5177. return ret; \
  5178. } \
  5179. RETURN_FAKE_RESULT(FUNCNAME) \
  5180. } \
  5181. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5182. #define FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  5183. DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  5184. DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
  5185. #define DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  5186. typedef struct FUNCNAME##_Fake { \
  5187. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5188. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5189. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5190. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5191. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5192. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5193. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5194. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5195. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5196. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5197. DECLARE_ALL_FUNC_COMMON \
  5198. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5199. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5200. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5201. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
  5202. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
  5203. } FUNCNAME##_Fake; \
  5204. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5205. void FUNCNAME##_reset(void); \
  5206. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
  5207. #define DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  5208. FUNCNAME##_Fake FUNCNAME##_fake; \
  5209. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
  5210. SAVE_ARG(FUNCNAME, 0); \
  5211. SAVE_ARG(FUNCNAME, 1); \
  5212. SAVE_ARG(FUNCNAME, 2); \
  5213. SAVE_ARG(FUNCNAME, 3); \
  5214. SAVE_ARG(FUNCNAME, 4); \
  5215. SAVE_ARG(FUNCNAME, 5); \
  5216. SAVE_ARG(FUNCNAME, 6); \
  5217. SAVE_ARG(FUNCNAME, 7); \
  5218. SAVE_ARG(FUNCNAME, 8); \
  5219. SAVE_ARG(FUNCNAME, 9); \
  5220. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5221. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5222. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5223. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5224. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5225. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5226. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5227. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5228. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5229. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5230. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5231. } \
  5232. else{ \
  5233. HISTORY_DROPPED(FUNCNAME); \
  5234. } \
  5235. INCREMENT_CALL_COUNT(FUNCNAME); \
  5236. REGISTER_CALL(FUNCNAME); \
  5237. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5238. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5239. va_list ap; \
  5240. va_start(ap, arg9); \
  5241. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
  5242. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5243. va_end(ap); \
  5244. return ret; \
  5245. } \
  5246. else{ \
  5247. va_list ap; \
  5248. va_start(ap, arg9); \
  5249. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
  5250. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5251. va_end(ap); \
  5252. return ret; \
  5253. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
  5254. } \
  5255. } \
  5256. if(FUNCNAME##_fake.custom_fake){ \
  5257. RETURN_TYPE ret; \
  5258. va_list ap; \
  5259. va_start(ap, arg9); \
  5260. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
  5261. va_end(ap); \
  5262. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5263. return ret; \
  5264. } \
  5265. RETURN_FAKE_RESULT(FUNCNAME) \
  5266. } \
  5267. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5268. #define FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  5269. DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  5270. DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
  5271. #define DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  5272. typedef struct FUNCNAME##_Fake { \
  5273. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5274. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5275. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5276. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5277. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5278. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5279. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5280. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5281. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5282. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5283. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5284. DECLARE_ALL_FUNC_COMMON \
  5285. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5286. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5287. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5288. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
  5289. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
  5290. } FUNCNAME##_Fake; \
  5291. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5292. void FUNCNAME##_reset(void); \
  5293. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
  5294. #define DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  5295. FUNCNAME##_Fake FUNCNAME##_fake; \
  5296. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
  5297. SAVE_ARG(FUNCNAME, 0); \
  5298. SAVE_ARG(FUNCNAME, 1); \
  5299. SAVE_ARG(FUNCNAME, 2); \
  5300. SAVE_ARG(FUNCNAME, 3); \
  5301. SAVE_ARG(FUNCNAME, 4); \
  5302. SAVE_ARG(FUNCNAME, 5); \
  5303. SAVE_ARG(FUNCNAME, 6); \
  5304. SAVE_ARG(FUNCNAME, 7); \
  5305. SAVE_ARG(FUNCNAME, 8); \
  5306. SAVE_ARG(FUNCNAME, 9); \
  5307. SAVE_ARG(FUNCNAME, 10); \
  5308. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5309. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5310. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5311. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5312. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5313. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5314. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5315. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5316. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5317. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5318. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5319. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  5320. } \
  5321. else{ \
  5322. HISTORY_DROPPED(FUNCNAME); \
  5323. } \
  5324. INCREMENT_CALL_COUNT(FUNCNAME); \
  5325. REGISTER_CALL(FUNCNAME); \
  5326. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5327. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5328. va_list ap; \
  5329. va_start(ap, arg10); \
  5330. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
  5331. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5332. va_end(ap); \
  5333. return ret; \
  5334. } \
  5335. else{ \
  5336. va_list ap; \
  5337. va_start(ap, arg10); \
  5338. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
  5339. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5340. va_end(ap); \
  5341. return ret; \
  5342. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
  5343. } \
  5344. } \
  5345. if(FUNCNAME##_fake.custom_fake){ \
  5346. RETURN_TYPE ret; \
  5347. va_list ap; \
  5348. va_start(ap, arg10); \
  5349. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
  5350. va_end(ap); \
  5351. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5352. return ret; \
  5353. } \
  5354. RETURN_FAKE_RESULT(FUNCNAME) \
  5355. } \
  5356. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5357. #define FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  5358. DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  5359. DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
  5360. #define DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  5361. typedef struct FUNCNAME##_Fake { \
  5362. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5363. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5364. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5365. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5366. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5367. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5368. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5369. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5370. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5371. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5372. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5373. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  5374. DECLARE_ALL_FUNC_COMMON \
  5375. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5376. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5377. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5378. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
  5379. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
  5380. } FUNCNAME##_Fake; \
  5381. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5382. void FUNCNAME##_reset(void); \
  5383. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
  5384. #define DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  5385. FUNCNAME##_Fake FUNCNAME##_fake; \
  5386. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
  5387. SAVE_ARG(FUNCNAME, 0); \
  5388. SAVE_ARG(FUNCNAME, 1); \
  5389. SAVE_ARG(FUNCNAME, 2); \
  5390. SAVE_ARG(FUNCNAME, 3); \
  5391. SAVE_ARG(FUNCNAME, 4); \
  5392. SAVE_ARG(FUNCNAME, 5); \
  5393. SAVE_ARG(FUNCNAME, 6); \
  5394. SAVE_ARG(FUNCNAME, 7); \
  5395. SAVE_ARG(FUNCNAME, 8); \
  5396. SAVE_ARG(FUNCNAME, 9); \
  5397. SAVE_ARG(FUNCNAME, 10); \
  5398. SAVE_ARG(FUNCNAME, 11); \
  5399. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5400. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5401. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5402. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5403. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5404. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5405. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5406. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5407. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5408. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5409. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5410. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  5411. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  5412. } \
  5413. else{ \
  5414. HISTORY_DROPPED(FUNCNAME); \
  5415. } \
  5416. INCREMENT_CALL_COUNT(FUNCNAME); \
  5417. REGISTER_CALL(FUNCNAME); \
  5418. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5419. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5420. va_list ap; \
  5421. va_start(ap, arg11); \
  5422. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
  5423. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5424. va_end(ap); \
  5425. return ret; \
  5426. } \
  5427. else{ \
  5428. va_list ap; \
  5429. va_start(ap, arg11); \
  5430. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
  5431. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5432. va_end(ap); \
  5433. return ret; \
  5434. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
  5435. } \
  5436. } \
  5437. if(FUNCNAME##_fake.custom_fake){ \
  5438. RETURN_TYPE ret; \
  5439. va_list ap; \
  5440. va_start(ap, arg11); \
  5441. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
  5442. va_end(ap); \
  5443. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5444. return ret; \
  5445. } \
  5446. RETURN_FAKE_RESULT(FUNCNAME) \
  5447. } \
  5448. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5449. #define FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  5450. DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  5451. DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
  5452. #define DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  5453. typedef struct FUNCNAME##_Fake { \
  5454. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5455. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5456. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5457. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5458. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5459. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5460. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5461. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5462. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5463. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5464. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5465. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  5466. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  5467. DECLARE_ALL_FUNC_COMMON \
  5468. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5469. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5470. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5471. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
  5472. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
  5473. } FUNCNAME##_Fake; \
  5474. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5475. void FUNCNAME##_reset(void); \
  5476. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
  5477. #define DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  5478. FUNCNAME##_Fake FUNCNAME##_fake; \
  5479. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
  5480. SAVE_ARG(FUNCNAME, 0); \
  5481. SAVE_ARG(FUNCNAME, 1); \
  5482. SAVE_ARG(FUNCNAME, 2); \
  5483. SAVE_ARG(FUNCNAME, 3); \
  5484. SAVE_ARG(FUNCNAME, 4); \
  5485. SAVE_ARG(FUNCNAME, 5); \
  5486. SAVE_ARG(FUNCNAME, 6); \
  5487. SAVE_ARG(FUNCNAME, 7); \
  5488. SAVE_ARG(FUNCNAME, 8); \
  5489. SAVE_ARG(FUNCNAME, 9); \
  5490. SAVE_ARG(FUNCNAME, 10); \
  5491. SAVE_ARG(FUNCNAME, 11); \
  5492. SAVE_ARG(FUNCNAME, 12); \
  5493. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5494. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5495. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5496. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5497. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5498. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5499. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5500. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5501. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5502. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5503. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5504. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  5505. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  5506. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  5507. } \
  5508. else{ \
  5509. HISTORY_DROPPED(FUNCNAME); \
  5510. } \
  5511. INCREMENT_CALL_COUNT(FUNCNAME); \
  5512. REGISTER_CALL(FUNCNAME); \
  5513. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5514. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5515. va_list ap; \
  5516. va_start(ap, arg12); \
  5517. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
  5518. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5519. va_end(ap); \
  5520. return ret; \
  5521. } \
  5522. else{ \
  5523. va_list ap; \
  5524. va_start(ap, arg12); \
  5525. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
  5526. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5527. va_end(ap); \
  5528. return ret; \
  5529. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
  5530. } \
  5531. } \
  5532. if(FUNCNAME##_fake.custom_fake){ \
  5533. RETURN_TYPE ret; \
  5534. va_list ap; \
  5535. va_start(ap, arg12); \
  5536. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
  5537. va_end(ap); \
  5538. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5539. return ret; \
  5540. } \
  5541. RETURN_FAKE_RESULT(FUNCNAME) \
  5542. } \
  5543. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5544. #define FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  5545. DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  5546. DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
  5547. #define DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  5548. typedef struct FUNCNAME##_Fake { \
  5549. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5550. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5551. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5552. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5553. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5554. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5555. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5556. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5557. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5558. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5559. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5560. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  5561. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  5562. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  5563. DECLARE_ALL_FUNC_COMMON \
  5564. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5565. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5566. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5567. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
  5568. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
  5569. } FUNCNAME##_Fake; \
  5570. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5571. void FUNCNAME##_reset(void); \
  5572. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
  5573. #define DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  5574. FUNCNAME##_Fake FUNCNAME##_fake; \
  5575. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
  5576. SAVE_ARG(FUNCNAME, 0); \
  5577. SAVE_ARG(FUNCNAME, 1); \
  5578. SAVE_ARG(FUNCNAME, 2); \
  5579. SAVE_ARG(FUNCNAME, 3); \
  5580. SAVE_ARG(FUNCNAME, 4); \
  5581. SAVE_ARG(FUNCNAME, 5); \
  5582. SAVE_ARG(FUNCNAME, 6); \
  5583. SAVE_ARG(FUNCNAME, 7); \
  5584. SAVE_ARG(FUNCNAME, 8); \
  5585. SAVE_ARG(FUNCNAME, 9); \
  5586. SAVE_ARG(FUNCNAME, 10); \
  5587. SAVE_ARG(FUNCNAME, 11); \
  5588. SAVE_ARG(FUNCNAME, 12); \
  5589. SAVE_ARG(FUNCNAME, 13); \
  5590. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5591. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5592. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5593. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5594. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5595. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5596. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5597. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5598. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5599. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5600. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5601. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  5602. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  5603. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  5604. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  5605. } \
  5606. else{ \
  5607. HISTORY_DROPPED(FUNCNAME); \
  5608. } \
  5609. INCREMENT_CALL_COUNT(FUNCNAME); \
  5610. REGISTER_CALL(FUNCNAME); \
  5611. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5612. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5613. va_list ap; \
  5614. va_start(ap, arg13); \
  5615. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
  5616. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5617. va_end(ap); \
  5618. return ret; \
  5619. } \
  5620. else{ \
  5621. va_list ap; \
  5622. va_start(ap, arg13); \
  5623. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
  5624. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5625. va_end(ap); \
  5626. return ret; \
  5627. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
  5628. } \
  5629. } \
  5630. if(FUNCNAME##_fake.custom_fake){ \
  5631. RETURN_TYPE ret; \
  5632. va_list ap; \
  5633. va_start(ap, arg13); \
  5634. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
  5635. va_end(ap); \
  5636. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5637. return ret; \
  5638. } \
  5639. RETURN_FAKE_RESULT(FUNCNAME) \
  5640. } \
  5641. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5642. #define FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  5643. DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  5644. DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
  5645. #define DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  5646. typedef struct FUNCNAME##_Fake { \
  5647. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5648. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5649. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5650. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5651. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5652. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5653. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5654. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5655. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5656. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5657. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5658. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  5659. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  5660. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  5661. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  5662. DECLARE_ALL_FUNC_COMMON \
  5663. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5664. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5665. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5666. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
  5667. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
  5668. } FUNCNAME##_Fake; \
  5669. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5670. void FUNCNAME##_reset(void); \
  5671. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
  5672. #define DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  5673. FUNCNAME##_Fake FUNCNAME##_fake; \
  5674. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
  5675. SAVE_ARG(FUNCNAME, 0); \
  5676. SAVE_ARG(FUNCNAME, 1); \
  5677. SAVE_ARG(FUNCNAME, 2); \
  5678. SAVE_ARG(FUNCNAME, 3); \
  5679. SAVE_ARG(FUNCNAME, 4); \
  5680. SAVE_ARG(FUNCNAME, 5); \
  5681. SAVE_ARG(FUNCNAME, 6); \
  5682. SAVE_ARG(FUNCNAME, 7); \
  5683. SAVE_ARG(FUNCNAME, 8); \
  5684. SAVE_ARG(FUNCNAME, 9); \
  5685. SAVE_ARG(FUNCNAME, 10); \
  5686. SAVE_ARG(FUNCNAME, 11); \
  5687. SAVE_ARG(FUNCNAME, 12); \
  5688. SAVE_ARG(FUNCNAME, 13); \
  5689. SAVE_ARG(FUNCNAME, 14); \
  5690. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5691. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5692. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5693. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5694. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5695. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5696. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5697. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5698. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5699. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5700. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5701. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  5702. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  5703. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  5704. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  5705. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  5706. } \
  5707. else{ \
  5708. HISTORY_DROPPED(FUNCNAME); \
  5709. } \
  5710. INCREMENT_CALL_COUNT(FUNCNAME); \
  5711. REGISTER_CALL(FUNCNAME); \
  5712. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5713. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5714. va_list ap; \
  5715. va_start(ap, arg14); \
  5716. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
  5717. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5718. va_end(ap); \
  5719. return ret; \
  5720. } \
  5721. else{ \
  5722. va_list ap; \
  5723. va_start(ap, arg14); \
  5724. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
  5725. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5726. va_end(ap); \
  5727. return ret; \
  5728. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
  5729. } \
  5730. } \
  5731. if(FUNCNAME##_fake.custom_fake){ \
  5732. RETURN_TYPE ret; \
  5733. va_list ap; \
  5734. va_start(ap, arg14); \
  5735. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
  5736. va_end(ap); \
  5737. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5738. return ret; \
  5739. } \
  5740. RETURN_FAKE_RESULT(FUNCNAME) \
  5741. } \
  5742. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5743. #define FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  5744. DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  5745. DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
  5746. #define DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  5747. typedef struct FUNCNAME##_Fake { \
  5748. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5749. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5750. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5751. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5752. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5753. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5754. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5755. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5756. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5757. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5758. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5759. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  5760. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  5761. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  5762. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  5763. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  5764. DECLARE_ALL_FUNC_COMMON \
  5765. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5766. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5767. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5768. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
  5769. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
  5770. } FUNCNAME##_Fake; \
  5771. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5772. void FUNCNAME##_reset(void); \
  5773. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
  5774. #define DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  5775. FUNCNAME##_Fake FUNCNAME##_fake; \
  5776. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
  5777. SAVE_ARG(FUNCNAME, 0); \
  5778. SAVE_ARG(FUNCNAME, 1); \
  5779. SAVE_ARG(FUNCNAME, 2); \
  5780. SAVE_ARG(FUNCNAME, 3); \
  5781. SAVE_ARG(FUNCNAME, 4); \
  5782. SAVE_ARG(FUNCNAME, 5); \
  5783. SAVE_ARG(FUNCNAME, 6); \
  5784. SAVE_ARG(FUNCNAME, 7); \
  5785. SAVE_ARG(FUNCNAME, 8); \
  5786. SAVE_ARG(FUNCNAME, 9); \
  5787. SAVE_ARG(FUNCNAME, 10); \
  5788. SAVE_ARG(FUNCNAME, 11); \
  5789. SAVE_ARG(FUNCNAME, 12); \
  5790. SAVE_ARG(FUNCNAME, 13); \
  5791. SAVE_ARG(FUNCNAME, 14); \
  5792. SAVE_ARG(FUNCNAME, 15); \
  5793. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5794. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5795. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5796. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5797. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5798. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5799. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5800. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5801. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5802. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5803. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5804. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  5805. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  5806. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  5807. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  5808. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  5809. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  5810. } \
  5811. else{ \
  5812. HISTORY_DROPPED(FUNCNAME); \
  5813. } \
  5814. INCREMENT_CALL_COUNT(FUNCNAME); \
  5815. REGISTER_CALL(FUNCNAME); \
  5816. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5817. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5818. va_list ap; \
  5819. va_start(ap, arg15); \
  5820. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
  5821. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5822. va_end(ap); \
  5823. return ret; \
  5824. } \
  5825. else{ \
  5826. va_list ap; \
  5827. va_start(ap, arg15); \
  5828. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
  5829. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5830. va_end(ap); \
  5831. return ret; \
  5832. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
  5833. } \
  5834. } \
  5835. if(FUNCNAME##_fake.custom_fake){ \
  5836. RETURN_TYPE ret; \
  5837. va_list ap; \
  5838. va_start(ap, arg15); \
  5839. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
  5840. va_end(ap); \
  5841. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5842. return ret; \
  5843. } \
  5844. RETURN_FAKE_RESULT(FUNCNAME) \
  5845. } \
  5846. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5847. #define FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  5848. DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  5849. DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
  5850. #define DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  5851. typedef struct FUNCNAME##_Fake { \
  5852. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5853. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5854. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5855. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5856. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5857. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5858. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5859. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5860. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5861. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5862. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5863. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  5864. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  5865. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  5866. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  5867. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  5868. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  5869. DECLARE_ALL_FUNC_COMMON \
  5870. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5871. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5872. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5873. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
  5874. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
  5875. } FUNCNAME##_Fake; \
  5876. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5877. void FUNCNAME##_reset(void); \
  5878. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
  5879. #define DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  5880. FUNCNAME##_Fake FUNCNAME##_fake; \
  5881. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
  5882. SAVE_ARG(FUNCNAME, 0); \
  5883. SAVE_ARG(FUNCNAME, 1); \
  5884. SAVE_ARG(FUNCNAME, 2); \
  5885. SAVE_ARG(FUNCNAME, 3); \
  5886. SAVE_ARG(FUNCNAME, 4); \
  5887. SAVE_ARG(FUNCNAME, 5); \
  5888. SAVE_ARG(FUNCNAME, 6); \
  5889. SAVE_ARG(FUNCNAME, 7); \
  5890. SAVE_ARG(FUNCNAME, 8); \
  5891. SAVE_ARG(FUNCNAME, 9); \
  5892. SAVE_ARG(FUNCNAME, 10); \
  5893. SAVE_ARG(FUNCNAME, 11); \
  5894. SAVE_ARG(FUNCNAME, 12); \
  5895. SAVE_ARG(FUNCNAME, 13); \
  5896. SAVE_ARG(FUNCNAME, 14); \
  5897. SAVE_ARG(FUNCNAME, 15); \
  5898. SAVE_ARG(FUNCNAME, 16); \
  5899. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  5900. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  5901. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  5902. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  5903. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  5904. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  5905. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  5906. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  5907. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  5908. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  5909. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  5910. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  5911. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  5912. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  5913. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  5914. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  5915. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  5916. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  5917. } \
  5918. else{ \
  5919. HISTORY_DROPPED(FUNCNAME); \
  5920. } \
  5921. INCREMENT_CALL_COUNT(FUNCNAME); \
  5922. REGISTER_CALL(FUNCNAME); \
  5923. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  5924. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  5925. va_list ap; \
  5926. va_start(ap, arg16); \
  5927. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
  5928. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5929. va_end(ap); \
  5930. return ret; \
  5931. } \
  5932. else{ \
  5933. va_list ap; \
  5934. va_start(ap, arg16); \
  5935. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
  5936. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5937. va_end(ap); \
  5938. return ret; \
  5939. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
  5940. } \
  5941. } \
  5942. if(FUNCNAME##_fake.custom_fake){ \
  5943. RETURN_TYPE ret; \
  5944. va_list ap; \
  5945. va_start(ap, arg16); \
  5946. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
  5947. va_end(ap); \
  5948. SAVE_RET_HISTORY(FUNCNAME, ret); \
  5949. return ret; \
  5950. } \
  5951. RETURN_FAKE_RESULT(FUNCNAME) \
  5952. } \
  5953. DEFINE_RESET_FUNCTION(FUNCNAME) \
  5954. #define FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  5955. DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  5956. DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
  5957. #define DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  5958. typedef struct FUNCNAME##_Fake { \
  5959. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  5960. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  5961. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  5962. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  5963. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  5964. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  5965. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  5966. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  5967. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  5968. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  5969. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  5970. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  5971. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  5972. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  5973. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  5974. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  5975. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  5976. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  5977. DECLARE_ALL_FUNC_COMMON \
  5978. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  5979. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  5980. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  5981. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
  5982. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
  5983. } FUNCNAME##_Fake; \
  5984. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  5985. void FUNCNAME##_reset(void); \
  5986. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
  5987. #define DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  5988. FUNCNAME##_Fake FUNCNAME##_fake; \
  5989. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
  5990. SAVE_ARG(FUNCNAME, 0); \
  5991. SAVE_ARG(FUNCNAME, 1); \
  5992. SAVE_ARG(FUNCNAME, 2); \
  5993. SAVE_ARG(FUNCNAME, 3); \
  5994. SAVE_ARG(FUNCNAME, 4); \
  5995. SAVE_ARG(FUNCNAME, 5); \
  5996. SAVE_ARG(FUNCNAME, 6); \
  5997. SAVE_ARG(FUNCNAME, 7); \
  5998. SAVE_ARG(FUNCNAME, 8); \
  5999. SAVE_ARG(FUNCNAME, 9); \
  6000. SAVE_ARG(FUNCNAME, 10); \
  6001. SAVE_ARG(FUNCNAME, 11); \
  6002. SAVE_ARG(FUNCNAME, 12); \
  6003. SAVE_ARG(FUNCNAME, 13); \
  6004. SAVE_ARG(FUNCNAME, 14); \
  6005. SAVE_ARG(FUNCNAME, 15); \
  6006. SAVE_ARG(FUNCNAME, 16); \
  6007. SAVE_ARG(FUNCNAME, 17); \
  6008. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  6009. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  6010. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  6011. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  6012. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  6013. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  6014. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  6015. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  6016. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  6017. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  6018. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  6019. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  6020. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  6021. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  6022. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  6023. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  6024. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  6025. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  6026. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  6027. } \
  6028. else{ \
  6029. HISTORY_DROPPED(FUNCNAME); \
  6030. } \
  6031. INCREMENT_CALL_COUNT(FUNCNAME); \
  6032. REGISTER_CALL(FUNCNAME); \
  6033. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  6034. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  6035. va_list ap; \
  6036. va_start(ap, arg17); \
  6037. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
  6038. SAVE_RET_HISTORY(FUNCNAME, ret); \
  6039. va_end(ap); \
  6040. return ret; \
  6041. } \
  6042. else{ \
  6043. va_list ap; \
  6044. va_start(ap, arg17); \
  6045. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
  6046. SAVE_RET_HISTORY(FUNCNAME, ret); \
  6047. va_end(ap); \
  6048. return ret; \
  6049. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
  6050. } \
  6051. } \
  6052. if(FUNCNAME##_fake.custom_fake){ \
  6053. RETURN_TYPE ret; \
  6054. va_list ap; \
  6055. va_start(ap, arg17); \
  6056. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
  6057. va_end(ap); \
  6058. SAVE_RET_HISTORY(FUNCNAME, ret); \
  6059. return ret; \
  6060. } \
  6061. RETURN_FAKE_RESULT(FUNCNAME) \
  6062. } \
  6063. DEFINE_RESET_FUNCTION(FUNCNAME) \
  6064. #define FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  6065. DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  6066. DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
  6067. #define DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  6068. typedef struct FUNCNAME##_Fake { \
  6069. DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
  6070. DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
  6071. DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
  6072. DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
  6073. DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
  6074. DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
  6075. DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
  6076. DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
  6077. DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
  6078. DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
  6079. DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
  6080. DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
  6081. DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
  6082. DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
  6083. DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
  6084. DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
  6085. DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
  6086. DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
  6087. DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
  6088. DECLARE_ALL_FUNC_COMMON \
  6089. DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
  6090. DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
  6091. DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
  6092. RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
  6093. RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
  6094. } FUNCNAME##_Fake; \
  6095. extern FUNCNAME##_Fake FUNCNAME##_fake; \
  6096. void FUNCNAME##_reset(void); \
  6097. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
  6098. #define DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  6099. FUNCNAME##_Fake FUNCNAME##_fake; \
  6100. RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
  6101. SAVE_ARG(FUNCNAME, 0); \
  6102. SAVE_ARG(FUNCNAME, 1); \
  6103. SAVE_ARG(FUNCNAME, 2); \
  6104. SAVE_ARG(FUNCNAME, 3); \
  6105. SAVE_ARG(FUNCNAME, 4); \
  6106. SAVE_ARG(FUNCNAME, 5); \
  6107. SAVE_ARG(FUNCNAME, 6); \
  6108. SAVE_ARG(FUNCNAME, 7); \
  6109. SAVE_ARG(FUNCNAME, 8); \
  6110. SAVE_ARG(FUNCNAME, 9); \
  6111. SAVE_ARG(FUNCNAME, 10); \
  6112. SAVE_ARG(FUNCNAME, 11); \
  6113. SAVE_ARG(FUNCNAME, 12); \
  6114. SAVE_ARG(FUNCNAME, 13); \
  6115. SAVE_ARG(FUNCNAME, 14); \
  6116. SAVE_ARG(FUNCNAME, 15); \
  6117. SAVE_ARG(FUNCNAME, 16); \
  6118. SAVE_ARG(FUNCNAME, 17); \
  6119. SAVE_ARG(FUNCNAME, 18); \
  6120. if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
  6121. SAVE_ARG_HISTORY(FUNCNAME, 0); \
  6122. SAVE_ARG_HISTORY(FUNCNAME, 1); \
  6123. SAVE_ARG_HISTORY(FUNCNAME, 2); \
  6124. SAVE_ARG_HISTORY(FUNCNAME, 3); \
  6125. SAVE_ARG_HISTORY(FUNCNAME, 4); \
  6126. SAVE_ARG_HISTORY(FUNCNAME, 5); \
  6127. SAVE_ARG_HISTORY(FUNCNAME, 6); \
  6128. SAVE_ARG_HISTORY(FUNCNAME, 7); \
  6129. SAVE_ARG_HISTORY(FUNCNAME, 8); \
  6130. SAVE_ARG_HISTORY(FUNCNAME, 9); \
  6131. SAVE_ARG_HISTORY(FUNCNAME, 10); \
  6132. SAVE_ARG_HISTORY(FUNCNAME, 11); \
  6133. SAVE_ARG_HISTORY(FUNCNAME, 12); \
  6134. SAVE_ARG_HISTORY(FUNCNAME, 13); \
  6135. SAVE_ARG_HISTORY(FUNCNAME, 14); \
  6136. SAVE_ARG_HISTORY(FUNCNAME, 15); \
  6137. SAVE_ARG_HISTORY(FUNCNAME, 16); \
  6138. SAVE_ARG_HISTORY(FUNCNAME, 17); \
  6139. SAVE_ARG_HISTORY(FUNCNAME, 18); \
  6140. } \
  6141. else{ \
  6142. HISTORY_DROPPED(FUNCNAME); \
  6143. } \
  6144. INCREMENT_CALL_COUNT(FUNCNAME); \
  6145. REGISTER_CALL(FUNCNAME); \
  6146. if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
  6147. if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
  6148. va_list ap; \
  6149. va_start(ap, arg18); \
  6150. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
  6151. SAVE_RET_HISTORY(FUNCNAME, ret); \
  6152. va_end(ap); \
  6153. return ret; \
  6154. } \
  6155. else{ \
  6156. va_list ap; \
  6157. va_start(ap, arg18); \
  6158. RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
  6159. SAVE_RET_HISTORY(FUNCNAME, ret); \
  6160. va_end(ap); \
  6161. return ret; \
  6162. return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
  6163. } \
  6164. } \
  6165. if(FUNCNAME##_fake.custom_fake){ \
  6166. RETURN_TYPE ret; \
  6167. va_list ap; \
  6168. va_start(ap, arg18); \
  6169. ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
  6170. va_end(ap); \
  6171. SAVE_RET_HISTORY(FUNCNAME, ret); \
  6172. return ret; \
  6173. } \
  6174. RETURN_FAKE_RESULT(FUNCNAME) \
  6175. } \
  6176. DEFINE_RESET_FUNCTION(FUNCNAME) \
  6177. #define FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  6178. DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  6179. DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
  6180. /* MSVC expand macro fix */
  6181. #define EXPAND(x) x
  6182. #define PP_NARG_MINUS2(...) EXPAND(PP_NARG_MINUS2_(__VA_ARGS__, PP_RSEQ_N_MINUS2()))
  6183. #define PP_NARG_MINUS2_(...) EXPAND(PP_ARG_MINUS2_N(__VA_ARGS__))
  6184. #define PP_ARG_MINUS2_N(returnVal, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N
  6185. #define PP_RSEQ_N_MINUS2() 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
  6186. #define PP_NARG_MINUS1(...) EXPAND(PP_NARG_MINUS1_(__VA_ARGS__, PP_RSEQ_N_MINUS1()))
  6187. #define PP_NARG_MINUS1_(...) EXPAND(PP_ARG_MINUS1_N(__VA_ARGS__))
  6188. #define PP_ARG_MINUS1_N( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N
  6189. #define PP_RSEQ_N_MINUS1() 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
  6190. /* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
  6191. #define FAKE_VALUE_FUNC(...) EXPAND(FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
  6192. #define FUNC_VALUE_(N,...) EXPAND(FUNC_VALUE_N(N,__VA_ARGS__))
  6193. #define FUNC_VALUE_N(N,...) EXPAND(FAKE_VALUE_FUNC ## N(__VA_ARGS__))
  6194. #define FAKE_VOID_FUNC(...) EXPAND(FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
  6195. #define FUNC_VOID_(N,...) EXPAND(FUNC_VOID_N(N,__VA_ARGS__))
  6196. #define FUNC_VOID_N(N,...) EXPAND(FAKE_VOID_FUNC ## N(__VA_ARGS__))
  6197. #define FAKE_VALUE_FUNC_VARARG(...) EXPAND(FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
  6198. #define FUNC_VALUE_VARARG_(N,...) EXPAND(FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
  6199. #define FUNC_VALUE_VARARG_N(N,...) EXPAND(FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
  6200. #define FAKE_VOID_FUNC_VARARG(...) EXPAND(FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
  6201. #define FUNC_VOID_VARARG_(N,...) EXPAND(FUNC_VOID_VARARG_N(N,__VA_ARGS__))
  6202. #define FUNC_VOID_VARARG_N(N,...) EXPAND(FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
  6203. /* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
  6204. #define DECLARE_FAKE_VALUE_FUNC(...) EXPAND(DECLARE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
  6205. #define DECLARE_FUNC_VALUE_(N,...) EXPAND(DECLARE_FUNC_VALUE_N(N,__VA_ARGS__))
  6206. #define DECLARE_FUNC_VALUE_N(N,...) EXPAND(DECLARE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
  6207. #define DECLARE_FAKE_VOID_FUNC(...) EXPAND(DECLARE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
  6208. #define DECLARE_FUNC_VOID_(N,...) EXPAND(DECLARE_FUNC_VOID_N(N,__VA_ARGS__))
  6209. #define DECLARE_FUNC_VOID_N(N,...) EXPAND(DECLARE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
  6210. #define DECLARE_FAKE_VALUE_FUNC_VARARG(...) EXPAND(DECLARE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
  6211. #define DECLARE_FUNC_VALUE_VARARG_(N,...) EXPAND(DECLARE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
  6212. #define DECLARE_FUNC_VALUE_VARARG_N(N,...) EXPAND(DECLARE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
  6213. #define DECLARE_FAKE_VOID_FUNC_VARARG(...) EXPAND(DECLARE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
  6214. #define DECLARE_FUNC_VOID_VARARG_(N,...) EXPAND(DECLARE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
  6215. #define DECLARE_FUNC_VOID_VARARG_N(N,...) EXPAND(DECLARE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
  6216. /* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
  6217. #define DEFINE_FAKE_VALUE_FUNC(...) EXPAND(DEFINE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
  6218. #define DEFINE_FUNC_VALUE_(N,...) EXPAND(DEFINE_FUNC_VALUE_N(N,__VA_ARGS__))
  6219. #define DEFINE_FUNC_VALUE_N(N,...) EXPAND(DEFINE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
  6220. #define DEFINE_FAKE_VOID_FUNC(...) EXPAND(DEFINE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
  6221. #define DEFINE_FUNC_VOID_(N,...) EXPAND(DEFINE_FUNC_VOID_N(N,__VA_ARGS__))
  6222. #define DEFINE_FUNC_VOID_N(N,...) EXPAND(DEFINE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
  6223. #define DEFINE_FAKE_VALUE_FUNC_VARARG(...) EXPAND(DEFINE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
  6224. #define DEFINE_FUNC_VALUE_VARARG_(N,...) EXPAND(DEFINE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
  6225. #define DEFINE_FUNC_VALUE_VARARG_N(N,...) EXPAND(DEFINE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
  6226. #define DEFINE_FAKE_VOID_FUNC_VARARG(...) EXPAND(DEFINE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
  6227. #define DEFINE_FUNC_VOID_VARARG_(N,...) EXPAND(DEFINE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
  6228. #define DEFINE_FUNC_VOID_VARARG_N(N,...) EXPAND(DEFINE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
  6229. #endif /* FAKE_FUNCTIONS */