27503.patch 423 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583
  1. diff --git a/mingw-w64-tools/widl/src/client.c b/mingw-w64-tools/widl/src/client.c
  2. index a3b2bbb6..d27c6cad 100644
  3. --- a/mingw-w64-tools/widl/src/client.c
  4. +++ b/mingw-w64-tools/widl/src/client.c
  5. @@ -20,7 +20,7 @@
  6. #include "config.h"
  7. #include "wine/port.h"
  8. -
  9. +
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #ifdef HAVE_UNISTD_H
  13. @@ -34,7 +34,7 @@
  14. #include "parser.h"
  15. #include "header.h"
  16. -#include "widltypes.h"
  17. +#include "typetree.h"
  18. #include "typegen.h"
  19. #include "expr.h"
  20. @@ -52,12 +52,13 @@ static void print_client( const char *format, ... )
  21. static void write_client_func_decl( const type_t *iface, const var_t *func )
  22. {
  23. - const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
  24. - const var_list_t *args = type_get_function_args(func->type);
  25. - type_t *rettype = type_function_get_rettype(func->type);
  26. + const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
  27. + const var_list_t *args = type_function_get_args(func->declspec.type);
  28. + const decl_spec_t *retdeclspec = type_function_get_retdeclspec(func->declspec.type);
  29. if (!callconv) callconv = "__cdecl";
  30. - write_type_decl_left(client, rettype);
  31. + write_declspec_decl_left(client, retdeclspec);
  32. + if (func->declspec.funcspecifier == FUNCTION_SPECIFIER_INLINE) fprintf(client, " inline");
  33. fprintf(client, " %s ", callconv);
  34. fprintf(client, "%s%s(\n", prefix_client, get_name(func));
  35. indent++;
  36. @@ -74,9 +75,9 @@ static void write_function_stub( const type_t *iface, const var_t *func,
  37. {
  38. unsigned char explicit_fc, implicit_fc;
  39. int has_full_pointer = is_full_pointer_function(func);
  40. - var_t *retval = type_function_get_retval(func->type);
  41. + var_t *retval = type_function_get_retval(func->declspec.type);
  42. const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
  43. - int has_ret = !is_void(retval->type);
  44. + int has_ret = !is_void(retval->declspec.type);
  45. if (is_interpreted_func( iface, func ))
  46. {
  47. @@ -97,7 +98,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
  48. print_client("RPC_BINDING_HANDLE _Handle;\n");
  49. }
  50. - if (has_ret && decl_indirect(retval->type))
  51. + if (has_ret && decl_indirect(retval->declspec.type))
  52. {
  53. print_client("void *_p_%s;\n", retval->name);
  54. }
  55. @@ -136,7 +137,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
  56. if (has_ret)
  57. {
  58. print_client("%s", "");
  59. - write_type_decl(client, retval->type, retval->name);
  60. + write_declspec_decl(client, &retval->declspec, retval->name);
  61. fprintf(client, ";\n");
  62. }
  63. print_client("RPC_MESSAGE _RpcMessage;\n");
  64. @@ -147,7 +148,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
  65. if (explicit_fc == FC_BIND_GENERIC)
  66. print_client("__frame->%s = %s;\n", handle_var->name, handle_var->name );
  67. }
  68. - if (has_ret && decl_indirect(retval->type))
  69. + if (has_ret && decl_indirect(retval->declspec.type))
  70. {
  71. print_client("__frame->_p_%s = &%s;\n", retval->name, retval->name);
  72. }
  73. @@ -194,7 +195,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
  74. /* if the context_handle attribute appears in the chain of types
  75. * without pointers being followed, then the context handle must
  76. * be direct, otherwise it is a pointer */
  77. - int is_ch_ptr = !is_aliaschain_attr(handle_var->type, ATTR_CONTEXTHANDLE);
  78. + int is_ch_ptr = !is_aliaschain_attr(handle_var->declspec.type, ATTR_CONTEXTHANDLE);
  79. print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", handle_var->name);
  80. indent++;
  81. print_client("__frame->_Handle = NDRCContextBinding(%s%s);\n",
  82. @@ -257,9 +258,9 @@ static void write_function_stub( const type_t *iface, const var_t *func,
  83. /* unmarshal return value */
  84. if (has_ret)
  85. {
  86. - if (decl_indirect(retval->type))
  87. + if (decl_indirect(retval->declspec.type))
  88. print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", retval->name, retval->name);
  89. - else if (is_ptr(retval->type) || is_array(retval->type))
  90. + else if (is_ptr(retval->declspec.type) || is_array(retval->declspec.type))
  91. print_client("%s = 0;\n", retval->name);
  92. write_remoting_arguments(client, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL);
  93. }
  94. @@ -291,7 +292,7 @@ static void write_serialize_function(FILE *file, const type_t *type, const type_
  95. const char *func_name, const char *ret_type)
  96. {
  97. enum stub_mode mode = get_stub_mode();
  98. - static int emited_pickling_info;
  99. + static int emitted_pickling_info;
  100. if (iface && !type->typestring_offset)
  101. {
  102. @@ -301,7 +302,7 @@ static void write_serialize_function(FILE *file, const type_t *type, const type_
  103. return;
  104. }
  105. - if (!emited_pickling_info && iface && mode != MODE_Os)
  106. + if (!emitted_pickling_info && iface && mode != MODE_Os)
  107. {
  108. fprintf(file, "static const MIDL_TYPE_PICKLING_INFO __MIDL_TypePicklingInfo =\n");
  109. fprintf(file, "{\n");
  110. @@ -312,7 +313,7 @@ static void write_serialize_function(FILE *file, const type_t *type, const type_
  111. fprintf(file, " 0\n");
  112. fprintf(file, "};\n");
  113. fprintf(file, "\n");
  114. - emited_pickling_info = 1;
  115. + emitted_pickling_info = 1;
  116. }
  117. /* FIXME: Assuming explicit handle */
  118. @@ -365,8 +366,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
  119. case STMT_DECLARATION:
  120. {
  121. const var_t *func = stmt->u.var;
  122. - if (stmt->u.var->stgclass != STG_NONE
  123. - || type_get_type_detect_alias(stmt->u.var->type) != TYPE_FUNCTION)
  124. + if (stmt->u.var->declspec.stgclass != STG_NONE
  125. + || type_get_type_detect_alias(stmt->u.var->declspec.type) != TYPE_FUNCTION)
  126. continue;
  127. write_function_stub( iface, func, method_count++, *proc_offset );
  128. *proc_offset += get_size_procformatstring_func( iface, func );
  129. @@ -425,7 +426,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
  130. print_client("1, /* -error bounds_check flag */\n");
  131. print_client("0x%x, /* Ndr library version */\n", get_stub_mode() == MODE_Oif ? 0x50002 : 0x10001);
  132. print_client("0,\n");
  133. - print_client("0x50100a4, /* MIDL Version 5.1.164 */\n");
  134. + print_client("0x50200ca, /* MIDL Version 5.2.202 */\n");
  135. print_client("0,\n");
  136. print_client("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
  137. print_client("0, /* notify & notify_flag routine table */\n");
  138. @@ -488,7 +489,7 @@ static void write_implicithandledecl(type_t *iface)
  139. if (implicit_handle)
  140. {
  141. - write_type_decl( client, implicit_handle->type, implicit_handle->name );
  142. + write_declspec_decl( client, &implicit_handle->declspec, implicit_handle->name );
  143. fprintf(client, ";\n\n");
  144. }
  145. }
  146. @@ -532,8 +533,8 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
  147. LIST_FOR_EACH_ENTRY(stmt2, type_iface_get_stmts(iface), const statement_t, entry)
  148. {
  149. - if (stmt2->type == STMT_DECLARATION && stmt2->u.var->stgclass == STG_NONE &&
  150. - type_get_type_detect_alias(stmt2->u.var->type) == TYPE_FUNCTION)
  151. + if (stmt2->type == STMT_DECLARATION && stmt2->u.var->declspec.stgclass == STG_NONE &&
  152. + type_get_type_detect_alias(stmt2->u.var->declspec.type) == TYPE_FUNCTION)
  153. {
  154. needs_stub = 1;
  155. break;
  156. @@ -627,26 +628,6 @@ void write_client(const statement_list_t *stmts)
  157. if (!client)
  158. return;
  159. - if (do_win32 && do_win64)
  160. - {
  161. - fprintf(client, "#ifndef _WIN64\n\n");
  162. - pointer_size = 4;
  163. - write_client_routines( stmts );
  164. - fprintf(client, "\n#else /* _WIN64 */\n\n");
  165. - pointer_size = 8;
  166. - write_client_routines( stmts );
  167. - fprintf(client, "\n#endif /* _WIN64 */\n");
  168. - }
  169. - else if (do_win32)
  170. - {
  171. - pointer_size = 4;
  172. - write_client_routines( stmts );
  173. - }
  174. - else if (do_win64)
  175. - {
  176. - pointer_size = 8;
  177. - write_client_routines( stmts );
  178. - }
  179. -
  180. + write_client_routines( stmts );
  181. fclose(client);
  182. }
  183. diff --git a/mingw-w64-tools/widl/src/expr.c b/mingw-w64-tools/widl/src/expr.c
  184. index 2ed4aff6..2f075816 100644
  185. --- a/mingw-w64-tools/widl/src/expr.c
  186. +++ b/mingw-w64-tools/widl/src/expr.c
  187. @@ -194,10 +194,10 @@ expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr)
  188. expr_t *e;
  189. type_t *tref;
  190. - if (var->stgclass != STG_NONE && var->stgclass != STG_REGISTER)
  191. + if (var->declspec.stgclass != STG_NONE && var->declspec.stgclass != STG_REGISTER)
  192. error_loc("invalid storage class for type expression\n");
  193. - tref = var->type;
  194. + tref = var->declspec.type;
  195. e = xmalloc(sizeof(expr_t));
  196. e->type = type;
  197. @@ -474,7 +474,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
  198. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  199. if (field->name && !strcmp(identifier, field->name))
  200. {
  201. - type = field->type;
  202. + type = field->declspec.type;
  203. *found_in_cont_type = 1;
  204. break;
  205. }
  206. @@ -482,7 +482,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
  207. if (!type)
  208. {
  209. var_t *const_var = find_const(identifier, 0);
  210. - if (const_var) type = const_var->type;
  211. + if (const_var) type = const_var->declspec.type;
  212. }
  213. return type;
  214. @@ -521,11 +521,11 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
  215. break;
  216. case EXPR_STRLIT:
  217. result.is_temporary = TRUE;
  218. - result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_CHAR, 0), NULL);
  219. + result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_CHAR, 0));
  220. break;
  221. case EXPR_WSTRLIT:
  222. result.is_temporary = TRUE;
  223. - result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0), NULL);
  224. + result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0));
  225. break;
  226. case EXPR_CHARCONST:
  227. result.is_temporary = TRUE;
  228. @@ -575,15 +575,15 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
  229. expr_loc->attr ? expr_loc->attr : "");
  230. result.is_variable = FALSE;
  231. result.is_temporary = TRUE;
  232. - result.type = type_new_pointer(FC_UP, result.type, NULL);
  233. + result.type = type_new_pointer(FC_UP, result.type);
  234. break;
  235. case EXPR_PPTR:
  236. result = resolve_expression(expr_loc, cont_type, e->ref);
  237. if (result.type && is_ptr(result.type))
  238. - result.type = type_pointer_get_ref(result.type);
  239. + result.type = type_pointer_get_ref_type(result.type);
  240. else if(result.type && is_array(result.type)
  241. && type_array_is_decl_as_ptr(result.type))
  242. - result.type = type_array_get_element(result.type);
  243. + result.type = type_array_get_element_type(result.type);
  244. else
  245. error_loc_info(&expr_loc->v->loc_info, "dereference operator applied to non-pointer type in expression%s%s\n",
  246. expr_loc->attr ? " for attribute " : "",
  247. @@ -665,7 +665,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
  248. if (result.type && is_array(result.type))
  249. {
  250. struct expression_type index_result;
  251. - result.type = type_array_get_element(result.type);
  252. + result.type = type_array_get_element_type(result.type);
  253. index_result = resolve_expression(expr_loc, cont_type /* FIXME */, e->u.ext);
  254. if (!index_result.type || !is_integer_type(index_result.type))
  255. error_loc_info(&expr_loc->v->loc_info, "array subscript not of integral type in expression%s%s\n",
  256. diff --git a/mingw-w64-tools/widl/src/header.c b/mingw-w64-tools/widl/src/header.c
  257. index defc7f85..d0d0dc4b 100644
  258. --- a/mingw-w64-tools/widl/src/header.c
  259. +++ b/mingw-w64-tools/widl/src/header.c
  260. @@ -43,7 +43,7 @@ user_type_list_t user_type_list = LIST_INIT(user_type_list);
  261. context_handle_list_t context_handle_list = LIST_INIT(context_handle_list);
  262. generic_handle_list_t generic_handle_list = LIST_INIT(generic_handle_list);
  263. -static void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name);
  264. +static void write_type_v(FILE *h, const decl_spec_t *ds, int is_field, int declonly, const char *name);
  265. static void indent(FILE *h, int delta)
  266. {
  267. @@ -69,15 +69,15 @@ int is_ptrchain_attr(const var_t *var, enum attr_type t)
  268. return 1;
  269. else
  270. {
  271. - type_t *type = var->type;
  272. + type_t *type = var->declspec.type;
  273. for (;;)
  274. {
  275. if (is_attr(type->attrs, t))
  276. return 1;
  277. else if (type_is_alias(type))
  278. - type = type_alias_get_aliasee(type);
  279. + type = type_alias_get_aliasee_type(type);
  280. else if (is_ptr(type))
  281. - type = type_pointer_get_ref(type);
  282. + type = type_pointer_get_ref_type(type);
  283. else return 0;
  284. }
  285. }
  286. @@ -91,7 +91,7 @@ int is_aliaschain_attr(const type_t *type, enum attr_type attr)
  287. if (is_attr(t->attrs, attr))
  288. return 1;
  289. else if (type_is_alias(t))
  290. - t = type_alias_get_aliasee(t);
  291. + t = type_alias_get_aliasee_type(t);
  292. else return 0;
  293. }
  294. }
  295. @@ -204,9 +204,9 @@ static void write_fields(FILE *h, var_list_t *fields)
  296. if (!fields) return;
  297. LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) {
  298. - if (!v || !v->type) continue;
  299. + if (!v || !v->declspec.type) continue;
  300. - switch(type_get_type_detect_alias(v->type)) {
  301. + switch(type_get_type_detect_alias(v->declspec.type)) {
  302. case TYPE_STRUCT:
  303. case TYPE_ENCAPSULATED_UNION:
  304. nameless_struct_cnt++;
  305. @@ -220,12 +220,12 @@ static void write_fields(FILE *h, var_list_t *fields)
  306. }
  307. LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) {
  308. - if (!v || !v->type) continue;
  309. + if (!v || !v->declspec.type) continue;
  310. indent(h, 0);
  311. name = v->name;
  312. - switch(type_get_type_detect_alias(v->type)) {
  313. + switch(type_get_type_detect_alias(v->declspec.type)) {
  314. case TYPE_STRUCT:
  315. case TYPE_ENCAPSULATED_UNION:
  316. if(!v->name) {
  317. @@ -252,7 +252,7 @@ static void write_fields(FILE *h, var_list_t *fields)
  318. default:
  319. ;
  320. }
  321. - write_type_def_or_decl(h, v->type, TRUE, name);
  322. + write_type_v(h, &v->declspec, TRUE, v->declonly, name);
  323. fprintf(h, ";\n");
  324. }
  325. }
  326. @@ -295,14 +295,21 @@ static void write_pointer_left(FILE *h, type_t *ref)
  327. }
  328. void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
  329. +{
  330. + decl_spec_t ds;
  331. + write_declspec_left(h, init_declspec(&ds, t), name_type, declonly);
  332. +}
  333. +
  334. +void write_declspec_left(FILE* h, const decl_spec_t *ds, enum name_type name_type, int declonly)
  335. {
  336. const char *name;
  337. + type_t *t = ds->type;
  338. if (!h) return;
  339. name = type_get_name(t, name_type);
  340. - if (is_attr(t->attrs, ATTR_CONST) &&
  341. + if ((ds->typequalifier == TYPE_QUALIFIER_CONST) &&
  342. (type_is_alias(t) || !is_ptr(t)))
  343. fprintf(h, "const ");
  344. @@ -310,7 +317,7 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
  345. else {
  346. switch (type_get_type_detect_alias(t)) {
  347. case TYPE_ENUM:
  348. - if (!declonly && t->defined && !t->written) {
  349. + if (!declonly && type_is_defined(t) && !t->written) {
  350. if (name) fprintf(h, "enum %s {\n", name);
  351. else fprintf(h, "enum {\n");
  352. t->written = TRUE;
  353. @@ -323,7 +330,7 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
  354. break;
  355. case TYPE_STRUCT:
  356. case TYPE_ENCAPSULATED_UNION:
  357. - if (!declonly && t->defined && !t->written) {
  358. + if (!declonly && type_is_defined(t) && !t->written) {
  359. if (name) fprintf(h, "struct %s {\n", name);
  360. else fprintf(h, "struct {\n");
  361. t->written = TRUE;
  362. @@ -338,7 +345,7 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
  363. else fprintf(h, "struct %s", name ? name : "");
  364. break;
  365. case TYPE_UNION:
  366. - if (!declonly && t->defined && !t->written) {
  367. + if (!declonly && type_is_defined(t) && !t->written) {
  368. if (t->name) fprintf(h, "union %s {\n", t->name);
  369. else fprintf(h, "union {\n");
  370. t->written = TRUE;
  371. @@ -351,9 +358,9 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
  372. break;
  373. case TYPE_POINTER:
  374. {
  375. - write_type_left(h, type_pointer_get_ref(t), name_type, declonly);
  376. - write_pointer_left(h, type_pointer_get_ref(t));
  377. - if (is_attr(t->attrs, ATTR_CONST)) fprintf(h, "const ");
  378. + write_declspec_left(h, type_pointer_get_ref(t), name_type, declonly);
  379. + write_pointer_left(h, type_pointer_get_ref_type(t));
  380. + if (ds->typequalifier == TYPE_QUALIFIER_CONST) fprintf(h, "const ");
  381. break;
  382. }
  383. case TYPE_ARRAY:
  384. @@ -361,9 +368,9 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
  385. fprintf(h, "%s", t->name);
  386. else
  387. {
  388. - write_type_left(h, type_array_get_element(t), name_type, declonly);
  389. + write_declspec_left(h, type_array_get_element(t), name_type, declonly);
  390. if (type_array_is_decl_as_ptr(t))
  391. - write_pointer_left(h, type_array_get_element(t));
  392. + write_pointer_left(h, type_array_get_element_type(t));
  393. }
  394. break;
  395. case TYPE_BASIC:
  396. @@ -443,7 +450,7 @@ void write_type_right(FILE *h, type_t *t, int is_field)
  397. {
  398. case TYPE_ARRAY:
  399. {
  400. - type_t *elem = type_array_get_element(t);
  401. + type_t *elem = type_array_get_element_type(t);
  402. if (type_array_is_decl_as_ptr(t))
  403. {
  404. if (!type_is_alias(elem) && is_array(elem) && !type_array_is_decl_as_ptr(elem))
  405. @@ -461,7 +468,7 @@ void write_type_right(FILE *h, type_t *t, int is_field)
  406. }
  407. case TYPE_POINTER:
  408. {
  409. - type_t *ref = type_pointer_get_ref(t);
  410. + type_t *ref = type_pointer_get_ref_type(t);
  411. if (!type_is_alias(ref) && is_array(ref) && !type_array_is_decl_as_ptr(ref))
  412. fprintf(h, ")");
  413. write_type_right(h, ref, FALSE);
  414. @@ -485,30 +492,33 @@ void write_type_right(FILE *h, type_t *t, int is_field)
  415. }
  416. }
  417. -static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const char *name)
  418. +static void write_type_v(FILE *h, const decl_spec_t *ds, int is_field, int declonly, const char *name)
  419. {
  420. + type_t *t = ds->type;
  421. type_t *pt = NULL;
  422. int ptr_level = 0;
  423. if (!h) return;
  424. if (t) {
  425. - for (pt = t; is_ptr(pt); pt = type_pointer_get_ref(pt), ptr_level++)
  426. + const decl_spec_t *dpt = NULL;
  427. + for (dpt = ds; is_ptr(dpt->type); dpt = type_pointer_get_ref(dpt->type), ptr_level++)
  428. ;
  429. + pt = dpt->type;
  430. if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
  431. int i;
  432. const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV);
  433. if (!callconv && is_object_interface) callconv = "STDMETHODCALLTYPE";
  434. - if (is_attr(pt->attrs, ATTR_INLINE)) fprintf(h, "inline ");
  435. - write_type_left(h, type_function_get_rettype(pt), NAME_DEFAULT, declonly);
  436. + if (!is_ptr(ds->type) && dpt->funcspecifier == FUNCTION_SPECIFIER_INLINE) fprintf(h, "inline ");
  437. + write_declspec_left(h, type_function_get_retdeclspec(pt), NAME_DEFAULT, declonly);
  438. fputc(' ', h);
  439. if (ptr_level) fputc('(', h);
  440. if (callconv) fprintf(h, "%s ", callconv);
  441. for (i = 0; i < ptr_level; i++)
  442. fputc('*', h);
  443. } else
  444. - write_type_left(h, t, NAME_DEFAULT, declonly);
  445. + write_declspec_left(h, ds, NAME_DEFAULT, declonly);
  446. }
  447. if (name) fprintf(h, "%s%s", !t || needs_space_after(t) ? " " : "", name );
  448. @@ -529,12 +539,7 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
  449. }
  450. }
  451. -static void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name)
  452. -{
  453. - write_type_v(f, t, field, FALSE, name);
  454. -}
  455. -
  456. -static void write_type_definition(FILE *f, type_t *t)
  457. +static void write_type_definition(FILE *f, type_t *t, int declonly)
  458. {
  459. int in_namespace = t->namespace && !is_global_namespace(t->namespace);
  460. int save_written = t->written;
  461. @@ -545,14 +550,14 @@ static void write_type_definition(FILE *f, type_t *t)
  462. write_namespace_start(f, t->namespace);
  463. }
  464. indent(f, 0);
  465. - write_type_left(f, t, NAME_DEFAULT, FALSE);
  466. + write_type_left(f, t, NAME_DEFAULT, declonly);
  467. fprintf(f, ";\n");
  468. if(in_namespace) {
  469. t->written = save_written;
  470. write_namespace_end(f, t->namespace);
  471. fprintf(f, "extern \"C\" {\n");
  472. fprintf(f, "#else\n");
  473. - write_type_left(f, t, NAME_C, FALSE);
  474. + write_type_left(f, t, NAME_C, declonly);
  475. fprintf(f, ";\n");
  476. fprintf(f, "#endif\n\n");
  477. }
  478. @@ -560,12 +565,18 @@ static void write_type_definition(FILE *f, type_t *t)
  479. void write_type_decl(FILE *f, type_t *t, const char *name)
  480. {
  481. - write_type_v(f, t, FALSE, TRUE, name);
  482. + decl_spec_t ds;
  483. + write_declspec_decl(f, init_declspec(&ds, t), name);
  484. +}
  485. +
  486. +void write_declspec_decl(FILE *f, const decl_spec_t *ds, const char *name)
  487. +{
  488. + write_type_v(f, ds, FALSE, TRUE, name);
  489. }
  490. -void write_type_decl_left(FILE *f, type_t *t)
  491. +void write_declspec_decl_left(FILE *f, const decl_spec_t *ds)
  492. {
  493. - write_type_left(f, t, NAME_DEFAULT, TRUE);
  494. + write_declspec_left(f, ds, NAME_DEFAULT, TRUE);
  495. }
  496. static int user_type_registered(const char *name)
  497. @@ -602,8 +613,8 @@ unsigned int get_context_handle_offset( const type_t *type )
  498. while (!is_attr( type->attrs, ATTR_CONTEXTHANDLE ))
  499. {
  500. - if (type_is_alias( type )) type = type_alias_get_aliasee( type );
  501. - else if (is_ptr( type )) type = type_pointer_get_ref( type );
  502. + if (type_is_alias( type )) type = type_alias_get_aliasee_type( type );
  503. + else if (is_ptr( type )) type = type_pointer_get_ref_type( type );
  504. else error( "internal error: %s is not a context handle\n", type->name );
  505. }
  506. LIST_FOR_EACH_ENTRY( ch, &context_handle_list, context_handle_t, entry )
  507. @@ -622,8 +633,8 @@ unsigned int get_generic_handle_offset( const type_t *type )
  508. while (!is_attr( type->attrs, ATTR_HANDLE ))
  509. {
  510. - if (type_is_alias( type )) type = type_alias_get_aliasee( type );
  511. - else if (is_ptr( type )) type = type_pointer_get_ref( type );
  512. + if (type_is_alias( type )) type = type_alias_get_aliasee_type( type );
  513. + else if (is_ptr( type )) type = type_pointer_get_ref_type( type );
  514. else error( "internal error: %s is not a generic handle\n", type->name );
  515. }
  516. LIST_FOR_EACH_ENTRY( gh, &generic_handle_list, generic_handle_t, entry )
  517. @@ -637,82 +648,77 @@ unsigned int get_generic_handle_offset( const type_t *type )
  518. /* check for types which require additional prototypes to be generated in the
  519. * header */
  520. -void check_for_additional_prototype_types(const var_list_t *list)
  521. -{
  522. - const var_t *v;
  523. -
  524. - if (!list) return;
  525. - LIST_FOR_EACH_ENTRY( v, list, const var_t, entry )
  526. - {
  527. - type_t *type = v->type;
  528. - if (!type) continue;
  529. - for (;;) {
  530. - const char *name = type->name;
  531. - if (type->user_types_registered) break;
  532. - type->user_types_registered = 1;
  533. - if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) {
  534. - if (!context_handle_registered(name))
  535. - {
  536. - context_handle_t *ch = xmalloc(sizeof(*ch));
  537. - ch->name = xstrdup(name);
  538. - list_add_tail(&context_handle_list, &ch->entry);
  539. - }
  540. - /* don't carry on parsing fields within this type */
  541. - break;
  542. - }
  543. - if ((type_get_type(type) != TYPE_BASIC ||
  544. - type_basic_get_type(type) != TYPE_BASIC_HANDLE) &&
  545. - is_attr(type->attrs, ATTR_HANDLE)) {
  546. - if (!generic_handle_registered(name))
  547. - {
  548. - generic_handle_t *gh = xmalloc(sizeof(*gh));
  549. - gh->name = xstrdup(name);
  550. - list_add_tail(&generic_handle_list, &gh->entry);
  551. - }
  552. - /* don't carry on parsing fields within this type */
  553. - break;
  554. +void check_for_additional_prototype_types(type_t *type)
  555. +{
  556. + if (!type) return;
  557. + for (;;) {
  558. + const char *name = type->name;
  559. + if (type->user_types_registered) break;
  560. + type->user_types_registered = 1;
  561. + if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) {
  562. + if (!context_handle_registered(name))
  563. + {
  564. + context_handle_t *ch = xmalloc(sizeof(*ch));
  565. + ch->name = xstrdup(name);
  566. + list_add_tail(&context_handle_list, &ch->entry);
  567. }
  568. - if (is_attr(type->attrs, ATTR_WIREMARSHAL)) {
  569. - if (!user_type_registered(name))
  570. - {
  571. - user_type_t *ut = xmalloc(sizeof *ut);
  572. - ut->name = xstrdup(name);
  573. - list_add_tail(&user_type_list, &ut->entry);
  574. - }
  575. - /* don't carry on parsing fields within this type as we are already
  576. - * using a wire marshaled type */
  577. - break;
  578. + /* don't carry on parsing fields within this type */
  579. + break;
  580. + }
  581. + if ((type_get_type(type) != TYPE_BASIC ||
  582. + type_basic_get_type(type) != TYPE_BASIC_HANDLE) &&
  583. + is_attr(type->attrs, ATTR_HANDLE)) {
  584. + if (!generic_handle_registered(name))
  585. + {
  586. + generic_handle_t *gh = xmalloc(sizeof(*gh));
  587. + gh->name = xstrdup(name);
  588. + list_add_tail(&generic_handle_list, &gh->entry);
  589. }
  590. - else if (type_is_complete(type))
  591. + /* don't carry on parsing fields within this type */
  592. + break;
  593. + }
  594. + if (is_attr(type->attrs, ATTR_WIREMARSHAL)) {
  595. + if (!user_type_registered(name))
  596. {
  597. - var_list_t *vars;
  598. - switch (type_get_type_detect_alias(type))
  599. - {
  600. - case TYPE_ENUM:
  601. - vars = type_enum_get_values(type);
  602. - break;
  603. - case TYPE_STRUCT:
  604. - vars = type_struct_get_fields(type);
  605. - break;
  606. - case TYPE_UNION:
  607. - vars = type_union_get_cases(type);
  608. - break;
  609. - default:
  610. - vars = NULL;
  611. - break;
  612. - }
  613. - check_for_additional_prototype_types(vars);
  614. + user_type_t *ut = xmalloc(sizeof *ut);
  615. + ut->name = xstrdup(name);
  616. + list_add_tail(&user_type_list, &ut->entry);
  617. }
  618. -
  619. - if (type_is_alias(type))
  620. - type = type_alias_get_aliasee(type);
  621. - else if (is_ptr(type))
  622. - type = type_pointer_get_ref(type);
  623. - else if (is_array(type))
  624. - type = type_array_get_element(type);
  625. - else
  626. + /* don't carry on parsing fields within this type as we are already
  627. + * using a wire marshaled type */
  628. + break;
  629. + }
  630. + else if (type_is_complete(type))
  631. + {
  632. + var_list_t *vars;
  633. + const var_t *v;
  634. + switch (type_get_type_detect_alias(type))
  635. + {
  636. + case TYPE_ENUM:
  637. + vars = type_enum_get_values(type);
  638. + break;
  639. + case TYPE_STRUCT:
  640. + vars = type_struct_get_fields(type);
  641. break;
  642. + case TYPE_UNION:
  643. + vars = type_union_get_cases(type);
  644. + break;
  645. + default:
  646. + vars = NULL;
  647. + break;
  648. + }
  649. + if (vars) LIST_FOR_EACH_ENTRY( v, vars, const var_t, entry )
  650. + check_for_additional_prototype_types(v->declspec.type);
  651. }
  652. +
  653. + if (type_is_alias(type))
  654. + type = type_alias_get_aliasee_type(type);
  655. + else if (is_ptr(type))
  656. + type = type_pointer_get_ref_type(type);
  657. + else if (is_array(type))
  658. + type = type_array_get_element_type(type);
  659. + else
  660. + break;
  661. }
  662. }
  663. @@ -791,26 +797,26 @@ static void write_generic_handle_routines(FILE *header)
  664. }
  665. }
  666. -static void write_typedef(FILE *header, type_t *type)
  667. +static void write_typedef(FILE *header, type_t *type, int declonly)
  668. {
  669. fprintf(header, "typedef ");
  670. - write_type_def_or_decl(header, type_alias_get_aliasee(type), FALSE, type->name);
  671. + write_type_v(header, type_alias_get_aliasee(type), FALSE, declonly, type->name);
  672. fprintf(header, ";\n");
  673. }
  674. int is_const_decl(const var_t *var)
  675. {
  676. - const type_t *t;
  677. + const decl_spec_t *ds;
  678. /* strangely, MIDL accepts a const attribute on any pointer in the
  679. * declaration to mean that data isn't being instantiated. this appears
  680. * to be a bug, but there is no benefit to being incompatible with MIDL,
  681. * so we'll do the same thing */
  682. - for (t = var->type; ; )
  683. + for (ds = &var->declspec; ;)
  684. {
  685. - if (is_attr(t->attrs, ATTR_CONST))
  686. + if (ds->typequalifier == TYPE_QUALIFIER_CONST)
  687. return TRUE;
  688. - else if (is_ptr(t))
  689. - t = type_pointer_get_ref(t);
  690. + else if (is_ptr(ds->type))
  691. + ds = type_pointer_get_ref(ds->type);
  692. else break;
  693. }
  694. return FALSE;
  695. @@ -826,7 +832,7 @@ static void write_declaration(FILE *header, const var_t *v)
  696. }
  697. else
  698. {
  699. - switch (v->stgclass)
  700. + switch (v->declspec.stgclass)
  701. {
  702. case STG_NONE:
  703. case STG_REGISTER: /* ignored */
  704. @@ -838,7 +844,7 @@ static void write_declaration(FILE *header, const var_t *v)
  705. fprintf(header, "extern ");
  706. break;
  707. }
  708. - write_type_def_or_decl(header, v->type, FALSE, v->name);
  709. + write_type_v(header, &v->declspec, FALSE, FALSE, v->name);
  710. fprintf(header, ";\n\n");
  711. }
  712. }
  713. @@ -855,9 +861,9 @@ static void write_library(FILE *header, const typelib_t *typelib)
  714. const type_t* get_explicit_generic_handle_type(const var_t* var)
  715. {
  716. const type_t *t;
  717. - for (t = var->type;
  718. + for (t = var->declspec.type;
  719. is_ptr(t) || type_is_alias(t);
  720. - t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t))
  721. + t = type_is_alias(t) ? type_alias_get_aliasee_type(t) : type_pointer_get_ref_type(t))
  722. if ((type_get_type_detect_alias(t) != TYPE_BASIC || type_basic_get_type(t) != TYPE_BASIC_HANDLE) &&
  723. is_attr(t->attrs, ATTR_HANDLE))
  724. return t;
  725. @@ -868,13 +874,13 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
  726. unsigned char *explicit_fc, unsigned char *implicit_fc )
  727. {
  728. const var_t *var;
  729. - const var_list_t *args = type_get_function_args( func->type );
  730. + const var_list_t *args = type_function_get_args( func->declspec.type );
  731. *explicit_fc = *implicit_fc = 0;
  732. if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry )
  733. {
  734. if (!is_attr( var->attrs, ATTR_IN ) && is_attr( var->attrs, ATTR_OUT )) continue;
  735. - if (type_get_type( var->type ) == TYPE_BASIC && type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
  736. + if (type_get_type( var->declspec.type ) == TYPE_BASIC && type_basic_get_type( var->declspec.type ) == TYPE_BASIC_HANDLE)
  737. {
  738. *explicit_fc = FC_BIND_PRIMITIVE;
  739. return var;
  740. @@ -884,7 +890,7 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
  741. *explicit_fc = FC_BIND_GENERIC;
  742. return var;
  743. }
  744. - if (is_context_handle( var->type ))
  745. + if (is_context_handle( var->declspec.type ))
  746. {
  747. *explicit_fc = FC_BIND_CONTEXT;
  748. return var;
  749. @@ -893,8 +899,8 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
  750. if ((var = get_attrp( iface->attrs, ATTR_IMPLICIT_HANDLE )))
  751. {
  752. - if (type_get_type( var->type ) == TYPE_BASIC &&
  753. - type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
  754. + if (type_get_type( var->declspec.type ) == TYPE_BASIC &&
  755. + type_basic_get_type( var->declspec.type ) == TYPE_BASIC_HANDLE)
  756. *implicit_fc = FC_BIND_PRIMITIVE;
  757. else
  758. *implicit_fc = FC_BIND_GENERIC;
  759. @@ -909,13 +915,13 @@ int has_out_arg_or_return(const var_t *func)
  760. {
  761. const var_t *var;
  762. - if (!is_void(type_function_get_rettype(func->type)))
  763. + if (!is_void(type_function_get_rettype(func->declspec.type)))
  764. return 1;
  765. - if (!type_get_function_args(func->type))
  766. + if (!type_function_get_args(func->declspec.type))
  767. return 0;
  768. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  769. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  770. if (is_attr(var->attrs, ATTR_OUT))
  771. return 1;
  772. @@ -995,7 +1001,7 @@ static int is_override_method(const type_t *iface, const type_t *child, const va
  773. static int is_aggregate_return(const var_t *func)
  774. {
  775. - enum type_type type = type_get_type(type_function_get_rettype(func->type));
  776. + enum type_type type = type_get_type(type_function_get_rettype(func->declspec.type));
  777. return type == TYPE_STRUCT || type == TYPE_UNION ||
  778. type == TYPE_COCLASS || type == TYPE_INTERFACE;
  779. }
  780. @@ -1035,8 +1041,8 @@ static void write_method_macro(FILE *header, const type_t *iface, const type_t *
  781. const var_t *arg;
  782. fprintf(header, "#define %s_%s(This", name, get_name(func));
  783. - if (type_get_function_args(func->type))
  784. - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
  785. + if (type_function_get_args(func->declspec.type))
  786. + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry )
  787. fprintf(header, ",%s", arg->name);
  788. fprintf(header, ") ");
  789. @@ -1047,8 +1053,8 @@ static void write_method_macro(FILE *header, const type_t *iface, const type_t *
  790. }
  791. fprintf(header, "(This)->lpVtbl->%s(This", get_vtbl_entry_name(iface, func));
  792. - if (type_get_function_args(func->type))
  793. - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
  794. + if (type_function_get_args(func->declspec.type))
  795. + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry )
  796. fprintf(header, ",%s", arg->name);
  797. fprintf(header, ")\n");
  798. }
  799. @@ -1078,7 +1084,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
  800. }
  801. else fprintf(h, ",");
  802. }
  803. - write_type_decl(h, arg->type, arg->name);
  804. + write_declspec_decl(h, &arg->declspec, arg->name);
  805. if (method == 2) {
  806. const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE);
  807. if (expr) {
  808. @@ -1090,7 +1096,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
  809. expr_t bstr;
  810. /* Fixup the expression type for a BSTR like midl does. */
  811. - if (get_type_vt(arg->type) == VT_BSTR && expr->type == EXPR_STRLIT)
  812. + if (get_type_vt(arg->declspec.type) == VT_BSTR && expr->type == EXPR_STRLIT)
  813. {
  814. bstr = *expr;
  815. bstr.type = EXPR_WSTRLIT;
  816. @@ -1119,8 +1125,8 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
  817. {
  818. const var_t *func = stmt->u.var;
  819. if (!is_callas(func->attrs)) {
  820. - const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
  821. - const var_list_t *args = type_get_function_args(func->type);
  822. + const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
  823. + const var_list_t *args = type_function_get_args(func->declspec.type);
  824. const var_t *arg;
  825. if (!callconv) callconv = "STDMETHODCALLTYPE";
  826. @@ -1130,11 +1136,11 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
  827. indent(header, 0);
  828. fprintf(header, "virtual ");
  829. - write_type_decl_left(header, type_function_get_rettype(func->type));
  830. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  831. fprintf(header, "* %s %s(\n", callconv, get_name(func));
  832. ++indentation;
  833. indent(header, 0);
  834. - write_type_decl_left(header, type_function_get_rettype(func->type));
  835. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  836. fprintf(header, " *__ret");
  837. --indentation;
  838. if (args) {
  839. @@ -1144,7 +1150,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
  840. fprintf(header, ") = 0;\n");
  841. indent(header, 0);
  842. - write_type_decl_left(header, type_function_get_rettype(func->type));
  843. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  844. fprintf(header, " %s %s(\n", callconv, get_name(func));
  845. write_args(header, args, iface->name, 2, TRUE);
  846. fprintf(header, ")\n");
  847. @@ -1152,7 +1158,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
  848. fprintf(header, "{\n");
  849. ++indentation;
  850. indent(header, 0);
  851. - write_type_decl_left(header, type_function_get_rettype(func->type));
  852. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  853. fprintf(header, " __ret;\n");
  854. indent(header, 0);
  855. fprintf(header, "return *%s(&__ret", get_name(func));
  856. @@ -1169,7 +1175,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
  857. indent(header, 0);
  858. fprintf(header, "virtual ");
  859. - write_type_decl_left(header, type_function_get_rettype(func->type));
  860. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  861. fprintf(header, " %s %s(\n", callconv, get_name(func));
  862. write_args(header, args, iface->name, 2, TRUE);
  863. fprintf(header, ") = 0;\n");
  864. @@ -1206,25 +1212,25 @@ static void write_inline_wrappers(FILE *header, const type_t *iface, const type_
  865. const var_t *arg;
  866. fprintf(header, "static FORCEINLINE ");
  867. - write_type_decl_left(header, type_function_get_rettype(func->type));
  868. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  869. fprintf(header, " %s_%s(", name, get_name(func));
  870. - write_args(header, type_get_function_args(func->type), name, 1, FALSE);
  871. + write_args(header, type_function_get_args(func->declspec.type), name, 1, FALSE);
  872. fprintf(header, ") {\n");
  873. ++indentation;
  874. if (!is_aggregate_return(func)) {
  875. indent(header, 0);
  876. fprintf(header, "%sThis->lpVtbl->%s(This",
  877. - is_void(type_function_get_rettype(func->type)) ? "" : "return ",
  878. + is_void(type_function_get_rettype(func->declspec.type)) ? "" : "return ",
  879. get_vtbl_entry_name(iface, func));
  880. } else {
  881. indent(header, 0);
  882. - write_type_decl_left(header, type_function_get_rettype(func->type));
  883. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  884. fprintf(header, " __ret;\n");
  885. indent(header, 0);
  886. fprintf(header, "return *This->lpVtbl->%s(This,&__ret", get_vtbl_entry_name(iface, func));
  887. }
  888. - if (type_get_function_args(func->type))
  889. - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
  890. + if (type_function_get_args(func->declspec.type))
  891. + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry )
  892. fprintf(header, ",%s", arg->name);
  893. fprintf(header, ");\n");
  894. --indentation;
  895. @@ -1250,10 +1256,10 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char
  896. first_iface = 0;
  897. }
  898. if (!is_callas(func->attrs)) {
  899. - const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
  900. + const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
  901. if (!callconv) callconv = "STDMETHODCALLTYPE";
  902. indent(header, 0);
  903. - write_type_decl_left(header, type_function_get_rettype(func->type));
  904. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  905. if (is_aggregate_return(func))
  906. fprintf(header, " *");
  907. if (is_inherited_method(iface, func))
  908. @@ -1266,13 +1272,13 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char
  909. if (is_aggregate_return(func)) {
  910. fprintf(header, ",\n");
  911. indent(header, 0);
  912. - write_type_decl_left(header, type_function_get_rettype(func->type));
  913. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  914. fprintf(header, " *__ret");
  915. }
  916. --indentation;
  917. - if (type_get_function_args(func->type)) {
  918. + if (type_function_get_args(func->declspec.type)) {
  919. fprintf(header, ",\n");
  920. - write_args(header, type_get_function_args(func->type), name, 0, TRUE);
  921. + write_args(header, type_function_get_args(func->declspec.type), name, 0, TRUE);
  922. }
  923. fprintf(header, ");\n");
  924. fprintf(header, "\n");
  925. @@ -1299,12 +1305,12 @@ static void write_method_proto(FILE *header, const type_t *iface)
  926. const var_t *func = stmt->u.var;
  927. if (is_callas(func->attrs)) {
  928. - const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
  929. + const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
  930. if (!callconv) callconv = "STDMETHODCALLTYPE";
  931. /* proxy prototype */
  932. - write_type_decl_left(header, type_function_get_rettype(func->type));
  933. + write_declspec_decl_left(header, type_function_get_retdeclspec(func->declspec.type));
  934. fprintf(header, " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
  935. - write_args(header, type_get_function_args(func->type), iface->name, 1, TRUE);
  936. + write_args(header, type_function_get_args(func->declspec.type), iface->name, 1, TRUE);
  937. fprintf(header, ");\n");
  938. /* stub prototype */
  939. fprintf(header, "void __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(func));
  940. @@ -1337,12 +1343,12 @@ static void write_locals(FILE *fp, const type_t *iface, int body)
  941. if (&stmt2->entry != type_iface_get_stmts(iface)) {
  942. const var_t *m = stmt2->u.var;
  943. /* proxy prototype - use local prototype */
  944. - write_type_decl_left(fp, type_function_get_rettype(m->type));
  945. + write_declspec_decl_left(fp, type_function_get_retdeclspec(m->declspec.type));
  946. fprintf(fp, " CALLBACK %s_%s_Proxy(\n", iface->name, get_name(m));
  947. - write_args(fp, type_get_function_args(m->type), iface->name, 1, TRUE);
  948. + write_args(fp, type_function_get_args(m->declspec.type), iface->name, 1, TRUE);
  949. fprintf(fp, ")");
  950. if (body) {
  951. - type_t *rt = type_function_get_rettype(m->type);
  952. + type_t *rt = type_function_get_rettype(m->declspec.type);
  953. fprintf(fp, "\n{\n");
  954. fprintf(fp, " %s\n", comment);
  955. if (rt->name && strcmp(rt->name, "HRESULT") == 0)
  956. @@ -1359,9 +1365,9 @@ static void write_locals(FILE *fp, const type_t *iface, int body)
  957. else
  958. fprintf(fp, ";\n");
  959. /* stub prototype - use remotable prototype */
  960. - write_type_decl_left(fp, type_function_get_rettype(func->type));
  961. + write_declspec_decl_left(fp, type_function_get_retdeclspec(func->declspec.type));
  962. fprintf(fp, " __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(m));
  963. - write_args(fp, type_get_function_args(func->type), iface->name, 1, TRUE);
  964. + write_args(fp, type_function_get_args(func->declspec.type), iface->name, 1, TRUE);
  965. fprintf(fp, ")");
  966. if (body)
  967. /* Remotable methods must all return HRESULTs. */
  968. @@ -1407,15 +1413,16 @@ void write_local_stubs(const statement_list_t *stmts)
  969. static void write_function_proto(FILE *header, const type_t *iface, const var_t *fun, const char *prefix)
  970. {
  971. - const char *callconv = get_attrp(fun->type->attrs, ATTR_CALLCONV);
  972. + const char *callconv = get_attrp(fun->declspec.type->attrs, ATTR_CALLCONV);
  973. if (!callconv) callconv = "__cdecl";
  974. /* FIXME: do we need to handle call_as? */
  975. - write_type_decl_left(header, type_function_get_rettype(fun->type));
  976. + write_declspec_decl_left(header, type_function_get_retdeclspec(fun->declspec.type));
  977. + if (fun->declspec.funcspecifier == FUNCTION_SPECIFIER_INLINE) fprintf(header, " inline");
  978. fprintf(header, " %s ", callconv);
  979. fprintf(header, "%s%s(\n", prefix, get_name(fun));
  980. - if (type_get_function_args(fun->type))
  981. - write_args(header, type_get_function_args(fun->type), iface->name, 0, TRUE);
  982. + if (type_function_get_args(fun->declspec.type))
  983. + write_args(header, type_function_get_args(fun->declspec.type), iface->name, 0, TRUE);
  984. else
  985. fprintf(header, " void");
  986. fprintf(header, ");\n\n");
  987. @@ -1541,7 +1548,7 @@ static void write_rpc_interface_start(FILE *header, const type_t *iface)
  988. if (var)
  989. {
  990. fprintf(header, "extern ");
  991. - write_type_decl( header, var->type, var->name );
  992. + write_declspec_decl( header, &var->declspec, var->name );
  993. fprintf(header, ";\n");
  994. }
  995. if (old_names)
  996. @@ -1653,6 +1660,7 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
  997. if (type_get_type(stmt->u.type) == TYPE_INTERFACE)
  998. {
  999. type_t *iface = stmt->u.type;
  1000. + assert(type_get_type_detect_alias(iface) == TYPE_INTERFACE);
  1001. if (is_object(iface) || is_attr(iface->attrs, ATTR_DISPINTERFACE))
  1002. {
  1003. write_forward(header, iface);
  1004. @@ -1694,6 +1702,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
  1005. {
  1006. type_t *iface = stmt->u.type;
  1007. type_t *async_iface = iface->details.iface->async_iface;
  1008. + assert(type_get_type_detect_alias(iface) == TYPE_INTERFACE);
  1009. if (is_object(iface)) is_object_interface++;
  1010. if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type))
  1011. {
  1012. @@ -1718,7 +1727,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
  1013. write_coclass(header, stmt->u.type);
  1014. else
  1015. {
  1016. - write_type_definition(header, stmt->u.type);
  1017. + write_type_definition(header, stmt->u.type, stmt->declonly);
  1018. }
  1019. break;
  1020. case STMT_TYPEREF:
  1021. @@ -1739,7 +1748,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
  1022. {
  1023. const type_list_t *type_entry = stmt->u.type_list;
  1024. for (; type_entry; type_entry = type_entry->next)
  1025. - write_typedef(header, type_entry->type);
  1026. + write_typedef(header, type_entry->type, stmt->declonly);
  1027. break;
  1028. }
  1029. case STMT_LIBRARY:
  1030. @@ -1750,7 +1759,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
  1031. fprintf(header, "%s\n", stmt->u.str);
  1032. break;
  1033. case STMT_DECLARATION:
  1034. - if (iface && type_get_type(stmt->u.var->type) == TYPE_FUNCTION)
  1035. + if (iface && type_get_type(stmt->u.var->declspec.type) == TYPE_FUNCTION)
  1036. {
  1037. if (!ignore_funcs)
  1038. {
  1039. @@ -1784,15 +1793,15 @@ void write_header(const statement_list_t *stmts)
  1040. }
  1041. fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n\n", PACKAGE_VERSION, input_name);
  1042. + fprintf(header, "#ifdef _WIN32\n");
  1043. fprintf(header, "#ifndef __REQUIRED_RPCNDR_H_VERSION__\n");
  1044. fprintf(header, "#define __REQUIRED_RPCNDR_H_VERSION__ 475\n");
  1045. - fprintf(header, "#endif\n\n");
  1046. -
  1047. + fprintf(header, "#endif\n");
  1048. fprintf(header, "#include <rpc.h>\n" );
  1049. fprintf(header, "#include <rpcndr.h>\n" );
  1050. if (!for_each_serializable(stmts, NULL, serializable_exists))
  1051. fprintf(header, "#include <midles.h>\n" );
  1052. - fprintf(header, "\n" );
  1053. + fprintf(header, "#endif\n\n");
  1054. fprintf(header, "#ifndef COM_NO_WINDOWS_H\n");
  1055. fprintf(header, "#include <windows.h>\n");
  1056. diff --git a/mingw-w64-tools/widl/src/header.h b/mingw-w64-tools/widl/src/header.h
  1057. index 0d44b403..0e62f77c 100644
  1058. --- a/mingw-w64-tools/widl/src/header.h
  1059. +++ b/mingw-w64-tools/widl/src/header.h
  1060. @@ -29,10 +29,12 @@ extern int is_attr(const attr_list_t *list, enum attr_type t);
  1061. extern void *get_attrp(const attr_list_t *list, enum attr_type t);
  1062. extern unsigned int get_attrv(const attr_list_t *list, enum attr_type t);
  1063. extern const char* get_name(const var_t *v);
  1064. +extern void write_declspec_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, int declonly);
  1065. extern void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly);
  1066. extern void write_type_right(FILE *h, type_t *t, int is_field);
  1067. extern void write_type_decl(FILE *f, type_t *t, const char *name);
  1068. -extern void write_type_decl_left(FILE *f, type_t *t);
  1069. +extern void write_declspec_decl(FILE *f, const decl_spec_t *ds, const char *name);
  1070. +extern void write_declspec_decl_left(FILE *f, const decl_spec_t *ds);
  1071. extern unsigned int get_context_handle_offset( const type_t *type );
  1072. extern unsigned int get_generic_handle_offset( const type_t *type );
  1073. extern int needs_space_after(type_t *t);
  1074. @@ -83,12 +85,12 @@ static inline int is_conformant_array(const type_t *t)
  1075. static inline int last_ptr(const type_t *type)
  1076. {
  1077. - return is_ptr(type) && !is_declptr(type_pointer_get_ref(type));
  1078. + return is_ptr(type) && !is_declptr(type_pointer_get_ref_type(type));
  1079. }
  1080. static inline int last_array(const type_t *type)
  1081. {
  1082. - return is_array(type) && !is_array(type_array_get_element(type));
  1083. + return is_array(type) && !is_array(type_array_get_element_type(type));
  1084. }
  1085. static inline int is_string_type(const attr_list_t *attrs, const type_t *type)
  1086. @@ -102,7 +104,7 @@ static inline int is_context_handle(const type_t *type)
  1087. const type_t *t;
  1088. for (t = type;
  1089. is_ptr(t) || type_is_alias(t);
  1090. - t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t))
  1091. + t = type_is_alias(t) ? type_alias_get_aliasee_type(t) : type_pointer_get_ref_type(t))
  1092. if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
  1093. return 1;
  1094. return 0;
  1095. diff --git a/mingw-w64-tools/widl/src/parser.tab.c b/mingw-w64-tools/widl/src/parser.tab.c
  1096. index 6266e054..8cd1605a 100644
  1097. --- a/mingw-w64-tools/widl/src/parser.tab.c
  1098. +++ b/mingw-w64-tools/widl/src/parser.tab.c
  1099. @@ -1,8 +1,8 @@
  1100. -/* A Bison parser, made by GNU Bison 3.0.5. */
  1101. +/* A Bison parser, made by GNU Bison 3.0.4. */
  1102. /* Bison implementation for Yacc-like parsers in C
  1103. - Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
  1104. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
  1105. This program is free software: you can redistribute it and/or modify
  1106. it under the terms of the GNU General Public License as published by
  1107. @@ -44,7 +44,7 @@
  1108. #define YYBISON 1
  1109. /* Bison version. */
  1110. -#define YYBISON_VERSION "3.0.5"
  1111. +#define YYBISON_VERSION "3.0.4"
  1112. /* Skeleton name. */
  1113. #define YYSKELETON_NAME "yacc.c"
  1114. @@ -125,13 +125,6 @@ struct _import_t
  1115. int import_performed;
  1116. };
  1117. -typedef struct _decl_spec_t
  1118. -{
  1119. - type_t *type;
  1120. - attr_list_t *attrs;
  1121. - enum storage_class stgclass;
  1122. -} decl_spec_t;
  1123. -
  1124. typelist_t incomplete_types = LIST_INIT(incomplete_types);
  1125. static void fix_incomplete(void);
  1126. @@ -140,7 +133,7 @@ static void fix_incomplete_types(type_t *complete_type);
  1127. static str_list_t *append_str(str_list_t *list, char *str);
  1128. static attr_list_t *append_attr(attr_list_t *list, attr_t *attr);
  1129. static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list);
  1130. -static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, attr_t *attr, enum storage_class stgclass);
  1131. +static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, enum storage_class stgclass, enum type_qualifier typequalifier, enum function_specifier funcspecifier);
  1132. static attr_t *make_attr(enum attr_type type);
  1133. static attr_t *make_attrv(enum attr_type type, unsigned int val);
  1134. static attr_t *make_attrp(enum attr_type type, void *val);
  1135. @@ -156,6 +149,7 @@ static declarator_t *make_declarator(var_t *var);
  1136. static type_t *make_safearray(type_t *type);
  1137. static typelib_t *make_library(const char *name, const attr_list_t *attrs);
  1138. static type_t *append_chain_type(type_t *chain, type_t *type);
  1139. +static decl_spec_t *append_chain_declspec(decl_spec_t *chain, type_t *type, enum type_qualifier typequalifier);
  1140. static warning_list_t *append_warning(warning_list_t *, int);
  1141. static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
  1142. @@ -212,7 +206,7 @@ static struct namespace *current_namespace = &global_namespace;
  1143. static typelib_t *current_typelib;
  1144. -#line 216 "parser.tab.c" /* yacc.c:339 */
  1145. +#line 210 "parser.tab.c" /* yacc.c:339 */
  1146. # ifndef YY_NULLPTR
  1147. # if defined __cplusplus && 201103L <= __cplusplus
  1148. @@ -438,7 +432,7 @@ extern int parser_debug;
  1149. union YYSTYPE
  1150. {
  1151. -#line 142 "parser.y" /* yacc.c:355 */
  1152. +#line 136 "parser.y" /* yacc.c:355 */
  1153. attr_t *attr;
  1154. attr_list_t *attr_list;
  1155. @@ -465,8 +459,10 @@ union YYSTYPE
  1156. struct _import_t *import;
  1157. struct _decl_spec_t *declspec;
  1158. enum storage_class stgclass;
  1159. + enum type_qualifier typequalifier;
  1160. + enum function_specifier funcspecifier;
  1161. -#line 470 "parser.tab.c" /* yacc.c:355 */
  1162. +#line 466 "parser.tab.c" /* yacc.c:355 */
  1163. };
  1164. typedef union YYSTYPE YYSTYPE;
  1165. @@ -483,7 +479,7 @@ int parser_parse (void);
  1166. /* Copy the second part of user declarations. */
  1167. -#line 487 "parser.tab.c" /* yacc.c:358 */
  1168. +#line 483 "parser.tab.c" /* yacc.c:358 */
  1169. #ifdef short
  1170. # undef short
  1171. @@ -799,48 +795,48 @@ static const yytype_uint8 yytranslate[] =
  1172. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  1173. static const yytype_uint16 yyrline[] =
  1174. {
  1175. - 0, 325, 325, 340, 340, 342, 343, 343, 345, 346,
  1176. - 347, 350, 353, 354, 355, 358, 359, 360, 360, 362,
  1177. - 363, 364, 367, 368, 369, 370, 373, 374, 377, 378,
  1178. - 382, 383, 384, 385, 386, 387, 388, 391, 402, 403,
  1179. - 407, 408, 409, 410, 411, 412, 413, 414, 415, 418,
  1180. - 420, 428, 434, 438, 439, 441, 445, 449, 450, 453,
  1181. - 454, 457, 458, 462, 467, 474, 478, 479, 482, 483,
  1182. - 487, 490, 491, 492, 495, 496, 499, 500, 501, 502,
  1183. - 503, 504, 505, 506, 507, 508, 509, 510, 511, 512,
  1184. - 513, 514, 515, 516, 517, 518, 519, 520, 521, 522,
  1185. - 523, 524, 525, 526, 527, 528, 529, 530, 531, 532,
  1186. - 533, 534, 535, 536, 537, 538, 539, 540, 541, 542,
  1187. - 543, 544, 545, 546, 547, 548, 549, 550, 551, 552,
  1188. - 553, 554, 555, 556, 557, 558, 559, 560, 561, 562,
  1189. - 563, 564, 565, 566, 567, 568, 569, 570, 571, 572,
  1190. - 573, 574, 578, 579, 580, 581, 582, 583, 584, 585,
  1191. - 586, 587, 588, 589, 590, 591, 592, 593, 594, 595,
  1192. - 596, 597, 598, 599, 600, 601, 605, 606, 611, 612,
  1193. - 613, 614, 617, 618, 621, 625, 631, 632, 633, 636,
  1194. - 640, 652, 656, 661, 664, 665, 668, 669, 672, 673,
  1195. - 674, 675, 676, 677, 678, 679, 680, 681, 682, 683,
  1196. - 684, 685, 686, 687, 688, 689, 690, 691, 692, 693,
  1197. - 694, 695, 696, 697, 698, 699, 700, 701, 702, 703,
  1198. - 704, 705, 706, 707, 708, 709, 711, 713, 714, 717,
  1199. - 718, 721, 727, 733, 734, 737, 742, 749, 750, 753,
  1200. - 754, 758, 759, 762, 766, 772, 780, 784, 789, 790,
  1201. - 793, 794, 795, 798, 800, 803, 804, 805, 806, 807,
  1202. - 808, 809, 810, 811, 812, 813, 816, 817, 820, 821,
  1203. - 822, 823, 824, 825, 826, 827, 828, 831, 832, 840,
  1204. - 846, 850, 853, 854, 858, 861, 862, 865, 874, 875,
  1205. - 878, 879, 882, 888, 894, 895, 898, 899, 902, 912,
  1206. - 922, 928, 932, 933, 936, 937, 940, 945, 952, 953,
  1207. - 954, 958, 962, 965, 966, 969, 970, 974, 975, 979,
  1208. - 980, 981, 985, 987, 989, 993, 994, 995, 996, 1004,
  1209. - 1006, 1008, 1013, 1015, 1020, 1021, 1026, 1027, 1028, 1029,
  1210. - 1034, 1043, 1045, 1046, 1051, 1053, 1057, 1058, 1065, 1066,
  1211. - 1067, 1068, 1069, 1074, 1082, 1083, 1086, 1087, 1090, 1097,
  1212. - 1098, 1103, 1104, 1108, 1109, 1110, 1111, 1112, 1116, 1117,
  1213. - 1118, 1121, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131,
  1214. - 1132, 1133, 1136, 1143, 1145, 1151, 1152, 1153, 1156, 1158,
  1215. - 1160, 1162, 1165, 1170, 1178, 1179, 1182, 1183, 1186, 1187,
  1216. - 1188
  1217. + 0, 323, 323, 338, 338, 340, 341, 341, 343, 344,
  1218. + 345, 348, 351, 352, 353, 356, 357, 358, 358, 360,
  1219. + 361, 362, 365, 366, 367, 368, 371, 372, 375, 376,
  1220. + 380, 381, 382, 383, 384, 385, 386, 389, 400, 401,
  1221. + 405, 406, 407, 408, 409, 410, 411, 412, 413, 416,
  1222. + 418, 426, 432, 436, 437, 439, 443, 447, 448, 451,
  1223. + 452, 455, 456, 460, 465, 472, 476, 477, 480, 481,
  1224. + 485, 488, 489, 490, 493, 494, 497, 498, 499, 500,
  1225. + 501, 502, 503, 504, 505, 506, 507, 508, 509, 510,
  1226. + 511, 512, 513, 514, 515, 516, 517, 518, 519, 520,
  1227. + 521, 522, 523, 524, 525, 526, 527, 528, 529, 530,
  1228. + 531, 532, 533, 534, 535, 536, 537, 538, 539, 540,
  1229. + 541, 542, 543, 544, 545, 546, 547, 548, 549, 550,
  1230. + 551, 552, 553, 554, 555, 556, 557, 558, 559, 560,
  1231. + 561, 562, 563, 564, 565, 566, 567, 568, 569, 570,
  1232. + 571, 572, 576, 577, 578, 579, 580, 581, 582, 583,
  1233. + 584, 585, 586, 587, 588, 589, 590, 591, 592, 593,
  1234. + 594, 595, 596, 597, 598, 599, 603, 604, 609, 610,
  1235. + 611, 612, 615, 616, 619, 623, 629, 630, 631, 634,
  1236. + 638, 650, 654, 659, 662, 663, 666, 667, 670, 671,
  1237. + 672, 673, 674, 675, 676, 677, 678, 679, 680, 681,
  1238. + 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
  1239. + 692, 693, 694, 695, 696, 697, 698, 699, 700, 701,
  1240. + 702, 703, 704, 705, 706, 707, 709, 711, 712, 715,
  1241. + 716, 719, 725, 731, 732, 735, 740, 747, 748, 751,
  1242. + 752, 756, 757, 760, 764, 770, 778, 782, 787, 788,
  1243. + 791, 792, 793, 796, 798, 801, 802, 803, 804, 805,
  1244. + 806, 807, 808, 809, 810, 811, 814, 815, 818, 819,
  1245. + 820, 821, 822, 823, 824, 825, 826, 829, 830, 838,
  1246. + 844, 848, 851, 852, 856, 859, 860, 863, 872, 873,
  1247. + 876, 877, 880, 886, 892, 893, 896, 897, 900, 910,
  1248. + 920, 926, 930, 931, 934, 935, 938, 943, 950, 951,
  1249. + 952, 956, 960, 963, 964, 967, 968, 972, 973, 977,
  1250. + 978, 979, 983, 985, 987, 991, 992, 993, 994, 1002,
  1251. + 1004, 1006, 1011, 1013, 1018, 1019, 1024, 1025, 1026, 1027,
  1252. + 1032, 1041, 1043, 1044, 1049, 1051, 1055, 1056, 1063, 1064,
  1253. + 1065, 1066, 1067, 1072, 1080, 1081, 1084, 1085, 1088, 1095,
  1254. + 1096, 1101, 1102, 1106, 1107, 1108, 1109, 1110, 1114, 1115,
  1255. + 1116, 1119, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129,
  1256. + 1130, 1131, 1134, 1141, 1143, 1149, 1150, 1151, 1154, 1156,
  1257. + 1158, 1160, 1163, 1168, 1176, 1177, 1180, 1181, 1184, 1185,
  1258. + 1186
  1259. };
  1260. #endif
  1261. @@ -903,7 +899,7 @@ static const char *const yytname[] =
  1262. "dispinterfacedef", "inherit", "interface", "interfacehdr",
  1263. "interfacedef", "interfacedec", "module", "modulehdr", "moduledef",
  1264. "storage_cls_spec", "function_specifier", "type_qualifier",
  1265. - "m_type_qual_list", "decl_spec", "m_decl_spec_no_type",
  1266. + "m_type_qual_bits", "decl_spec", "m_decl_spec_no_type",
  1267. "decl_spec_no_type", "declarator", "direct_declarator",
  1268. "abstract_declarator", "abstract_declarator_no_direct",
  1269. "m_abstract_declarator", "abstract_direct_declarator", "any_declarator",
  1270. @@ -2298,7 +2294,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  1271. case N: \
  1272. yyformat = S; \
  1273. break
  1274. - default: /* Avoid compiler warnings. */
  1275. YYCASE_(0, YY_("syntax error"));
  1276. YYCASE_(1, YY_("syntax error, unexpected %s"));
  1277. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  1278. @@ -2615,7 +2610,7 @@ yyreduce:
  1279. switch (yyn)
  1280. {
  1281. case 2:
  1282. -#line 325 "parser.y" /* yacc.c:1648 */
  1283. +#line 323 "parser.y" /* yacc.c:1646 */
  1284. { fix_incomplete();
  1285. check_statements((yyvsp[-1].stmt_list), FALSE);
  1286. check_all_user_types((yyvsp[-1].stmt_list));
  1287. @@ -2629,197 +2624,197 @@ yyreduce:
  1288. write_dlldata((yyvsp[-1].stmt_list));
  1289. write_local_stubs((yyvsp[-1].stmt_list));
  1290. }
  1291. -#line 2633 "parser.tab.c" /* yacc.c:1648 */
  1292. +#line 2628 "parser.tab.c" /* yacc.c:1646 */
  1293. break;
  1294. case 5:
  1295. -#line 342 "parser.y" /* yacc.c:1648 */
  1296. +#line 340 "parser.y" /* yacc.c:1646 */
  1297. { (yyval.stmt_list) = NULL; }
  1298. -#line 2639 "parser.tab.c" /* yacc.c:1648 */
  1299. +#line 2634 "parser.tab.c" /* yacc.c:1646 */
  1300. break;
  1301. case 6:
  1302. -#line 343 "parser.y" /* yacc.c:1648 */
  1303. +#line 341 "parser.y" /* yacc.c:1646 */
  1304. { push_namespace((yyvsp[-1].str)); }
  1305. -#line 2645 "parser.tab.c" /* yacc.c:1648 */
  1306. +#line 2640 "parser.tab.c" /* yacc.c:1646 */
  1307. break;
  1308. case 7:
  1309. -#line 344 "parser.y" /* yacc.c:1648 */
  1310. +#line 342 "parser.y" /* yacc.c:1646 */
  1311. { pop_namespace((yyvsp[-4].str)); (yyval.stmt_list) = append_statements((yyvsp[-5].stmt_list), (yyvsp[-1].stmt_list)); }
  1312. -#line 2651 "parser.tab.c" /* yacc.c:1648 */
  1313. +#line 2646 "parser.tab.c" /* yacc.c:1646 */
  1314. break;
  1315. case 8:
  1316. -#line 345 "parser.y" /* yacc.c:1648 */
  1317. +#line 343 "parser.y" /* yacc.c:1646 */
  1318. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_reference((yyvsp[0].type))); }
  1319. -#line 2657 "parser.tab.c" /* yacc.c:1648 */
  1320. +#line 2652 "parser.tab.c" /* yacc.c:1646 */
  1321. break;
  1322. case 9:
  1323. -#line 346 "parser.y" /* yacc.c:1648 */
  1324. +#line 344 "parser.y" /* yacc.c:1646 */
  1325. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type))); }
  1326. -#line 2663 "parser.tab.c" /* yacc.c:1648 */
  1327. +#line 2658 "parser.tab.c" /* yacc.c:1646 */
  1328. break;
  1329. case 10:
  1330. -#line 347 "parser.y" /* yacc.c:1648 */
  1331. +#line 345 "parser.y" /* yacc.c:1646 */
  1332. { (yyval.stmt_list) = (yyvsp[-2].stmt_list);
  1333. reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, current_namespace, 0);
  1334. }
  1335. -#line 2671 "parser.tab.c" /* yacc.c:1648 */
  1336. +#line 2666 "parser.tab.c" /* yacc.c:1646 */
  1337. break;
  1338. case 11:
  1339. -#line 350 "parser.y" /* yacc.c:1648 */
  1340. +#line 348 "parser.y" /* yacc.c:1646 */
  1341. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type)));
  1342. reg_type((yyvsp[0].type), (yyvsp[0].type)->name, current_namespace, 0);
  1343. }
  1344. -#line 2679 "parser.tab.c" /* yacc.c:1648 */
  1345. +#line 2674 "parser.tab.c" /* yacc.c:1646 */
  1346. break;
  1347. case 12:
  1348. -#line 353 "parser.y" /* yacc.c:1648 */
  1349. +#line 351 "parser.y" /* yacc.c:1646 */
  1350. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_module((yyvsp[0].type))); }
  1351. -#line 2685 "parser.tab.c" /* yacc.c:1648 */
  1352. +#line 2680 "parser.tab.c" /* yacc.c:1646 */
  1353. break;
  1354. case 13:
  1355. -#line 354 "parser.y" /* yacc.c:1648 */
  1356. +#line 352 "parser.y" /* yacc.c:1646 */
  1357. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_library((yyvsp[0].typelib))); }
  1358. -#line 2691 "parser.tab.c" /* yacc.c:1648 */
  1359. +#line 2686 "parser.tab.c" /* yacc.c:1646 */
  1360. break;
  1361. case 14:
  1362. -#line 355 "parser.y" /* yacc.c:1648 */
  1363. +#line 353 "parser.y" /* yacc.c:1646 */
  1364. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), (yyvsp[0].statement)); }
  1365. -#line 2697 "parser.tab.c" /* yacc.c:1648 */
  1366. +#line 2692 "parser.tab.c" /* yacc.c:1646 */
  1367. break;
  1368. case 15:
  1369. -#line 358 "parser.y" /* yacc.c:1648 */
  1370. +#line 356 "parser.y" /* yacc.c:1646 */
  1371. { (yyval.stmt_list) = NULL; }
  1372. -#line 2703 "parser.tab.c" /* yacc.c:1648 */
  1373. +#line 2698 "parser.tab.c" /* yacc.c:1646 */
  1374. break;
  1375. case 16:
  1376. -#line 359 "parser.y" /* yacc.c:1648 */
  1377. +#line 357 "parser.y" /* yacc.c:1646 */
  1378. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_reference((yyvsp[0].type))); }
  1379. -#line 2709 "parser.tab.c" /* yacc.c:1648 */
  1380. +#line 2704 "parser.tab.c" /* yacc.c:1646 */
  1381. break;
  1382. case 17:
  1383. -#line 360 "parser.y" /* yacc.c:1648 */
  1384. +#line 358 "parser.y" /* yacc.c:1646 */
  1385. { push_namespace((yyvsp[-1].str)); }
  1386. -#line 2715 "parser.tab.c" /* yacc.c:1648 */
  1387. +#line 2710 "parser.tab.c" /* yacc.c:1646 */
  1388. break;
  1389. case 18:
  1390. -#line 361 "parser.y" /* yacc.c:1648 */
  1391. +#line 359 "parser.y" /* yacc.c:1646 */
  1392. { pop_namespace((yyvsp[-4].str)); (yyval.stmt_list) = append_statements((yyvsp[-5].stmt_list), (yyvsp[-1].stmt_list)); }
  1393. -#line 2721 "parser.tab.c" /* yacc.c:1648 */
  1394. +#line 2716 "parser.tab.c" /* yacc.c:1646 */
  1395. break;
  1396. case 19:
  1397. -#line 362 "parser.y" /* yacc.c:1648 */
  1398. +#line 360 "parser.y" /* yacc.c:1646 */
  1399. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type))); }
  1400. -#line 2727 "parser.tab.c" /* yacc.c:1648 */
  1401. +#line 2722 "parser.tab.c" /* yacc.c:1646 */
  1402. break;
  1403. case 20:
  1404. -#line 363 "parser.y" /* yacc.c:1648 */
  1405. +#line 361 "parser.y" /* yacc.c:1646 */
  1406. { (yyval.stmt_list) = (yyvsp[-2].stmt_list); reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, current_namespace, 0); }
  1407. -#line 2733 "parser.tab.c" /* yacc.c:1648 */
  1408. +#line 2728 "parser.tab.c" /* yacc.c:1646 */
  1409. break;
  1410. case 21:
  1411. -#line 364 "parser.y" /* yacc.c:1648 */
  1412. +#line 362 "parser.y" /* yacc.c:1646 */
  1413. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type)));
  1414. reg_type((yyvsp[0].type), (yyvsp[0].type)->name, current_namespace, 0);
  1415. }
  1416. -#line 2741 "parser.tab.c" /* yacc.c:1648 */
  1417. +#line 2736 "parser.tab.c" /* yacc.c:1646 */
  1418. break;
  1419. case 22:
  1420. -#line 367 "parser.y" /* yacc.c:1648 */
  1421. +#line 365 "parser.y" /* yacc.c:1646 */
  1422. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_module((yyvsp[0].type))); }
  1423. -#line 2747 "parser.tab.c" /* yacc.c:1648 */
  1424. +#line 2742 "parser.tab.c" /* yacc.c:1646 */
  1425. break;
  1426. case 23:
  1427. -#line 368 "parser.y" /* yacc.c:1648 */
  1428. +#line 366 "parser.y" /* yacc.c:1646 */
  1429. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), (yyvsp[0].statement)); }
  1430. -#line 2753 "parser.tab.c" /* yacc.c:1648 */
  1431. +#line 2748 "parser.tab.c" /* yacc.c:1646 */
  1432. break;
  1433. case 24:
  1434. -#line 369 "parser.y" /* yacc.c:1648 */
  1435. +#line 367 "parser.y" /* yacc.c:1646 */
  1436. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_importlib((yyvsp[0].str))); }
  1437. -#line 2759 "parser.tab.c" /* yacc.c:1648 */
  1438. +#line 2754 "parser.tab.c" /* yacc.c:1646 */
  1439. break;
  1440. case 25:
  1441. -#line 370 "parser.y" /* yacc.c:1648 */
  1442. +#line 368 "parser.y" /* yacc.c:1646 */
  1443. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_library((yyvsp[0].typelib))); }
  1444. -#line 2765 "parser.tab.c" /* yacc.c:1648 */
  1445. +#line 2760 "parser.tab.c" /* yacc.c:1646 */
  1446. break;
  1447. case 26:
  1448. -#line 373 "parser.y" /* yacc.c:1648 */
  1449. +#line 371 "parser.y" /* yacc.c:1646 */
  1450. { (yyval.stmt_list) = NULL; }
  1451. -#line 2771 "parser.tab.c" /* yacc.c:1648 */
  1452. +#line 2766 "parser.tab.c" /* yacc.c:1646 */
  1453. break;
  1454. case 27:
  1455. -#line 374 "parser.y" /* yacc.c:1648 */
  1456. +#line 372 "parser.y" /* yacc.c:1646 */
  1457. { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), (yyvsp[0].statement)); }
  1458. -#line 2777 "parser.tab.c" /* yacc.c:1648 */
  1459. +#line 2772 "parser.tab.c" /* yacc.c:1646 */
  1460. break;
  1461. case 30:
  1462. -#line 382 "parser.y" /* yacc.c:1648 */
  1463. +#line 380 "parser.y" /* yacc.c:1646 */
  1464. { (yyval.statement) = make_statement_cppquote((yyvsp[0].str)); }
  1465. -#line 2783 "parser.tab.c" /* yacc.c:1648 */
  1466. +#line 2778 "parser.tab.c" /* yacc.c:1646 */
  1467. break;
  1468. case 31:
  1469. -#line 383 "parser.y" /* yacc.c:1648 */
  1470. +#line 381 "parser.y" /* yacc.c:1646 */
  1471. { (yyval.statement) = make_statement_type_decl((yyvsp[-1].type)); }
  1472. -#line 2789 "parser.tab.c" /* yacc.c:1648 */
  1473. +#line 2784 "parser.tab.c" /* yacc.c:1646 */
  1474. break;
  1475. case 32:
  1476. -#line 384 "parser.y" /* yacc.c:1648 */
  1477. +#line 382 "parser.y" /* yacc.c:1646 */
  1478. { (yyval.statement) = make_statement_declaration((yyvsp[-1].var)); }
  1479. -#line 2795 "parser.tab.c" /* yacc.c:1648 */
  1480. +#line 2790 "parser.tab.c" /* yacc.c:1646 */
  1481. break;
  1482. case 33:
  1483. -#line 385 "parser.y" /* yacc.c:1648 */
  1484. +#line 383 "parser.y" /* yacc.c:1646 */
  1485. { (yyval.statement) = make_statement_import((yyvsp[0].str)); }
  1486. -#line 2801 "parser.tab.c" /* yacc.c:1648 */
  1487. +#line 2796 "parser.tab.c" /* yacc.c:1646 */
  1488. break;
  1489. case 34:
  1490. -#line 386 "parser.y" /* yacc.c:1648 */
  1491. +#line 384 "parser.y" /* yacc.c:1646 */
  1492. { (yyval.statement) = (yyvsp[-1].statement); }
  1493. -#line 2807 "parser.tab.c" /* yacc.c:1648 */
  1494. +#line 2802 "parser.tab.c" /* yacc.c:1646 */
  1495. break;
  1496. case 35:
  1497. -#line 387 "parser.y" /* yacc.c:1648 */
  1498. +#line 385 "parser.y" /* yacc.c:1646 */
  1499. { (yyval.statement) = make_statement_pragma((yyvsp[0].str)); }
  1500. -#line 2813 "parser.tab.c" /* yacc.c:1648 */
  1501. +#line 2808 "parser.tab.c" /* yacc.c:1646 */
  1502. break;
  1503. case 36:
  1504. -#line 388 "parser.y" /* yacc.c:1648 */
  1505. +#line 386 "parser.y" /* yacc.c:1646 */
  1506. { (yyval.statement) = NULL; }
  1507. -#line 2819 "parser.tab.c" /* yacc.c:1648 */
  1508. +#line 2814 "parser.tab.c" /* yacc.c:1646 */
  1509. break;
  1510. case 37:
  1511. -#line 392 "parser.y" /* yacc.c:1648 */
  1512. +#line 390 "parser.y" /* yacc.c:1646 */
  1513. {
  1514. int result;
  1515. (yyval.statement) = NULL;
  1516. @@ -2827,909 +2822,909 @@ yyreduce:
  1517. if(!result)
  1518. error_loc("expected \"disable\" or \"enable\"\n");
  1519. }
  1520. -#line 2831 "parser.tab.c" /* yacc.c:1648 */
  1521. +#line 2826 "parser.tab.c" /* yacc.c:1646 */
  1522. break;
  1523. case 38:
  1524. -#line 402 "parser.y" /* yacc.c:1648 */
  1525. +#line 400 "parser.y" /* yacc.c:1646 */
  1526. { (yyval.warning_list) = append_warning(NULL, (yyvsp[0].num)); }
  1527. -#line 2837 "parser.tab.c" /* yacc.c:1648 */
  1528. +#line 2832 "parser.tab.c" /* yacc.c:1646 */
  1529. break;
  1530. case 39:
  1531. -#line 403 "parser.y" /* yacc.c:1648 */
  1532. +#line 401 "parser.y" /* yacc.c:1646 */
  1533. { (yyval.warning_list) = append_warning((yyvsp[-1].warning_list), (yyvsp[0].num)); }
  1534. -#line 2843 "parser.tab.c" /* yacc.c:1648 */
  1535. +#line 2838 "parser.tab.c" /* yacc.c:1646 */
  1536. break;
  1537. case 41:
  1538. -#line 408 "parser.y" /* yacc.c:1648 */
  1539. +#line 406 "parser.y" /* yacc.c:1646 */
  1540. { (yyval.type) = type_new_enum((yyvsp[0].str), current_namespace, FALSE, NULL); }
  1541. -#line 2849 "parser.tab.c" /* yacc.c:1648 */
  1542. +#line 2844 "parser.tab.c" /* yacc.c:1646 */
  1543. break;
  1544. case 43:
  1545. -#line 410 "parser.y" /* yacc.c:1648 */
  1546. +#line 408 "parser.y" /* yacc.c:1646 */
  1547. { (yyval.type) = type_new_struct((yyvsp[0].str), current_namespace, FALSE, NULL); }
  1548. -#line 2855 "parser.tab.c" /* yacc.c:1648 */
  1549. +#line 2850 "parser.tab.c" /* yacc.c:1646 */
  1550. break;
  1551. case 45:
  1552. -#line 412 "parser.y" /* yacc.c:1648 */
  1553. +#line 410 "parser.y" /* yacc.c:1646 */
  1554. { (yyval.type) = type_new_nonencapsulated_union((yyvsp[0].str), FALSE, NULL); }
  1555. -#line 2861 "parser.tab.c" /* yacc.c:1648 */
  1556. +#line 2856 "parser.tab.c" /* yacc.c:1646 */
  1557. break;
  1558. case 46:
  1559. -#line 413 "parser.y" /* yacc.c:1648 */
  1560. +#line 411 "parser.y" /* yacc.c:1646 */
  1561. { (yyval.type) = (yyvsp[0].type); (yyval.type)->attrs = check_enum_attrs((yyvsp[-1].attr_list)); }
  1562. -#line 2867 "parser.tab.c" /* yacc.c:1648 */
  1563. +#line 2862 "parser.tab.c" /* yacc.c:1646 */
  1564. break;
  1565. case 47:
  1566. -#line 414 "parser.y" /* yacc.c:1648 */
  1567. +#line 412 "parser.y" /* yacc.c:1646 */
  1568. { (yyval.type) = (yyvsp[0].type); (yyval.type)->attrs = check_struct_attrs((yyvsp[-1].attr_list)); }
  1569. -#line 2873 "parser.tab.c" /* yacc.c:1648 */
  1570. +#line 2868 "parser.tab.c" /* yacc.c:1646 */
  1571. break;
  1572. case 48:
  1573. -#line 415 "parser.y" /* yacc.c:1648 */
  1574. +#line 413 "parser.y" /* yacc.c:1646 */
  1575. { (yyval.type) = (yyvsp[0].type); (yyval.type)->attrs = check_union_attrs((yyvsp[-1].attr_list)); }
  1576. -#line 2879 "parser.tab.c" /* yacc.c:1648 */
  1577. +#line 2874 "parser.tab.c" /* yacc.c:1646 */
  1578. break;
  1579. case 49:
  1580. -#line 418 "parser.y" /* yacc.c:1648 */
  1581. +#line 416 "parser.y" /* yacc.c:1646 */
  1582. { (yyval.str) = (yyvsp[-1].str); }
  1583. -#line 2885 "parser.tab.c" /* yacc.c:1648 */
  1584. +#line 2880 "parser.tab.c" /* yacc.c:1646 */
  1585. break;
  1586. case 50:
  1587. -#line 420 "parser.y" /* yacc.c:1648 */
  1588. +#line 418 "parser.y" /* yacc.c:1646 */
  1589. { assert(yychar == YYEMPTY);
  1590. (yyval.import) = xmalloc(sizeof(struct _import_t));
  1591. (yyval.import)->name = (yyvsp[-1].str);
  1592. (yyval.import)->import_performed = do_import((yyvsp[-1].str));
  1593. if (!(yyval.import)->import_performed) yychar = aEOF;
  1594. }
  1595. -#line 2896 "parser.tab.c" /* yacc.c:1648 */
  1596. +#line 2891 "parser.tab.c" /* yacc.c:1646 */
  1597. break;
  1598. case 51:
  1599. -#line 428 "parser.y" /* yacc.c:1648 */
  1600. +#line 426 "parser.y" /* yacc.c:1646 */
  1601. { (yyval.str) = (yyvsp[-2].import)->name;
  1602. if ((yyvsp[-2].import)->import_performed) pop_import();
  1603. free((yyvsp[-2].import));
  1604. }
  1605. -#line 2905 "parser.tab.c" /* yacc.c:1648 */
  1606. +#line 2900 "parser.tab.c" /* yacc.c:1646 */
  1607. break;
  1608. case 52:
  1609. -#line 435 "parser.y" /* yacc.c:1648 */
  1610. +#line 433 "parser.y" /* yacc.c:1646 */
  1611. { (yyval.str) = (yyvsp[-2].str); if(!parse_only) add_importlib((yyvsp[-2].str), current_typelib); }
  1612. -#line 2911 "parser.tab.c" /* yacc.c:1648 */
  1613. +#line 2906 "parser.tab.c" /* yacc.c:1646 */
  1614. break;
  1615. case 53:
  1616. -#line 438 "parser.y" /* yacc.c:1648 */
  1617. +#line 436 "parser.y" /* yacc.c:1646 */
  1618. { (yyval.str) = (yyvsp[0].str); }
  1619. -#line 2917 "parser.tab.c" /* yacc.c:1648 */
  1620. +#line 2912 "parser.tab.c" /* yacc.c:1646 */
  1621. break;
  1622. case 54:
  1623. -#line 439 "parser.y" /* yacc.c:1648 */
  1624. +#line 437 "parser.y" /* yacc.c:1646 */
  1625. { (yyval.str) = (yyvsp[0].str); }
  1626. -#line 2923 "parser.tab.c" /* yacc.c:1648 */
  1627. +#line 2918 "parser.tab.c" /* yacc.c:1646 */
  1628. break;
  1629. case 55:
  1630. -#line 441 "parser.y" /* yacc.c:1648 */
  1631. +#line 439 "parser.y" /* yacc.c:1646 */
  1632. { (yyval.typelib) = make_library((yyvsp[-1].str), check_library_attrs((yyvsp[-1].str), (yyvsp[-2].attr_list)));
  1633. if (!parse_only && do_typelib) current_typelib = (yyval.typelib);
  1634. }
  1635. -#line 2931 "parser.tab.c" /* yacc.c:1648 */
  1636. +#line 2926 "parser.tab.c" /* yacc.c:1646 */
  1637. break;
  1638. case 56:
  1639. -#line 446 "parser.y" /* yacc.c:1648 */
  1640. +#line 444 "parser.y" /* yacc.c:1646 */
  1641. { (yyval.typelib) = (yyvsp[-3].typelib); (yyval.typelib)->stmts = (yyvsp[-2].stmt_list); }
  1642. -#line 2937 "parser.tab.c" /* yacc.c:1648 */
  1643. +#line 2932 "parser.tab.c" /* yacc.c:1646 */
  1644. break;
  1645. case 57:
  1646. -#line 449 "parser.y" /* yacc.c:1648 */
  1647. +#line 447 "parser.y" /* yacc.c:1646 */
  1648. { (yyval.var_list) = NULL; }
  1649. -#line 2943 "parser.tab.c" /* yacc.c:1648 */
  1650. +#line 2938 "parser.tab.c" /* yacc.c:1646 */
  1651. break;
  1652. case 59:
  1653. -#line 453 "parser.y" /* yacc.c:1648 */
  1654. +#line 451 "parser.y" /* yacc.c:1646 */
  1655. { check_arg_attrs((yyvsp[0].var)); (yyval.var_list) = append_var( NULL, (yyvsp[0].var) ); }
  1656. -#line 2949 "parser.tab.c" /* yacc.c:1648 */
  1657. +#line 2944 "parser.tab.c" /* yacc.c:1646 */
  1658. break;
  1659. case 60:
  1660. -#line 454 "parser.y" /* yacc.c:1648 */
  1661. +#line 452 "parser.y" /* yacc.c:1646 */
  1662. { check_arg_attrs((yyvsp[0].var)); (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var) ); }
  1663. -#line 2955 "parser.tab.c" /* yacc.c:1648 */
  1664. +#line 2950 "parser.tab.c" /* yacc.c:1646 */
  1665. break;
  1666. case 62:
  1667. -#line 458 "parser.y" /* yacc.c:1648 */
  1668. +#line 456 "parser.y" /* yacc.c:1646 */
  1669. { (yyval.var_list) = append_var( (yyvsp[-2].var_list), make_var(strdup("...")) ); }
  1670. -#line 2961 "parser.tab.c" /* yacc.c:1648 */
  1671. +#line 2956 "parser.tab.c" /* yacc.c:1646 */
  1672. break;
  1673. case 63:
  1674. -#line 462 "parser.y" /* yacc.c:1648 */
  1675. +#line 460 "parser.y" /* yacc.c:1646 */
  1676. { if ((yyvsp[-1].declspec)->stgclass != STG_NONE && (yyvsp[-1].declspec)->stgclass != STG_REGISTER)
  1677. error_loc("invalid storage class for function parameter\n");
  1678. (yyval.var) = declare_var((yyvsp[-2].attr_list), (yyvsp[-1].declspec), (yyvsp[0].declarator), TRUE);
  1679. free((yyvsp[-1].declspec)); free((yyvsp[0].declarator));
  1680. }
  1681. -#line 2971 "parser.tab.c" /* yacc.c:1648 */
  1682. +#line 2966 "parser.tab.c" /* yacc.c:1646 */
  1683. break;
  1684. case 64:
  1685. -#line 467 "parser.y" /* yacc.c:1648 */
  1686. +#line 465 "parser.y" /* yacc.c:1646 */
  1687. { if ((yyvsp[-1].declspec)->stgclass != STG_NONE && (yyvsp[-1].declspec)->stgclass != STG_REGISTER)
  1688. error_loc("invalid storage class for function parameter\n");
  1689. (yyval.var) = declare_var(NULL, (yyvsp[-1].declspec), (yyvsp[0].declarator), TRUE);
  1690. free((yyvsp[-1].declspec)); free((yyvsp[0].declarator));
  1691. }
  1692. -#line 2981 "parser.tab.c" /* yacc.c:1648 */
  1693. +#line 2976 "parser.tab.c" /* yacc.c:1646 */
  1694. break;
  1695. case 65:
  1696. -#line 474 "parser.y" /* yacc.c:1648 */
  1697. +#line 472 "parser.y" /* yacc.c:1646 */
  1698. { (yyval.expr) = (yyvsp[-1].expr);
  1699. if (!(yyval.expr)->is_const || (yyval.expr)->cval <= 0)
  1700. error_loc("array dimension is not a positive integer constant\n");
  1701. }
  1702. -#line 2990 "parser.tab.c" /* yacc.c:1648 */
  1703. +#line 2985 "parser.tab.c" /* yacc.c:1646 */
  1704. break;
  1705. case 66:
  1706. -#line 478 "parser.y" /* yacc.c:1648 */
  1707. +#line 476 "parser.y" /* yacc.c:1646 */
  1708. { (yyval.expr) = make_expr(EXPR_VOID); }
  1709. -#line 2996 "parser.tab.c" /* yacc.c:1648 */
  1710. +#line 2991 "parser.tab.c" /* yacc.c:1646 */
  1711. break;
  1712. case 67:
  1713. -#line 479 "parser.y" /* yacc.c:1648 */
  1714. +#line 477 "parser.y" /* yacc.c:1646 */
  1715. { (yyval.expr) = make_expr(EXPR_VOID); }
  1716. -#line 3002 "parser.tab.c" /* yacc.c:1648 */
  1717. +#line 2997 "parser.tab.c" /* yacc.c:1646 */
  1718. break;
  1719. case 68:
  1720. -#line 482 "parser.y" /* yacc.c:1648 */
  1721. +#line 480 "parser.y" /* yacc.c:1646 */
  1722. { (yyval.attr_list) = NULL; }
  1723. -#line 3008 "parser.tab.c" /* yacc.c:1648 */
  1724. +#line 3003 "parser.tab.c" /* yacc.c:1646 */
  1725. break;
  1726. case 70:
  1727. -#line 487 "parser.y" /* yacc.c:1648 */
  1728. +#line 485 "parser.y" /* yacc.c:1646 */
  1729. { (yyval.attr_list) = (yyvsp[-1].attr_list); }
  1730. -#line 3014 "parser.tab.c" /* yacc.c:1648 */
  1731. +#line 3009 "parser.tab.c" /* yacc.c:1646 */
  1732. break;
  1733. case 71:
  1734. -#line 490 "parser.y" /* yacc.c:1648 */
  1735. +#line 488 "parser.y" /* yacc.c:1646 */
  1736. { (yyval.attr_list) = append_attr( NULL, (yyvsp[0].attr) ); }
  1737. -#line 3020 "parser.tab.c" /* yacc.c:1648 */
  1738. +#line 3015 "parser.tab.c" /* yacc.c:1646 */
  1739. break;
  1740. case 72:
  1741. -#line 491 "parser.y" /* yacc.c:1648 */
  1742. +#line 489 "parser.y" /* yacc.c:1646 */
  1743. { (yyval.attr_list) = append_attr( (yyvsp[-2].attr_list), (yyvsp[0].attr) ); }
  1744. -#line 3026 "parser.tab.c" /* yacc.c:1648 */
  1745. +#line 3021 "parser.tab.c" /* yacc.c:1646 */
  1746. break;
  1747. case 73:
  1748. -#line 492 "parser.y" /* yacc.c:1648 */
  1749. +#line 490 "parser.y" /* yacc.c:1646 */
  1750. { (yyval.attr_list) = append_attr( (yyvsp[-3].attr_list), (yyvsp[0].attr) ); }
  1751. -#line 3032 "parser.tab.c" /* yacc.c:1648 */
  1752. +#line 3027 "parser.tab.c" /* yacc.c:1646 */
  1753. break;
  1754. case 74:
  1755. -#line 495 "parser.y" /* yacc.c:1648 */
  1756. +#line 493 "parser.y" /* yacc.c:1646 */
  1757. { (yyval.str_list) = append_str( NULL, (yyvsp[0].str) ); }
  1758. -#line 3038 "parser.tab.c" /* yacc.c:1648 */
  1759. +#line 3033 "parser.tab.c" /* yacc.c:1646 */
  1760. break;
  1761. case 75:
  1762. -#line 496 "parser.y" /* yacc.c:1648 */
  1763. +#line 494 "parser.y" /* yacc.c:1646 */
  1764. { (yyval.str_list) = append_str( (yyvsp[-2].str_list), (yyvsp[0].str) ); }
  1765. -#line 3044 "parser.tab.c" /* yacc.c:1648 */
  1766. +#line 3039 "parser.tab.c" /* yacc.c:1646 */
  1767. break;
  1768. case 76:
  1769. -#line 499 "parser.y" /* yacc.c:1648 */
  1770. +#line 497 "parser.y" /* yacc.c:1646 */
  1771. { (yyval.attr) = NULL; }
  1772. -#line 3050 "parser.tab.c" /* yacc.c:1648 */
  1773. +#line 3045 "parser.tab.c" /* yacc.c:1646 */
  1774. break;
  1775. case 77:
  1776. -#line 500 "parser.y" /* yacc.c:1648 */
  1777. +#line 498 "parser.y" /* yacc.c:1646 */
  1778. { (yyval.attr) = make_attr(ATTR_AGGREGATABLE); }
  1779. -#line 3056 "parser.tab.c" /* yacc.c:1648 */
  1780. +#line 3051 "parser.tab.c" /* yacc.c:1646 */
  1781. break;
  1782. case 78:
  1783. -#line 501 "parser.y" /* yacc.c:1648 */
  1784. +#line 499 "parser.y" /* yacc.c:1646 */
  1785. { (yyval.attr) = make_attrp(ATTR_ANNOTATION, (yyvsp[-1].str)); }
  1786. -#line 3062 "parser.tab.c" /* yacc.c:1648 */
  1787. +#line 3057 "parser.tab.c" /* yacc.c:1646 */
  1788. break;
  1789. case 79:
  1790. -#line 502 "parser.y" /* yacc.c:1648 */
  1791. +#line 500 "parser.y" /* yacc.c:1646 */
  1792. { (yyval.attr) = make_attr(ATTR_APPOBJECT); }
  1793. -#line 3068 "parser.tab.c" /* yacc.c:1648 */
  1794. +#line 3063 "parser.tab.c" /* yacc.c:1646 */
  1795. break;
  1796. case 80:
  1797. -#line 503 "parser.y" /* yacc.c:1648 */
  1798. +#line 501 "parser.y" /* yacc.c:1646 */
  1799. { (yyval.attr) = make_attr(ATTR_ASYNC); }
  1800. -#line 3074 "parser.tab.c" /* yacc.c:1648 */
  1801. +#line 3069 "parser.tab.c" /* yacc.c:1646 */
  1802. break;
  1803. case 81:
  1804. -#line 504 "parser.y" /* yacc.c:1648 */
  1805. +#line 502 "parser.y" /* yacc.c:1646 */
  1806. { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); }
  1807. -#line 3080 "parser.tab.c" /* yacc.c:1648 */
  1808. +#line 3075 "parser.tab.c" /* yacc.c:1646 */
  1809. break;
  1810. case 82:
  1811. -#line 505 "parser.y" /* yacc.c:1648 */
  1812. +#line 503 "parser.y" /* yacc.c:1646 */
  1813. { (yyval.attr) = make_attr(ATTR_BINDABLE); }
  1814. -#line 3086 "parser.tab.c" /* yacc.c:1648 */
  1815. +#line 3081 "parser.tab.c" /* yacc.c:1646 */
  1816. break;
  1817. case 83:
  1818. -#line 506 "parser.y" /* yacc.c:1648 */
  1819. +#line 504 "parser.y" /* yacc.c:1646 */
  1820. { (yyval.attr) = make_attr(ATTR_BROADCAST); }
  1821. -#line 3092 "parser.tab.c" /* yacc.c:1648 */
  1822. +#line 3087 "parser.tab.c" /* yacc.c:1646 */
  1823. break;
  1824. case 84:
  1825. -#line 507 "parser.y" /* yacc.c:1648 */
  1826. +#line 505 "parser.y" /* yacc.c:1646 */
  1827. { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[-1].var)); }
  1828. -#line 3098 "parser.tab.c" /* yacc.c:1648 */
  1829. +#line 3093 "parser.tab.c" /* yacc.c:1646 */
  1830. break;
  1831. case 85:
  1832. -#line 508 "parser.y" /* yacc.c:1648 */
  1833. +#line 506 "parser.y" /* yacc.c:1646 */
  1834. { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[-1].expr_list)); }
  1835. -#line 3104 "parser.tab.c" /* yacc.c:1648 */
  1836. +#line 3099 "parser.tab.c" /* yacc.c:1646 */
  1837. break;
  1838. case 86:
  1839. -#line 509 "parser.y" /* yacc.c:1648 */
  1840. +#line 507 "parser.y" /* yacc.c:1646 */
  1841. { (yyval.attr) = make_attr(ATTR_CODE); }
  1842. -#line 3110 "parser.tab.c" /* yacc.c:1648 */
  1843. +#line 3105 "parser.tab.c" /* yacc.c:1646 */
  1844. break;
  1845. case 87:
  1846. -#line 510 "parser.y" /* yacc.c:1648 */
  1847. +#line 508 "parser.y" /* yacc.c:1646 */
  1848. { (yyval.attr) = make_attr(ATTR_COMMSTATUS); }
  1849. -#line 3116 "parser.tab.c" /* yacc.c:1648 */
  1850. +#line 3111 "parser.tab.c" /* yacc.c:1646 */
  1851. break;
  1852. case 88:
  1853. -#line 511 "parser.y" /* yacc.c:1648 */
  1854. +#line 509 "parser.y" /* yacc.c:1646 */
  1855. { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); }
  1856. -#line 3122 "parser.tab.c" /* yacc.c:1648 */
  1857. +#line 3117 "parser.tab.c" /* yacc.c:1646 */
  1858. break;
  1859. case 89:
  1860. -#line 512 "parser.y" /* yacc.c:1648 */
  1861. +#line 510 "parser.y" /* yacc.c:1646 */
  1862. { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ }
  1863. -#line 3128 "parser.tab.c" /* yacc.c:1648 */
  1864. +#line 3123 "parser.tab.c" /* yacc.c:1646 */
  1865. break;
  1866. case 90:
  1867. -#line 513 "parser.y" /* yacc.c:1648 */
  1868. +#line 511 "parser.y" /* yacc.c:1646 */
  1869. { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ }
  1870. -#line 3134 "parser.tab.c" /* yacc.c:1648 */
  1871. +#line 3129 "parser.tab.c" /* yacc.c:1646 */
  1872. break;
  1873. case 91:
  1874. -#line 514 "parser.y" /* yacc.c:1648 */
  1875. +#line 512 "parser.y" /* yacc.c:1646 */
  1876. { (yyval.attr) = make_attr(ATTR_CONTROL); }
  1877. -#line 3140 "parser.tab.c" /* yacc.c:1648 */
  1878. +#line 3135 "parser.tab.c" /* yacc.c:1646 */
  1879. break;
  1880. case 92:
  1881. -#line 515 "parser.y" /* yacc.c:1648 */
  1882. +#line 513 "parser.y" /* yacc.c:1646 */
  1883. { (yyval.attr) = make_attr(ATTR_DECODE); }
  1884. -#line 3146 "parser.tab.c" /* yacc.c:1648 */
  1885. +#line 3141 "parser.tab.c" /* yacc.c:1646 */
  1886. break;
  1887. case 93:
  1888. -#line 516 "parser.y" /* yacc.c:1648 */
  1889. +#line 514 "parser.y" /* yacc.c:1646 */
  1890. { (yyval.attr) = make_attr(ATTR_DEFAULT); }
  1891. -#line 3152 "parser.tab.c" /* yacc.c:1648 */
  1892. +#line 3147 "parser.tab.c" /* yacc.c:1646 */
  1893. break;
  1894. case 94:
  1895. -#line 517 "parser.y" /* yacc.c:1648 */
  1896. +#line 515 "parser.y" /* yacc.c:1646 */
  1897. { (yyval.attr) = make_attr(ATTR_DEFAULTBIND); }
  1898. -#line 3158 "parser.tab.c" /* yacc.c:1648 */
  1899. +#line 3153 "parser.tab.c" /* yacc.c:1646 */
  1900. break;
  1901. case 95:
  1902. -#line 518 "parser.y" /* yacc.c:1648 */
  1903. +#line 516 "parser.y" /* yacc.c:1646 */
  1904. { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); }
  1905. -#line 3164 "parser.tab.c" /* yacc.c:1648 */
  1906. +#line 3159 "parser.tab.c" /* yacc.c:1646 */
  1907. break;
  1908. case 96:
  1909. -#line 519 "parser.y" /* yacc.c:1648 */
  1910. +#line 517 "parser.y" /* yacc.c:1646 */
  1911. { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE, (yyvsp[-1].expr)); }
  1912. -#line 3170 "parser.tab.c" /* yacc.c:1648 */
  1913. +#line 3165 "parser.tab.c" /* yacc.c:1646 */
  1914. break;
  1915. case 97:
  1916. -#line 520 "parser.y" /* yacc.c:1648 */
  1917. +#line 518 "parser.y" /* yacc.c:1646 */
  1918. { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); }
  1919. -#line 3176 "parser.tab.c" /* yacc.c:1648 */
  1920. +#line 3171 "parser.tab.c" /* yacc.c:1646 */
  1921. break;
  1922. case 98:
  1923. -#line 521 "parser.y" /* yacc.c:1648 */
  1924. +#line 519 "parser.y" /* yacc.c:1646 */
  1925. { (yyval.attr) = make_attr(ATTR_DISABLECONSISTENCYCHECK); }
  1926. -#line 3182 "parser.tab.c" /* yacc.c:1648 */
  1927. +#line 3177 "parser.tab.c" /* yacc.c:1646 */
  1928. break;
  1929. case 99:
  1930. -#line 522 "parser.y" /* yacc.c:1648 */
  1931. +#line 520 "parser.y" /* yacc.c:1646 */
  1932. { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); }
  1933. -#line 3188 "parser.tab.c" /* yacc.c:1648 */
  1934. +#line 3183 "parser.tab.c" /* yacc.c:1646 */
  1935. break;
  1936. case 100:
  1937. -#line 523 "parser.y" /* yacc.c:1648 */
  1938. +#line 521 "parser.y" /* yacc.c:1646 */
  1939. { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[-1].str)); }
  1940. -#line 3194 "parser.tab.c" /* yacc.c:1648 */
  1941. +#line 3189 "parser.tab.c" /* yacc.c:1646 */
  1942. break;
  1943. case 101:
  1944. -#line 524 "parser.y" /* yacc.c:1648 */
  1945. +#line 522 "parser.y" /* yacc.c:1646 */
  1946. { (yyval.attr) = make_attr(ATTR_DUAL); }
  1947. -#line 3200 "parser.tab.c" /* yacc.c:1648 */
  1948. +#line 3195 "parser.tab.c" /* yacc.c:1646 */
  1949. break;
  1950. case 102:
  1951. -#line 525 "parser.y" /* yacc.c:1648 */
  1952. +#line 523 "parser.y" /* yacc.c:1646 */
  1953. { (yyval.attr) = make_attr(ATTR_ENABLEALLOCATE); }
  1954. -#line 3206 "parser.tab.c" /* yacc.c:1648 */
  1955. +#line 3201 "parser.tab.c" /* yacc.c:1646 */
  1956. break;
  1957. case 103:
  1958. -#line 526 "parser.y" /* yacc.c:1648 */
  1959. +#line 524 "parser.y" /* yacc.c:1646 */
  1960. { (yyval.attr) = make_attr(ATTR_ENCODE); }
  1961. -#line 3212 "parser.tab.c" /* yacc.c:1648 */
  1962. +#line 3207 "parser.tab.c" /* yacc.c:1646 */
  1963. break;
  1964. case 104:
  1965. -#line 527 "parser.y" /* yacc.c:1648 */
  1966. +#line 525 "parser.y" /* yacc.c:1646 */
  1967. { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[-1].str_list)); }
  1968. -#line 3218 "parser.tab.c" /* yacc.c:1648 */
  1969. +#line 3213 "parser.tab.c" /* yacc.c:1646 */
  1970. break;
  1971. case 105:
  1972. -#line 528 "parser.y" /* yacc.c:1648 */
  1973. +#line 526 "parser.y" /* yacc.c:1646 */
  1974. { (yyval.attr) = make_attrp(ATTR_ENTRY, (yyvsp[-1].expr)); }
  1975. -#line 3224 "parser.tab.c" /* yacc.c:1648 */
  1976. +#line 3219 "parser.tab.c" /* yacc.c:1646 */
  1977. break;
  1978. case 106:
  1979. -#line 529 "parser.y" /* yacc.c:1648 */
  1980. +#line 527 "parser.y" /* yacc.c:1646 */
  1981. { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); }
  1982. -#line 3230 "parser.tab.c" /* yacc.c:1648 */
  1983. +#line 3225 "parser.tab.c" /* yacc.c:1646 */
  1984. break;
  1985. case 107:
  1986. -#line 530 "parser.y" /* yacc.c:1648 */
  1987. +#line 528 "parser.y" /* yacc.c:1646 */
  1988. { (yyval.attr) = make_attr(ATTR_FAULTSTATUS); }
  1989. -#line 3236 "parser.tab.c" /* yacc.c:1648 */
  1990. +#line 3231 "parser.tab.c" /* yacc.c:1646 */
  1991. break;
  1992. case 108:
  1993. -#line 531 "parser.y" /* yacc.c:1648 */
  1994. +#line 529 "parser.y" /* yacc.c:1646 */
  1995. { (yyval.attr) = make_attr(ATTR_FORCEALLOCATE); }
  1996. -#line 3242 "parser.tab.c" /* yacc.c:1648 */
  1997. +#line 3237 "parser.tab.c" /* yacc.c:1646 */
  1998. break;
  1999. case 109:
  2000. -#line 532 "parser.y" /* yacc.c:1648 */
  2001. +#line 530 "parser.y" /* yacc.c:1646 */
  2002. { (yyval.attr) = make_attr(ATTR_HANDLE); }
  2003. -#line 3248 "parser.tab.c" /* yacc.c:1648 */
  2004. +#line 3243 "parser.tab.c" /* yacc.c:1646 */
  2005. break;
  2006. case 110:
  2007. -#line 533 "parser.y" /* yacc.c:1648 */
  2008. +#line 531 "parser.y" /* yacc.c:1646 */
  2009. { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[-1].expr)); }
  2010. -#line 3254 "parser.tab.c" /* yacc.c:1648 */
  2011. +#line 3249 "parser.tab.c" /* yacc.c:1646 */
  2012. break;
  2013. case 111:
  2014. -#line 534 "parser.y" /* yacc.c:1648 */
  2015. +#line 532 "parser.y" /* yacc.c:1646 */
  2016. { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[-1].str)); }
  2017. -#line 3260 "parser.tab.c" /* yacc.c:1648 */
  2018. +#line 3255 "parser.tab.c" /* yacc.c:1646 */
  2019. break;
  2020. case 112:
  2021. -#line 535 "parser.y" /* yacc.c:1648 */
  2022. +#line 533 "parser.y" /* yacc.c:1646 */
  2023. { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[-1].str)); }
  2024. -#line 3266 "parser.tab.c" /* yacc.c:1648 */
  2025. +#line 3261 "parser.tab.c" /* yacc.c:1646 */
  2026. break;
  2027. case 113:
  2028. -#line 536 "parser.y" /* yacc.c:1648 */
  2029. +#line 534 "parser.y" /* yacc.c:1646 */
  2030. { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[-1].expr)); }
  2031. -#line 3272 "parser.tab.c" /* yacc.c:1648 */
  2032. +#line 3267 "parser.tab.c" /* yacc.c:1646 */
  2033. break;
  2034. case 114:
  2035. -#line 537 "parser.y" /* yacc.c:1648 */
  2036. +#line 535 "parser.y" /* yacc.c:1646 */
  2037. { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[-1].str)); }
  2038. -#line 3278 "parser.tab.c" /* yacc.c:1648 */
  2039. +#line 3273 "parser.tab.c" /* yacc.c:1646 */
  2040. break;
  2041. case 115:
  2042. -#line 538 "parser.y" /* yacc.c:1648 */
  2043. +#line 536 "parser.y" /* yacc.c:1646 */
  2044. { (yyval.attr) = make_attr(ATTR_HIDDEN); }
  2045. -#line 3284 "parser.tab.c" /* yacc.c:1648 */
  2046. +#line 3279 "parser.tab.c" /* yacc.c:1646 */
  2047. break;
  2048. case 116:
  2049. -#line 539 "parser.y" /* yacc.c:1648 */
  2050. +#line 537 "parser.y" /* yacc.c:1646 */
  2051. { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[-1].expr)); }
  2052. -#line 3290 "parser.tab.c" /* yacc.c:1648 */
  2053. +#line 3285 "parser.tab.c" /* yacc.c:1646 */
  2054. break;
  2055. case 117:
  2056. -#line 540 "parser.y" /* yacc.c:1648 */
  2057. +#line 538 "parser.y" /* yacc.c:1646 */
  2058. { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); }
  2059. -#line 3296 "parser.tab.c" /* yacc.c:1648 */
  2060. +#line 3291 "parser.tab.c" /* yacc.c:1646 */
  2061. break;
  2062. case 118:
  2063. -#line 541 "parser.y" /* yacc.c:1648 */
  2064. +#line 539 "parser.y" /* yacc.c:1646 */
  2065. { (yyval.attr) = make_attr(ATTR_IGNORE); }
  2066. -#line 3302 "parser.tab.c" /* yacc.c:1648 */
  2067. +#line 3297 "parser.tab.c" /* yacc.c:1646 */
  2068. break;
  2069. case 119:
  2070. -#line 542 "parser.y" /* yacc.c:1648 */
  2071. +#line 540 "parser.y" /* yacc.c:1646 */
  2072. { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[-1].expr)); }
  2073. -#line 3308 "parser.tab.c" /* yacc.c:1648 */
  2074. +#line 3303 "parser.tab.c" /* yacc.c:1646 */
  2075. break;
  2076. case 120:
  2077. -#line 543 "parser.y" /* yacc.c:1648 */
  2078. +#line 541 "parser.y" /* yacc.c:1646 */
  2079. { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); }
  2080. -#line 3314 "parser.tab.c" /* yacc.c:1648 */
  2081. +#line 3309 "parser.tab.c" /* yacc.c:1646 */
  2082. break;
  2083. case 121:
  2084. -#line 544 "parser.y" /* yacc.c:1648 */
  2085. +#line 542 "parser.y" /* yacc.c:1646 */
  2086. { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[-1].var)); }
  2087. -#line 3320 "parser.tab.c" /* yacc.c:1648 */
  2088. +#line 3315 "parser.tab.c" /* yacc.c:1646 */
  2089. break;
  2090. case 122:
  2091. -#line 545 "parser.y" /* yacc.c:1648 */
  2092. +#line 543 "parser.y" /* yacc.c:1646 */
  2093. { (yyval.attr) = make_attr(ATTR_IN); }
  2094. -#line 3326 "parser.tab.c" /* yacc.c:1648 */
  2095. +#line 3321 "parser.tab.c" /* yacc.c:1646 */
  2096. break;
  2097. case 123:
  2098. -#line 546 "parser.y" /* yacc.c:1648 */
  2099. +#line 544 "parser.y" /* yacc.c:1646 */
  2100. { (yyval.attr) = make_attr(ATTR_INPUTSYNC); }
  2101. -#line 3332 "parser.tab.c" /* yacc.c:1648 */
  2102. +#line 3327 "parser.tab.c" /* yacc.c:1646 */
  2103. break;
  2104. case 124:
  2105. -#line 547 "parser.y" /* yacc.c:1648 */
  2106. +#line 545 "parser.y" /* yacc.c:1646 */
  2107. { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[-1].expr_list)); }
  2108. -#line 3338 "parser.tab.c" /* yacc.c:1648 */
  2109. +#line 3333 "parser.tab.c" /* yacc.c:1646 */
  2110. break;
  2111. case 125:
  2112. -#line 548 "parser.y" /* yacc.c:1648 */
  2113. +#line 546 "parser.y" /* yacc.c:1646 */
  2114. { (yyval.attr) = make_attrp(ATTR_LIBLCID, (yyvsp[-1].expr)); }
  2115. -#line 3344 "parser.tab.c" /* yacc.c:1648 */
  2116. +#line 3339 "parser.tab.c" /* yacc.c:1646 */
  2117. break;
  2118. case 126:
  2119. -#line 549 "parser.y" /* yacc.c:1648 */
  2120. +#line 547 "parser.y" /* yacc.c:1646 */
  2121. { (yyval.attr) = make_attr(ATTR_PARAMLCID); }
  2122. -#line 3350 "parser.tab.c" /* yacc.c:1648 */
  2123. +#line 3345 "parser.tab.c" /* yacc.c:1646 */
  2124. break;
  2125. case 127:
  2126. -#line 550 "parser.y" /* yacc.c:1648 */
  2127. +#line 548 "parser.y" /* yacc.c:1646 */
  2128. { (yyval.attr) = make_attr(ATTR_LICENSED); }
  2129. -#line 3356 "parser.tab.c" /* yacc.c:1648 */
  2130. +#line 3351 "parser.tab.c" /* yacc.c:1646 */
  2131. break;
  2132. case 128:
  2133. -#line 551 "parser.y" /* yacc.c:1648 */
  2134. +#line 549 "parser.y" /* yacc.c:1646 */
  2135. { (yyval.attr) = make_attr(ATTR_LOCAL); }
  2136. -#line 3362 "parser.tab.c" /* yacc.c:1648 */
  2137. +#line 3357 "parser.tab.c" /* yacc.c:1646 */
  2138. break;
  2139. case 129:
  2140. -#line 552 "parser.y" /* yacc.c:1648 */
  2141. +#line 550 "parser.y" /* yacc.c:1646 */
  2142. { (yyval.attr) = make_attr(ATTR_MAYBE); }
  2143. -#line 3368 "parser.tab.c" /* yacc.c:1648 */
  2144. +#line 3363 "parser.tab.c" /* yacc.c:1646 */
  2145. break;
  2146. case 130:
  2147. -#line 553 "parser.y" /* yacc.c:1648 */
  2148. +#line 551 "parser.y" /* yacc.c:1646 */
  2149. { (yyval.attr) = make_attr(ATTR_MESSAGE); }
  2150. -#line 3374 "parser.tab.c" /* yacc.c:1648 */
  2151. +#line 3369 "parser.tab.c" /* yacc.c:1646 */
  2152. break;
  2153. case 131:
  2154. -#line 554 "parser.y" /* yacc.c:1648 */
  2155. +#line 552 "parser.y" /* yacc.c:1646 */
  2156. { (yyval.attr) = make_attr(ATTR_NOCODE); }
  2157. -#line 3380 "parser.tab.c" /* yacc.c:1648 */
  2158. +#line 3375 "parser.tab.c" /* yacc.c:1646 */
  2159. break;
  2160. case 132:
  2161. -#line 555 "parser.y" /* yacc.c:1648 */
  2162. +#line 553 "parser.y" /* yacc.c:1646 */
  2163. { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); }
  2164. -#line 3386 "parser.tab.c" /* yacc.c:1648 */
  2165. +#line 3381 "parser.tab.c" /* yacc.c:1646 */
  2166. break;
  2167. case 133:
  2168. -#line 556 "parser.y" /* yacc.c:1648 */
  2169. +#line 554 "parser.y" /* yacc.c:1646 */
  2170. { (yyval.attr) = make_attr(ATTR_NONCREATABLE); }
  2171. -#line 3392 "parser.tab.c" /* yacc.c:1648 */
  2172. +#line 3387 "parser.tab.c" /* yacc.c:1646 */
  2173. break;
  2174. case 134:
  2175. -#line 557 "parser.y" /* yacc.c:1648 */
  2176. +#line 555 "parser.y" /* yacc.c:1646 */
  2177. { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); }
  2178. -#line 3398 "parser.tab.c" /* yacc.c:1648 */
  2179. +#line 3393 "parser.tab.c" /* yacc.c:1646 */
  2180. break;
  2181. case 135:
  2182. -#line 558 "parser.y" /* yacc.c:1648 */
  2183. +#line 556 "parser.y" /* yacc.c:1646 */
  2184. { (yyval.attr) = make_attr(ATTR_NOTIFY); }
  2185. -#line 3404 "parser.tab.c" /* yacc.c:1648 */
  2186. +#line 3399 "parser.tab.c" /* yacc.c:1646 */
  2187. break;
  2188. case 136:
  2189. -#line 559 "parser.y" /* yacc.c:1648 */
  2190. +#line 557 "parser.y" /* yacc.c:1646 */
  2191. { (yyval.attr) = make_attr(ATTR_NOTIFYFLAG); }
  2192. -#line 3410 "parser.tab.c" /* yacc.c:1648 */
  2193. +#line 3405 "parser.tab.c" /* yacc.c:1646 */
  2194. break;
  2195. case 137:
  2196. -#line 560 "parser.y" /* yacc.c:1648 */
  2197. +#line 558 "parser.y" /* yacc.c:1646 */
  2198. { (yyval.attr) = make_attr(ATTR_OBJECT); }
  2199. -#line 3416 "parser.tab.c" /* yacc.c:1648 */
  2200. +#line 3411 "parser.tab.c" /* yacc.c:1646 */
  2201. break;
  2202. case 138:
  2203. -#line 561 "parser.y" /* yacc.c:1648 */
  2204. +#line 559 "parser.y" /* yacc.c:1646 */
  2205. { (yyval.attr) = make_attr(ATTR_ODL); }
  2206. -#line 3422 "parser.tab.c" /* yacc.c:1648 */
  2207. +#line 3417 "parser.tab.c" /* yacc.c:1646 */
  2208. break;
  2209. case 139:
  2210. -#line 562 "parser.y" /* yacc.c:1648 */
  2211. +#line 560 "parser.y" /* yacc.c:1646 */
  2212. { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); }
  2213. -#line 3428 "parser.tab.c" /* yacc.c:1648 */
  2214. +#line 3423 "parser.tab.c" /* yacc.c:1646 */
  2215. break;
  2216. case 140:
  2217. -#line 563 "parser.y" /* yacc.c:1648 */
  2218. +#line 561 "parser.y" /* yacc.c:1646 */
  2219. { (yyval.attr) = make_attrp(ATTR_OPTIMIZE, (yyvsp[-1].str)); }
  2220. -#line 3434 "parser.tab.c" /* yacc.c:1648 */
  2221. +#line 3429 "parser.tab.c" /* yacc.c:1646 */
  2222. break;
  2223. case 141:
  2224. -#line 564 "parser.y" /* yacc.c:1648 */
  2225. +#line 562 "parser.y" /* yacc.c:1646 */
  2226. { (yyval.attr) = make_attr(ATTR_OPTIONAL); }
  2227. -#line 3440 "parser.tab.c" /* yacc.c:1648 */
  2228. +#line 3435 "parser.tab.c" /* yacc.c:1646 */
  2229. break;
  2230. case 142:
  2231. -#line 565 "parser.y" /* yacc.c:1648 */
  2232. +#line 563 "parser.y" /* yacc.c:1646 */
  2233. { (yyval.attr) = make_attr(ATTR_OUT); }
  2234. -#line 3446 "parser.tab.c" /* yacc.c:1648 */
  2235. +#line 3441 "parser.tab.c" /* yacc.c:1646 */
  2236. break;
  2237. case 143:
  2238. -#line 566 "parser.y" /* yacc.c:1648 */
  2239. +#line 564 "parser.y" /* yacc.c:1646 */
  2240. { (yyval.attr) = make_attr(ATTR_PARTIALIGNORE); }
  2241. -#line 3452 "parser.tab.c" /* yacc.c:1648 */
  2242. +#line 3447 "parser.tab.c" /* yacc.c:1646 */
  2243. break;
  2244. case 144:
  2245. -#line 567 "parser.y" /* yacc.c:1648 */
  2246. +#line 565 "parser.y" /* yacc.c:1646 */
  2247. { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[-1].num)); }
  2248. -#line 3458 "parser.tab.c" /* yacc.c:1648 */
  2249. +#line 3453 "parser.tab.c" /* yacc.c:1646 */
  2250. break;
  2251. case 145:
  2252. -#line 568 "parser.y" /* yacc.c:1648 */
  2253. +#line 566 "parser.y" /* yacc.c:1646 */
  2254. { (yyval.attr) = make_attrp(ATTR_PROGID, (yyvsp[-1].str)); }
  2255. -#line 3464 "parser.tab.c" /* yacc.c:1648 */
  2256. +#line 3459 "parser.tab.c" /* yacc.c:1646 */
  2257. break;
  2258. case 146:
  2259. -#line 569 "parser.y" /* yacc.c:1648 */
  2260. +#line 567 "parser.y" /* yacc.c:1646 */
  2261. { (yyval.attr) = make_attr(ATTR_PROPGET); }
  2262. -#line 3470 "parser.tab.c" /* yacc.c:1648 */
  2263. +#line 3465 "parser.tab.c" /* yacc.c:1646 */
  2264. break;
  2265. case 147:
  2266. -#line 570 "parser.y" /* yacc.c:1648 */
  2267. +#line 568 "parser.y" /* yacc.c:1646 */
  2268. { (yyval.attr) = make_attr(ATTR_PROPPUT); }
  2269. -#line 3476 "parser.tab.c" /* yacc.c:1648 */
  2270. +#line 3471 "parser.tab.c" /* yacc.c:1646 */
  2271. break;
  2272. case 148:
  2273. -#line 571 "parser.y" /* yacc.c:1648 */
  2274. +#line 569 "parser.y" /* yacc.c:1646 */
  2275. { (yyval.attr) = make_attr(ATTR_PROPPUTREF); }
  2276. -#line 3482 "parser.tab.c" /* yacc.c:1648 */
  2277. +#line 3477 "parser.tab.c" /* yacc.c:1646 */
  2278. break;
  2279. case 149:
  2280. -#line 572 "parser.y" /* yacc.c:1648 */
  2281. +#line 570 "parser.y" /* yacc.c:1646 */
  2282. { (yyval.attr) = make_attr(ATTR_PROXY); }
  2283. -#line 3488 "parser.tab.c" /* yacc.c:1648 */
  2284. +#line 3483 "parser.tab.c" /* yacc.c:1646 */
  2285. break;
  2286. case 150:
  2287. -#line 573 "parser.y" /* yacc.c:1648 */
  2288. +#line 571 "parser.y" /* yacc.c:1646 */
  2289. { (yyval.attr) = make_attr(ATTR_PUBLIC); }
  2290. -#line 3494 "parser.tab.c" /* yacc.c:1648 */
  2291. +#line 3489 "parser.tab.c" /* yacc.c:1646 */
  2292. break;
  2293. case 151:
  2294. -#line 575 "parser.y" /* yacc.c:1648 */
  2295. +#line 573 "parser.y" /* yacc.c:1646 */
  2296. { expr_list_t *list = append_expr( NULL, (yyvsp[-3].expr) );
  2297. list = append_expr( list, (yyvsp[-1].expr) );
  2298. (yyval.attr) = make_attrp(ATTR_RANGE, list); }
  2299. -#line 3502 "parser.tab.c" /* yacc.c:1648 */
  2300. +#line 3497 "parser.tab.c" /* yacc.c:1646 */
  2301. break;
  2302. case 152:
  2303. -#line 578 "parser.y" /* yacc.c:1648 */
  2304. +#line 576 "parser.y" /* yacc.c:1646 */
  2305. { (yyval.attr) = make_attr(ATTR_READONLY); }
  2306. -#line 3508 "parser.tab.c" /* yacc.c:1648 */
  2307. +#line 3503 "parser.tab.c" /* yacc.c:1646 */
  2308. break;
  2309. case 153:
  2310. -#line 579 "parser.y" /* yacc.c:1648 */
  2311. +#line 577 "parser.y" /* yacc.c:1646 */
  2312. { (yyval.attr) = make_attrp(ATTR_REPRESENTAS, (yyvsp[-1].type)); }
  2313. -#line 3514 "parser.tab.c" /* yacc.c:1648 */
  2314. +#line 3509 "parser.tab.c" /* yacc.c:1646 */
  2315. break;
  2316. case 154:
  2317. -#line 580 "parser.y" /* yacc.c:1648 */
  2318. +#line 578 "parser.y" /* yacc.c:1646 */
  2319. { (yyval.attr) = make_attr(ATTR_REQUESTEDIT); }
  2320. -#line 3520 "parser.tab.c" /* yacc.c:1648 */
  2321. +#line 3515 "parser.tab.c" /* yacc.c:1646 */
  2322. break;
  2323. case 155:
  2324. -#line 581 "parser.y" /* yacc.c:1648 */
  2325. +#line 579 "parser.y" /* yacc.c:1646 */
  2326. { (yyval.attr) = make_attr(ATTR_RESTRICTED); }
  2327. -#line 3526 "parser.tab.c" /* yacc.c:1648 */
  2328. +#line 3521 "parser.tab.c" /* yacc.c:1646 */
  2329. break;
  2330. case 156:
  2331. -#line 582 "parser.y" /* yacc.c:1648 */
  2332. +#line 580 "parser.y" /* yacc.c:1646 */
  2333. { (yyval.attr) = make_attr(ATTR_RETVAL); }
  2334. -#line 3532 "parser.tab.c" /* yacc.c:1648 */
  2335. +#line 3527 "parser.tab.c" /* yacc.c:1646 */
  2336. break;
  2337. case 157:
  2338. -#line 583 "parser.y" /* yacc.c:1648 */
  2339. +#line 581 "parser.y" /* yacc.c:1646 */
  2340. { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[-1].expr_list)); }
  2341. -#line 3538 "parser.tab.c" /* yacc.c:1648 */
  2342. +#line 3533 "parser.tab.c" /* yacc.c:1646 */
  2343. break;
  2344. case 158:
  2345. -#line 584 "parser.y" /* yacc.c:1648 */
  2346. +#line 582 "parser.y" /* yacc.c:1646 */
  2347. { (yyval.attr) = make_attr(ATTR_SOURCE); }
  2348. -#line 3544 "parser.tab.c" /* yacc.c:1648 */
  2349. +#line 3539 "parser.tab.c" /* yacc.c:1646 */
  2350. break;
  2351. case 159:
  2352. -#line 585 "parser.y" /* yacc.c:1648 */
  2353. +#line 583 "parser.y" /* yacc.c:1646 */
  2354. { (yyval.attr) = make_attr(ATTR_STRICTCONTEXTHANDLE); }
  2355. -#line 3550 "parser.tab.c" /* yacc.c:1648 */
  2356. +#line 3545 "parser.tab.c" /* yacc.c:1646 */
  2357. break;
  2358. case 160:
  2359. -#line 586 "parser.y" /* yacc.c:1648 */
  2360. +#line 584 "parser.y" /* yacc.c:1646 */
  2361. { (yyval.attr) = make_attr(ATTR_STRING); }
  2362. -#line 3556 "parser.tab.c" /* yacc.c:1648 */
  2363. +#line 3551 "parser.tab.c" /* yacc.c:1646 */
  2364. break;
  2365. case 161:
  2366. -#line 587 "parser.y" /* yacc.c:1648 */
  2367. +#line 585 "parser.y" /* yacc.c:1646 */
  2368. { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[-1].expr)); }
  2369. -#line 3562 "parser.tab.c" /* yacc.c:1648 */
  2370. +#line 3557 "parser.tab.c" /* yacc.c:1646 */
  2371. break;
  2372. case 162:
  2373. -#line 588 "parser.y" /* yacc.c:1648 */
  2374. +#line 586 "parser.y" /* yacc.c:1646 */
  2375. { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[-1].type)); }
  2376. -#line 3568 "parser.tab.c" /* yacc.c:1648 */
  2377. +#line 3563 "parser.tab.c" /* yacc.c:1646 */
  2378. break;
  2379. case 163:
  2380. -#line 589 "parser.y" /* yacc.c:1648 */
  2381. +#line 587 "parser.y" /* yacc.c:1646 */
  2382. { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[-1].type)); }
  2383. -#line 3574 "parser.tab.c" /* yacc.c:1648 */
  2384. +#line 3569 "parser.tab.c" /* yacc.c:1646 */
  2385. break;
  2386. case 164:
  2387. -#line 590 "parser.y" /* yacc.c:1648 */
  2388. +#line 588 "parser.y" /* yacc.c:1646 */
  2389. { (yyval.attr) = make_attrv(ATTR_THREADING, (yyvsp[-1].num)); }
  2390. -#line 3580 "parser.tab.c" /* yacc.c:1648 */
  2391. +#line 3575 "parser.tab.c" /* yacc.c:1646 */
  2392. break;
  2393. case 165:
  2394. -#line 591 "parser.y" /* yacc.c:1648 */
  2395. +#line 589 "parser.y" /* yacc.c:1646 */
  2396. { (yyval.attr) = make_attr(ATTR_UIDEFAULT); }
  2397. -#line 3586 "parser.tab.c" /* yacc.c:1648 */
  2398. +#line 3581 "parser.tab.c" /* yacc.c:1646 */
  2399. break;
  2400. case 166:
  2401. -#line 592 "parser.y" /* yacc.c:1648 */
  2402. +#line 590 "parser.y" /* yacc.c:1646 */
  2403. { (yyval.attr) = make_attr(ATTR_USESGETLASTERROR); }
  2404. -#line 3592 "parser.tab.c" /* yacc.c:1648 */
  2405. +#line 3587 "parser.tab.c" /* yacc.c:1646 */
  2406. break;
  2407. case 167:
  2408. -#line 593 "parser.y" /* yacc.c:1648 */
  2409. +#line 591 "parser.y" /* yacc.c:1646 */
  2410. { (yyval.attr) = make_attrp(ATTR_USERMARSHAL, (yyvsp[-1].type)); }
  2411. -#line 3598 "parser.tab.c" /* yacc.c:1648 */
  2412. +#line 3593 "parser.tab.c" /* yacc.c:1646 */
  2413. break;
  2414. case 168:
  2415. -#line 594 "parser.y" /* yacc.c:1648 */
  2416. +#line 592 "parser.y" /* yacc.c:1646 */
  2417. { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[-1].uuid)); }
  2418. -#line 3604 "parser.tab.c" /* yacc.c:1648 */
  2419. +#line 3599 "parser.tab.c" /* yacc.c:1646 */
  2420. break;
  2421. case 169:
  2422. -#line 595 "parser.y" /* yacc.c:1648 */
  2423. +#line 593 "parser.y" /* yacc.c:1646 */
  2424. { (yyval.attr) = make_attrp(ATTR_ASYNCUUID, (yyvsp[-1].uuid)); }
  2425. -#line 3610 "parser.tab.c" /* yacc.c:1648 */
  2426. +#line 3605 "parser.tab.c" /* yacc.c:1646 */
  2427. break;
  2428. case 170:
  2429. -#line 596 "parser.y" /* yacc.c:1648 */
  2430. +#line 594 "parser.y" /* yacc.c:1646 */
  2431. { (yyval.attr) = make_attr(ATTR_V1ENUM); }
  2432. -#line 3616 "parser.tab.c" /* yacc.c:1648 */
  2433. +#line 3611 "parser.tab.c" /* yacc.c:1646 */
  2434. break;
  2435. case 171:
  2436. -#line 597 "parser.y" /* yacc.c:1648 */
  2437. +#line 595 "parser.y" /* yacc.c:1646 */
  2438. { (yyval.attr) = make_attr(ATTR_VARARG); }
  2439. -#line 3622 "parser.tab.c" /* yacc.c:1648 */
  2440. +#line 3617 "parser.tab.c" /* yacc.c:1646 */
  2441. break;
  2442. case 172:
  2443. -#line 598 "parser.y" /* yacc.c:1648 */
  2444. +#line 596 "parser.y" /* yacc.c:1646 */
  2445. { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[-1].num)); }
  2446. -#line 3628 "parser.tab.c" /* yacc.c:1648 */
  2447. +#line 3623 "parser.tab.c" /* yacc.c:1646 */
  2448. break;
  2449. case 173:
  2450. -#line 599 "parser.y" /* yacc.c:1648 */
  2451. +#line 597 "parser.y" /* yacc.c:1646 */
  2452. { (yyval.attr) = make_attrp(ATTR_VIPROGID, (yyvsp[-1].str)); }
  2453. -#line 3634 "parser.tab.c" /* yacc.c:1648 */
  2454. +#line 3629 "parser.tab.c" /* yacc.c:1646 */
  2455. break;
  2456. case 174:
  2457. -#line 600 "parser.y" /* yacc.c:1648 */
  2458. +#line 598 "parser.y" /* yacc.c:1646 */
  2459. { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[-1].type)); }
  2460. -#line 3640 "parser.tab.c" /* yacc.c:1648 */
  2461. +#line 3635 "parser.tab.c" /* yacc.c:1646 */
  2462. break;
  2463. case 175:
  2464. -#line 601 "parser.y" /* yacc.c:1648 */
  2465. +#line 599 "parser.y" /* yacc.c:1646 */
  2466. { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[0].num)); }
  2467. -#line 3646 "parser.tab.c" /* yacc.c:1648 */
  2468. +#line 3641 "parser.tab.c" /* yacc.c:1646 */
  2469. break;
  2470. case 177:
  2471. -#line 606 "parser.y" /* yacc.c:1648 */
  2472. +#line 604 "parser.y" /* yacc.c:1646 */
  2473. { if (!is_valid_uuid((yyvsp[0].str)))
  2474. error_loc("invalid UUID: %s\n", (yyvsp[0].str));
  2475. (yyval.uuid) = parse_uuid((yyvsp[0].str)); }
  2476. -#line 3654 "parser.tab.c" /* yacc.c:1648 */
  2477. +#line 3649 "parser.tab.c" /* yacc.c:1646 */
  2478. break;
  2479. case 178:
  2480. -#line 611 "parser.y" /* yacc.c:1648 */
  2481. +#line 609 "parser.y" /* yacc.c:1646 */
  2482. { (yyval.str) = xstrdup("__cdecl"); }
  2483. -#line 3660 "parser.tab.c" /* yacc.c:1648 */
  2484. +#line 3655 "parser.tab.c" /* yacc.c:1646 */
  2485. break;
  2486. case 179:
  2487. -#line 612 "parser.y" /* yacc.c:1648 */
  2488. +#line 610 "parser.y" /* yacc.c:1646 */
  2489. { (yyval.str) = xstrdup("__fastcall"); }
  2490. -#line 3666 "parser.tab.c" /* yacc.c:1648 */
  2491. +#line 3661 "parser.tab.c" /* yacc.c:1646 */
  2492. break;
  2493. case 180:
  2494. -#line 613 "parser.y" /* yacc.c:1648 */
  2495. +#line 611 "parser.y" /* yacc.c:1646 */
  2496. { (yyval.str) = xstrdup("__pascal"); }
  2497. -#line 3672 "parser.tab.c" /* yacc.c:1648 */
  2498. +#line 3667 "parser.tab.c" /* yacc.c:1646 */
  2499. break;
  2500. case 181:
  2501. -#line 614 "parser.y" /* yacc.c:1648 */
  2502. +#line 612 "parser.y" /* yacc.c:1646 */
  2503. { (yyval.str) = xstrdup("__stdcall"); }
  2504. -#line 3678 "parser.tab.c" /* yacc.c:1648 */
  2505. +#line 3673 "parser.tab.c" /* yacc.c:1646 */
  2506. break;
  2507. case 182:
  2508. -#line 617 "parser.y" /* yacc.c:1648 */
  2509. +#line 615 "parser.y" /* yacc.c:1646 */
  2510. { (yyval.var_list) = NULL; }
  2511. -#line 3684 "parser.tab.c" /* yacc.c:1648 */
  2512. +#line 3679 "parser.tab.c" /* yacc.c:1646 */
  2513. break;
  2514. case 183:
  2515. -#line 618 "parser.y" /* yacc.c:1648 */
  2516. +#line 616 "parser.y" /* yacc.c:1646 */
  2517. { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); }
  2518. -#line 3690 "parser.tab.c" /* yacc.c:1648 */
  2519. +#line 3685 "parser.tab.c" /* yacc.c:1646 */
  2520. break;
  2521. case 184:
  2522. -#line 621 "parser.y" /* yacc.c:1648 */
  2523. +#line 619 "parser.y" /* yacc.c:1646 */
  2524. { attr_t *a = make_attrp(ATTR_CASE, append_expr( NULL, (yyvsp[-2].expr) ));
  2525. (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL);
  2526. (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a );
  2527. }
  2528. -#line 3699 "parser.tab.c" /* yacc.c:1648 */
  2529. +#line 3694 "parser.tab.c" /* yacc.c:1646 */
  2530. break;
  2531. case 185:
  2532. -#line 625 "parser.y" /* yacc.c:1648 */
  2533. +#line 623 "parser.y" /* yacc.c:1646 */
  2534. { attr_t *a = make_attr(ATTR_DEFAULT);
  2535. (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL);
  2536. (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a );
  2537. }
  2538. -#line 3708 "parser.tab.c" /* yacc.c:1648 */
  2539. +#line 3703 "parser.tab.c" /* yacc.c:1646 */
  2540. break;
  2541. case 186:
  2542. -#line 631 "parser.y" /* yacc.c:1648 */
  2543. +#line 629 "parser.y" /* yacc.c:1646 */
  2544. { (yyval.var_list) = NULL; }
  2545. -#line 3714 "parser.tab.c" /* yacc.c:1648 */
  2546. +#line 3709 "parser.tab.c" /* yacc.c:1646 */
  2547. break;
  2548. case 187:
  2549. -#line 632 "parser.y" /* yacc.c:1648 */
  2550. +#line 630 "parser.y" /* yacc.c:1646 */
  2551. { (yyval.var_list) = (yyvsp[-1].var_list); }
  2552. -#line 3720 "parser.tab.c" /* yacc.c:1648 */
  2553. +#line 3715 "parser.tab.c" /* yacc.c:1646 */
  2554. break;
  2555. case 189:
  2556. -#line 636 "parser.y" /* yacc.c:1648 */
  2557. +#line 634 "parser.y" /* yacc.c:1646 */
  2558. { if (!(yyvsp[0].var)->eval)
  2559. (yyvsp[0].var)->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */);
  2560. (yyval.var_list) = append_var( NULL, (yyvsp[0].var) );
  2561. }
  2562. -#line 3729 "parser.tab.c" /* yacc.c:1648 */
  2563. +#line 3724 "parser.tab.c" /* yacc.c:1646 */
  2564. break;
  2565. case 190:
  2566. -#line 640 "parser.y" /* yacc.c:1648 */
  2567. +#line 638 "parser.y" /* yacc.c:1646 */
  2568. { if (!(yyvsp[0].var)->eval)
  2569. {
  2570. var_t *last = LIST_ENTRY( list_tail((yyval.var_list)), var_t, entry );
  2571. @@ -3740,656 +3735,656 @@ yyreduce:
  2572. }
  2573. (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var) );
  2574. }
  2575. -#line 3744 "parser.tab.c" /* yacc.c:1648 */
  2576. +#line 3739 "parser.tab.c" /* yacc.c:1646 */
  2577. break;
  2578. case 191:
  2579. -#line 652 "parser.y" /* yacc.c:1648 */
  2580. +#line 650 "parser.y" /* yacc.c:1646 */
  2581. { (yyval.var) = reg_const((yyvsp[-2].var));
  2582. (yyval.var)->eval = (yyvsp[0].expr);
  2583. - (yyval.var)->type = type_new_int(TYPE_BASIC_INT, 0);
  2584. + (yyval.var)->declspec.type = type_new_int(TYPE_BASIC_INT, 0);
  2585. }
  2586. -#line 3753 "parser.tab.c" /* yacc.c:1648 */
  2587. +#line 3748 "parser.tab.c" /* yacc.c:1646 */
  2588. break;
  2589. case 192:
  2590. -#line 656 "parser.y" /* yacc.c:1648 */
  2591. +#line 654 "parser.y" /* yacc.c:1646 */
  2592. { (yyval.var) = reg_const((yyvsp[0].var));
  2593. - (yyval.var)->type = type_new_int(TYPE_BASIC_INT, 0);
  2594. + (yyval.var)->declspec.type = type_new_int(TYPE_BASIC_INT, 0);
  2595. }
  2596. -#line 3761 "parser.tab.c" /* yacc.c:1648 */
  2597. +#line 3756 "parser.tab.c" /* yacc.c:1646 */
  2598. break;
  2599. case 193:
  2600. -#line 661 "parser.y" /* yacc.c:1648 */
  2601. +#line 659 "parser.y" /* yacc.c:1646 */
  2602. { (yyval.type) = type_new_enum((yyvsp[-3].str), current_namespace, TRUE, (yyvsp[-1].var_list)); }
  2603. -#line 3767 "parser.tab.c" /* yacc.c:1648 */
  2604. +#line 3762 "parser.tab.c" /* yacc.c:1646 */
  2605. break;
  2606. case 194:
  2607. -#line 664 "parser.y" /* yacc.c:1648 */
  2608. +#line 662 "parser.y" /* yacc.c:1646 */
  2609. { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); }
  2610. -#line 3773 "parser.tab.c" /* yacc.c:1648 */
  2611. +#line 3768 "parser.tab.c" /* yacc.c:1646 */
  2612. break;
  2613. case 195:
  2614. -#line 665 "parser.y" /* yacc.c:1648 */
  2615. +#line 663 "parser.y" /* yacc.c:1646 */
  2616. { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); }
  2617. -#line 3779 "parser.tab.c" /* yacc.c:1648 */
  2618. +#line 3774 "parser.tab.c" /* yacc.c:1646 */
  2619. break;
  2620. case 196:
  2621. -#line 668 "parser.y" /* yacc.c:1648 */
  2622. +#line 666 "parser.y" /* yacc.c:1646 */
  2623. { (yyval.expr) = make_expr(EXPR_VOID); }
  2624. -#line 3785 "parser.tab.c" /* yacc.c:1648 */
  2625. +#line 3780 "parser.tab.c" /* yacc.c:1646 */
  2626. break;
  2627. case 198:
  2628. -#line 672 "parser.y" /* yacc.c:1648 */
  2629. +#line 670 "parser.y" /* yacc.c:1646 */
  2630. { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[0].num)); }
  2631. -#line 3791 "parser.tab.c" /* yacc.c:1648 */
  2632. +#line 3786 "parser.tab.c" /* yacc.c:1646 */
  2633. break;
  2634. case 199:
  2635. -#line 673 "parser.y" /* yacc.c:1648 */
  2636. +#line 671 "parser.y" /* yacc.c:1646 */
  2637. { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[0].num)); }
  2638. -#line 3797 "parser.tab.c" /* yacc.c:1648 */
  2639. +#line 3792 "parser.tab.c" /* yacc.c:1646 */
  2640. break;
  2641. case 200:
  2642. -#line 674 "parser.y" /* yacc.c:1648 */
  2643. +#line 672 "parser.y" /* yacc.c:1646 */
  2644. { (yyval.expr) = make_exprd(EXPR_DOUBLE, (yyvsp[0].dbl)); }
  2645. -#line 3803 "parser.tab.c" /* yacc.c:1648 */
  2646. +#line 3798 "parser.tab.c" /* yacc.c:1646 */
  2647. break;
  2648. case 201:
  2649. -#line 675 "parser.y" /* yacc.c:1648 */
  2650. +#line 673 "parser.y" /* yacc.c:1646 */
  2651. { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 0); }
  2652. -#line 3809 "parser.tab.c" /* yacc.c:1648 */
  2653. +#line 3804 "parser.tab.c" /* yacc.c:1646 */
  2654. break;
  2655. case 202:
  2656. -#line 676 "parser.y" /* yacc.c:1648 */
  2657. +#line 674 "parser.y" /* yacc.c:1646 */
  2658. { (yyval.expr) = make_exprl(EXPR_NUM, 0); }
  2659. -#line 3815 "parser.tab.c" /* yacc.c:1648 */
  2660. +#line 3810 "parser.tab.c" /* yacc.c:1646 */
  2661. break;
  2662. case 203:
  2663. -#line 677 "parser.y" /* yacc.c:1648 */
  2664. +#line 675 "parser.y" /* yacc.c:1646 */
  2665. { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 1); }
  2666. -#line 3821 "parser.tab.c" /* yacc.c:1648 */
  2667. +#line 3816 "parser.tab.c" /* yacc.c:1646 */
  2668. break;
  2669. case 204:
  2670. -#line 678 "parser.y" /* yacc.c:1648 */
  2671. +#line 676 "parser.y" /* yacc.c:1646 */
  2672. { (yyval.expr) = make_exprs(EXPR_STRLIT, (yyvsp[0].str)); }
  2673. -#line 3827 "parser.tab.c" /* yacc.c:1648 */
  2674. +#line 3822 "parser.tab.c" /* yacc.c:1646 */
  2675. break;
  2676. case 205:
  2677. -#line 679 "parser.y" /* yacc.c:1648 */
  2678. +#line 677 "parser.y" /* yacc.c:1646 */
  2679. { (yyval.expr) = make_exprs(EXPR_WSTRLIT, (yyvsp[0].str)); }
  2680. -#line 3833 "parser.tab.c" /* yacc.c:1648 */
  2681. +#line 3828 "parser.tab.c" /* yacc.c:1646 */
  2682. break;
  2683. case 206:
  2684. -#line 680 "parser.y" /* yacc.c:1648 */
  2685. +#line 678 "parser.y" /* yacc.c:1646 */
  2686. { (yyval.expr) = make_exprs(EXPR_CHARCONST, (yyvsp[0].str)); }
  2687. -#line 3839 "parser.tab.c" /* yacc.c:1648 */
  2688. +#line 3834 "parser.tab.c" /* yacc.c:1646 */
  2689. break;
  2690. case 207:
  2691. -#line 681 "parser.y" /* yacc.c:1648 */
  2692. +#line 679 "parser.y" /* yacc.c:1646 */
  2693. { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str)); }
  2694. -#line 3845 "parser.tab.c" /* yacc.c:1648 */
  2695. +#line 3840 "parser.tab.c" /* yacc.c:1646 */
  2696. break;
  2697. case 208:
  2698. -#line 682 "parser.y" /* yacc.c:1648 */
  2699. +#line 680 "parser.y" /* yacc.c:1646 */
  2700. { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2701. -#line 3851 "parser.tab.c" /* yacc.c:1648 */
  2702. +#line 3846 "parser.tab.c" /* yacc.c:1646 */
  2703. break;
  2704. case 209:
  2705. -#line 683 "parser.y" /* yacc.c:1648 */
  2706. +#line 681 "parser.y" /* yacc.c:1646 */
  2707. { (yyval.expr) = make_expr2(EXPR_LOGOR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2708. -#line 3857 "parser.tab.c" /* yacc.c:1648 */
  2709. +#line 3852 "parser.tab.c" /* yacc.c:1646 */
  2710. break;
  2711. case 210:
  2712. -#line 684 "parser.y" /* yacc.c:1648 */
  2713. +#line 682 "parser.y" /* yacc.c:1646 */
  2714. { (yyval.expr) = make_expr2(EXPR_LOGAND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2715. -#line 3863 "parser.tab.c" /* yacc.c:1648 */
  2716. +#line 3858 "parser.tab.c" /* yacc.c:1646 */
  2717. break;
  2718. case 211:
  2719. -#line 685 "parser.y" /* yacc.c:1648 */
  2720. +#line 683 "parser.y" /* yacc.c:1646 */
  2721. { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2722. -#line 3869 "parser.tab.c" /* yacc.c:1648 */
  2723. +#line 3864 "parser.tab.c" /* yacc.c:1646 */
  2724. break;
  2725. case 212:
  2726. -#line 686 "parser.y" /* yacc.c:1648 */
  2727. +#line 684 "parser.y" /* yacc.c:1646 */
  2728. { (yyval.expr) = make_expr2(EXPR_XOR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2729. -#line 3875 "parser.tab.c" /* yacc.c:1648 */
  2730. +#line 3870 "parser.tab.c" /* yacc.c:1646 */
  2731. break;
  2732. case 213:
  2733. -#line 687 "parser.y" /* yacc.c:1648 */
  2734. +#line 685 "parser.y" /* yacc.c:1646 */
  2735. { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2736. -#line 3881 "parser.tab.c" /* yacc.c:1648 */
  2737. +#line 3876 "parser.tab.c" /* yacc.c:1646 */
  2738. break;
  2739. case 214:
  2740. -#line 688 "parser.y" /* yacc.c:1648 */
  2741. +#line 686 "parser.y" /* yacc.c:1646 */
  2742. { (yyval.expr) = make_expr2(EXPR_EQUALITY, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2743. -#line 3887 "parser.tab.c" /* yacc.c:1648 */
  2744. +#line 3882 "parser.tab.c" /* yacc.c:1646 */
  2745. break;
  2746. case 215:
  2747. -#line 689 "parser.y" /* yacc.c:1648 */
  2748. +#line 687 "parser.y" /* yacc.c:1646 */
  2749. { (yyval.expr) = make_expr2(EXPR_INEQUALITY, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2750. -#line 3893 "parser.tab.c" /* yacc.c:1648 */
  2751. +#line 3888 "parser.tab.c" /* yacc.c:1646 */
  2752. break;
  2753. case 216:
  2754. -#line 690 "parser.y" /* yacc.c:1648 */
  2755. +#line 688 "parser.y" /* yacc.c:1646 */
  2756. { (yyval.expr) = make_expr2(EXPR_GTR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2757. -#line 3899 "parser.tab.c" /* yacc.c:1648 */
  2758. +#line 3894 "parser.tab.c" /* yacc.c:1646 */
  2759. break;
  2760. case 217:
  2761. -#line 691 "parser.y" /* yacc.c:1648 */
  2762. +#line 689 "parser.y" /* yacc.c:1646 */
  2763. { (yyval.expr) = make_expr2(EXPR_LESS, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2764. -#line 3905 "parser.tab.c" /* yacc.c:1648 */
  2765. +#line 3900 "parser.tab.c" /* yacc.c:1646 */
  2766. break;
  2767. case 218:
  2768. -#line 692 "parser.y" /* yacc.c:1648 */
  2769. +#line 690 "parser.y" /* yacc.c:1646 */
  2770. { (yyval.expr) = make_expr2(EXPR_GTREQL, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2771. -#line 3911 "parser.tab.c" /* yacc.c:1648 */
  2772. +#line 3906 "parser.tab.c" /* yacc.c:1646 */
  2773. break;
  2774. case 219:
  2775. -#line 693 "parser.y" /* yacc.c:1648 */
  2776. +#line 691 "parser.y" /* yacc.c:1646 */
  2777. { (yyval.expr) = make_expr2(EXPR_LESSEQL, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2778. -#line 3917 "parser.tab.c" /* yacc.c:1648 */
  2779. +#line 3912 "parser.tab.c" /* yacc.c:1646 */
  2780. break;
  2781. case 220:
  2782. -#line 694 "parser.y" /* yacc.c:1648 */
  2783. +#line 692 "parser.y" /* yacc.c:1646 */
  2784. { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2785. -#line 3923 "parser.tab.c" /* yacc.c:1648 */
  2786. +#line 3918 "parser.tab.c" /* yacc.c:1646 */
  2787. break;
  2788. case 221:
  2789. -#line 695 "parser.y" /* yacc.c:1648 */
  2790. +#line 693 "parser.y" /* yacc.c:1646 */
  2791. { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2792. -#line 3929 "parser.tab.c" /* yacc.c:1648 */
  2793. +#line 3924 "parser.tab.c" /* yacc.c:1646 */
  2794. break;
  2795. case 222:
  2796. -#line 696 "parser.y" /* yacc.c:1648 */
  2797. +#line 694 "parser.y" /* yacc.c:1646 */
  2798. { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2799. -#line 3935 "parser.tab.c" /* yacc.c:1648 */
  2800. +#line 3930 "parser.tab.c" /* yacc.c:1646 */
  2801. break;
  2802. case 223:
  2803. -#line 697 "parser.y" /* yacc.c:1648 */
  2804. +#line 695 "parser.y" /* yacc.c:1646 */
  2805. { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2806. -#line 3941 "parser.tab.c" /* yacc.c:1648 */
  2807. +#line 3936 "parser.tab.c" /* yacc.c:1646 */
  2808. break;
  2809. case 224:
  2810. -#line 698 "parser.y" /* yacc.c:1648 */
  2811. +#line 696 "parser.y" /* yacc.c:1646 */
  2812. { (yyval.expr) = make_expr2(EXPR_MOD, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2813. -#line 3947 "parser.tab.c" /* yacc.c:1648 */
  2814. +#line 3942 "parser.tab.c" /* yacc.c:1646 */
  2815. break;
  2816. case 225:
  2817. -#line 699 "parser.y" /* yacc.c:1648 */
  2818. +#line 697 "parser.y" /* yacc.c:1646 */
  2819. { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2820. -#line 3953 "parser.tab.c" /* yacc.c:1648 */
  2821. +#line 3948 "parser.tab.c" /* yacc.c:1646 */
  2822. break;
  2823. case 226:
  2824. -#line 700 "parser.y" /* yacc.c:1648 */
  2825. +#line 698 "parser.y" /* yacc.c:1646 */
  2826. { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[-2].expr), (yyvsp[0].expr)); }
  2827. -#line 3959 "parser.tab.c" /* yacc.c:1648 */
  2828. +#line 3954 "parser.tab.c" /* yacc.c:1646 */
  2829. break;
  2830. case 227:
  2831. -#line 701 "parser.y" /* yacc.c:1648 */
  2832. +#line 699 "parser.y" /* yacc.c:1646 */
  2833. { (yyval.expr) = make_expr1(EXPR_LOGNOT, (yyvsp[0].expr)); }
  2834. -#line 3965 "parser.tab.c" /* yacc.c:1648 */
  2835. +#line 3960 "parser.tab.c" /* yacc.c:1646 */
  2836. break;
  2837. case 228:
  2838. -#line 702 "parser.y" /* yacc.c:1648 */
  2839. +#line 700 "parser.y" /* yacc.c:1646 */
  2840. { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[0].expr)); }
  2841. -#line 3971 "parser.tab.c" /* yacc.c:1648 */
  2842. +#line 3966 "parser.tab.c" /* yacc.c:1646 */
  2843. break;
  2844. case 229:
  2845. -#line 703 "parser.y" /* yacc.c:1648 */
  2846. +#line 701 "parser.y" /* yacc.c:1646 */
  2847. { (yyval.expr) = make_expr1(EXPR_POS, (yyvsp[0].expr)); }
  2848. -#line 3977 "parser.tab.c" /* yacc.c:1648 */
  2849. +#line 3972 "parser.tab.c" /* yacc.c:1646 */
  2850. break;
  2851. case 230:
  2852. -#line 704 "parser.y" /* yacc.c:1648 */
  2853. +#line 702 "parser.y" /* yacc.c:1646 */
  2854. { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[0].expr)); }
  2855. -#line 3983 "parser.tab.c" /* yacc.c:1648 */
  2856. +#line 3978 "parser.tab.c" /* yacc.c:1646 */
  2857. break;
  2858. case 231:
  2859. -#line 705 "parser.y" /* yacc.c:1648 */
  2860. +#line 703 "parser.y" /* yacc.c:1646 */
  2861. { (yyval.expr) = make_expr1(EXPR_ADDRESSOF, (yyvsp[0].expr)); }
  2862. -#line 3989 "parser.tab.c" /* yacc.c:1648 */
  2863. +#line 3984 "parser.tab.c" /* yacc.c:1646 */
  2864. break;
  2865. case 232:
  2866. -#line 706 "parser.y" /* yacc.c:1648 */
  2867. +#line 704 "parser.y" /* yacc.c:1646 */
  2868. { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[0].expr)); }
  2869. -#line 3995 "parser.tab.c" /* yacc.c:1648 */
  2870. +#line 3990 "parser.tab.c" /* yacc.c:1646 */
  2871. break;
  2872. case 233:
  2873. -#line 707 "parser.y" /* yacc.c:1648 */
  2874. +#line 705 "parser.y" /* yacc.c:1646 */
  2875. { (yyval.expr) = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, (yyvsp[-2].expr)), make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str))); }
  2876. -#line 4001 "parser.tab.c" /* yacc.c:1648 */
  2877. +#line 3996 "parser.tab.c" /* yacc.c:1646 */
  2878. break;
  2879. case 234:
  2880. -#line 708 "parser.y" /* yacc.c:1648 */
  2881. +#line 706 "parser.y" /* yacc.c:1646 */
  2882. { (yyval.expr) = make_expr2(EXPR_MEMBER, (yyvsp[-2].expr), make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str))); }
  2883. -#line 4007 "parser.tab.c" /* yacc.c:1648 */
  2884. +#line 4002 "parser.tab.c" /* yacc.c:1646 */
  2885. break;
  2886. case 235:
  2887. -#line 710 "parser.y" /* yacc.c:1648 */
  2888. +#line 708 "parser.y" /* yacc.c:1646 */
  2889. { (yyval.expr) = make_exprt(EXPR_CAST, declare_var(NULL, (yyvsp[-3].declspec), (yyvsp[-2].declarator), 0), (yyvsp[0].expr)); free((yyvsp[-3].declspec)); free((yyvsp[-2].declarator)); }
  2890. -#line 4013 "parser.tab.c" /* yacc.c:1648 */
  2891. +#line 4008 "parser.tab.c" /* yacc.c:1646 */
  2892. break;
  2893. case 236:
  2894. -#line 712 "parser.y" /* yacc.c:1648 */
  2895. +#line 710 "parser.y" /* yacc.c:1646 */
  2896. { (yyval.expr) = make_exprt(EXPR_SIZEOF, declare_var(NULL, (yyvsp[-2].declspec), (yyvsp[-1].declarator), 0), NULL); free((yyvsp[-2].declspec)); free((yyvsp[-1].declarator)); }
  2897. -#line 4019 "parser.tab.c" /* yacc.c:1648 */
  2898. +#line 4014 "parser.tab.c" /* yacc.c:1646 */
  2899. break;
  2900. case 237:
  2901. -#line 713 "parser.y" /* yacc.c:1648 */
  2902. +#line 711 "parser.y" /* yacc.c:1646 */
  2903. { (yyval.expr) = make_expr2(EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); }
  2904. -#line 4025 "parser.tab.c" /* yacc.c:1648 */
  2905. +#line 4020 "parser.tab.c" /* yacc.c:1646 */
  2906. break;
  2907. case 238:
  2908. -#line 714 "parser.y" /* yacc.c:1648 */
  2909. +#line 712 "parser.y" /* yacc.c:1646 */
  2910. { (yyval.expr) = (yyvsp[-1].expr); }
  2911. -#line 4031 "parser.tab.c" /* yacc.c:1648 */
  2912. +#line 4026 "parser.tab.c" /* yacc.c:1646 */
  2913. break;
  2914. case 239:
  2915. -#line 717 "parser.y" /* yacc.c:1648 */
  2916. +#line 715 "parser.y" /* yacc.c:1646 */
  2917. { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); }
  2918. -#line 4037 "parser.tab.c" /* yacc.c:1648 */
  2919. +#line 4032 "parser.tab.c" /* yacc.c:1646 */
  2920. break;
  2921. case 240:
  2922. -#line 718 "parser.y" /* yacc.c:1648 */
  2923. +#line 716 "parser.y" /* yacc.c:1646 */
  2924. { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); }
  2925. -#line 4043 "parser.tab.c" /* yacc.c:1648 */
  2926. +#line 4038 "parser.tab.c" /* yacc.c:1646 */
  2927. break;
  2928. case 241:
  2929. -#line 721 "parser.y" /* yacc.c:1648 */
  2930. +#line 719 "parser.y" /* yacc.c:1646 */
  2931. { (yyval.expr) = (yyvsp[0].expr);
  2932. if (!(yyval.expr)->is_const)
  2933. error_loc("expression is not an integer constant\n");
  2934. }
  2935. -#line 4052 "parser.tab.c" /* yacc.c:1648 */
  2936. +#line 4047 "parser.tab.c" /* yacc.c:1646 */
  2937. break;
  2938. case 242:
  2939. -#line 727 "parser.y" /* yacc.c:1648 */
  2940. +#line 725 "parser.y" /* yacc.c:1646 */
  2941. { (yyval.expr) = (yyvsp[0].expr);
  2942. if (!(yyval.expr)->is_const && (yyval.expr)->type != EXPR_STRLIT && (yyval.expr)->type != EXPR_WSTRLIT)
  2943. error_loc("expression is not constant\n");
  2944. }
  2945. -#line 4061 "parser.tab.c" /* yacc.c:1648 */
  2946. +#line 4056 "parser.tab.c" /* yacc.c:1646 */
  2947. break;
  2948. case 243:
  2949. -#line 733 "parser.y" /* yacc.c:1648 */
  2950. +#line 731 "parser.y" /* yacc.c:1646 */
  2951. { (yyval.var_list) = NULL; }
  2952. -#line 4067 "parser.tab.c" /* yacc.c:1648 */
  2953. +#line 4062 "parser.tab.c" /* yacc.c:1646 */
  2954. break;
  2955. case 244:
  2956. -#line 734 "parser.y" /* yacc.c:1648 */
  2957. +#line 732 "parser.y" /* yacc.c:1646 */
  2958. { (yyval.var_list) = append_var_list((yyvsp[-1].var_list), (yyvsp[0].var_list)); }
  2959. -#line 4073 "parser.tab.c" /* yacc.c:1648 */
  2960. +#line 4068 "parser.tab.c" /* yacc.c:1646 */
  2961. break;
  2962. case 245:
  2963. -#line 738 "parser.y" /* yacc.c:1648 */
  2964. +#line 736 "parser.y" /* yacc.c:1646 */
  2965. { const char *first = LIST_ENTRY(list_head((yyvsp[-1].declarator_list)), declarator_t, entry)->var->name;
  2966. check_field_attrs(first, (yyvsp[-3].attr_list));
  2967. (yyval.var_list) = set_var_types((yyvsp[-3].attr_list), (yyvsp[-2].declspec), (yyvsp[-1].declarator_list));
  2968. }
  2969. -#line 4082 "parser.tab.c" /* yacc.c:1648 */
  2970. +#line 4077 "parser.tab.c" /* yacc.c:1646 */
  2971. break;
  2972. case 246:
  2973. -#line 742 "parser.y" /* yacc.c:1648 */
  2974. +#line 740 "parser.y" /* yacc.c:1646 */
  2975. { var_t *v = make_var(NULL);
  2976. - v->type = (yyvsp[-1].type); v->attrs = (yyvsp[-2].attr_list);
  2977. + v->declspec.type = (yyvsp[-1].type); v->attrs = (yyvsp[-2].attr_list);
  2978. (yyval.var_list) = append_var(NULL, v);
  2979. }
  2980. -#line 4091 "parser.tab.c" /* yacc.c:1648 */
  2981. +#line 4086 "parser.tab.c" /* yacc.c:1646 */
  2982. break;
  2983. case 247:
  2984. -#line 749 "parser.y" /* yacc.c:1648 */
  2985. +#line 747 "parser.y" /* yacc.c:1646 */
  2986. { (yyval.var) = (yyvsp[-1].var); }
  2987. -#line 4097 "parser.tab.c" /* yacc.c:1648 */
  2988. +#line 4092 "parser.tab.c" /* yacc.c:1646 */
  2989. break;
  2990. case 248:
  2991. -#line 750 "parser.y" /* yacc.c:1648 */
  2992. +#line 748 "parser.y" /* yacc.c:1646 */
  2993. { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[-1].attr_list); }
  2994. -#line 4103 "parser.tab.c" /* yacc.c:1648 */
  2995. +#line 4098 "parser.tab.c" /* yacc.c:1646 */
  2996. break;
  2997. case 249:
  2998. -#line 753 "parser.y" /* yacc.c:1648 */
  2999. +#line 751 "parser.y" /* yacc.c:1646 */
  3000. { (yyval.var_list) = NULL; }
  3001. -#line 4109 "parser.tab.c" /* yacc.c:1648 */
  3002. +#line 4104 "parser.tab.c" /* yacc.c:1646 */
  3003. break;
  3004. case 250:
  3005. -#line 754 "parser.y" /* yacc.c:1648 */
  3006. +#line 752 "parser.y" /* yacc.c:1646 */
  3007. { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); }
  3008. -#line 4115 "parser.tab.c" /* yacc.c:1648 */
  3009. +#line 4110 "parser.tab.c" /* yacc.c:1646 */
  3010. break;
  3011. case 251:
  3012. -#line 758 "parser.y" /* yacc.c:1648 */
  3013. +#line 756 "parser.y" /* yacc.c:1646 */
  3014. { (yyval.var) = (yyvsp[-1].var); }
  3015. -#line 4121 "parser.tab.c" /* yacc.c:1648 */
  3016. +#line 4116 "parser.tab.c" /* yacc.c:1646 */
  3017. break;
  3018. case 252:
  3019. -#line 759 "parser.y" /* yacc.c:1648 */
  3020. +#line 757 "parser.y" /* yacc.c:1646 */
  3021. { (yyval.var) = NULL; }
  3022. -#line 4127 "parser.tab.c" /* yacc.c:1648 */
  3023. +#line 4122 "parser.tab.c" /* yacc.c:1646 */
  3024. break;
  3025. case 253:
  3026. -#line 762 "parser.y" /* yacc.c:1648 */
  3027. +#line 760 "parser.y" /* yacc.c:1646 */
  3028. { (yyval.var) = declare_var(check_field_attrs((yyvsp[0].declarator)->var->name, (yyvsp[-2].attr_list)),
  3029. (yyvsp[-1].declspec), (yyvsp[0].declarator), FALSE);
  3030. free((yyvsp[0].declarator));
  3031. }
  3032. -#line 4136 "parser.tab.c" /* yacc.c:1648 */
  3033. +#line 4131 "parser.tab.c" /* yacc.c:1646 */
  3034. break;
  3035. case 254:
  3036. -#line 766 "parser.y" /* yacc.c:1648 */
  3037. +#line 764 "parser.y" /* yacc.c:1646 */
  3038. { var_t *v = make_var(NULL);
  3039. - v->type = (yyvsp[0].type); v->attrs = (yyvsp[-1].attr_list);
  3040. + v->declspec.type = (yyvsp[0].type); v->attrs = (yyvsp[-1].attr_list);
  3041. (yyval.var) = v;
  3042. }
  3043. -#line 4145 "parser.tab.c" /* yacc.c:1648 */
  3044. +#line 4140 "parser.tab.c" /* yacc.c:1646 */
  3045. break;
  3046. case 255:
  3047. -#line 772 "parser.y" /* yacc.c:1648 */
  3048. +#line 770 "parser.y" /* yacc.c:1646 */
  3049. { (yyval.var) = (yyvsp[0].var);
  3050. - if (type_get_type((yyval.var)->type) != TYPE_FUNCTION)
  3051. + if (type_get_type((yyval.var)->declspec.type) != TYPE_FUNCTION)
  3052. error_loc("only methods may be declared inside the methods section of a dispinterface\n");
  3053. check_function_attrs((yyval.var)->name, (yyval.var)->attrs);
  3054. }
  3055. -#line 4155 "parser.tab.c" /* yacc.c:1648 */
  3056. +#line 4150 "parser.tab.c" /* yacc.c:1646 */
  3057. break;
  3058. case 256:
  3059. -#line 781 "parser.y" /* yacc.c:1648 */
  3060. +#line 779 "parser.y" /* yacc.c:1646 */
  3061. { (yyval.var) = declare_var((yyvsp[-2].attr_list), (yyvsp[-1].declspec), (yyvsp[0].declarator), FALSE);
  3062. free((yyvsp[0].declarator));
  3063. }
  3064. -#line 4163 "parser.tab.c" /* yacc.c:1648 */
  3065. +#line 4158 "parser.tab.c" /* yacc.c:1646 */
  3066. break;
  3067. case 257:
  3068. -#line 784 "parser.y" /* yacc.c:1648 */
  3069. +#line 782 "parser.y" /* yacc.c:1646 */
  3070. { (yyval.var) = declare_var(NULL, (yyvsp[-1].declspec), (yyvsp[0].declarator), FALSE);
  3071. free((yyvsp[0].declarator));
  3072. }
  3073. -#line 4171 "parser.tab.c" /* yacc.c:1648 */
  3074. +#line 4166 "parser.tab.c" /* yacc.c:1646 */
  3075. break;
  3076. case 258:
  3077. -#line 789 "parser.y" /* yacc.c:1648 */
  3078. +#line 787 "parser.y" /* yacc.c:1646 */
  3079. { (yyval.var) = NULL; }
  3080. -#line 4177 "parser.tab.c" /* yacc.c:1648 */
  3081. +#line 4172 "parser.tab.c" /* yacc.c:1646 */
  3082. break;
  3083. case 260:
  3084. -#line 793 "parser.y" /* yacc.c:1648 */
  3085. +#line 791 "parser.y" /* yacc.c:1646 */
  3086. { (yyval.str) = NULL; }
  3087. -#line 4183 "parser.tab.c" /* yacc.c:1648 */
  3088. +#line 4178 "parser.tab.c" /* yacc.c:1646 */
  3089. break;
  3090. case 261:
  3091. -#line 794 "parser.y" /* yacc.c:1648 */
  3092. +#line 792 "parser.y" /* yacc.c:1646 */
  3093. { (yyval.str) = (yyvsp[0].str); }
  3094. -#line 4189 "parser.tab.c" /* yacc.c:1648 */
  3095. +#line 4184 "parser.tab.c" /* yacc.c:1646 */
  3096. break;
  3097. case 262:
  3098. -#line 795 "parser.y" /* yacc.c:1648 */
  3099. +#line 793 "parser.y" /* yacc.c:1646 */
  3100. { (yyval.str) = (yyvsp[0].str); }
  3101. -#line 4195 "parser.tab.c" /* yacc.c:1648 */
  3102. +#line 4190 "parser.tab.c" /* yacc.c:1646 */
  3103. break;
  3104. case 263:
  3105. -#line 798 "parser.y" /* yacc.c:1648 */
  3106. +#line 796 "parser.y" /* yacc.c:1646 */
  3107. { (yyval.var) = make_var((yyvsp[0].str)); }
  3108. -#line 4201 "parser.tab.c" /* yacc.c:1648 */
  3109. +#line 4196 "parser.tab.c" /* yacc.c:1646 */
  3110. break;
  3111. case 264:
  3112. -#line 800 "parser.y" /* yacc.c:1648 */
  3113. +#line 798 "parser.y" /* yacc.c:1646 */
  3114. { (yyval.var) = make_var((yyvsp[0].str)); }
  3115. -#line 4207 "parser.tab.c" /* yacc.c:1648 */
  3116. +#line 4202 "parser.tab.c" /* yacc.c:1646 */
  3117. break;
  3118. case 265:
  3119. -#line 803 "parser.y" /* yacc.c:1648 */
  3120. +#line 801 "parser.y" /* yacc.c:1646 */
  3121. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3122. -#line 4213 "parser.tab.c" /* yacc.c:1648 */
  3123. +#line 4208 "parser.tab.c" /* yacc.c:1646 */
  3124. break;
  3125. case 266:
  3126. -#line 804 "parser.y" /* yacc.c:1648 */
  3127. +#line 802 "parser.y" /* yacc.c:1646 */
  3128. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3129. -#line 4219 "parser.tab.c" /* yacc.c:1648 */
  3130. +#line 4214 "parser.tab.c" /* yacc.c:1646 */
  3131. break;
  3132. case 268:
  3133. -#line 806 "parser.y" /* yacc.c:1648 */
  3134. +#line 804 "parser.y" /* yacc.c:1646 */
  3135. { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[0].type)), -1); }
  3136. -#line 4225 "parser.tab.c" /* yacc.c:1648 */
  3137. +#line 4220 "parser.tab.c" /* yacc.c:1646 */
  3138. break;
  3139. case 269:
  3140. -#line 807 "parser.y" /* yacc.c:1648 */
  3141. +#line 805 "parser.y" /* yacc.c:1646 */
  3142. { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[0].type)), 1); }
  3143. -#line 4231 "parser.tab.c" /* yacc.c:1648 */
  3144. +#line 4226 "parser.tab.c" /* yacc.c:1646 */
  3145. break;
  3146. case 270:
  3147. -#line 808 "parser.y" /* yacc.c:1648 */
  3148. +#line 806 "parser.y" /* yacc.c:1646 */
  3149. { (yyval.type) = type_new_int(TYPE_BASIC_INT, 1); }
  3150. -#line 4237 "parser.tab.c" /* yacc.c:1648 */
  3151. +#line 4232 "parser.tab.c" /* yacc.c:1646 */
  3152. break;
  3153. case 271:
  3154. -#line 809 "parser.y" /* yacc.c:1648 */
  3155. +#line 807 "parser.y" /* yacc.c:1646 */
  3156. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3157. -#line 4243 "parser.tab.c" /* yacc.c:1648 */
  3158. +#line 4238 "parser.tab.c" /* yacc.c:1646 */
  3159. break;
  3160. case 272:
  3161. -#line 810 "parser.y" /* yacc.c:1648 */
  3162. +#line 808 "parser.y" /* yacc.c:1646 */
  3163. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3164. -#line 4249 "parser.tab.c" /* yacc.c:1648 */
  3165. +#line 4244 "parser.tab.c" /* yacc.c:1646 */
  3166. break;
  3167. case 273:
  3168. -#line 811 "parser.y" /* yacc.c:1648 */
  3169. +#line 809 "parser.y" /* yacc.c:1646 */
  3170. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3171. -#line 4255 "parser.tab.c" /* yacc.c:1648 */
  3172. +#line 4250 "parser.tab.c" /* yacc.c:1646 */
  3173. break;
  3174. case 274:
  3175. -#line 812 "parser.y" /* yacc.c:1648 */
  3176. +#line 810 "parser.y" /* yacc.c:1646 */
  3177. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3178. -#line 4261 "parser.tab.c" /* yacc.c:1648 */
  3179. +#line 4256 "parser.tab.c" /* yacc.c:1646 */
  3180. break;
  3181. case 275:
  3182. -#line 813 "parser.y" /* yacc.c:1648 */
  3183. +#line 811 "parser.y" /* yacc.c:1646 */
  3184. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3185. -#line 4267 "parser.tab.c" /* yacc.c:1648 */
  3186. +#line 4262 "parser.tab.c" /* yacc.c:1646 */
  3187. break;
  3188. case 278:
  3189. -#line 820 "parser.y" /* yacc.c:1648 */
  3190. +#line 818 "parser.y" /* yacc.c:1646 */
  3191. { (yyval.type) = type_new_int(TYPE_BASIC_INT, 0); }
  3192. -#line 4273 "parser.tab.c" /* yacc.c:1648 */
  3193. +#line 4268 "parser.tab.c" /* yacc.c:1646 */
  3194. break;
  3195. case 279:
  3196. -#line 821 "parser.y" /* yacc.c:1648 */
  3197. +#line 819 "parser.y" /* yacc.c:1646 */
  3198. { (yyval.type) = type_new_int(TYPE_BASIC_INT16, 0); }
  3199. -#line 4279 "parser.tab.c" /* yacc.c:1648 */
  3200. +#line 4274 "parser.tab.c" /* yacc.c:1646 */
  3201. break;
  3202. case 280:
  3203. -#line 822 "parser.y" /* yacc.c:1648 */
  3204. +#line 820 "parser.y" /* yacc.c:1646 */
  3205. { (yyval.type) = type_new_int(TYPE_BASIC_INT8, 0); }
  3206. -#line 4285 "parser.tab.c" /* yacc.c:1648 */
  3207. +#line 4280 "parser.tab.c" /* yacc.c:1646 */
  3208. break;
  3209. case 281:
  3210. -#line 823 "parser.y" /* yacc.c:1648 */
  3211. +#line 821 "parser.y" /* yacc.c:1646 */
  3212. { (yyval.type) = type_new_int(TYPE_BASIC_LONG, 0); }
  3213. -#line 4291 "parser.tab.c" /* yacc.c:1648 */
  3214. +#line 4286 "parser.tab.c" /* yacc.c:1646 */
  3215. break;
  3216. case 282:
  3217. -#line 824 "parser.y" /* yacc.c:1648 */
  3218. +#line 822 "parser.y" /* yacc.c:1646 */
  3219. { (yyval.type) = type_new_int(TYPE_BASIC_HYPER, 0); }
  3220. -#line 4297 "parser.tab.c" /* yacc.c:1648 */
  3221. +#line 4292 "parser.tab.c" /* yacc.c:1646 */
  3222. break;
  3223. case 283:
  3224. -#line 825 "parser.y" /* yacc.c:1648 */
  3225. +#line 823 "parser.y" /* yacc.c:1646 */
  3226. { (yyval.type) = type_new_int(TYPE_BASIC_INT64, 0); }
  3227. -#line 4303 "parser.tab.c" /* yacc.c:1648 */
  3228. +#line 4298 "parser.tab.c" /* yacc.c:1646 */
  3229. break;
  3230. case 284:
  3231. -#line 826 "parser.y" /* yacc.c:1648 */
  3232. +#line 824 "parser.y" /* yacc.c:1646 */
  3233. { (yyval.type) = type_new_int(TYPE_BASIC_CHAR, 0); }
  3234. -#line 4309 "parser.tab.c" /* yacc.c:1648 */
  3235. +#line 4304 "parser.tab.c" /* yacc.c:1646 */
  3236. break;
  3237. case 285:
  3238. -#line 827 "parser.y" /* yacc.c:1648 */
  3239. +#line 825 "parser.y" /* yacc.c:1646 */
  3240. { (yyval.type) = type_new_int(TYPE_BASIC_INT32, 0); }
  3241. -#line 4315 "parser.tab.c" /* yacc.c:1648 */
  3242. +#line 4310 "parser.tab.c" /* yacc.c:1646 */
  3243. break;
  3244. case 286:
  3245. -#line 828 "parser.y" /* yacc.c:1648 */
  3246. +#line 826 "parser.y" /* yacc.c:1646 */
  3247. { (yyval.type) = type_new_int(TYPE_BASIC_INT3264, 0); }
  3248. -#line 4321 "parser.tab.c" /* yacc.c:1648 */
  3249. +#line 4316 "parser.tab.c" /* yacc.c:1646 */
  3250. break;
  3251. case 287:
  3252. -#line 831 "parser.y" /* yacc.c:1648 */
  3253. +#line 829 "parser.y" /* yacc.c:1646 */
  3254. { (yyval.type) = type_new_coclass((yyvsp[0].str)); }
  3255. -#line 4327 "parser.tab.c" /* yacc.c:1648 */
  3256. +#line 4322 "parser.tab.c" /* yacc.c:1646 */
  3257. break;
  3258. case 288:
  3259. -#line 832 "parser.y" /* yacc.c:1648 */
  3260. +#line 830 "parser.y" /* yacc.c:1646 */
  3261. { (yyval.type) = find_type((yyvsp[0].str), NULL, 0);
  3262. if (type_get_type_detect_alias((yyval.type)) != TYPE_COCLASS)
  3263. error_loc("%s was not declared a coclass at %s:%d\n",
  3264. (yyvsp[0].str), (yyval.type)->loc_info.input_name,
  3265. (yyval.type)->loc_info.line_number);
  3266. }
  3267. -#line 4338 "parser.tab.c" /* yacc.c:1648 */
  3268. +#line 4333 "parser.tab.c" /* yacc.c:1646 */
  3269. break;
  3270. case 289:
  3271. -#line 840 "parser.y" /* yacc.c:1648 */
  3272. +#line 838 "parser.y" /* yacc.c:1646 */
  3273. { (yyval.type) = (yyvsp[0].type);
  3274. check_def((yyval.type));
  3275. (yyval.type)->attrs = check_coclass_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list));
  3276. }
  3277. -#line 4347 "parser.tab.c" /* yacc.c:1648 */
  3278. +#line 4342 "parser.tab.c" /* yacc.c:1646 */
  3279. break;
  3280. case 290:
  3281. -#line 847 "parser.y" /* yacc.c:1648 */
  3282. +#line 845 "parser.y" /* yacc.c:1646 */
  3283. { (yyval.type) = type_coclass_define((yyvsp[-4].type), (yyvsp[-2].ifref_list)); }
  3284. -#line 4353 "parser.tab.c" /* yacc.c:1648 */
  3285. +#line 4348 "parser.tab.c" /* yacc.c:1646 */
  3286. break;
  3287. case 291:
  3288. -#line 850 "parser.y" /* yacc.c:1648 */
  3289. +#line 848 "parser.y" /* yacc.c:1646 */
  3290. { (yyval.str) = (yyvsp[0].str); }
  3291. -#line 4359 "parser.tab.c" /* yacc.c:1648 */
  3292. +#line 4354 "parser.tab.c" /* yacc.c:1646 */
  3293. break;
  3294. case 292:
  3295. -#line 853 "parser.y" /* yacc.c:1648 */
  3296. +#line 851 "parser.y" /* yacc.c:1646 */
  3297. { (yyval.ifref_list) = NULL; }
  3298. -#line 4365 "parser.tab.c" /* yacc.c:1648 */
  3299. +#line 4360 "parser.tab.c" /* yacc.c:1646 */
  3300. break;
  3301. case 293:
  3302. -#line 854 "parser.y" /* yacc.c:1648 */
  3303. +#line 852 "parser.y" /* yacc.c:1646 */
  3304. { (yyval.ifref_list) = append_ifref( (yyvsp[-1].ifref_list), (yyvsp[0].ifref) ); }
  3305. -#line 4371 "parser.tab.c" /* yacc.c:1648 */
  3306. +#line 4366 "parser.tab.c" /* yacc.c:1646 */
  3307. break;
  3308. case 294:
  3309. -#line 858 "parser.y" /* yacc.c:1648 */
  3310. +#line 856 "parser.y" /* yacc.c:1646 */
  3311. { (yyval.ifref) = make_ifref((yyvsp[0].type)); (yyval.ifref)->attrs = (yyvsp[-1].attr_list); }
  3312. -#line 4377 "parser.tab.c" /* yacc.c:1648 */
  3313. +#line 4372 "parser.tab.c" /* yacc.c:1646 */
  3314. break;
  3315. case 295:
  3316. -#line 861 "parser.y" /* yacc.c:1648 */
  3317. +#line 859 "parser.y" /* yacc.c:1646 */
  3318. { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[0].str), current_namespace, 0); }
  3319. -#line 4383 "parser.tab.c" /* yacc.c:1648 */
  3320. +#line 4378 "parser.tab.c" /* yacc.c:1646 */
  3321. break;
  3322. case 296:
  3323. -#line 862 "parser.y" /* yacc.c:1648 */
  3324. +#line 860 "parser.y" /* yacc.c:1646 */
  3325. { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[0].str), current_namespace, 0); }
  3326. -#line 4389 "parser.tab.c" /* yacc.c:1648 */
  3327. +#line 4384 "parser.tab.c" /* yacc.c:1646 */
  3328. break;
  3329. case 297:
  3330. -#line 865 "parser.y" /* yacc.c:1648 */
  3331. +#line 863 "parser.y" /* yacc.c:1646 */
  3332. { attr_t *attrs;
  3333. (yyval.type) = (yyvsp[0].type);
  3334. check_def((yyval.type));
  3335. @@ -4397,75 +4392,75 @@ yyreduce:
  3336. (yyval.type)->attrs = append_attr( check_dispiface_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list)), attrs );
  3337. (yyval.type)->defined = TRUE;
  3338. }
  3339. -#line 4401 "parser.tab.c" /* yacc.c:1648 */
  3340. +#line 4396 "parser.tab.c" /* yacc.c:1646 */
  3341. break;
  3342. case 298:
  3343. -#line 874 "parser.y" /* yacc.c:1648 */
  3344. +#line 872 "parser.y" /* yacc.c:1646 */
  3345. { (yyval.var_list) = NULL; }
  3346. -#line 4407 "parser.tab.c" /* yacc.c:1648 */
  3347. +#line 4402 "parser.tab.c" /* yacc.c:1646 */
  3348. break;
  3349. case 299:
  3350. -#line 875 "parser.y" /* yacc.c:1648 */
  3351. +#line 873 "parser.y" /* yacc.c:1646 */
  3352. { (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[-1].var) ); }
  3353. -#line 4413 "parser.tab.c" /* yacc.c:1648 */
  3354. +#line 4408 "parser.tab.c" /* yacc.c:1646 */
  3355. break;
  3356. case 300:
  3357. -#line 878 "parser.y" /* yacc.c:1648 */
  3358. +#line 876 "parser.y" /* yacc.c:1646 */
  3359. { (yyval.var_list) = NULL; }
  3360. -#line 4419 "parser.tab.c" /* yacc.c:1648 */
  3361. +#line 4414 "parser.tab.c" /* yacc.c:1646 */
  3362. break;
  3363. case 301:
  3364. -#line 879 "parser.y" /* yacc.c:1648 */
  3365. +#line 877 "parser.y" /* yacc.c:1646 */
  3366. { (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[-1].var) ); }
  3367. -#line 4425 "parser.tab.c" /* yacc.c:1648 */
  3368. +#line 4420 "parser.tab.c" /* yacc.c:1646 */
  3369. break;
  3370. case 302:
  3371. -#line 885 "parser.y" /* yacc.c:1648 */
  3372. +#line 883 "parser.y" /* yacc.c:1646 */
  3373. { (yyval.type) = (yyvsp[-4].type);
  3374. type_dispinterface_define((yyval.type), (yyvsp[-2].var_list), (yyvsp[-1].var_list));
  3375. }
  3376. -#line 4433 "parser.tab.c" /* yacc.c:1648 */
  3377. +#line 4428 "parser.tab.c" /* yacc.c:1646 */
  3378. break;
  3379. case 303:
  3380. -#line 889 "parser.y" /* yacc.c:1648 */
  3381. +#line 887 "parser.y" /* yacc.c:1646 */
  3382. { (yyval.type) = (yyvsp[-4].type);
  3383. type_dispinterface_define_from_iface((yyval.type), (yyvsp[-2].type));
  3384. }
  3385. -#line 4441 "parser.tab.c" /* yacc.c:1648 */
  3386. +#line 4436 "parser.tab.c" /* yacc.c:1646 */
  3387. break;
  3388. case 304:
  3389. -#line 894 "parser.y" /* yacc.c:1648 */
  3390. +#line 892 "parser.y" /* yacc.c:1646 */
  3391. { (yyval.type) = NULL; }
  3392. -#line 4447 "parser.tab.c" /* yacc.c:1648 */
  3393. +#line 4442 "parser.tab.c" /* yacc.c:1646 */
  3394. break;
  3395. case 305:
  3396. -#line 895 "parser.y" /* yacc.c:1648 */
  3397. +#line 893 "parser.y" /* yacc.c:1646 */
  3398. { (yyval.type) = find_type_or_error2((yyvsp[0].str), 0); }
  3399. -#line 4453 "parser.tab.c" /* yacc.c:1648 */
  3400. +#line 4448 "parser.tab.c" /* yacc.c:1646 */
  3401. break;
  3402. case 306:
  3403. -#line 898 "parser.y" /* yacc.c:1648 */
  3404. +#line 896 "parser.y" /* yacc.c:1646 */
  3405. { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[0].str), current_namespace, 0); }
  3406. -#line 4459 "parser.tab.c" /* yacc.c:1648 */
  3407. +#line 4454 "parser.tab.c" /* yacc.c:1646 */
  3408. break;
  3409. case 307:
  3410. -#line 899 "parser.y" /* yacc.c:1648 */
  3411. +#line 897 "parser.y" /* yacc.c:1646 */
  3412. { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[0].str), current_namespace, 0); }
  3413. -#line 4465 "parser.tab.c" /* yacc.c:1648 */
  3414. +#line 4460 "parser.tab.c" /* yacc.c:1646 */
  3415. break;
  3416. case 308:
  3417. -#line 902 "parser.y" /* yacc.c:1648 */
  3418. +#line 900 "parser.y" /* yacc.c:1646 */
  3419. { (yyval.ifinfo).interface = (yyvsp[0].type);
  3420. (yyval.ifinfo).old_pointer_default = pointer_default;
  3421. if (is_attr((yyvsp[-1].attr_list), ATTR_POINTERDEFAULT))
  3422. @@ -4474,11 +4469,11 @@ yyreduce:
  3423. (yyvsp[0].type)->attrs = check_iface_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list));
  3424. (yyvsp[0].type)->defined = TRUE;
  3425. }
  3426. -#line 4478 "parser.tab.c" /* yacc.c:1648 */
  3427. +#line 4473 "parser.tab.c" /* yacc.c:1646 */
  3428. break;
  3429. case 309:
  3430. -#line 913 "parser.y" /* yacc.c:1648 */
  3431. +#line 911 "parser.y" /* yacc.c:1646 */
  3432. { (yyval.type) = (yyvsp[-5].ifinfo).interface;
  3433. if((yyval.type) == (yyvsp[-4].type))
  3434. error_loc("Interface can't inherit from itself\n");
  3435. @@ -4486,594 +4481,594 @@ yyreduce:
  3436. check_async_uuid((yyval.type));
  3437. pointer_default = (yyvsp[-5].ifinfo).old_pointer_default;
  3438. }
  3439. -#line 4490 "parser.tab.c" /* yacc.c:1648 */
  3440. +#line 4485 "parser.tab.c" /* yacc.c:1646 */
  3441. break;
  3442. case 310:
  3443. -#line 924 "parser.y" /* yacc.c:1648 */
  3444. +#line 922 "parser.y" /* yacc.c:1646 */
  3445. { (yyval.type) = (yyvsp[-7].ifinfo).interface;
  3446. type_interface_define((yyval.type), find_type_or_error2((yyvsp[-5].str), 0), (yyvsp[-2].stmt_list));
  3447. pointer_default = (yyvsp[-7].ifinfo).old_pointer_default;
  3448. }
  3449. -#line 4499 "parser.tab.c" /* yacc.c:1648 */
  3450. +#line 4494 "parser.tab.c" /* yacc.c:1646 */
  3451. break;
  3452. case 311:
  3453. -#line 928 "parser.y" /* yacc.c:1648 */
  3454. +#line 926 "parser.y" /* yacc.c:1646 */
  3455. { (yyval.type) = (yyvsp[-1].type); }
  3456. -#line 4505 "parser.tab.c" /* yacc.c:1648 */
  3457. +#line 4500 "parser.tab.c" /* yacc.c:1646 */
  3458. break;
  3459. case 312:
  3460. -#line 932 "parser.y" /* yacc.c:1648 */
  3461. +#line 930 "parser.y" /* yacc.c:1646 */
  3462. { (yyval.type) = (yyvsp[-1].type); }
  3463. -#line 4511 "parser.tab.c" /* yacc.c:1648 */
  3464. +#line 4506 "parser.tab.c" /* yacc.c:1646 */
  3465. break;
  3466. case 313:
  3467. -#line 933 "parser.y" /* yacc.c:1648 */
  3468. +#line 931 "parser.y" /* yacc.c:1646 */
  3469. { (yyval.type) = (yyvsp[-1].type); }
  3470. -#line 4517 "parser.tab.c" /* yacc.c:1648 */
  3471. +#line 4512 "parser.tab.c" /* yacc.c:1646 */
  3472. break;
  3473. case 314:
  3474. -#line 936 "parser.y" /* yacc.c:1648 */
  3475. +#line 934 "parser.y" /* yacc.c:1646 */
  3476. { (yyval.type) = type_new_module((yyvsp[0].str)); }
  3477. -#line 4523 "parser.tab.c" /* yacc.c:1648 */
  3478. +#line 4518 "parser.tab.c" /* yacc.c:1646 */
  3479. break;
  3480. case 315:
  3481. -#line 937 "parser.y" /* yacc.c:1648 */
  3482. +#line 935 "parser.y" /* yacc.c:1646 */
  3483. { (yyval.type) = type_new_module((yyvsp[0].str)); }
  3484. -#line 4529 "parser.tab.c" /* yacc.c:1648 */
  3485. +#line 4524 "parser.tab.c" /* yacc.c:1646 */
  3486. break;
  3487. case 316:
  3488. -#line 940 "parser.y" /* yacc.c:1648 */
  3489. +#line 938 "parser.y" /* yacc.c:1646 */
  3490. { (yyval.type) = (yyvsp[0].type);
  3491. (yyval.type)->attrs = check_module_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list));
  3492. }
  3493. -#line 4537 "parser.tab.c" /* yacc.c:1648 */
  3494. +#line 4532 "parser.tab.c" /* yacc.c:1646 */
  3495. break;
  3496. case 317:
  3497. -#line 946 "parser.y" /* yacc.c:1648 */
  3498. +#line 944 "parser.y" /* yacc.c:1646 */
  3499. { (yyval.type) = (yyvsp[-4].type);
  3500. type_module_define((yyval.type), (yyvsp[-2].stmt_list));
  3501. }
  3502. -#line 4545 "parser.tab.c" /* yacc.c:1648 */
  3503. +#line 4540 "parser.tab.c" /* yacc.c:1646 */
  3504. break;
  3505. case 318:
  3506. -#line 952 "parser.y" /* yacc.c:1648 */
  3507. +#line 950 "parser.y" /* yacc.c:1646 */
  3508. { (yyval.stgclass) = STG_EXTERN; }
  3509. -#line 4551 "parser.tab.c" /* yacc.c:1648 */
  3510. +#line 4546 "parser.tab.c" /* yacc.c:1646 */
  3511. break;
  3512. case 319:
  3513. -#line 953 "parser.y" /* yacc.c:1648 */
  3514. +#line 951 "parser.y" /* yacc.c:1646 */
  3515. { (yyval.stgclass) = STG_STATIC; }
  3516. -#line 4557 "parser.tab.c" /* yacc.c:1648 */
  3517. +#line 4552 "parser.tab.c" /* yacc.c:1646 */
  3518. break;
  3519. case 320:
  3520. -#line 954 "parser.y" /* yacc.c:1648 */
  3521. +#line 952 "parser.y" /* yacc.c:1646 */
  3522. { (yyval.stgclass) = STG_REGISTER; }
  3523. -#line 4563 "parser.tab.c" /* yacc.c:1648 */
  3524. +#line 4558 "parser.tab.c" /* yacc.c:1646 */
  3525. break;
  3526. case 321:
  3527. -#line 958 "parser.y" /* yacc.c:1648 */
  3528. - { (yyval.attr) = make_attr(ATTR_INLINE); }
  3529. -#line 4569 "parser.tab.c" /* yacc.c:1648 */
  3530. +#line 956 "parser.y" /* yacc.c:1646 */
  3531. + { (yyval.funcspecifier) = FUNCTION_SPECIFIER_INLINE; }
  3532. +#line 4564 "parser.tab.c" /* yacc.c:1646 */
  3533. break;
  3534. case 322:
  3535. -#line 962 "parser.y" /* yacc.c:1648 */
  3536. - { (yyval.attr) = make_attr(ATTR_CONST); }
  3537. -#line 4575 "parser.tab.c" /* yacc.c:1648 */
  3538. +#line 960 "parser.y" /* yacc.c:1646 */
  3539. + { (yyval.typequalifier) = TYPE_QUALIFIER_CONST; }
  3540. +#line 4570 "parser.tab.c" /* yacc.c:1646 */
  3541. break;
  3542. case 323:
  3543. -#line 965 "parser.y" /* yacc.c:1648 */
  3544. - { (yyval.attr_list) = NULL; }
  3545. -#line 4581 "parser.tab.c" /* yacc.c:1648 */
  3546. +#line 963 "parser.y" /* yacc.c:1646 */
  3547. + { (yyval.typequalifier) = TYPE_QUALIFIER_NONE; }
  3548. +#line 4576 "parser.tab.c" /* yacc.c:1646 */
  3549. break;
  3550. case 324:
  3551. -#line 966 "parser.y" /* yacc.c:1648 */
  3552. - { (yyval.attr_list) = append_attr((yyvsp[-1].attr_list), (yyvsp[0].attr)); }
  3553. -#line 4587 "parser.tab.c" /* yacc.c:1648 */
  3554. +#line 964 "parser.y" /* yacc.c:1646 */
  3555. + { (yyval.typequalifier) = (yyvsp[-1].typequalifier) | (yyvsp[0].typequalifier); }
  3556. +#line 4582 "parser.tab.c" /* yacc.c:1646 */
  3557. break;
  3558. case 325:
  3559. -#line 969 "parser.y" /* yacc.c:1648 */
  3560. - { (yyval.declspec) = make_decl_spec((yyvsp[-1].type), (yyvsp[0].declspec), NULL, NULL, STG_NONE); }
  3561. -#line 4593 "parser.tab.c" /* yacc.c:1648 */
  3562. +#line 967 "parser.y" /* yacc.c:1646 */
  3563. + { (yyval.declspec) = make_decl_spec((yyvsp[-1].type), (yyvsp[0].declspec), NULL, STG_NONE, TYPE_QUALIFIER_NONE, FUNCTION_SPECIFIER_NONE); }
  3564. +#line 4588 "parser.tab.c" /* yacc.c:1646 */
  3565. break;
  3566. case 326:
  3567. -#line 971 "parser.y" /* yacc.c:1648 */
  3568. - { (yyval.declspec) = make_decl_spec((yyvsp[-1].type), (yyvsp[-2].declspec), (yyvsp[0].declspec), NULL, STG_NONE); }
  3569. -#line 4599 "parser.tab.c" /* yacc.c:1648 */
  3570. +#line 969 "parser.y" /* yacc.c:1646 */
  3571. + { (yyval.declspec) = make_decl_spec((yyvsp[-1].type), (yyvsp[-2].declspec), (yyvsp[0].declspec), STG_NONE, TYPE_QUALIFIER_NONE, FUNCTION_SPECIFIER_NONE); }
  3572. +#line 4594 "parser.tab.c" /* yacc.c:1646 */
  3573. break;
  3574. case 327:
  3575. -#line 974 "parser.y" /* yacc.c:1648 */
  3576. +#line 972 "parser.y" /* yacc.c:1646 */
  3577. { (yyval.declspec) = NULL; }
  3578. -#line 4605 "parser.tab.c" /* yacc.c:1648 */
  3579. +#line 4600 "parser.tab.c" /* yacc.c:1646 */
  3580. break;
  3581. case 329:
  3582. -#line 979 "parser.y" /* yacc.c:1648 */
  3583. - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, (yyvsp[-1].attr), STG_NONE); }
  3584. -#line 4611 "parser.tab.c" /* yacc.c:1648 */
  3585. +#line 977 "parser.y" /* yacc.c:1646 */
  3586. + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, STG_NONE, (yyvsp[-1].typequalifier), FUNCTION_SPECIFIER_NONE); }
  3587. +#line 4606 "parser.tab.c" /* yacc.c:1646 */
  3588. break;
  3589. case 330:
  3590. -#line 980 "parser.y" /* yacc.c:1648 */
  3591. - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, (yyvsp[-1].attr), STG_NONE); }
  3592. -#line 4617 "parser.tab.c" /* yacc.c:1648 */
  3593. +#line 978 "parser.y" /* yacc.c:1646 */
  3594. + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, STG_NONE, TYPE_QUALIFIER_NONE, (yyvsp[-1].funcspecifier)); }
  3595. +#line 4612 "parser.tab.c" /* yacc.c:1646 */
  3596. break;
  3597. case 331:
  3598. -#line 981 "parser.y" /* yacc.c:1648 */
  3599. - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, NULL, (yyvsp[-1].stgclass)); }
  3600. -#line 4623 "parser.tab.c" /* yacc.c:1648 */
  3601. +#line 979 "parser.y" /* yacc.c:1646 */
  3602. + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, (yyvsp[-1].stgclass), TYPE_QUALIFIER_NONE, FUNCTION_SPECIFIER_NONE); }
  3603. +#line 4618 "parser.tab.c" /* yacc.c:1646 */
  3604. break;
  3605. case 332:
  3606. -#line 986 "parser.y" /* yacc.c:1648 */
  3607. - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type = append_chain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[-1].attr_list))); }
  3608. -#line 4629 "parser.tab.c" /* yacc.c:1648 */
  3609. +#line 984 "parser.y" /* yacc.c:1646 */
  3610. + { (yyval.declarator) = (yyvsp[0].declarator); append_chain_declspec(&(yyval.declarator)->declspec, type_new_pointer(pointer_default, NULL), (yyvsp[-1].typequalifier)); }
  3611. +#line 4624 "parser.tab.c" /* yacc.c:1646 */
  3612. break;
  3613. case 333:
  3614. -#line 987 "parser.y" /* yacc.c:1648 */
  3615. +#line 985 "parser.y" /* yacc.c:1646 */
  3616. { (yyval.declarator) = (yyvsp[0].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str)));
  3617. - else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3618. -#line 4636 "parser.tab.c" /* yacc.c:1648 */
  3619. + else if ((yyval.declarator)->declspec.type) (yyval.declarator)->declspec.type->attrs = append_attr((yyval.declarator)->declspec.type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3620. +#line 4631 "parser.tab.c" /* yacc.c:1646 */
  3621. break;
  3622. case 335:
  3623. -#line 993 "parser.y" /* yacc.c:1648 */
  3624. +#line 991 "parser.y" /* yacc.c:1646 */
  3625. { (yyval.declarator) = make_declarator((yyvsp[0].var)); }
  3626. -#line 4642 "parser.tab.c" /* yacc.c:1648 */
  3627. +#line 4637 "parser.tab.c" /* yacc.c:1646 */
  3628. break;
  3629. case 336:
  3630. -#line 994 "parser.y" /* yacc.c:1648 */
  3631. +#line 992 "parser.y" /* yacc.c:1646 */
  3632. { (yyval.declarator) = (yyvsp[-1].declarator); }
  3633. -#line 4648 "parser.tab.c" /* yacc.c:1648 */
  3634. +#line 4643 "parser.tab.c" /* yacc.c:1646 */
  3635. break;
  3636. case 337:
  3637. -#line 995 "parser.y" /* yacc.c:1648 */
  3638. - { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->type = append_array((yyval.declarator)->type, (yyvsp[0].expr)); }
  3639. -#line 4654 "parser.tab.c" /* yacc.c:1648 */
  3640. +#line 993 "parser.y" /* yacc.c:1646 */
  3641. + { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->declspec.type = append_array((yyval.declarator)->declspec.type, (yyvsp[0].expr)); }
  3642. +#line 4649 "parser.tab.c" /* yacc.c:1646 */
  3643. break;
  3644. case 338:
  3645. -#line 996 "parser.y" /* yacc.c:1648 */
  3646. +#line 994 "parser.y" /* yacc.c:1646 */
  3647. { (yyval.declarator) = (yyvsp[-3].declarator);
  3648. - (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->type, type_new_function((yyvsp[-1].var_list)));
  3649. - (yyval.declarator)->type = NULL;
  3650. + (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->declspec.type, type_new_function((yyvsp[-1].var_list)));
  3651. + (yyval.declarator)->declspec.type = NULL;
  3652. }
  3653. -#line 4663 "parser.tab.c" /* yacc.c:1648 */
  3654. +#line 4658 "parser.tab.c" /* yacc.c:1646 */
  3655. break;
  3656. case 339:
  3657. -#line 1005 "parser.y" /* yacc.c:1648 */
  3658. - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type = append_chain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[-1].attr_list))); }
  3659. -#line 4669 "parser.tab.c" /* yacc.c:1648 */
  3660. +#line 1003 "parser.y" /* yacc.c:1646 */
  3661. + { (yyval.declarator) = (yyvsp[0].declarator); append_chain_declspec(&(yyval.declarator)->declspec, type_new_pointer(pointer_default, NULL), (yyvsp[-1].typequalifier)); }
  3662. +#line 4664 "parser.tab.c" /* yacc.c:1646 */
  3663. break;
  3664. case 340:
  3665. -#line 1006 "parser.y" /* yacc.c:1648 */
  3666. +#line 1004 "parser.y" /* yacc.c:1646 */
  3667. { (yyval.declarator) = (yyvsp[0].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str)));
  3668. - else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3669. -#line 4676 "parser.tab.c" /* yacc.c:1648 */
  3670. + else if ((yyval.declarator)->declspec.type) (yyval.declarator)->declspec.type->attrs = append_attr((yyval.declarator)->declspec.type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3671. +#line 4671 "parser.tab.c" /* yacc.c:1646 */
  3672. break;
  3673. case 342:
  3674. -#line 1014 "parser.y" /* yacc.c:1648 */
  3675. - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type = append_chain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[-1].attr_list))); }
  3676. -#line 4682 "parser.tab.c" /* yacc.c:1648 */
  3677. +#line 1012 "parser.y" /* yacc.c:1646 */
  3678. + { (yyval.declarator) = (yyvsp[0].declarator); append_chain_declspec(&(yyval.declarator)->declspec, type_new_pointer(pointer_default, NULL), (yyvsp[-1].typequalifier)); }
  3679. +#line 4677 "parser.tab.c" /* yacc.c:1646 */
  3680. break;
  3681. case 343:
  3682. -#line 1015 "parser.y" /* yacc.c:1648 */
  3683. +#line 1013 "parser.y" /* yacc.c:1646 */
  3684. { (yyval.declarator) = (yyvsp[0].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str)));
  3685. - else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3686. -#line 4689 "parser.tab.c" /* yacc.c:1648 */
  3687. + else if ((yyval.declarator)->declspec.type) (yyval.declarator)->declspec.type->attrs = append_attr((yyval.declarator)->declspec.type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3688. +#line 4684 "parser.tab.c" /* yacc.c:1646 */
  3689. break;
  3690. case 344:
  3691. -#line 1020 "parser.y" /* yacc.c:1648 */
  3692. +#line 1018 "parser.y" /* yacc.c:1646 */
  3693. { (yyval.declarator) = make_declarator(NULL); }
  3694. -#line 4695 "parser.tab.c" /* yacc.c:1648 */
  3695. +#line 4690 "parser.tab.c" /* yacc.c:1646 */
  3696. break;
  3697. case 346:
  3698. -#line 1026 "parser.y" /* yacc.c:1648 */
  3699. +#line 1024 "parser.y" /* yacc.c:1646 */
  3700. { (yyval.declarator) = (yyvsp[-1].declarator); }
  3701. -#line 4701 "parser.tab.c" /* yacc.c:1648 */
  3702. +#line 4696 "parser.tab.c" /* yacc.c:1646 */
  3703. break;
  3704. case 347:
  3705. -#line 1027 "parser.y" /* yacc.c:1648 */
  3706. - { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->type = append_array((yyval.declarator)->type, (yyvsp[0].expr)); }
  3707. -#line 4707 "parser.tab.c" /* yacc.c:1648 */
  3708. +#line 1025 "parser.y" /* yacc.c:1646 */
  3709. + { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->declspec.type = append_array((yyval.declarator)->declspec.type, (yyvsp[0].expr)); }
  3710. +#line 4702 "parser.tab.c" /* yacc.c:1646 */
  3711. break;
  3712. case 348:
  3713. -#line 1028 "parser.y" /* yacc.c:1648 */
  3714. - { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->type = append_array((yyval.declarator)->type, (yyvsp[0].expr)); }
  3715. -#line 4713 "parser.tab.c" /* yacc.c:1648 */
  3716. +#line 1026 "parser.y" /* yacc.c:1646 */
  3717. + { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->declspec.type = append_array((yyval.declarator)->declspec.type, (yyvsp[0].expr)); }
  3718. +#line 4708 "parser.tab.c" /* yacc.c:1646 */
  3719. break;
  3720. case 349:
  3721. -#line 1030 "parser.y" /* yacc.c:1648 */
  3722. +#line 1028 "parser.y" /* yacc.c:1646 */
  3723. { (yyval.declarator) = make_declarator(NULL);
  3724. - (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->type, type_new_function((yyvsp[-1].var_list)));
  3725. - (yyval.declarator)->type = NULL;
  3726. + (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->declspec.type, type_new_function((yyvsp[-1].var_list)));
  3727. + (yyval.declarator)->declspec.type = NULL;
  3728. }
  3729. -#line 4722 "parser.tab.c" /* yacc.c:1648 */
  3730. +#line 4717 "parser.tab.c" /* yacc.c:1646 */
  3731. break;
  3732. case 350:
  3733. -#line 1035 "parser.y" /* yacc.c:1648 */
  3734. +#line 1033 "parser.y" /* yacc.c:1646 */
  3735. { (yyval.declarator) = (yyvsp[-3].declarator);
  3736. - (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->type, type_new_function((yyvsp[-1].var_list)));
  3737. - (yyval.declarator)->type = NULL;
  3738. + (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->declspec.type, type_new_function((yyvsp[-1].var_list)));
  3739. + (yyval.declarator)->declspec.type = NULL;
  3740. }
  3741. -#line 4731 "parser.tab.c" /* yacc.c:1648 */
  3742. +#line 4726 "parser.tab.c" /* yacc.c:1646 */
  3743. break;
  3744. case 351:
  3745. -#line 1044 "parser.y" /* yacc.c:1648 */
  3746. - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type = append_chain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[-1].attr_list))); }
  3747. -#line 4737 "parser.tab.c" /* yacc.c:1648 */
  3748. +#line 1042 "parser.y" /* yacc.c:1646 */
  3749. + { (yyval.declarator) = (yyvsp[0].declarator); append_chain_declspec(&(yyval.declarator)->declspec, type_new_pointer(pointer_default, NULL), (yyvsp[-1].typequalifier)); }
  3750. +#line 4732 "parser.tab.c" /* yacc.c:1646 */
  3751. break;
  3752. case 352:
  3753. -#line 1045 "parser.y" /* yacc.c:1648 */
  3754. - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3755. -#line 4743 "parser.tab.c" /* yacc.c:1648 */
  3756. +#line 1043 "parser.y" /* yacc.c:1646 */
  3757. + { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->declspec.type->attrs = append_attr((yyval.declarator)->declspec.type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3758. +#line 4738 "parser.tab.c" /* yacc.c:1646 */
  3759. break;
  3760. case 354:
  3761. -#line 1052 "parser.y" /* yacc.c:1648 */
  3762. - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type = append_chain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[-1].attr_list))); }
  3763. -#line 4749 "parser.tab.c" /* yacc.c:1648 */
  3764. +#line 1050 "parser.y" /* yacc.c:1646 */
  3765. + { (yyval.declarator) = (yyvsp[0].declarator); append_chain_declspec(&(yyval.declarator)->declspec, type_new_pointer(pointer_default, NULL), (yyvsp[-1].typequalifier)); }
  3766. +#line 4744 "parser.tab.c" /* yacc.c:1646 */
  3767. break;
  3768. case 355:
  3769. -#line 1053 "parser.y" /* yacc.c:1648 */
  3770. - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3771. -#line 4755 "parser.tab.c" /* yacc.c:1648 */
  3772. +#line 1051 "parser.y" /* yacc.c:1646 */
  3773. + { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->declspec.type->attrs = append_attr((yyval.declarator)->declspec.type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); }
  3774. +#line 4750 "parser.tab.c" /* yacc.c:1646 */
  3775. break;
  3776. case 356:
  3777. -#line 1057 "parser.y" /* yacc.c:1648 */
  3778. +#line 1055 "parser.y" /* yacc.c:1646 */
  3779. { (yyval.declarator) = make_declarator(NULL); }
  3780. -#line 4761 "parser.tab.c" /* yacc.c:1648 */
  3781. +#line 4756 "parser.tab.c" /* yacc.c:1646 */
  3782. break;
  3783. case 358:
  3784. -#line 1065 "parser.y" /* yacc.c:1648 */
  3785. +#line 1063 "parser.y" /* yacc.c:1646 */
  3786. { (yyval.declarator) = make_declarator((yyvsp[0].var)); }
  3787. -#line 4767 "parser.tab.c" /* yacc.c:1648 */
  3788. +#line 4762 "parser.tab.c" /* yacc.c:1646 */
  3789. break;
  3790. case 359:
  3791. -#line 1066 "parser.y" /* yacc.c:1648 */
  3792. +#line 1064 "parser.y" /* yacc.c:1646 */
  3793. { (yyval.declarator) = (yyvsp[-1].declarator); }
  3794. -#line 4773 "parser.tab.c" /* yacc.c:1648 */
  3795. +#line 4768 "parser.tab.c" /* yacc.c:1646 */
  3796. break;
  3797. case 360:
  3798. -#line 1067 "parser.y" /* yacc.c:1648 */
  3799. - { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->type = append_array((yyval.declarator)->type, (yyvsp[0].expr)); }
  3800. -#line 4779 "parser.tab.c" /* yacc.c:1648 */
  3801. +#line 1065 "parser.y" /* yacc.c:1646 */
  3802. + { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->declspec.type = append_array((yyval.declarator)->declspec.type, (yyvsp[0].expr)); }
  3803. +#line 4774 "parser.tab.c" /* yacc.c:1646 */
  3804. break;
  3805. case 361:
  3806. -#line 1068 "parser.y" /* yacc.c:1648 */
  3807. - { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->type = append_array((yyval.declarator)->type, (yyvsp[0].expr)); }
  3808. -#line 4785 "parser.tab.c" /* yacc.c:1648 */
  3809. +#line 1066 "parser.y" /* yacc.c:1646 */
  3810. + { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->declspec.type = append_array((yyval.declarator)->declspec.type, (yyvsp[0].expr)); }
  3811. +#line 4780 "parser.tab.c" /* yacc.c:1646 */
  3812. break;
  3813. case 362:
  3814. -#line 1070 "parser.y" /* yacc.c:1648 */
  3815. +#line 1068 "parser.y" /* yacc.c:1646 */
  3816. { (yyval.declarator) = make_declarator(NULL);
  3817. - (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->type, type_new_function((yyvsp[-1].var_list)));
  3818. - (yyval.declarator)->type = NULL;
  3819. + (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->declspec.type, type_new_function((yyvsp[-1].var_list)));
  3820. + (yyval.declarator)->declspec.type = NULL;
  3821. }
  3822. -#line 4794 "parser.tab.c" /* yacc.c:1648 */
  3823. +#line 4789 "parser.tab.c" /* yacc.c:1646 */
  3824. break;
  3825. case 363:
  3826. -#line 1075 "parser.y" /* yacc.c:1648 */
  3827. +#line 1073 "parser.y" /* yacc.c:1646 */
  3828. { (yyval.declarator) = (yyvsp[-3].declarator);
  3829. - (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->type, type_new_function((yyvsp[-1].var_list)));
  3830. - (yyval.declarator)->type = NULL;
  3831. + (yyval.declarator)->func_type = append_chain_type((yyval.declarator)->declspec.type, type_new_function((yyvsp[-1].var_list)));
  3832. + (yyval.declarator)->declspec.type = NULL;
  3833. }
  3834. -#line 4803 "parser.tab.c" /* yacc.c:1648 */
  3835. +#line 4798 "parser.tab.c" /* yacc.c:1646 */
  3836. break;
  3837. case 364:
  3838. -#line 1082 "parser.y" /* yacc.c:1648 */
  3839. +#line 1080 "parser.y" /* yacc.c:1646 */
  3840. { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[0].declarator) ); }
  3841. -#line 4809 "parser.tab.c" /* yacc.c:1648 */
  3842. +#line 4804 "parser.tab.c" /* yacc.c:1646 */
  3843. break;
  3844. case 365:
  3845. -#line 1083 "parser.y" /* yacc.c:1648 */
  3846. +#line 1081 "parser.y" /* yacc.c:1646 */
  3847. { (yyval.declarator_list) = append_declarator( (yyvsp[-2].declarator_list), (yyvsp[0].declarator) ); }
  3848. -#line 4815 "parser.tab.c" /* yacc.c:1648 */
  3849. +#line 4810 "parser.tab.c" /* yacc.c:1646 */
  3850. break;
  3851. case 366:
  3852. -#line 1086 "parser.y" /* yacc.c:1648 */
  3853. +#line 1084 "parser.y" /* yacc.c:1646 */
  3854. { (yyval.expr) = NULL; }
  3855. -#line 4821 "parser.tab.c" /* yacc.c:1648 */
  3856. +#line 4816 "parser.tab.c" /* yacc.c:1646 */
  3857. break;
  3858. case 367:
  3859. -#line 1087 "parser.y" /* yacc.c:1648 */
  3860. +#line 1085 "parser.y" /* yacc.c:1646 */
  3861. { (yyval.expr) = (yyvsp[0].expr); }
  3862. -#line 4827 "parser.tab.c" /* yacc.c:1648 */
  3863. +#line 4822 "parser.tab.c" /* yacc.c:1646 */
  3864. break;
  3865. case 368:
  3866. -#line 1090 "parser.y" /* yacc.c:1648 */
  3867. +#line 1088 "parser.y" /* yacc.c:1646 */
  3868. { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->bits = (yyvsp[0].expr);
  3869. if (!(yyval.declarator)->bits && !(yyval.declarator)->var->name)
  3870. error_loc("unnamed fields are not allowed\n");
  3871. }
  3872. -#line 4836 "parser.tab.c" /* yacc.c:1648 */
  3873. +#line 4831 "parser.tab.c" /* yacc.c:1646 */
  3874. break;
  3875. case 369:
  3876. -#line 1097 "parser.y" /* yacc.c:1648 */
  3877. +#line 1095 "parser.y" /* yacc.c:1646 */
  3878. { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[0].declarator) ); }
  3879. -#line 4842 "parser.tab.c" /* yacc.c:1648 */
  3880. +#line 4837 "parser.tab.c" /* yacc.c:1646 */
  3881. break;
  3882. case 370:
  3883. -#line 1099 "parser.y" /* yacc.c:1648 */
  3884. +#line 1097 "parser.y" /* yacc.c:1646 */
  3885. { (yyval.declarator_list) = append_declarator( (yyvsp[-2].declarator_list), (yyvsp[0].declarator) ); }
  3886. -#line 4848 "parser.tab.c" /* yacc.c:1648 */
  3887. +#line 4843 "parser.tab.c" /* yacc.c:1646 */
  3888. break;
  3889. case 371:
  3890. -#line 1103 "parser.y" /* yacc.c:1648 */
  3891. +#line 1101 "parser.y" /* yacc.c:1646 */
  3892. { (yyval.declarator) = (yyvsp[0].declarator); }
  3893. -#line 4854 "parser.tab.c" /* yacc.c:1648 */
  3894. +#line 4849 "parser.tab.c" /* yacc.c:1646 */
  3895. break;
  3896. case 372:
  3897. -#line 1104 "parser.y" /* yacc.c:1648 */
  3898. +#line 1102 "parser.y" /* yacc.c:1646 */
  3899. { (yyval.declarator) = (yyvsp[-2].declarator); (yyvsp[-2].declarator)->var->eval = (yyvsp[0].expr); }
  3900. -#line 4860 "parser.tab.c" /* yacc.c:1648 */
  3901. +#line 4855 "parser.tab.c" /* yacc.c:1646 */
  3902. break;
  3903. case 373:
  3904. -#line 1108 "parser.y" /* yacc.c:1648 */
  3905. +#line 1106 "parser.y" /* yacc.c:1646 */
  3906. { (yyval.num) = THREADING_APARTMENT; }
  3907. -#line 4866 "parser.tab.c" /* yacc.c:1648 */
  3908. +#line 4861 "parser.tab.c" /* yacc.c:1646 */
  3909. break;
  3910. case 374:
  3911. -#line 1109 "parser.y" /* yacc.c:1648 */
  3912. +#line 1107 "parser.y" /* yacc.c:1646 */
  3913. { (yyval.num) = THREADING_NEUTRAL; }
  3914. -#line 4872 "parser.tab.c" /* yacc.c:1648 */
  3915. +#line 4867 "parser.tab.c" /* yacc.c:1646 */
  3916. break;
  3917. case 375:
  3918. -#line 1110 "parser.y" /* yacc.c:1648 */
  3919. +#line 1108 "parser.y" /* yacc.c:1646 */
  3920. { (yyval.num) = THREADING_SINGLE; }
  3921. -#line 4878 "parser.tab.c" /* yacc.c:1648 */
  3922. +#line 4873 "parser.tab.c" /* yacc.c:1646 */
  3923. break;
  3924. case 376:
  3925. -#line 1111 "parser.y" /* yacc.c:1648 */
  3926. +#line 1109 "parser.y" /* yacc.c:1646 */
  3927. { (yyval.num) = THREADING_FREE; }
  3928. -#line 4884 "parser.tab.c" /* yacc.c:1648 */
  3929. +#line 4879 "parser.tab.c" /* yacc.c:1646 */
  3930. break;
  3931. case 377:
  3932. -#line 1112 "parser.y" /* yacc.c:1648 */
  3933. +#line 1110 "parser.y" /* yacc.c:1646 */
  3934. { (yyval.num) = THREADING_BOTH; }
  3935. -#line 4890 "parser.tab.c" /* yacc.c:1648 */
  3936. +#line 4885 "parser.tab.c" /* yacc.c:1646 */
  3937. break;
  3938. case 378:
  3939. -#line 1116 "parser.y" /* yacc.c:1648 */
  3940. +#line 1114 "parser.y" /* yacc.c:1646 */
  3941. { (yyval.num) = FC_RP; }
  3942. -#line 4896 "parser.tab.c" /* yacc.c:1648 */
  3943. +#line 4891 "parser.tab.c" /* yacc.c:1646 */
  3944. break;
  3945. case 379:
  3946. -#line 1117 "parser.y" /* yacc.c:1648 */
  3947. +#line 1115 "parser.y" /* yacc.c:1646 */
  3948. { (yyval.num) = FC_UP; }
  3949. -#line 4902 "parser.tab.c" /* yacc.c:1648 */
  3950. +#line 4897 "parser.tab.c" /* yacc.c:1646 */
  3951. break;
  3952. case 380:
  3953. -#line 1118 "parser.y" /* yacc.c:1648 */
  3954. +#line 1116 "parser.y" /* yacc.c:1646 */
  3955. { (yyval.num) = FC_FP; }
  3956. -#line 4908 "parser.tab.c" /* yacc.c:1648 */
  3957. +#line 4903 "parser.tab.c" /* yacc.c:1646 */
  3958. break;
  3959. case 381:
  3960. -#line 1121 "parser.y" /* yacc.c:1648 */
  3961. +#line 1119 "parser.y" /* yacc.c:1646 */
  3962. { (yyval.type) = type_new_struct((yyvsp[-3].str), current_namespace, TRUE, (yyvsp[-1].var_list)); }
  3963. -#line 4914 "parser.tab.c" /* yacc.c:1648 */
  3964. +#line 4909 "parser.tab.c" /* yacc.c:1646 */
  3965. break;
  3966. case 382:
  3967. -#line 1124 "parser.y" /* yacc.c:1648 */
  3968. +#line 1122 "parser.y" /* yacc.c:1646 */
  3969. { (yyval.type) = type_new_void(); }
  3970. -#line 4920 "parser.tab.c" /* yacc.c:1648 */
  3971. +#line 4915 "parser.tab.c" /* yacc.c:1646 */
  3972. break;
  3973. case 383:
  3974. -#line 1125 "parser.y" /* yacc.c:1648 */
  3975. +#line 1123 "parser.y" /* yacc.c:1646 */
  3976. { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); }
  3977. -#line 4926 "parser.tab.c" /* yacc.c:1648 */
  3978. +#line 4921 "parser.tab.c" /* yacc.c:1646 */
  3979. break;
  3980. case 384:
  3981. -#line 1126 "parser.y" /* yacc.c:1648 */
  3982. +#line 1124 "parser.y" /* yacc.c:1646 */
  3983. { (yyval.type) = (yyvsp[0].type); }
  3984. -#line 4932 "parser.tab.c" /* yacc.c:1648 */
  3985. +#line 4927 "parser.tab.c" /* yacc.c:1646 */
  3986. break;
  3987. case 385:
  3988. -#line 1127 "parser.y" /* yacc.c:1648 */
  3989. +#line 1125 "parser.y" /* yacc.c:1646 */
  3990. { (yyval.type) = (yyvsp[0].type); }
  3991. -#line 4938 "parser.tab.c" /* yacc.c:1648 */
  3992. +#line 4933 "parser.tab.c" /* yacc.c:1646 */
  3993. break;
  3994. case 386:
  3995. -#line 1128 "parser.y" /* yacc.c:1648 */
  3996. +#line 1126 "parser.y" /* yacc.c:1646 */
  3997. { (yyval.type) = type_new_enum((yyvsp[0].str), current_namespace, FALSE, NULL); }
  3998. -#line 4944 "parser.tab.c" /* yacc.c:1648 */
  3999. +#line 4939 "parser.tab.c" /* yacc.c:1646 */
  4000. break;
  4001. case 387:
  4002. -#line 1129 "parser.y" /* yacc.c:1648 */
  4003. +#line 1127 "parser.y" /* yacc.c:1646 */
  4004. { (yyval.type) = (yyvsp[0].type); }
  4005. -#line 4950 "parser.tab.c" /* yacc.c:1648 */
  4006. +#line 4945 "parser.tab.c" /* yacc.c:1646 */
  4007. break;
  4008. case 388:
  4009. -#line 1130 "parser.y" /* yacc.c:1648 */
  4010. +#line 1128 "parser.y" /* yacc.c:1646 */
  4011. { (yyval.type) = type_new_struct((yyvsp[0].str), current_namespace, FALSE, NULL); }
  4012. -#line 4956 "parser.tab.c" /* yacc.c:1648 */
  4013. +#line 4951 "parser.tab.c" /* yacc.c:1646 */
  4014. break;
  4015. case 389:
  4016. -#line 1131 "parser.y" /* yacc.c:1648 */
  4017. +#line 1129 "parser.y" /* yacc.c:1646 */
  4018. { (yyval.type) = (yyvsp[0].type); }
  4019. -#line 4962 "parser.tab.c" /* yacc.c:1648 */
  4020. +#line 4957 "parser.tab.c" /* yacc.c:1646 */
  4021. break;
  4022. case 390:
  4023. -#line 1132 "parser.y" /* yacc.c:1648 */
  4024. +#line 1130 "parser.y" /* yacc.c:1646 */
  4025. { (yyval.type) = type_new_nonencapsulated_union((yyvsp[0].str), FALSE, NULL); }
  4026. -#line 4968 "parser.tab.c" /* yacc.c:1648 */
  4027. +#line 4963 "parser.tab.c" /* yacc.c:1646 */
  4028. break;
  4029. case 391:
  4030. -#line 1133 "parser.y" /* yacc.c:1648 */
  4031. +#line 1131 "parser.y" /* yacc.c:1646 */
  4032. { (yyval.type) = make_safearray((yyvsp[-1].type)); }
  4033. -#line 4974 "parser.tab.c" /* yacc.c:1648 */
  4034. +#line 4969 "parser.tab.c" /* yacc.c:1646 */
  4035. break;
  4036. case 392:
  4037. -#line 1137 "parser.y" /* yacc.c:1648 */
  4038. +#line 1135 "parser.y" /* yacc.c:1646 */
  4039. { (yyvsp[-4].attr_list) = append_attribs((yyvsp[-4].attr_list), (yyvsp[-2].attr_list));
  4040. reg_typedefs((yyvsp[-1].declspec), (yyvsp[0].declarator_list), check_typedef_attrs((yyvsp[-4].attr_list)));
  4041. (yyval.statement) = make_statement_typedef((yyvsp[0].declarator_list));
  4042. }
  4043. -#line 4983 "parser.tab.c" /* yacc.c:1648 */
  4044. +#line 4978 "parser.tab.c" /* yacc.c:1646 */
  4045. break;
  4046. case 393:
  4047. -#line 1144 "parser.y" /* yacc.c:1648 */
  4048. +#line 1142 "parser.y" /* yacc.c:1646 */
  4049. { (yyval.type) = type_new_nonencapsulated_union((yyvsp[-3].str), TRUE, (yyvsp[-1].var_list)); }
  4050. -#line 4989 "parser.tab.c" /* yacc.c:1648 */
  4051. +#line 4984 "parser.tab.c" /* yacc.c:1646 */
  4052. break;
  4053. case 394:
  4054. -#line 1147 "parser.y" /* yacc.c:1648 */
  4055. +#line 1145 "parser.y" /* yacc.c:1646 */
  4056. { (yyval.type) = type_new_encapsulated_union((yyvsp[-8].str), (yyvsp[-5].var), (yyvsp[-3].var), (yyvsp[-1].var_list)); }
  4057. -#line 4995 "parser.tab.c" /* yacc.c:1648 */
  4058. +#line 4990 "parser.tab.c" /* yacc.c:1646 */
  4059. break;
  4060. case 395:
  4061. -#line 1151 "parser.y" /* yacc.c:1648 */
  4062. +#line 1149 "parser.y" /* yacc.c:1646 */
  4063. { (yyval.num) = MAKEVERSION((yyvsp[0].num), 0); }
  4064. -#line 5001 "parser.tab.c" /* yacc.c:1648 */
  4065. +#line 4996 "parser.tab.c" /* yacc.c:1646 */
  4066. break;
  4067. case 396:
  4068. -#line 1152 "parser.y" /* yacc.c:1648 */
  4069. +#line 1150 "parser.y" /* yacc.c:1646 */
  4070. { (yyval.num) = MAKEVERSION((yyvsp[-2].num), (yyvsp[0].num)); }
  4071. -#line 5007 "parser.tab.c" /* yacc.c:1648 */
  4072. +#line 5002 "parser.tab.c" /* yacc.c:1646 */
  4073. break;
  4074. case 397:
  4075. -#line 1153 "parser.y" /* yacc.c:1648 */
  4076. +#line 1151 "parser.y" /* yacc.c:1646 */
  4077. { (yyval.num) = (yyvsp[0].num); }
  4078. -#line 5013 "parser.tab.c" /* yacc.c:1648 */
  4079. +#line 5008 "parser.tab.c" /* yacc.c:1646 */
  4080. break;
  4081. case 402:
  4082. -#line 1166 "parser.y" /* yacc.c:1648 */
  4083. +#line 1164 "parser.y" /* yacc.c:1646 */
  4084. { type_t *type = find_type_or_error((yyvsp[-1].str), 0);
  4085. type->attrs = append_attr_list(type->attrs, (yyvsp[-2].attr_list));
  4086. }
  4087. -#line 5021 "parser.tab.c" /* yacc.c:1648 */
  4088. +#line 5016 "parser.tab.c" /* yacc.c:1646 */
  4089. break;
  4090. case 403:
  4091. -#line 1171 "parser.y" /* yacc.c:1648 */
  4092. +#line 1169 "parser.y" /* yacc.c:1646 */
  4093. { type_t *iface = find_type_or_error2((yyvsp[-3].str), 0);
  4094. if (type_get_type(iface) != TYPE_INTERFACE)
  4095. error_loc("%s is not an interface\n", iface->name);
  4096. iface->attrs = append_attr_list(iface->attrs, (yyvsp[-5].attr_list));
  4097. }
  4098. -#line 5031 "parser.tab.c" /* yacc.c:1648 */
  4099. +#line 5026 "parser.tab.c" /* yacc.c:1646 */
  4100. break;
  4101. case 404:
  4102. -#line 1178 "parser.y" /* yacc.c:1648 */
  4103. +#line 1176 "parser.y" /* yacc.c:1646 */
  4104. { (yyval.attr_list) = NULL; }
  4105. -#line 5037 "parser.tab.c" /* yacc.c:1648 */
  4106. +#line 5032 "parser.tab.c" /* yacc.c:1646 */
  4107. break;
  4108. case 405:
  4109. -#line 1179 "parser.y" /* yacc.c:1648 */
  4110. +#line 1177 "parser.y" /* yacc.c:1646 */
  4111. { (yyval.attr_list) = (yyvsp[-1].attr_list); }
  4112. -#line 5043 "parser.tab.c" /* yacc.c:1648 */
  4113. +#line 5038 "parser.tab.c" /* yacc.c:1646 */
  4114. break;
  4115. case 406:
  4116. -#line 1182 "parser.y" /* yacc.c:1648 */
  4117. +#line 1180 "parser.y" /* yacc.c:1646 */
  4118. { (yyval.attr_list) = append_attr(NULL, (yyvsp[0].attr)); }
  4119. -#line 5049 "parser.tab.c" /* yacc.c:1648 */
  4120. +#line 5044 "parser.tab.c" /* yacc.c:1646 */
  4121. break;
  4122. case 407:
  4123. -#line 1183 "parser.y" /* yacc.c:1648 */
  4124. +#line 1181 "parser.y" /* yacc.c:1646 */
  4125. { (yyval.attr_list) = append_attr((yyvsp[-2].attr_list), (yyvsp[0].attr)); }
  4126. -#line 5055 "parser.tab.c" /* yacc.c:1648 */
  4127. +#line 5050 "parser.tab.c" /* yacc.c:1646 */
  4128. break;
  4129. case 408:
  4130. -#line 1186 "parser.y" /* yacc.c:1648 */
  4131. +#line 1184 "parser.y" /* yacc.c:1646 */
  4132. { (yyval.attr) = make_attr(ATTR_ENCODE); }
  4133. -#line 5061 "parser.tab.c" /* yacc.c:1648 */
  4134. +#line 5056 "parser.tab.c" /* yacc.c:1646 */
  4135. break;
  4136. case 409:
  4137. -#line 1187 "parser.y" /* yacc.c:1648 */
  4138. +#line 1185 "parser.y" /* yacc.c:1646 */
  4139. { (yyval.attr) = make_attr(ATTR_DECODE); }
  4140. -#line 5067 "parser.tab.c" /* yacc.c:1648 */
  4141. +#line 5062 "parser.tab.c" /* yacc.c:1646 */
  4142. break;
  4143. case 410:
  4144. -#line 1188 "parser.y" /* yacc.c:1648 */
  4145. +#line 1186 "parser.y" /* yacc.c:1646 */
  4146. { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); }
  4147. -#line 5073 "parser.tab.c" /* yacc.c:1648 */
  4148. +#line 5068 "parser.tab.c" /* yacc.c:1646 */
  4149. break;
  4150. -#line 5077 "parser.tab.c" /* yacc.c:1648 */
  4151. +#line 5072 "parser.tab.c" /* yacc.c:1646 */
  4152. default: break;
  4153. }
  4154. /* User semantic actions sometimes alter yychar, and that requires
  4155. @@ -5301,7 +5296,7 @@ yyreturn:
  4156. #endif
  4157. return yyresult;
  4158. }
  4159. -#line 1190 "parser.y" /* yacc.c:1907 */
  4160. +#line 1188 "parser.y" /* yacc.c:1906 */
  4161. static void decl_builtin_basic(const char *name, enum type_basic_type type)
  4162. @@ -5312,7 +5307,8 @@ static void decl_builtin_basic(const char *name, enum type_basic_type type)
  4163. static void decl_builtin_alias(const char *name, type_t *t)
  4164. {
  4165. - reg_type(type_new_alias(t, name), name, NULL, 0);
  4166. + decl_spec_t ds;
  4167. + reg_type(type_new_alias(init_declspec(&ds, t), name), name, &global_namespace, 0);
  4168. }
  4169. void init_types(void)
  4170. @@ -5323,7 +5319,7 @@ void init_types(void)
  4171. decl_builtin_basic("double", TYPE_BASIC_DOUBLE);
  4172. decl_builtin_basic("error_status_t", TYPE_BASIC_ERROR_STATUS_T);
  4173. decl_builtin_basic("handle_t", TYPE_BASIC_HANDLE);
  4174. - decl_builtin_alias("boolean", type_new_basic(TYPE_BASIC_BYTE));
  4175. + decl_builtin_alias("boolean", type_new_basic(TYPE_BASIC_CHAR));
  4176. }
  4177. static str_list_t *append_str(str_list_t *list, char *str)
  4178. @@ -5354,6 +5350,7 @@ static attr_list_t *append_attr(attr_list_t *list, attr_t *attr)
  4179. LIST_FOR_EACH_ENTRY(attr_existing, list, attr_t, entry)
  4180. if (attr_existing->type == attr->type)
  4181. {
  4182. + __builtin_trap();
  4183. parser_warning("duplicate attribute %s\n", get_attr_display_name(attr->type));
  4184. /* use the last attribute, like MIDL does */
  4185. list_remove(&attr_existing->entry);
  4186. @@ -5413,53 +5410,73 @@ static attr_list_t *map_attrs(const attr_list_t *list, map_attrs_filter_t filter
  4187. return new_list;
  4188. }
  4189. -static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, attr_t *attr, enum storage_class stgclass)
  4190. +static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, enum storage_class stgclass, enum type_qualifier typequalifier, enum function_specifier funcspecifier)
  4191. {
  4192. decl_spec_t *declspec = left ? left : right;
  4193. if (!declspec)
  4194. {
  4195. declspec = xmalloc(sizeof(*declspec));
  4196. declspec->type = NULL;
  4197. - declspec->attrs = NULL;
  4198. declspec->stgclass = STG_NONE;
  4199. + declspec->typequalifier = TYPE_QUALIFIER_NONE;
  4200. + declspec->funcspecifier = FUNCTION_SPECIFIER_NONE;
  4201. }
  4202. declspec->type = type;
  4203. if (left && declspec != left)
  4204. {
  4205. - declspec->attrs = append_attr_list(declspec->attrs, left->attrs);
  4206. if (declspec->stgclass == STG_NONE)
  4207. declspec->stgclass = left->stgclass;
  4208. else if (left->stgclass != STG_NONE)
  4209. error_loc("only one storage class can be specified\n");
  4210. +
  4211. + if (declspec->typequalifier == TYPE_QUALIFIER_NONE)
  4212. + declspec->typequalifier = left->typequalifier;
  4213. + else if (left->typequalifier != TYPE_QUALIFIER_NONE)
  4214. + error_loc("only one type qualifier can be specified\n");
  4215. +
  4216. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_NONE)
  4217. + declspec->funcspecifier = left->funcspecifier;
  4218. + else if (left->funcspecifier != FUNCTION_SPECIFIER_NONE)
  4219. + error_loc("only one function specifier can be specified\n");
  4220. +
  4221. assert(!left->type);
  4222. free(left);
  4223. }
  4224. if (right && declspec != right)
  4225. {
  4226. - declspec->attrs = append_attr_list(declspec->attrs, right->attrs);
  4227. if (declspec->stgclass == STG_NONE)
  4228. declspec->stgclass = right->stgclass;
  4229. else if (right->stgclass != STG_NONE)
  4230. error_loc("only one storage class can be specified\n");
  4231. +
  4232. + if (declspec->typequalifier == TYPE_QUALIFIER_NONE)
  4233. + declspec->typequalifier = right->typequalifier;
  4234. + else if (right->typequalifier != TYPE_QUALIFIER_NONE)
  4235. + error_loc("only one type qualifier can be specified\n");
  4236. +
  4237. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_NONE)
  4238. + declspec->funcspecifier = right->funcspecifier;
  4239. + else if (right->funcspecifier != FUNCTION_SPECIFIER_NONE)
  4240. + error_loc("only one function specifier can be specified\n");
  4241. +
  4242. assert(!right->type);
  4243. free(right);
  4244. }
  4245. - declspec->attrs = append_attr(declspec->attrs, attr);
  4246. if (declspec->stgclass == STG_NONE)
  4247. declspec->stgclass = stgclass;
  4248. else if (stgclass != STG_NONE)
  4249. error_loc("only one storage class can be specified\n");
  4250. - /* apply attributes to type */
  4251. - if (type && declspec->attrs)
  4252. - {
  4253. - attr_list_t *attrs;
  4254. - declspec->type = duptype(type, 1);
  4255. - attrs = map_attrs(type->attrs, NULL);
  4256. - declspec->type->attrs = append_attr_list(attrs, declspec->attrs);
  4257. - declspec->attrs = NULL;
  4258. - }
  4259. + if (declspec->typequalifier == TYPE_QUALIFIER_NONE)
  4260. + declspec->typequalifier = typequalifier;
  4261. + else if (typequalifier != TYPE_QUALIFIER_NONE)
  4262. + error_loc("only one type qualifier can be specified\n");
  4263. +
  4264. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_NONE)
  4265. + declspec->funcspecifier = funcspecifier;
  4266. + else if (funcspecifier != FUNCTION_SPECIFIER_NONE)
  4267. + error_loc("only one function specifier can be specified\n");
  4268. return declspec;
  4269. }
  4270. @@ -5545,6 +5562,7 @@ void clear_all_offsets(void)
  4271. static void type_function_add_head_arg(type_t *type, var_t *arg)
  4272. {
  4273. + assert(type_get_type_detect_alias(type) == TYPE_FUNCTION);
  4274. if (!type->details.function->args)
  4275. {
  4276. type->details.function->args = xmalloc( sizeof(*type->details.function->args) );
  4277. @@ -5589,31 +5607,60 @@ static int is_allowed_range_type(const type_t *type)
  4278. static type_t *get_array_or_ptr_ref(type_t *type)
  4279. {
  4280. if (is_ptr(type))
  4281. - return type_pointer_get_ref(type);
  4282. + return type_pointer_get_ref_type(type);
  4283. else if (is_array(type))
  4284. - return type_array_get_element(type);
  4285. + return type_array_get_element_type(type);
  4286. return NULL;
  4287. }
  4288. static type_t *append_chain_type(type_t *chain, type_t *type)
  4289. {
  4290. - type_t *chain_type;
  4291. + type_t *chain_type = NULL;
  4292. if (!chain)
  4293. return type;
  4294. for (chain_type = chain; get_array_or_ptr_ref(chain_type); chain_type = get_array_or_ptr_ref(chain_type))
  4295. ;
  4296. + assert(!type_is_alias(chain_type));
  4297. if (is_ptr(chain_type))
  4298. - chain_type->details.pointer.ref = type;
  4299. + chain_type->details.pointer.ref.type = type;
  4300. else if (is_array(chain_type))
  4301. - chain_type->details.array.elem = type;
  4302. + chain_type->details.array.elem.type = type;
  4303. else
  4304. assert(0);
  4305. return chain;
  4306. }
  4307. +static decl_spec_t *append_chain_declspec(decl_spec_t *chain, type_t *type, enum type_qualifier typequalifier)
  4308. +{
  4309. + type_t *chain_type = chain->type;
  4310. + decl_spec_t *chain_declspec = NULL;
  4311. +
  4312. + if (!chain_type)
  4313. + {
  4314. + chain->type = type;
  4315. + chain->typequalifier = typequalifier;
  4316. + return chain;
  4317. + }
  4318. +
  4319. + for(; get_array_or_ptr_ref(chain_type); chain_type = get_array_or_ptr_ref(chain_type))
  4320. + ;
  4321. +
  4322. + if (is_ptr(chain_type))
  4323. + chain_declspec = &chain_type->details.pointer.ref;
  4324. + else if (is_array(chain_type))
  4325. + chain_declspec = &chain_type->details.array.elem;
  4326. + else
  4327. + assert(NULL);
  4328. +
  4329. + chain_declspec->type = type;
  4330. + chain_declspec->typequalifier = typequalifier;
  4331. +
  4332. + return chain;
  4333. +}
  4334. +
  4335. static warning_list_t *append_warning(warning_list_t *list, int num)
  4336. {
  4337. warning_t *entry;
  4338. @@ -5629,7 +5676,7 @@ static warning_list_t *append_warning(warning_list_t *list, int num)
  4339. return list;
  4340. }
  4341. -static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t *decl,
  4342. +static var_t *declare_var(attr_list_t *attrs, decl_spec_t *declspec, const declarator_t *decl,
  4343. int top)
  4344. {
  4345. var_t *v = decl->var;
  4346. @@ -5638,58 +5685,74 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  4347. expr_t *dim;
  4348. type_t **ptype;
  4349. type_t *func_type = decl ? decl->func_type : NULL;
  4350. - type_t *type = decl_spec->type;
  4351. + type_t *type = declspec->type;
  4352. - if (is_attr(type->attrs, ATTR_INLINE))
  4353. - {
  4354. +
  4355. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_INLINE) {
  4356. if (!func_type)
  4357. error_loc("inline attribute applied to non-function type\n");
  4358. else
  4359. {
  4360. - type_t *t;
  4361. - /* move inline attribute from return type node to function node */
  4362. - for (t = func_type; is_ptr(t); t = type_pointer_get_ref(t))
  4363. - ;
  4364. - t->attrs = move_attr(t->attrs, type->attrs, ATTR_INLINE);
  4365. + v->declspec.funcspecifier = declspec->funcspecifier;
  4366. }
  4367. }
  4368. - /* add type onto the end of the pointers in pident->type */
  4369. - v->type = append_chain_type(decl ? decl->type : NULL, type);
  4370. - v->stgclass = decl_spec->stgclass;
  4371. + /* if the var type is a pointerish, we need to move the type qualifier to the pointee's declspec
  4372. + * unless the pointee already has const type qualifier*/
  4373. + if (!decl)
  4374. + {
  4375. + /* simplest case, no pointers to deal with here */
  4376. + v->declspec.typequalifier = declspec->typequalifier;
  4377. + } else if (decl->bits)
  4378. + {
  4379. + /* dealing with a bitfield, generate bitfield and copy over typequalifier*/
  4380. + v->declspec.type = type_new_bitfield(declspec->type, decl->bits);
  4381. + v->declspec.typequalifier = declspec->typequalifier;
  4382. + }
  4383. + else
  4384. + {
  4385. + /* here we're dealing with a pointerish type chain, so we need to pull
  4386. + * the typequalifier off of the declspec and stick them in the type's attr list
  4387. + */
  4388. + v->declspec.type = decl->declspec.type;
  4389. + v->declspec.typequalifier = decl->declspec.typequalifier;
  4390. + append_chain_declspec(&v->declspec, type, declspec->typequalifier);
  4391. + }
  4392. +
  4393. + v->declspec.stgclass = declspec->stgclass;
  4394. v->attrs = attrs;
  4395. /* check for pointer attribute being applied to non-pointer, non-array
  4396. * type */
  4397. - if (!is_array(v->type))
  4398. + if (!is_array(v->declspec.type))
  4399. {
  4400. int ptr_attr = get_attrv(v->attrs, ATTR_POINTERTYPE);
  4401. const type_t *ptr = NULL;
  4402. /* pointer attributes on the left side of the type belong to the function
  4403. * pointer, if one is being declared */
  4404. - type_t **pt = func_type ? &func_type : &v->type;
  4405. + type_t **pt = func_type ? &func_type : &v->declspec.type;
  4406. for (ptr = *pt; ptr && !ptr_attr; )
  4407. {
  4408. ptr_attr = get_attrv(ptr->attrs, ATTR_POINTERTYPE);
  4409. if (!ptr_attr && type_is_alias(ptr))
  4410. - ptr = type_alias_get_aliasee(ptr);
  4411. + ptr = type_alias_get_aliasee_type(ptr);
  4412. else
  4413. break;
  4414. }
  4415. if (is_ptr(ptr))
  4416. {
  4417. if (ptr_attr && ptr_attr != FC_UP &&
  4418. - type_get_type(type_pointer_get_ref(ptr)) == TYPE_INTERFACE)
  4419. + type_get_type(type_pointer_get_ref_type(ptr)) == TYPE_INTERFACE)
  4420. warning_loc_info(&v->loc_info,
  4421. "%s: pointer attribute applied to interface "
  4422. "pointer type has no effect\n", v->name);
  4423. - if (!ptr_attr && top && (*pt)->details.pointer.def_fc != FC_RP)
  4424. + if (!ptr_attr && top && type_pointer_get_default_fc(*pt) != FC_RP)
  4425. {
  4426. /* FIXME: this is a horrible hack to cope with the issue that we
  4427. * store an offset to the typeformat string in the type object, but
  4428. * two typeformat strings may be written depending on whether the
  4429. * pointer is a toplevel parameter or not */
  4430. - *pt = duptype(*pt, 1);
  4431. + *pt = dup_pointer_type(*pt);
  4432. }
  4433. }
  4434. else if (ptr_attr)
  4435. @@ -5700,16 +5763,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  4436. {
  4437. type_t *t = type;
  4438. - if (!is_ptr(v->type) && !is_array(v->type))
  4439. + if (!is_ptr(v->declspec.type) && !is_array(v->declspec.type))
  4440. error_loc("'%s': [string] attribute applied to non-pointer, non-array type\n",
  4441. v->name);
  4442. for (;;)
  4443. {
  4444. if (is_ptr(t))
  4445. - t = type_pointer_get_ref(t);
  4446. + t = type_pointer_get_ref_type(t);
  4447. else if (is_array(t))
  4448. - t = type_array_get_element(t);
  4449. + t = type_array_get_element_type(t);
  4450. else
  4451. break;
  4452. }
  4453. @@ -5726,15 +5789,15 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  4454. if (is_attr(v->attrs, ATTR_V1ENUM))
  4455. {
  4456. - if (type_get_type_detect_alias(v->type) != TYPE_ENUM)
  4457. + if (type_get_type_detect_alias(v->declspec.type) != TYPE_ENUM)
  4458. error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name);
  4459. }
  4460. - if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->type))
  4461. + if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->declspec.type))
  4462. error_loc("'%s': [range] attribute applied to non-integer type\n",
  4463. v->name);
  4464. - ptype = &v->type;
  4465. + ptype = &v->declspec.type;
  4466. if (sizes) LIST_FOR_EACH_ENTRY(dim, sizes, expr_t, entry)
  4467. {
  4468. if (dim->type != EXPR_VOID)
  4469. @@ -5747,7 +5810,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  4470. else
  4471. *ptype = type_new_array((*ptype)->name,
  4472. type_array_get_element(*ptype), FALSE,
  4473. - 0, dim, NULL, 0);
  4474. + 0, dim, NULL, FC_RP);
  4475. }
  4476. else if (is_ptr(*ptype))
  4477. *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE,
  4478. @@ -5756,15 +5819,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  4479. error_loc("%s: size_is attribute applied to illegal type\n", v->name);
  4480. }
  4481. + assert(!type_is_alias(*ptype));
  4482. if (is_ptr(*ptype))
  4483. - ptype = &(*ptype)->details.pointer.ref;
  4484. + ptype = &(*ptype)->details.pointer.ref.type;
  4485. else if (is_array(*ptype))
  4486. - ptype = &(*ptype)->details.array.elem;
  4487. + ptype = &(*ptype)->details.array.elem.type;
  4488. else
  4489. error_loc("%s: too many expressions in size_is attribute\n", v->name);
  4490. }
  4491. - ptype = &v->type;
  4492. + ptype = &v->declspec.type;
  4493. if (lengs) LIST_FOR_EACH_ENTRY(dim, lengs, expr_t, entry)
  4494. {
  4495. if (dim->type != EXPR_VOID)
  4496. @@ -5782,10 +5846,11 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  4497. error_loc("%s: length_is attribute applied to illegal type\n", v->name);
  4498. }
  4499. + assert(!type_is_alias(*ptype));
  4500. if (is_ptr(*ptype))
  4501. - ptype = &(*ptype)->details.pointer.ref;
  4502. + ptype = &(*ptype)->details.pointer.ref.type;
  4503. else if (is_array(*ptype))
  4504. - ptype = &(*ptype)->details.array.elem;
  4505. + ptype = &(*ptype)->details.array.elem.type;
  4506. else
  4507. error_loc("%s: too many expressions in length_is attribute\n", v->name);
  4508. }
  4509. @@ -5796,29 +5861,31 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  4510. if (func_type)
  4511. {
  4512. type_t *ft, *t;
  4513. - type_t *return_type = v->type;
  4514. - v->type = func_type;
  4515. - for (ft = v->type; is_ptr(ft); ft = type_pointer_get_ref(ft))
  4516. + type_t *return_type = v->declspec.type;
  4517. + enum type_qualifier typequalifier = v->declspec.typequalifier;
  4518. +
  4519. + v->declspec.type = func_type;
  4520. + v->declspec.typequalifier = TYPE_QUALIFIER_NONE;
  4521. + for (ft = v->declspec.type; is_ptr(ft); ft = type_pointer_get_ref_type(ft))
  4522. ;
  4523. assert(type_get_type_detect_alias(ft) == TYPE_FUNCTION);
  4524. ft->details.function->retval = make_var(xstrdup("_RetVal"));
  4525. - ft->details.function->retval->type = return_type;
  4526. + ft->details.function->retval->declspec.type = return_type;
  4527. + ft->details.function->retval->declspec.typequalifier = typequalifier;
  4528. +
  4529. /* move calling convention attribute, if present, from pointer nodes to
  4530. * function node */
  4531. - for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t))
  4532. + for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref_type(t))
  4533. ft->attrs = move_attr(ft->attrs, t->attrs, ATTR_CALLCONV);
  4534. }
  4535. else
  4536. {
  4537. type_t *t;
  4538. - for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t))
  4539. + for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref_type(t))
  4540. if (is_attr(t->attrs, ATTR_CALLCONV))
  4541. error_loc("calling convention applied to non-function-pointer type\n");
  4542. }
  4543. - if (decl->bits)
  4544. - v->type = type_new_bitfield(v->type, decl->bits);
  4545. -
  4546. return v;
  4547. }
  4548. @@ -5866,6 +5933,10 @@ var_list_t *append_var(var_list_t *list, var_t *var)
  4549. list_init( list );
  4550. }
  4551. list_add_tail( list, &var->entry );
  4552. +
  4553. + if (var->declspec.type)
  4554. + var->declonly = !type_is_defined(var->declspec.type);
  4555. +
  4556. return list;
  4557. }
  4558. @@ -5885,11 +5956,11 @@ var_t *make_var(char *name)
  4559. {
  4560. var_t *v = xmalloc(sizeof(var_t));
  4561. v->name = name;
  4562. - v->type = NULL;
  4563. + init_declspec(&v->declspec, NULL);
  4564. v->attrs = NULL;
  4565. v->eval = NULL;
  4566. - v->stgclass = STG_NONE;
  4567. init_loc_info(&v->loc_info);
  4568. + v->declonly = TRUE;
  4569. return v;
  4570. }
  4571. @@ -5897,10 +5968,9 @@ static var_t *copy_var(var_t *src, char *name, map_attrs_filter_t attr_filter)
  4572. {
  4573. var_t *v = xmalloc(sizeof(var_t));
  4574. v->name = name;
  4575. - v->type = src->type;
  4576. + v->declspec = src->declspec;
  4577. v->attrs = map_attrs(src->attrs, attr_filter);
  4578. v->eval = src->eval;
  4579. - v->stgclass = src->stgclass;
  4580. v->loc_info = src->loc_info;
  4581. return v;
  4582. }
  4583. @@ -5920,7 +5990,7 @@ static declarator_t *make_declarator(var_t *var)
  4584. {
  4585. declarator_t *d = xmalloc(sizeof(*d));
  4586. d->var = var ? var : make_var(NULL);
  4587. - d->type = NULL;
  4588. + init_declspec(&d->declspec, NULL);
  4589. d->func_type = NULL;
  4590. d->bits = NULL;
  4591. return d;
  4592. @@ -5928,7 +5998,15 @@ static declarator_t *make_declarator(var_t *var)
  4593. static type_t *make_safearray(type_t *type)
  4594. {
  4595. - return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0,
  4596. + decl_spec_t aliasee_ds;
  4597. + decl_spec_t element_ds;
  4598. +
  4599. + init_declspec(&element_ds,
  4600. + type_new_alias(
  4601. + init_declspec(&aliasee_ds, type),
  4602. + "SAFEARRAY"));
  4603. +
  4604. + return type_new_array(NULL, &element_ds, TRUE, 0,
  4605. NULL, NULL, FC_RP);
  4606. }
  4607. @@ -6018,15 +6096,16 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
  4608. nt->t = t;
  4609. nt->next = namespace->type_hash[hash];
  4610. namespace->type_hash[hash] = nt;
  4611. - if ((t == tsSTRUCT || t == tsUNION))
  4612. + if ((t == tsSTRUCT || t == tsUNION || t == tsENUM))
  4613. fix_incomplete_types(type);
  4614. return type;
  4615. }
  4616. static int is_incomplete(const type_t *t)
  4617. {
  4618. - return !t->defined &&
  4619. - (type_get_type_detect_alias(t) == TYPE_STRUCT ||
  4620. + return !type_is_defined(t) &&
  4621. + (type_get_type_detect_alias(t) == TYPE_ENUM ||
  4622. + type_get_type_detect_alias(t) == TYPE_STRUCT ||
  4623. type_get_type_detect_alias(t) == TYPE_UNION ||
  4624. type_get_type_detect_alias(t) == TYPE_ENCAPSULATED_UNION);
  4625. }
  4626. @@ -6034,19 +6113,16 @@ static int is_incomplete(const type_t *t)
  4627. void add_incomplete(type_t *t)
  4628. {
  4629. struct typenode *tn = xmalloc(sizeof *tn);
  4630. + assert(is_incomplete(t));
  4631. tn->type = t;
  4632. list_add_tail(&incomplete_types, &tn->entry);
  4633. }
  4634. static void fix_type(type_t *t)
  4635. {
  4636. - if (type_is_alias(t) && is_incomplete(t)) {
  4637. - type_t *ot = type_alias_get_aliasee(t);
  4638. - fix_type(ot);
  4639. - if (type_get_type_detect_alias(ot) == TYPE_STRUCT ||
  4640. - type_get_type_detect_alias(ot) == TYPE_UNION ||
  4641. - type_get_type_detect_alias(ot) == TYPE_ENCAPSULATED_UNION)
  4642. - t->details.structure = ot->details.structure;
  4643. + if (type_is_alias(t) && is_incomplete(t))
  4644. + {
  4645. + type_t *ot = type_alias_get_aliasee_type(t);
  4646. t->defined = ot->defined;
  4647. }
  4648. }
  4649. @@ -6070,7 +6146,7 @@ static void fix_incomplete_types(type_t *complete_type)
  4650. {
  4651. if (type_is_equal(complete_type, tn->type))
  4652. {
  4653. - tn->type->details.structure = complete_type->details.structure;
  4654. + tn->type->details = complete_type->details;
  4655. list_remove(&tn->entry);
  4656. free(tn);
  4657. }
  4658. @@ -6094,7 +6170,13 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
  4659. type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION)
  4660. {
  4661. if (!type->name)
  4662. + {
  4663. type->name = gen_name();
  4664. + /* the generated name will be used and this typedef excluded from the
  4665. + * built typelib unless the typedef has the 'public' attribute, so add it here */
  4666. + if (do_typelib && !is_attr(attrs, ATTR_PUBLIC))
  4667. + attrs = append_attr(attrs, make_attr(ATTR_PUBLIC));
  4668. + }
  4669. /* replace existing attributes when generating a typelib */
  4670. if (do_typelib)
  4671. @@ -6125,7 +6207,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
  4672. cur->loc_info.line_number);
  4673. name = declare_var(attrs, decl_spec, decl, 0);
  4674. - cur = type_new_alias(name->type, name->name);
  4675. + cur = type_new_alias(&name->declspec, name->name);
  4676. cur->attrs = attrs;
  4677. if (is_incomplete(cur))
  4678. @@ -6293,7 +6375,6 @@ struct allowed_attr allowed_attr[] =
  4679. /* ATTR_CASE */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "case" },
  4680. /* ATTR_CODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" },
  4681. /* ATTR_COMMSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
  4682. - /* ATTR_CONST */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "const" },
  4683. /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
  4684. /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" },
  4685. /* ATTR_DECODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "decode" },
  4686. @@ -6328,7 +6409,6 @@ struct allowed_attr allowed_attr[] =
  4687. /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" },
  4688. /* ATTR_IMPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" },
  4689. /* ATTR_IN */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" },
  4690. - /* ATTR_INLINE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inline" },
  4691. /* ATTR_INPUTSYNC */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" },
  4692. /* ATTR_LENGTHIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, "length_is" },
  4693. /* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "lcid" },
  4694. @@ -6400,10 +6480,10 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
  4695. if (attr->type == ATTR_IMPLICIT_HANDLE)
  4696. {
  4697. const var_t *var = attr->u.pval;
  4698. - if (type_get_type( var->type) == TYPE_BASIC &&
  4699. - type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
  4700. + if (type_get_type( var->declspec.type) == TYPE_BASIC &&
  4701. + type_basic_get_type( var->declspec.type ) == TYPE_BASIC_HANDLE)
  4702. continue;
  4703. - if (is_aliaschain_attr( var->type, ATTR_HANDLE ))
  4704. + if (is_aliaschain_attr( var->declspec.type, ATTR_HANDLE ))
  4705. continue;
  4706. error_loc("attribute %s requires a handle type in interface %s\n",
  4707. allowed_attr[attr->type].display_name, name);
  4708. @@ -6608,7 +6688,7 @@ static int is_ptr_guid_type(const type_t *type)
  4709. /* second, make sure it is a pointer to something of size sizeof(GUID),
  4710. * i.e. 16 bytes */
  4711. - return (type_memsize(type_pointer_get_ref(type)) == 16);
  4712. + return (type_memsize(type_pointer_get_ref_type(type)) == 16);
  4713. }
  4714. static void check_conformance_expr_list(const char *attr_name, const var_t *arg, const type_t *container_type, expr_list_t *expr_list)
  4715. @@ -6635,7 +6715,7 @@ static void check_remoting_fields(const var_t *var, type_t *type);
  4716. static void check_field_common(const type_t *container_type,
  4717. const char *container_name, const var_t *arg)
  4718. {
  4719. - type_t *type = arg->type;
  4720. + type_t *type = arg->declspec.type;
  4721. int more_to_do;
  4722. const char *container_type_name;
  4723. const char *var_type;
  4724. @@ -6665,7 +6745,7 @@ static void check_field_common(const type_t *container_type,
  4725. }
  4726. if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
  4727. - (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->type, ATTR_STRING)))
  4728. + (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->declspec.type, ATTR_STRING)))
  4729. error_loc_info(&arg->loc_info,
  4730. "string and length_is specified for argument %s are mutually exclusive attributes\n",
  4731. arg->name);
  4732. @@ -6762,23 +6842,28 @@ static void check_field_common(const type_t *container_type,
  4733. {
  4734. const type_t *t = type;
  4735. while (is_ptr(t))
  4736. - t = type_pointer_get_ref(t);
  4737. + t = type_pointer_get_ref_type(t);
  4738. if (is_aliaschain_attr(t, ATTR_RANGE))
  4739. warning_loc_info(&arg->loc_info, "%s: range not verified for a string of ranged types\n", arg->name);
  4740. break;
  4741. }
  4742. case TGT_POINTER:
  4743. - type = type_pointer_get_ref(type);
  4744. + type = type_pointer_get_ref_type(type);
  4745. more_to_do = TRUE;
  4746. break;
  4747. case TGT_ARRAY:
  4748. - type = type_array_get_element(type);
  4749. + type = type_array_get_element_type(type);
  4750. more_to_do = TRUE;
  4751. break;
  4752. + case TGT_ENUM:
  4753. + type = type_get_real_type(type);
  4754. + if(!type_is_complete(type))
  4755. + {
  4756. + error_loc_info(&arg->loc_info, "undefined type declaration enum %s\n", type->name);
  4757. + }
  4758. case TGT_USER_TYPE:
  4759. case TGT_IFACE_POINTER:
  4760. case TGT_BASIC:
  4761. - case TGT_ENUM:
  4762. case TGT_RANGE:
  4763. /* nothing to do */
  4764. break;
  4765. @@ -6803,13 +6888,18 @@ static void check_remoting_fields(const var_t *var, type_t *type)
  4766. if (type_is_complete(type))
  4767. fields = type_struct_get_fields(type);
  4768. else
  4769. - error_loc_info(&var->loc_info, "undefined type declaration %s\n", type->name);
  4770. + error_loc_info(&var->loc_info, "undefined type declaration struct %s\n", type->name);
  4771. }
  4772. else if (type_get_type(type) == TYPE_UNION || type_get_type(type) == TYPE_ENCAPSULATED_UNION)
  4773. - fields = type_union_get_cases(type);
  4774. + {
  4775. + if (type_is_complete(type))
  4776. + fields = type_union_get_cases(type);
  4777. + else
  4778. + error_loc_info(&var->loc_info, "undefined type declaration union %s\n", type->name);
  4779. + }
  4780. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  4781. - if (field->type) check_field_common(type, type->name, field);
  4782. + if (field->declspec.type) check_field_common(type, type->name, field);
  4783. }
  4784. /* checks that arguments for a function make sense for marshalling and unmarshalling */
  4785. @@ -6818,9 +6908,10 @@ static void check_remoting_args(const var_t *func)
  4786. const char *funcname = func->name;
  4787. const var_t *arg;
  4788. - if (func->type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->type->details.function->args, const var_t, entry )
  4789. + assert(type_get_type_detect_alias(func->declspec.type) == TYPE_FUNCTION);
  4790. + if (func->declspec.type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->declspec.type->details.function->args, const var_t, entry )
  4791. {
  4792. - const type_t *type = arg->type;
  4793. + const type_t *type = arg->declspec.type;
  4794. /* check that [out] parameters have enough pointer levels */
  4795. if (is_attr(arg->attrs, ATTR_OUT))
  4796. @@ -6860,16 +6951,16 @@ static void check_remoting_args(const var_t *func)
  4797. }
  4798. }
  4799. - check_field_common(func->type, funcname, arg);
  4800. + check_field_common(func->declspec.type, funcname, arg);
  4801. }
  4802. - if (type_get_type(type_function_get_rettype(func->type)) != TYPE_VOID)
  4803. + if (type_get_type(type_function_get_rettype(func->declspec.type)) != TYPE_VOID)
  4804. {
  4805. var_t var;
  4806. var = *func;
  4807. - var.type = type_function_get_rettype(func->type);
  4808. + var.declspec.type = type_function_get_rettype(func->declspec.type);
  4809. var.name = xstrdup("return value");
  4810. - check_field_common(func->type, funcname, &var);
  4811. + check_field_common(func->declspec.type, funcname, &var);
  4812. free(var.name);
  4813. }
  4814. }
  4815. @@ -6886,8 +6977,8 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
  4816. * function */
  4817. var_t *idl_handle = make_var(xstrdup("IDL_handle"));
  4818. idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
  4819. - idl_handle->type = find_type_or_error("handle_t", 0);
  4820. - type_function_add_head_arg(func->type, idl_handle);
  4821. + idl_handle->declspec.type = find_type_or_error("handle_t", 0);
  4822. + type_function_add_head_arg(func->declspec.type, idl_handle);
  4823. }
  4824. }
  4825. @@ -6952,6 +7043,7 @@ static void check_async_uuid(type_t *iface)
  4826. type_t *async_iface;
  4827. type_t *inherit;
  4828. + assert(type_get_type_detect_alias(iface) == TYPE_INTERFACE);
  4829. if (!is_attr(iface->attrs, ATTR_ASYNCUUID)) return;
  4830. inherit = iface->details.iface->inherit;
  4831. @@ -6968,7 +7060,8 @@ static void check_async_uuid(type_t *iface)
  4832. var_t *begin_func, *finish_func, *func = stmt->u.var, *arg;
  4833. var_list_t *begin_args = NULL, *finish_args = NULL, *args;
  4834. - args = func->type->details.function->args;
  4835. + assert(type_get_type_detect_alias(func->declspec.type) == TYPE_FUNCTION);
  4836. + args = func->declspec.type->details.function->args;
  4837. if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
  4838. {
  4839. if (is_attr(arg->attrs, ATTR_IN) || !is_attr(arg->attrs, ATTR_OUT))
  4840. @@ -6978,15 +7071,15 @@ static void check_async_uuid(type_t *iface)
  4841. }
  4842. begin_func = copy_var(func, concat_str("Begin_", func->name), NULL);
  4843. - begin_func->type = type_new_function(begin_args);
  4844. - begin_func->type->attrs = func->attrs;
  4845. - begin_func->type->details.function->retval = func->type->details.function->retval;
  4846. + begin_func->declspec.type = type_new_function(begin_args);
  4847. + begin_func->declspec.type->attrs = func->attrs;
  4848. + begin_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
  4849. stmts = append_statement(stmts, make_statement_declaration(begin_func));
  4850. finish_func = copy_var(func, concat_str("Finish_", func->name), NULL);
  4851. - finish_func->type = type_new_function(finish_args);
  4852. - finish_func->type->attrs = func->attrs;
  4853. - finish_func->type->details.function->retval = func->type->details.function->retval;
  4854. + finish_func->declspec.type = type_new_function(finish_args);
  4855. + finish_func->declspec.type->attrs = func->attrs;
  4856. + finish_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
  4857. stmts = append_statement(stmts, make_statement_declaration(finish_func));
  4858. }
  4859. @@ -7026,6 +7119,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
  4860. static void check_all_user_types(const statement_list_t *stmts)
  4861. {
  4862. const statement_t *stmt;
  4863. + const var_t *v;
  4864. if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
  4865. {
  4866. @@ -7037,7 +7131,11 @@ static void check_all_user_types(const statement_list_t *stmts)
  4867. const statement_t *stmt_func;
  4868. STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) {
  4869. const var_t *func = stmt_func->u.var;
  4870. - check_for_additional_prototype_types(func->type->details.function->args);
  4871. + assert(type_get_type_detect_alias(func->declspec.type) == TYPE_FUNCTION);
  4872. + if (func->declspec.type->details.function->args)
  4873. + LIST_FOR_EACH_ENTRY( v, func->declspec.type->details.function->args, const var_t, entry )
  4874. + check_for_additional_prototype_types(v->declspec.type);
  4875. + check_for_additional_prototype_types(type_function_get_rettype(func->declspec.type));
  4876. }
  4877. }
  4878. }
  4879. @@ -7071,6 +7169,10 @@ static statement_t *make_statement_type_decl(type_t *type)
  4880. {
  4881. statement_t *stmt = make_statement(STMT_TYPE);
  4882. stmt->u.type = type;
  4883. + if (type_is_defined(type))
  4884. + {
  4885. + stmt->declonly = FALSE;
  4886. + }
  4887. return stmt;
  4888. }
  4889. @@ -7085,16 +7187,16 @@ static statement_t *make_statement_declaration(var_t *var)
  4890. {
  4891. statement_t *stmt = make_statement(STMT_DECLARATION);
  4892. stmt->u.var = var;
  4893. - if (var->stgclass == STG_EXTERN && var->eval)
  4894. + if (var->declspec.stgclass == STG_EXTERN && var->eval)
  4895. warning("'%s' initialised and declared extern\n", var->name);
  4896. if (is_const_decl(var))
  4897. {
  4898. if (var->eval)
  4899. reg_const(var);
  4900. }
  4901. - else if (type_get_type(var->type) == TYPE_FUNCTION)
  4902. + else if (type_get_type(var->declspec.type) == TYPE_FUNCTION)
  4903. check_function_attrs(var->name, var->attrs);
  4904. - else if (var->stgclass == STG_NONE || var->stgclass == STG_REGISTER)
  4905. + else if (var->declspec.stgclass == STG_NONE || var->declspec.stgclass == STG_REGISTER)
  4906. error_loc("instantiation of data is illegal\n");
  4907. return stmt;
  4908. }
  4909. @@ -7146,6 +7248,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
  4910. declarator_t *decl, *next;
  4911. statement_t *stmt;
  4912. type_list_t **type_list;
  4913. + int defined = TRUE;
  4914. if (!decls) return NULL;
  4915. @@ -7157,6 +7260,18 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
  4916. {
  4917. var_t *var = decl->var;
  4918. type_t *type = find_type_or_error(var->name, 0);
  4919. +
  4920. + /* ensure that all of the types in this typedef statement have been defined
  4921. + * before setting its declonly flag */
  4922. + if (type_is_pointerish(type))
  4923. + {
  4924. + defined = defined & type_is_defined(type_get_pointer_chain_tail(type));
  4925. + }
  4926. + else
  4927. + {
  4928. + defined = defined & type_is_defined(type_get_real_type(type));
  4929. + }
  4930. +
  4931. *type_list = xmalloc(sizeof(type_list_t));
  4932. (*type_list)->type = type;
  4933. (*type_list)->next = NULL;
  4934. @@ -7166,6 +7281,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
  4935. free(var);
  4936. }
  4937. + stmt->declonly = !defined;
  4938. return stmt;
  4939. }
  4940. @@ -7206,7 +7322,7 @@ void init_loc_info(loc_info_t *i)
  4941. static void check_def(const type_t *t)
  4942. {
  4943. - if (t->defined)
  4944. + if (type_is_defined(t))
  4945. error_loc("%s: redefinition error; original definition was at %s:%d\n",
  4946. t->name, t->loc_info.input_name, t->loc_info.line_number);
  4947. }
  4948. diff --git a/mingw-w64-tools/widl/src/parser.tab.h b/mingw-w64-tools/widl/src/parser.tab.h
  4949. index 09874726..fc7a8f4d 100644
  4950. --- a/mingw-w64-tools/widl/src/parser.tab.h
  4951. +++ b/mingw-w64-tools/widl/src/parser.tab.h
  4952. @@ -1,8 +1,8 @@
  4953. -/* A Bison parser, made by GNU Bison 3.0.5. */
  4954. +/* A Bison parser, made by GNU Bison 3.0.4. */
  4955. /* Bison interface for Yacc-like parsers in C
  4956. - Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
  4957. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
  4958. This program is free software: you can redistribute it and/or modify
  4959. it under the terms of the GNU General Public License as published by
  4960. @@ -239,7 +239,7 @@ extern int parser_debug;
  4961. union YYSTYPE
  4962. {
  4963. -#line 142 "parser.y" /* yacc.c:1910 */
  4964. +#line 136 "parser.y" /* yacc.c:1909 */
  4965. attr_t *attr;
  4966. attr_list_t *attr_list;
  4967. @@ -266,8 +266,10 @@ union YYSTYPE
  4968. struct _import_t *import;
  4969. struct _decl_spec_t *declspec;
  4970. enum storage_class stgclass;
  4971. + enum type_qualifier typequalifier;
  4972. + enum function_specifier funcspecifier;
  4973. -#line 271 "parser.tab.h" /* yacc.c:1910 */
  4974. +#line 273 "parser.tab.h" /* yacc.c:1909 */
  4975. };
  4976. typedef union YYSTYPE YYSTYPE;
  4977. diff --git a/mingw-w64-tools/widl/src/parser.y b/mingw-w64-tools/widl/src/parser.y
  4978. index d9793941..64503ac1 100644
  4979. --- a/mingw-w64-tools/widl/src/parser.y
  4980. +++ b/mingw-w64-tools/widl/src/parser.y
  4981. @@ -52,13 +52,6 @@ struct _import_t
  4982. int import_performed;
  4983. };
  4984. -typedef struct _decl_spec_t
  4985. -{
  4986. - type_t *type;
  4987. - attr_list_t *attrs;
  4988. - enum storage_class stgclass;
  4989. -} decl_spec_t;
  4990. -
  4991. typelist_t incomplete_types = LIST_INIT(incomplete_types);
  4992. static void fix_incomplete(void);
  4993. @@ -67,7 +60,7 @@ static void fix_incomplete_types(type_t *complete_type);
  4994. static str_list_t *append_str(str_list_t *list, char *str);
  4995. static attr_list_t *append_attr(attr_list_t *list, attr_t *attr);
  4996. static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list);
  4997. -static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, attr_t *attr, enum storage_class stgclass);
  4998. +static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, enum storage_class stgclass, enum type_qualifier typequalifier, enum function_specifier funcspecifier);
  4999. static attr_t *make_attr(enum attr_type type);
  5000. static attr_t *make_attrv(enum attr_type type, unsigned int val);
  5001. static attr_t *make_attrp(enum attr_type type, void *val);
  5002. @@ -83,6 +76,7 @@ static declarator_t *make_declarator(var_t *var);
  5003. static type_t *make_safearray(type_t *type);
  5004. static typelib_t *make_library(const char *name, const attr_list_t *attrs);
  5005. static type_t *append_chain_type(type_t *chain, type_t *type);
  5006. +static decl_spec_t *append_chain_declspec(decl_spec_t *chain, type_t *type, enum type_qualifier typequalifier);
  5007. static warning_list_t *append_warning(warning_list_t *, int);
  5008. static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
  5009. @@ -165,6 +159,8 @@ static typelib_t *current_typelib;
  5010. struct _import_t *import;
  5011. struct _decl_spec_t *declspec;
  5012. enum storage_class stgclass;
  5013. + enum type_qualifier typequalifier;
  5014. + enum function_specifier funcspecifier;
  5015. }
  5016. %token <str> aIDENTIFIER aPRAGMA
  5017. @@ -266,14 +262,16 @@ static typelib_t *current_typelib;
  5018. %token tWCHAR tWIREMARSHAL
  5019. %token tAPARTMENT tNEUTRAL tSINGLE tFREE tBOTH
  5020. -%type <attr> attribute type_qualifier function_specifier acf_attribute
  5021. -%type <attr_list> m_attributes attributes attrib_list m_type_qual_list
  5022. +%type <attr> attribute acf_attribute
  5023. +%type <attr_list> m_attributes attributes attrib_list
  5024. %type <attr_list> acf_attributes acf_attribute_list
  5025. %type <str_list> str_list
  5026. %type <expr> m_expr expr expr_const expr_int_const array m_bitfield
  5027. %type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
  5028. %type <ifinfo> interfacehdr
  5029. %type <stgclass> storage_cls_spec
  5030. +%type <typequalifier> type_qualifier m_type_qual_bits
  5031. +%type <funcspecifier> function_specifier
  5032. %type <declspec> decl_spec decl_spec_no_type m_decl_spec_no_type
  5033. %type <type> inherit interface interfacedef interfacedec
  5034. %type <type> dispinterface dispinterfacehdr dispinterfacedef
  5035. @@ -318,7 +316,7 @@ static typelib_t *current_typelib;
  5036. %right '!' '~' CAST PPTR POS NEG ADDRESSOF tSIZEOF
  5037. %left '.' MEMBERPTR '[' ']'
  5038. -%error-verbose
  5039. +%define parse.error verbose
  5040. %%
  5041. @@ -651,10 +649,10 @@ enum_list: enum { if (!$1->eval)
  5042. enum: ident '=' expr_int_const { $$ = reg_const($1);
  5043. $$->eval = $3;
  5044. - $$->type = type_new_int(TYPE_BASIC_INT, 0);
  5045. + $$->declspec.type = type_new_int(TYPE_BASIC_INT, 0);
  5046. }
  5047. | ident { $$ = reg_const($1);
  5048. - $$->type = type_new_int(TYPE_BASIC_INT, 0);
  5049. + $$->declspec.type = type_new_int(TYPE_BASIC_INT, 0);
  5050. }
  5051. ;
  5052. @@ -740,7 +738,7 @@ field: m_attributes decl_spec struct_declarator_list ';'
  5053. $$ = set_var_types($1, $2, $3);
  5054. }
  5055. | m_attributes uniondef ';' { var_t *v = make_var(NULL);
  5056. - v->type = $2; v->attrs = $1;
  5057. + v->declspec.type = $2; v->attrs = $1;
  5058. $$ = append_var(NULL, v);
  5059. }
  5060. ;
  5061. @@ -764,13 +762,13 @@ s_field: m_attributes decl_spec declarator { $$ = declare_var(check_field_attrs
  5062. free($3);
  5063. }
  5064. | m_attributes structdef { var_t *v = make_var(NULL);
  5065. - v->type = $2; v->attrs = $1;
  5066. + v->declspec.type = $2; v->attrs = $1;
  5067. $$ = v;
  5068. }
  5069. ;
  5070. funcdef: declaration { $$ = $1;
  5071. - if (type_get_type($$->type) != TYPE_FUNCTION)
  5072. + if (type_get_type($$->declspec.type) != TYPE_FUNCTION)
  5073. error_loc("only methods may be declared inside the methods section of a dispinterface\n");
  5074. check_function_attrs($$->name, $$->attrs);
  5075. }
  5076. @@ -955,20 +953,20 @@ storage_cls_spec:
  5077. ;
  5078. function_specifier:
  5079. - tINLINE { $$ = make_attr(ATTR_INLINE); }
  5080. + tINLINE { $$ = FUNCTION_SPECIFIER_INLINE; }
  5081. ;
  5082. type_qualifier:
  5083. - tCONST { $$ = make_attr(ATTR_CONST); }
  5084. + tCONST { $$ = TYPE_QUALIFIER_CONST; }
  5085. ;
  5086. -m_type_qual_list: { $$ = NULL; }
  5087. - | m_type_qual_list type_qualifier { $$ = append_attr($1, $2); }
  5088. +m_type_qual_bits: { $$ = TYPE_QUALIFIER_NONE; }
  5089. + | m_type_qual_bits type_qualifier { $$ = $1 | $2; }
  5090. ;
  5091. -decl_spec: type m_decl_spec_no_type { $$ = make_decl_spec($1, $2, NULL, NULL, STG_NONE); }
  5092. +decl_spec: type m_decl_spec_no_type { $$ = make_decl_spec($1, $2, NULL, STG_NONE, TYPE_QUALIFIER_NONE, FUNCTION_SPECIFIER_NONE); }
  5093. | decl_spec_no_type type m_decl_spec_no_type
  5094. - { $$ = make_decl_spec($2, $1, $3, NULL, STG_NONE); }
  5095. + { $$ = make_decl_spec($2, $1, $3, STG_NONE, TYPE_QUALIFIER_NONE, FUNCTION_SPECIFIER_NONE); }
  5096. ;
  5097. m_decl_spec_no_type: { $$ = NULL; }
  5098. @@ -976,44 +974,44 @@ m_decl_spec_no_type: { $$ = NULL; }
  5099. ;
  5100. decl_spec_no_type:
  5101. - type_qualifier m_decl_spec_no_type { $$ = make_decl_spec(NULL, $2, NULL, $1, STG_NONE); }
  5102. - | function_specifier m_decl_spec_no_type { $$ = make_decl_spec(NULL, $2, NULL, $1, STG_NONE); }
  5103. - | storage_cls_spec m_decl_spec_no_type { $$ = make_decl_spec(NULL, $2, NULL, NULL, $1); }
  5104. + type_qualifier m_decl_spec_no_type { $$ = make_decl_spec(NULL, $2, NULL, STG_NONE, $1, FUNCTION_SPECIFIER_NONE); }
  5105. + | function_specifier m_decl_spec_no_type { $$ = make_decl_spec(NULL, $2, NULL, STG_NONE, TYPE_QUALIFIER_NONE, $1); }
  5106. + | storage_cls_spec m_decl_spec_no_type { $$ = make_decl_spec(NULL, $2, NULL, $1, TYPE_QUALIFIER_NONE, FUNCTION_SPECIFIER_NONE); }
  5107. ;
  5108. declarator:
  5109. - '*' m_type_qual_list declarator %prec PPTR
  5110. - { $$ = $3; $$->type = append_chain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
  5111. + '*' m_type_qual_bits declarator %prec PPTR
  5112. + { $$ = $3; append_chain_declspec(&$$->declspec, type_new_pointer(pointer_default, NULL), $2); }
  5113. | callconv declarator { $$ = $2; if ($$->func_type) $$->func_type->attrs = append_attr($$->func_type->attrs, make_attrp(ATTR_CALLCONV, $1));
  5114. - else if ($$->type) $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5115. + else if ($$->declspec.type) $$->declspec.type->attrs = append_attr($$->declspec.type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5116. | direct_declarator
  5117. ;
  5118. direct_declarator:
  5119. ident { $$ = make_declarator($1); }
  5120. | '(' declarator ')' { $$ = $2; }
  5121. - | direct_declarator array { $$ = $1; $$->type = append_array($$->type, $2); }
  5122. + | direct_declarator array { $$ = $1; $$->declspec.type = append_array($$->declspec.type, $2); }
  5123. | direct_declarator '(' m_args ')' { $$ = $1;
  5124. - $$->func_type = append_chain_type($$->type, type_new_function($3));
  5125. - $$->type = NULL;
  5126. + $$->func_type = append_chain_type($$->declspec.type, type_new_function($3));
  5127. + $$->declspec.type = NULL;
  5128. }
  5129. ;
  5130. /* abstract declarator */
  5131. abstract_declarator:
  5132. - '*' m_type_qual_list m_abstract_declarator %prec PPTR
  5133. - { $$ = $3; $$->type = append_chain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
  5134. + '*' m_type_qual_bits m_abstract_declarator %prec PPTR
  5135. + { $$ = $3; append_chain_declspec(&$$->declspec, type_new_pointer(pointer_default, NULL), $2); }
  5136. | callconv m_abstract_declarator { $$ = $2; if ($$->func_type) $$->func_type->attrs = append_attr($$->func_type->attrs, make_attrp(ATTR_CALLCONV, $1));
  5137. - else if ($$->type) $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5138. + else if ($$->declspec.type) $$->declspec.type->attrs = append_attr($$->declspec.type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5139. | abstract_direct_declarator
  5140. ;
  5141. /* abstract declarator without accepting direct declarator */
  5142. abstract_declarator_no_direct:
  5143. - '*' m_type_qual_list m_any_declarator %prec PPTR
  5144. - { $$ = $3; $$->type = append_chain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
  5145. + '*' m_type_qual_bits m_any_declarator %prec PPTR
  5146. + { $$ = $3; append_chain_declspec(&$$->declspec, type_new_pointer(pointer_default, NULL), $2); }
  5147. | callconv m_any_declarator { $$ = $2; if ($$->func_type) $$->func_type->attrs = append_attr($$->func_type->attrs, make_attrp(ATTR_CALLCONV, $1));
  5148. - else if ($$->type) $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5149. + else if ($$->declspec.type) $$->declspec.type->attrs = append_attr($$->declspec.type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5150. ;
  5151. /* abstract declarator or empty */
  5152. @@ -1024,33 +1022,33 @@ m_abstract_declarator: { $$ = make_declarator(NULL); }
  5153. /* abstract direct declarator */
  5154. abstract_direct_declarator:
  5155. '(' abstract_declarator_no_direct ')' { $$ = $2; }
  5156. - | abstract_direct_declarator array { $$ = $1; $$->type = append_array($$->type, $2); }
  5157. - | array { $$ = make_declarator(NULL); $$->type = append_array($$->type, $1); }
  5158. + | abstract_direct_declarator array { $$ = $1; $$->declspec.type = append_array($$->declspec.type, $2); }
  5159. + | array { $$ = make_declarator(NULL); $$->declspec.type = append_array($$->declspec.type, $1); }
  5160. | '(' m_args ')'
  5161. { $$ = make_declarator(NULL);
  5162. - $$->func_type = append_chain_type($$->type, type_new_function($2));
  5163. - $$->type = NULL;
  5164. + $$->func_type = append_chain_type($$->declspec.type, type_new_function($2));
  5165. + $$->declspec.type = NULL;
  5166. }
  5167. | abstract_direct_declarator '(' m_args ')'
  5168. { $$ = $1;
  5169. - $$->func_type = append_chain_type($$->type, type_new_function($3));
  5170. - $$->type = NULL;
  5171. + $$->func_type = append_chain_type($$->declspec.type, type_new_function($3));
  5172. + $$->declspec.type = NULL;
  5173. }
  5174. ;
  5175. /* abstract or non-abstract declarator */
  5176. any_declarator:
  5177. - '*' m_type_qual_list m_any_declarator %prec PPTR
  5178. - { $$ = $3; $$->type = append_chain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
  5179. - | callconv m_any_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5180. + '*' m_type_qual_bits m_any_declarator %prec PPTR
  5181. + { $$ = $3; append_chain_declspec(&$$->declspec, type_new_pointer(pointer_default, NULL), $2); }
  5182. + | callconv m_any_declarator { $$ = $2; $$->declspec.type->attrs = append_attr($$->declspec.type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5183. | any_direct_declarator
  5184. ;
  5185. /* abstract or non-abstract declarator without accepting direct declarator */
  5186. any_declarator_no_direct:
  5187. - '*' m_type_qual_list m_any_declarator %prec PPTR
  5188. - { $$ = $3; $$->type = append_chain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
  5189. - | callconv m_any_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5190. + '*' m_type_qual_bits m_any_declarator %prec PPTR
  5191. + { $$ = $3; append_chain_declspec(&$$->declspec, type_new_pointer(pointer_default, NULL), $2); }
  5192. + | callconv m_any_declarator { $$ = $2; $$->declspec.type->attrs = append_attr($$->declspec.type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
  5193. ;
  5194. /* abstract or non-abstract declarator or empty */
  5195. @@ -1064,17 +1062,17 @@ m_any_declarator: { $$ = make_declarator(NULL); }
  5196. any_direct_declarator:
  5197. ident { $$ = make_declarator($1); }
  5198. | '(' any_declarator_no_direct ')' { $$ = $2; }
  5199. - | any_direct_declarator array { $$ = $1; $$->type = append_array($$->type, $2); }
  5200. - | array { $$ = make_declarator(NULL); $$->type = append_array($$->type, $1); }
  5201. + | any_direct_declarator array { $$ = $1; $$->declspec.type = append_array($$->declspec.type, $2); }
  5202. + | array { $$ = make_declarator(NULL); $$->declspec.type = append_array($$->declspec.type, $1); }
  5203. | '(' m_args ')'
  5204. { $$ = make_declarator(NULL);
  5205. - $$->func_type = append_chain_type($$->type, type_new_function($2));
  5206. - $$->type = NULL;
  5207. + $$->func_type = append_chain_type($$->declspec.type, type_new_function($2));
  5208. + $$->declspec.type = NULL;
  5209. }
  5210. | any_direct_declarator '(' m_args ')'
  5211. { $$ = $1;
  5212. - $$->func_type = append_chain_type($$->type, type_new_function($3));
  5213. - $$->type = NULL;
  5214. + $$->func_type = append_chain_type($$->declspec.type, type_new_function($3));
  5215. + $$->declspec.type = NULL;
  5216. }
  5217. ;
  5218. @@ -1197,7 +1195,8 @@ static void decl_builtin_basic(const char *name, enum type_basic_type type)
  5219. static void decl_builtin_alias(const char *name, type_t *t)
  5220. {
  5221. - reg_type(type_new_alias(t, name), name, NULL, 0);
  5222. + decl_spec_t ds;
  5223. + reg_type(type_new_alias(init_declspec(&ds, t), name), name, &global_namespace, 0);
  5224. }
  5225. void init_types(void)
  5226. @@ -1208,7 +1207,7 @@ void init_types(void)
  5227. decl_builtin_basic("double", TYPE_BASIC_DOUBLE);
  5228. decl_builtin_basic("error_status_t", TYPE_BASIC_ERROR_STATUS_T);
  5229. decl_builtin_basic("handle_t", TYPE_BASIC_HANDLE);
  5230. - decl_builtin_alias("boolean", type_new_basic(TYPE_BASIC_BYTE));
  5231. + decl_builtin_alias("boolean", type_new_basic(TYPE_BASIC_CHAR));
  5232. }
  5233. static str_list_t *append_str(str_list_t *list, char *str)
  5234. @@ -1239,6 +1238,7 @@ static attr_list_t *append_attr(attr_list_t *list, attr_t *attr)
  5235. LIST_FOR_EACH_ENTRY(attr_existing, list, attr_t, entry)
  5236. if (attr_existing->type == attr->type)
  5237. {
  5238. + __builtin_trap();
  5239. parser_warning("duplicate attribute %s\n", get_attr_display_name(attr->type));
  5240. /* use the last attribute, like MIDL does */
  5241. list_remove(&attr_existing->entry);
  5242. @@ -1298,53 +1298,73 @@ static attr_list_t *map_attrs(const attr_list_t *list, map_attrs_filter_t filter
  5243. return new_list;
  5244. }
  5245. -static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, attr_t *attr, enum storage_class stgclass)
  5246. +static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, enum storage_class stgclass, enum type_qualifier typequalifier, enum function_specifier funcspecifier)
  5247. {
  5248. decl_spec_t *declspec = left ? left : right;
  5249. if (!declspec)
  5250. {
  5251. declspec = xmalloc(sizeof(*declspec));
  5252. declspec->type = NULL;
  5253. - declspec->attrs = NULL;
  5254. declspec->stgclass = STG_NONE;
  5255. + declspec->typequalifier = TYPE_QUALIFIER_NONE;
  5256. + declspec->funcspecifier = FUNCTION_SPECIFIER_NONE;
  5257. }
  5258. declspec->type = type;
  5259. if (left && declspec != left)
  5260. {
  5261. - declspec->attrs = append_attr_list(declspec->attrs, left->attrs);
  5262. if (declspec->stgclass == STG_NONE)
  5263. declspec->stgclass = left->stgclass;
  5264. else if (left->stgclass != STG_NONE)
  5265. error_loc("only one storage class can be specified\n");
  5266. +
  5267. + if (declspec->typequalifier == TYPE_QUALIFIER_NONE)
  5268. + declspec->typequalifier = left->typequalifier;
  5269. + else if (left->typequalifier != TYPE_QUALIFIER_NONE)
  5270. + error_loc("only one type qualifier can be specified\n");
  5271. +
  5272. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_NONE)
  5273. + declspec->funcspecifier = left->funcspecifier;
  5274. + else if (left->funcspecifier != FUNCTION_SPECIFIER_NONE)
  5275. + error_loc("only one function specifier can be specified\n");
  5276. +
  5277. assert(!left->type);
  5278. free(left);
  5279. }
  5280. if (right && declspec != right)
  5281. {
  5282. - declspec->attrs = append_attr_list(declspec->attrs, right->attrs);
  5283. if (declspec->stgclass == STG_NONE)
  5284. declspec->stgclass = right->stgclass;
  5285. else if (right->stgclass != STG_NONE)
  5286. error_loc("only one storage class can be specified\n");
  5287. +
  5288. + if (declspec->typequalifier == TYPE_QUALIFIER_NONE)
  5289. + declspec->typequalifier = right->typequalifier;
  5290. + else if (right->typequalifier != TYPE_QUALIFIER_NONE)
  5291. + error_loc("only one type qualifier can be specified\n");
  5292. +
  5293. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_NONE)
  5294. + declspec->funcspecifier = right->funcspecifier;
  5295. + else if (right->funcspecifier != FUNCTION_SPECIFIER_NONE)
  5296. + error_loc("only one function specifier can be specified\n");
  5297. +
  5298. assert(!right->type);
  5299. free(right);
  5300. }
  5301. - declspec->attrs = append_attr(declspec->attrs, attr);
  5302. if (declspec->stgclass == STG_NONE)
  5303. declspec->stgclass = stgclass;
  5304. else if (stgclass != STG_NONE)
  5305. error_loc("only one storage class can be specified\n");
  5306. - /* apply attributes to type */
  5307. - if (type && declspec->attrs)
  5308. - {
  5309. - attr_list_t *attrs;
  5310. - declspec->type = duptype(type, 1);
  5311. - attrs = map_attrs(type->attrs, NULL);
  5312. - declspec->type->attrs = append_attr_list(attrs, declspec->attrs);
  5313. - declspec->attrs = NULL;
  5314. - }
  5315. + if (declspec->typequalifier == TYPE_QUALIFIER_NONE)
  5316. + declspec->typequalifier = typequalifier;
  5317. + else if (typequalifier != TYPE_QUALIFIER_NONE)
  5318. + error_loc("only one type qualifier can be specified\n");
  5319. +
  5320. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_NONE)
  5321. + declspec->funcspecifier = funcspecifier;
  5322. + else if (funcspecifier != FUNCTION_SPECIFIER_NONE)
  5323. + error_loc("only one function specifier can be specified\n");
  5324. return declspec;
  5325. }
  5326. @@ -1430,6 +1450,7 @@ void clear_all_offsets(void)
  5327. static void type_function_add_head_arg(type_t *type, var_t *arg)
  5328. {
  5329. + assert(type_get_type_detect_alias(type) == TYPE_FUNCTION);
  5330. if (!type->details.function->args)
  5331. {
  5332. type->details.function->args = xmalloc( sizeof(*type->details.function->args) );
  5333. @@ -1474,31 +1495,60 @@ static int is_allowed_range_type(const type_t *type)
  5334. static type_t *get_array_or_ptr_ref(type_t *type)
  5335. {
  5336. if (is_ptr(type))
  5337. - return type_pointer_get_ref(type);
  5338. + return type_pointer_get_ref_type(type);
  5339. else if (is_array(type))
  5340. - return type_array_get_element(type);
  5341. + return type_array_get_element_type(type);
  5342. return NULL;
  5343. }
  5344. static type_t *append_chain_type(type_t *chain, type_t *type)
  5345. {
  5346. - type_t *chain_type;
  5347. + type_t *chain_type = NULL;
  5348. if (!chain)
  5349. return type;
  5350. for (chain_type = chain; get_array_or_ptr_ref(chain_type); chain_type = get_array_or_ptr_ref(chain_type))
  5351. ;
  5352. + assert(!type_is_alias(chain_type));
  5353. if (is_ptr(chain_type))
  5354. - chain_type->details.pointer.ref = type;
  5355. + chain_type->details.pointer.ref.type = type;
  5356. else if (is_array(chain_type))
  5357. - chain_type->details.array.elem = type;
  5358. + chain_type->details.array.elem.type = type;
  5359. else
  5360. assert(0);
  5361. return chain;
  5362. }
  5363. +static decl_spec_t *append_chain_declspec(decl_spec_t *chain, type_t *type, enum type_qualifier typequalifier)
  5364. +{
  5365. + type_t *chain_type = chain->type;
  5366. + decl_spec_t *chain_declspec = NULL;
  5367. +
  5368. + if (!chain_type)
  5369. + {
  5370. + chain->type = type;
  5371. + chain->typequalifier = typequalifier;
  5372. + return chain;
  5373. + }
  5374. +
  5375. + for(; get_array_or_ptr_ref(chain_type); chain_type = get_array_or_ptr_ref(chain_type))
  5376. + ;
  5377. +
  5378. + if (is_ptr(chain_type))
  5379. + chain_declspec = &chain_type->details.pointer.ref;
  5380. + else if (is_array(chain_type))
  5381. + chain_declspec = &chain_type->details.array.elem;
  5382. + else
  5383. + assert(NULL);
  5384. +
  5385. + chain_declspec->type = type;
  5386. + chain_declspec->typequalifier = typequalifier;
  5387. +
  5388. + return chain;
  5389. +}
  5390. +
  5391. static warning_list_t *append_warning(warning_list_t *list, int num)
  5392. {
  5393. warning_t *entry;
  5394. @@ -1514,7 +1564,7 @@ static warning_list_t *append_warning(warning_list_t *list, int num)
  5395. return list;
  5396. }
  5397. -static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t *decl,
  5398. +static var_t *declare_var(attr_list_t *attrs, decl_spec_t *declspec, const declarator_t *decl,
  5399. int top)
  5400. {
  5401. var_t *v = decl->var;
  5402. @@ -1523,58 +1573,74 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  5403. expr_t *dim;
  5404. type_t **ptype;
  5405. type_t *func_type = decl ? decl->func_type : NULL;
  5406. - type_t *type = decl_spec->type;
  5407. + type_t *type = declspec->type;
  5408. - if (is_attr(type->attrs, ATTR_INLINE))
  5409. - {
  5410. +
  5411. + if (declspec->funcspecifier == FUNCTION_SPECIFIER_INLINE) {
  5412. if (!func_type)
  5413. error_loc("inline attribute applied to non-function type\n");
  5414. else
  5415. {
  5416. - type_t *t;
  5417. - /* move inline attribute from return type node to function node */
  5418. - for (t = func_type; is_ptr(t); t = type_pointer_get_ref(t))
  5419. - ;
  5420. - t->attrs = move_attr(t->attrs, type->attrs, ATTR_INLINE);
  5421. + v->declspec.funcspecifier = declspec->funcspecifier;
  5422. }
  5423. }
  5424. - /* add type onto the end of the pointers in pident->type */
  5425. - v->type = append_chain_type(decl ? decl->type : NULL, type);
  5426. - v->stgclass = decl_spec->stgclass;
  5427. + /* if the var type is a pointerish, we need to move the type qualifier to the pointee's declspec
  5428. + * unless the pointee already has const type qualifier*/
  5429. + if (!decl)
  5430. + {
  5431. + /* simplest case, no pointers to deal with here */
  5432. + v->declspec.typequalifier = declspec->typequalifier;
  5433. + } else if (decl->bits)
  5434. + {
  5435. + /* dealing with a bitfield, generate bitfield and copy over typequalifier*/
  5436. + v->declspec.type = type_new_bitfield(declspec->type, decl->bits);
  5437. + v->declspec.typequalifier = declspec->typequalifier;
  5438. + }
  5439. + else
  5440. + {
  5441. + /* here we're dealing with a pointerish type chain, so we need to pull
  5442. + * the typequalifier off of the declspec and stick them in the type's attr list
  5443. + */
  5444. + v->declspec.type = decl->declspec.type;
  5445. + v->declspec.typequalifier = decl->declspec.typequalifier;
  5446. + append_chain_declspec(&v->declspec, type, declspec->typequalifier);
  5447. + }
  5448. +
  5449. + v->declspec.stgclass = declspec->stgclass;
  5450. v->attrs = attrs;
  5451. /* check for pointer attribute being applied to non-pointer, non-array
  5452. * type */
  5453. - if (!is_array(v->type))
  5454. + if (!is_array(v->declspec.type))
  5455. {
  5456. int ptr_attr = get_attrv(v->attrs, ATTR_POINTERTYPE);
  5457. const type_t *ptr = NULL;
  5458. /* pointer attributes on the left side of the type belong to the function
  5459. * pointer, if one is being declared */
  5460. - type_t **pt = func_type ? &func_type : &v->type;
  5461. + type_t **pt = func_type ? &func_type : &v->declspec.type;
  5462. for (ptr = *pt; ptr && !ptr_attr; )
  5463. {
  5464. ptr_attr = get_attrv(ptr->attrs, ATTR_POINTERTYPE);
  5465. if (!ptr_attr && type_is_alias(ptr))
  5466. - ptr = type_alias_get_aliasee(ptr);
  5467. + ptr = type_alias_get_aliasee_type(ptr);
  5468. else
  5469. break;
  5470. }
  5471. if (is_ptr(ptr))
  5472. {
  5473. if (ptr_attr && ptr_attr != FC_UP &&
  5474. - type_get_type(type_pointer_get_ref(ptr)) == TYPE_INTERFACE)
  5475. + type_get_type(type_pointer_get_ref_type(ptr)) == TYPE_INTERFACE)
  5476. warning_loc_info(&v->loc_info,
  5477. "%s: pointer attribute applied to interface "
  5478. "pointer type has no effect\n", v->name);
  5479. - if (!ptr_attr && top && (*pt)->details.pointer.def_fc != FC_RP)
  5480. + if (!ptr_attr && top && type_pointer_get_default_fc(*pt) != FC_RP)
  5481. {
  5482. /* FIXME: this is a horrible hack to cope with the issue that we
  5483. * store an offset to the typeformat string in the type object, but
  5484. * two typeformat strings may be written depending on whether the
  5485. * pointer is a toplevel parameter or not */
  5486. - *pt = duptype(*pt, 1);
  5487. + *pt = dup_pointer_type(*pt);
  5488. }
  5489. }
  5490. else if (ptr_attr)
  5491. @@ -1585,16 +1651,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  5492. {
  5493. type_t *t = type;
  5494. - if (!is_ptr(v->type) && !is_array(v->type))
  5495. + if (!is_ptr(v->declspec.type) && !is_array(v->declspec.type))
  5496. error_loc("'%s': [string] attribute applied to non-pointer, non-array type\n",
  5497. v->name);
  5498. for (;;)
  5499. {
  5500. if (is_ptr(t))
  5501. - t = type_pointer_get_ref(t);
  5502. + t = type_pointer_get_ref_type(t);
  5503. else if (is_array(t))
  5504. - t = type_array_get_element(t);
  5505. + t = type_array_get_element_type(t);
  5506. else
  5507. break;
  5508. }
  5509. @@ -1611,15 +1677,15 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  5510. if (is_attr(v->attrs, ATTR_V1ENUM))
  5511. {
  5512. - if (type_get_type_detect_alias(v->type) != TYPE_ENUM)
  5513. + if (type_get_type_detect_alias(v->declspec.type) != TYPE_ENUM)
  5514. error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name);
  5515. }
  5516. - if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->type))
  5517. + if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->declspec.type))
  5518. error_loc("'%s': [range] attribute applied to non-integer type\n",
  5519. v->name);
  5520. - ptype = &v->type;
  5521. + ptype = &v->declspec.type;
  5522. if (sizes) LIST_FOR_EACH_ENTRY(dim, sizes, expr_t, entry)
  5523. {
  5524. if (dim->type != EXPR_VOID)
  5525. @@ -1632,7 +1698,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  5526. else
  5527. *ptype = type_new_array((*ptype)->name,
  5528. type_array_get_element(*ptype), FALSE,
  5529. - 0, dim, NULL, 0);
  5530. + 0, dim, NULL, FC_RP);
  5531. }
  5532. else if (is_ptr(*ptype))
  5533. *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE,
  5534. @@ -1641,15 +1707,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  5535. error_loc("%s: size_is attribute applied to illegal type\n", v->name);
  5536. }
  5537. + assert(!type_is_alias(*ptype));
  5538. if (is_ptr(*ptype))
  5539. - ptype = &(*ptype)->details.pointer.ref;
  5540. + ptype = &(*ptype)->details.pointer.ref.type;
  5541. else if (is_array(*ptype))
  5542. - ptype = &(*ptype)->details.array.elem;
  5543. + ptype = &(*ptype)->details.array.elem.type;
  5544. else
  5545. error_loc("%s: too many expressions in size_is attribute\n", v->name);
  5546. }
  5547. - ptype = &v->type;
  5548. + ptype = &v->declspec.type;
  5549. if (lengs) LIST_FOR_EACH_ENTRY(dim, lengs, expr_t, entry)
  5550. {
  5551. if (dim->type != EXPR_VOID)
  5552. @@ -1667,10 +1734,11 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  5553. error_loc("%s: length_is attribute applied to illegal type\n", v->name);
  5554. }
  5555. + assert(!type_is_alias(*ptype));
  5556. if (is_ptr(*ptype))
  5557. - ptype = &(*ptype)->details.pointer.ref;
  5558. + ptype = &(*ptype)->details.pointer.ref.type;
  5559. else if (is_array(*ptype))
  5560. - ptype = &(*ptype)->details.array.elem;
  5561. + ptype = &(*ptype)->details.array.elem.type;
  5562. else
  5563. error_loc("%s: too many expressions in length_is attribute\n", v->name);
  5564. }
  5565. @@ -1681,29 +1749,31 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
  5566. if (func_type)
  5567. {
  5568. type_t *ft, *t;
  5569. - type_t *return_type = v->type;
  5570. - v->type = func_type;
  5571. - for (ft = v->type; is_ptr(ft); ft = type_pointer_get_ref(ft))
  5572. + type_t *return_type = v->declspec.type;
  5573. + enum type_qualifier typequalifier = v->declspec.typequalifier;
  5574. +
  5575. + v->declspec.type = func_type;
  5576. + v->declspec.typequalifier = TYPE_QUALIFIER_NONE;
  5577. + for (ft = v->declspec.type; is_ptr(ft); ft = type_pointer_get_ref_type(ft))
  5578. ;
  5579. assert(type_get_type_detect_alias(ft) == TYPE_FUNCTION);
  5580. ft->details.function->retval = make_var(xstrdup("_RetVal"));
  5581. - ft->details.function->retval->type = return_type;
  5582. + ft->details.function->retval->declspec.type = return_type;
  5583. + ft->details.function->retval->declspec.typequalifier = typequalifier;
  5584. +
  5585. /* move calling convention attribute, if present, from pointer nodes to
  5586. * function node */
  5587. - for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t))
  5588. + for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref_type(t))
  5589. ft->attrs = move_attr(ft->attrs, t->attrs, ATTR_CALLCONV);
  5590. }
  5591. else
  5592. {
  5593. type_t *t;
  5594. - for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t))
  5595. + for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref_type(t))
  5596. if (is_attr(t->attrs, ATTR_CALLCONV))
  5597. error_loc("calling convention applied to non-function-pointer type\n");
  5598. }
  5599. - if (decl->bits)
  5600. - v->type = type_new_bitfield(v->type, decl->bits);
  5601. -
  5602. return v;
  5603. }
  5604. @@ -1751,6 +1821,10 @@ var_list_t *append_var(var_list_t *list, var_t *var)
  5605. list_init( list );
  5606. }
  5607. list_add_tail( list, &var->entry );
  5608. +
  5609. + if (var->declspec.type)
  5610. + var->declonly = !type_is_defined(var->declspec.type);
  5611. +
  5612. return list;
  5613. }
  5614. @@ -1770,11 +1844,11 @@ var_t *make_var(char *name)
  5615. {
  5616. var_t *v = xmalloc(sizeof(var_t));
  5617. v->name = name;
  5618. - v->type = NULL;
  5619. + init_declspec(&v->declspec, NULL);
  5620. v->attrs = NULL;
  5621. v->eval = NULL;
  5622. - v->stgclass = STG_NONE;
  5623. init_loc_info(&v->loc_info);
  5624. + v->declonly = TRUE;
  5625. return v;
  5626. }
  5627. @@ -1782,10 +1856,9 @@ static var_t *copy_var(var_t *src, char *name, map_attrs_filter_t attr_filter)
  5628. {
  5629. var_t *v = xmalloc(sizeof(var_t));
  5630. v->name = name;
  5631. - v->type = src->type;
  5632. + v->declspec = src->declspec;
  5633. v->attrs = map_attrs(src->attrs, attr_filter);
  5634. v->eval = src->eval;
  5635. - v->stgclass = src->stgclass;
  5636. v->loc_info = src->loc_info;
  5637. return v;
  5638. }
  5639. @@ -1805,7 +1878,7 @@ static declarator_t *make_declarator(var_t *var)
  5640. {
  5641. declarator_t *d = xmalloc(sizeof(*d));
  5642. d->var = var ? var : make_var(NULL);
  5643. - d->type = NULL;
  5644. + init_declspec(&d->declspec, NULL);
  5645. d->func_type = NULL;
  5646. d->bits = NULL;
  5647. return d;
  5648. @@ -1813,7 +1886,15 @@ static declarator_t *make_declarator(var_t *var)
  5649. static type_t *make_safearray(type_t *type)
  5650. {
  5651. - return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0,
  5652. + decl_spec_t aliasee_ds;
  5653. + decl_spec_t element_ds;
  5654. +
  5655. + init_declspec(&element_ds,
  5656. + type_new_alias(
  5657. + init_declspec(&aliasee_ds, type),
  5658. + "SAFEARRAY"));
  5659. +
  5660. + return type_new_array(NULL, &element_ds, TRUE, 0,
  5661. NULL, NULL, FC_RP);
  5662. }
  5663. @@ -1903,15 +1984,16 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
  5664. nt->t = t;
  5665. nt->next = namespace->type_hash[hash];
  5666. namespace->type_hash[hash] = nt;
  5667. - if ((t == tsSTRUCT || t == tsUNION))
  5668. + if ((t == tsSTRUCT || t == tsUNION || t == tsENUM))
  5669. fix_incomplete_types(type);
  5670. return type;
  5671. }
  5672. static int is_incomplete(const type_t *t)
  5673. {
  5674. - return !t->defined &&
  5675. - (type_get_type_detect_alias(t) == TYPE_STRUCT ||
  5676. + return !type_is_defined(t) &&
  5677. + (type_get_type_detect_alias(t) == TYPE_ENUM ||
  5678. + type_get_type_detect_alias(t) == TYPE_STRUCT ||
  5679. type_get_type_detect_alias(t) == TYPE_UNION ||
  5680. type_get_type_detect_alias(t) == TYPE_ENCAPSULATED_UNION);
  5681. }
  5682. @@ -1919,19 +2001,16 @@ static int is_incomplete(const type_t *t)
  5683. void add_incomplete(type_t *t)
  5684. {
  5685. struct typenode *tn = xmalloc(sizeof *tn);
  5686. + assert(is_incomplete(t));
  5687. tn->type = t;
  5688. list_add_tail(&incomplete_types, &tn->entry);
  5689. }
  5690. static void fix_type(type_t *t)
  5691. {
  5692. - if (type_is_alias(t) && is_incomplete(t)) {
  5693. - type_t *ot = type_alias_get_aliasee(t);
  5694. - fix_type(ot);
  5695. - if (type_get_type_detect_alias(ot) == TYPE_STRUCT ||
  5696. - type_get_type_detect_alias(ot) == TYPE_UNION ||
  5697. - type_get_type_detect_alias(ot) == TYPE_ENCAPSULATED_UNION)
  5698. - t->details.structure = ot->details.structure;
  5699. + if (type_is_alias(t) && is_incomplete(t))
  5700. + {
  5701. + type_t *ot = type_alias_get_aliasee_type(t);
  5702. t->defined = ot->defined;
  5703. }
  5704. }
  5705. @@ -1955,7 +2034,7 @@ static void fix_incomplete_types(type_t *complete_type)
  5706. {
  5707. if (type_is_equal(complete_type, tn->type))
  5708. {
  5709. - tn->type->details.structure = complete_type->details.structure;
  5710. + tn->type->details = complete_type->details;
  5711. list_remove(&tn->entry);
  5712. free(tn);
  5713. }
  5714. @@ -1979,7 +2058,13 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
  5715. type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION)
  5716. {
  5717. if (!type->name)
  5718. + {
  5719. type->name = gen_name();
  5720. + /* the generated name will be used and this typedef excluded from the
  5721. + * built typelib unless the typedef has the 'public' attribute, so add it here */
  5722. + if (do_typelib && !is_attr(attrs, ATTR_PUBLIC))
  5723. + attrs = append_attr(attrs, make_attr(ATTR_PUBLIC));
  5724. + }
  5725. /* replace existing attributes when generating a typelib */
  5726. if (do_typelib)
  5727. @@ -2010,7 +2095,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
  5728. cur->loc_info.line_number);
  5729. name = declare_var(attrs, decl_spec, decl, 0);
  5730. - cur = type_new_alias(name->type, name->name);
  5731. + cur = type_new_alias(&name->declspec, name->name);
  5732. cur->attrs = attrs;
  5733. if (is_incomplete(cur))
  5734. @@ -2178,7 +2263,6 @@ struct allowed_attr allowed_attr[] =
  5735. /* ATTR_CASE */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "case" },
  5736. /* ATTR_CODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" },
  5737. /* ATTR_COMMSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
  5738. - /* ATTR_CONST */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "const" },
  5739. /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
  5740. /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" },
  5741. /* ATTR_DECODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "decode" },
  5742. @@ -2213,7 +2297,6 @@ struct allowed_attr allowed_attr[] =
  5743. /* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" },
  5744. /* ATTR_IMPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" },
  5745. /* ATTR_IN */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" },
  5746. - /* ATTR_INLINE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inline" },
  5747. /* ATTR_INPUTSYNC */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" },
  5748. /* ATTR_LENGTHIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, "length_is" },
  5749. /* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "lcid" },
  5750. @@ -2285,10 +2368,10 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
  5751. if (attr->type == ATTR_IMPLICIT_HANDLE)
  5752. {
  5753. const var_t *var = attr->u.pval;
  5754. - if (type_get_type( var->type) == TYPE_BASIC &&
  5755. - type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
  5756. + if (type_get_type( var->declspec.type) == TYPE_BASIC &&
  5757. + type_basic_get_type( var->declspec.type ) == TYPE_BASIC_HANDLE)
  5758. continue;
  5759. - if (is_aliaschain_attr( var->type, ATTR_HANDLE ))
  5760. + if (is_aliaschain_attr( var->declspec.type, ATTR_HANDLE ))
  5761. continue;
  5762. error_loc("attribute %s requires a handle type in interface %s\n",
  5763. allowed_attr[attr->type].display_name, name);
  5764. @@ -2493,7 +2576,7 @@ static int is_ptr_guid_type(const type_t *type)
  5765. /* second, make sure it is a pointer to something of size sizeof(GUID),
  5766. * i.e. 16 bytes */
  5767. - return (type_memsize(type_pointer_get_ref(type)) == 16);
  5768. + return (type_memsize(type_pointer_get_ref_type(type)) == 16);
  5769. }
  5770. static void check_conformance_expr_list(const char *attr_name, const var_t *arg, const type_t *container_type, expr_list_t *expr_list)
  5771. @@ -2520,7 +2603,7 @@ static void check_remoting_fields(const var_t *var, type_t *type);
  5772. static void check_field_common(const type_t *container_type,
  5773. const char *container_name, const var_t *arg)
  5774. {
  5775. - type_t *type = arg->type;
  5776. + type_t *type = arg->declspec.type;
  5777. int more_to_do;
  5778. const char *container_type_name;
  5779. const char *var_type;
  5780. @@ -2550,7 +2633,7 @@ static void check_field_common(const type_t *container_type,
  5781. }
  5782. if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
  5783. - (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->type, ATTR_STRING)))
  5784. + (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->declspec.type, ATTR_STRING)))
  5785. error_loc_info(&arg->loc_info,
  5786. "string and length_is specified for argument %s are mutually exclusive attributes\n",
  5787. arg->name);
  5788. @@ -2647,23 +2730,28 @@ static void check_field_common(const type_t *container_type,
  5789. {
  5790. const type_t *t = type;
  5791. while (is_ptr(t))
  5792. - t = type_pointer_get_ref(t);
  5793. + t = type_pointer_get_ref_type(t);
  5794. if (is_aliaschain_attr(t, ATTR_RANGE))
  5795. warning_loc_info(&arg->loc_info, "%s: range not verified for a string of ranged types\n", arg->name);
  5796. break;
  5797. }
  5798. case TGT_POINTER:
  5799. - type = type_pointer_get_ref(type);
  5800. + type = type_pointer_get_ref_type(type);
  5801. more_to_do = TRUE;
  5802. break;
  5803. case TGT_ARRAY:
  5804. - type = type_array_get_element(type);
  5805. + type = type_array_get_element_type(type);
  5806. more_to_do = TRUE;
  5807. break;
  5808. + case TGT_ENUM:
  5809. + type = type_get_real_type(type);
  5810. + if(!type_is_complete(type))
  5811. + {
  5812. + error_loc_info(&arg->loc_info, "undefined type declaration enum %s\n", type->name);
  5813. + }
  5814. case TGT_USER_TYPE:
  5815. case TGT_IFACE_POINTER:
  5816. case TGT_BASIC:
  5817. - case TGT_ENUM:
  5818. case TGT_RANGE:
  5819. /* nothing to do */
  5820. break;
  5821. @@ -2688,13 +2776,18 @@ static void check_remoting_fields(const var_t *var, type_t *type)
  5822. if (type_is_complete(type))
  5823. fields = type_struct_get_fields(type);
  5824. else
  5825. - error_loc_info(&var->loc_info, "undefined type declaration %s\n", type->name);
  5826. + error_loc_info(&var->loc_info, "undefined type declaration struct %s\n", type->name);
  5827. }
  5828. else if (type_get_type(type) == TYPE_UNION || type_get_type(type) == TYPE_ENCAPSULATED_UNION)
  5829. - fields = type_union_get_cases(type);
  5830. + {
  5831. + if (type_is_complete(type))
  5832. + fields = type_union_get_cases(type);
  5833. + else
  5834. + error_loc_info(&var->loc_info, "undefined type declaration union %s\n", type->name);
  5835. + }
  5836. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  5837. - if (field->type) check_field_common(type, type->name, field);
  5838. + if (field->declspec.type) check_field_common(type, type->name, field);
  5839. }
  5840. /* checks that arguments for a function make sense for marshalling and unmarshalling */
  5841. @@ -2703,9 +2796,10 @@ static void check_remoting_args(const var_t *func)
  5842. const char *funcname = func->name;
  5843. const var_t *arg;
  5844. - if (func->type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->type->details.function->args, const var_t, entry )
  5845. + assert(type_get_type_detect_alias(func->declspec.type) == TYPE_FUNCTION);
  5846. + if (func->declspec.type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->declspec.type->details.function->args, const var_t, entry )
  5847. {
  5848. - const type_t *type = arg->type;
  5849. + const type_t *type = arg->declspec.type;
  5850. /* check that [out] parameters have enough pointer levels */
  5851. if (is_attr(arg->attrs, ATTR_OUT))
  5852. @@ -2745,16 +2839,16 @@ static void check_remoting_args(const var_t *func)
  5853. }
  5854. }
  5855. - check_field_common(func->type, funcname, arg);
  5856. + check_field_common(func->declspec.type, funcname, arg);
  5857. }
  5858. - if (type_get_type(type_function_get_rettype(func->type)) != TYPE_VOID)
  5859. + if (type_get_type(type_function_get_rettype(func->declspec.type)) != TYPE_VOID)
  5860. {
  5861. var_t var;
  5862. var = *func;
  5863. - var.type = type_function_get_rettype(func->type);
  5864. + var.declspec.type = type_function_get_rettype(func->declspec.type);
  5865. var.name = xstrdup("return value");
  5866. - check_field_common(func->type, funcname, &var);
  5867. + check_field_common(func->declspec.type, funcname, &var);
  5868. free(var.name);
  5869. }
  5870. }
  5871. @@ -2771,8 +2865,8 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
  5872. * function */
  5873. var_t *idl_handle = make_var(xstrdup("IDL_handle"));
  5874. idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
  5875. - idl_handle->type = find_type_or_error("handle_t", 0);
  5876. - type_function_add_head_arg(func->type, idl_handle);
  5877. + idl_handle->declspec.type = find_type_or_error("handle_t", 0);
  5878. + type_function_add_head_arg(func->declspec.type, idl_handle);
  5879. }
  5880. }
  5881. @@ -2837,6 +2931,7 @@ static void check_async_uuid(type_t *iface)
  5882. type_t *async_iface;
  5883. type_t *inherit;
  5884. + assert(type_get_type_detect_alias(iface) == TYPE_INTERFACE);
  5885. if (!is_attr(iface->attrs, ATTR_ASYNCUUID)) return;
  5886. inherit = iface->details.iface->inherit;
  5887. @@ -2853,7 +2948,8 @@ static void check_async_uuid(type_t *iface)
  5888. var_t *begin_func, *finish_func, *func = stmt->u.var, *arg;
  5889. var_list_t *begin_args = NULL, *finish_args = NULL, *args;
  5890. - args = func->type->details.function->args;
  5891. + assert(type_get_type_detect_alias(func->declspec.type) == TYPE_FUNCTION);
  5892. + args = func->declspec.type->details.function->args;
  5893. if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
  5894. {
  5895. if (is_attr(arg->attrs, ATTR_IN) || !is_attr(arg->attrs, ATTR_OUT))
  5896. @@ -2863,15 +2959,15 @@ static void check_async_uuid(type_t *iface)
  5897. }
  5898. begin_func = copy_var(func, concat_str("Begin_", func->name), NULL);
  5899. - begin_func->type = type_new_function(begin_args);
  5900. - begin_func->type->attrs = func->attrs;
  5901. - begin_func->type->details.function->retval = func->type->details.function->retval;
  5902. + begin_func->declspec.type = type_new_function(begin_args);
  5903. + begin_func->declspec.type->attrs = func->attrs;
  5904. + begin_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
  5905. stmts = append_statement(stmts, make_statement_declaration(begin_func));
  5906. finish_func = copy_var(func, concat_str("Finish_", func->name), NULL);
  5907. - finish_func->type = type_new_function(finish_args);
  5908. - finish_func->type->attrs = func->attrs;
  5909. - finish_func->type->details.function->retval = func->type->details.function->retval;
  5910. + finish_func->declspec.type = type_new_function(finish_args);
  5911. + finish_func->declspec.type->attrs = func->attrs;
  5912. + finish_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
  5913. stmts = append_statement(stmts, make_statement_declaration(finish_func));
  5914. }
  5915. @@ -2911,6 +3007,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
  5916. static void check_all_user_types(const statement_list_t *stmts)
  5917. {
  5918. const statement_t *stmt;
  5919. + const var_t *v;
  5920. if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
  5921. {
  5922. @@ -2922,7 +3019,11 @@ static void check_all_user_types(const statement_list_t *stmts)
  5923. const statement_t *stmt_func;
  5924. STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) {
  5925. const var_t *func = stmt_func->u.var;
  5926. - check_for_additional_prototype_types(func->type->details.function->args);
  5927. + assert(type_get_type_detect_alias(func->declspec.type) == TYPE_FUNCTION);
  5928. + if (func->declspec.type->details.function->args)
  5929. + LIST_FOR_EACH_ENTRY( v, func->declspec.type->details.function->args, const var_t, entry )
  5930. + check_for_additional_prototype_types(v->declspec.type);
  5931. + check_for_additional_prototype_types(type_function_get_rettype(func->declspec.type));
  5932. }
  5933. }
  5934. }
  5935. @@ -2956,6 +3057,10 @@ static statement_t *make_statement_type_decl(type_t *type)
  5936. {
  5937. statement_t *stmt = make_statement(STMT_TYPE);
  5938. stmt->u.type = type;
  5939. + if (type_is_defined(type))
  5940. + {
  5941. + stmt->declonly = FALSE;
  5942. + }
  5943. return stmt;
  5944. }
  5945. @@ -2970,16 +3075,16 @@ static statement_t *make_statement_declaration(var_t *var)
  5946. {
  5947. statement_t *stmt = make_statement(STMT_DECLARATION);
  5948. stmt->u.var = var;
  5949. - if (var->stgclass == STG_EXTERN && var->eval)
  5950. + if (var->declspec.stgclass == STG_EXTERN && var->eval)
  5951. warning("'%s' initialised and declared extern\n", var->name);
  5952. if (is_const_decl(var))
  5953. {
  5954. if (var->eval)
  5955. reg_const(var);
  5956. }
  5957. - else if (type_get_type(var->type) == TYPE_FUNCTION)
  5958. + else if (type_get_type(var->declspec.type) == TYPE_FUNCTION)
  5959. check_function_attrs(var->name, var->attrs);
  5960. - else if (var->stgclass == STG_NONE || var->stgclass == STG_REGISTER)
  5961. + else if (var->declspec.stgclass == STG_NONE || var->declspec.stgclass == STG_REGISTER)
  5962. error_loc("instantiation of data is illegal\n");
  5963. return stmt;
  5964. }
  5965. @@ -3031,6 +3136,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
  5966. declarator_t *decl, *next;
  5967. statement_t *stmt;
  5968. type_list_t **type_list;
  5969. + int defined = TRUE;
  5970. if (!decls) return NULL;
  5971. @@ -3042,6 +3148,18 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
  5972. {
  5973. var_t *var = decl->var;
  5974. type_t *type = find_type_or_error(var->name, 0);
  5975. +
  5976. + /* ensure that all of the types in this typedef statement have been defined
  5977. + * before setting its declonly flag */
  5978. + if (type_is_pointerish(type))
  5979. + {
  5980. + defined = defined & type_is_defined(type_get_pointer_chain_tail(type));
  5981. + }
  5982. + else
  5983. + {
  5984. + defined = defined & type_is_defined(type_get_real_type(type));
  5985. + }
  5986. +
  5987. *type_list = xmalloc(sizeof(type_list_t));
  5988. (*type_list)->type = type;
  5989. (*type_list)->next = NULL;
  5990. @@ -3051,6 +3169,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
  5991. free(var);
  5992. }
  5993. + stmt->declonly = !defined;
  5994. return stmt;
  5995. }
  5996. @@ -3091,7 +3210,7 @@ void init_loc_info(loc_info_t *i)
  5997. static void check_def(const type_t *t)
  5998. {
  5999. - if (t->defined)
  6000. + if (type_is_defined(t))
  6001. error_loc("%s: redefinition error; original definition was at %s:%d\n",
  6002. t->name, t->loc_info.input_name, t->loc_info.line_number);
  6003. }
  6004. diff --git a/mingw-w64-tools/widl/src/parser.yy.c b/mingw-w64-tools/widl/src/parser.yy.c
  6005. index 2aaf3c27..0482aa7e 100644
  6006. --- a/mingw-w64-tools/widl/src/parser.yy.c
  6007. +++ b/mingw-w64-tools/widl/src/parser.yy.c
  6008. @@ -1,6 +1,6 @@
  6009. -#line 1 "parser.yy.c"
  6010. +#line 2 "parser.yy.c"
  6011. -#line 3 "parser.yy.c"
  6012. +#line 4 "parser.yy.c"
  6013. #define YY_INT_ALIGNED short int
  6014. @@ -1041,13 +1041,13 @@ UUID *parse_uuid(const char *u)
  6015. return uuid;
  6016. }
  6017. -#line 1044 "parser.yy.c"
  6018. +#line 1045 "parser.yy.c"
  6019. /*
  6020. **************************************************************************
  6021. * The flexer starts here
  6022. **************************************************************************
  6023. */
  6024. -#line 1050 "parser.yy.c"
  6025. +#line 1051 "parser.yy.c"
  6026. #define INITIAL 0
  6027. #define QUOTE 1
  6028. @@ -1281,7 +1281,7 @@ YY_DECL
  6029. {
  6030. #line 132 "parser.l"
  6031. -#line 1284 "parser.yy.c"
  6032. +#line 1285 "parser.yy.c"
  6033. while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
  6034. {
  6035. @@ -1616,7 +1616,7 @@ YY_RULE_SETUP
  6036. #line 239 "parser.l"
  6037. ECHO;
  6038. YY_BREAK
  6039. -#line 1619 "parser.yy.c"
  6040. +#line 1620 "parser.yy.c"
  6041. case YY_END_OF_BUFFER:
  6042. {
  6043. diff --git a/mingw-w64-tools/widl/src/proxy.c b/mingw-w64-tools/widl/src/proxy.c
  6044. index 87c27be9..36b552be 100644
  6045. --- a/mingw-w64-tools/widl/src/proxy.c
  6046. +++ b/mingw-w64-tools/widl/src/proxy.c
  6047. @@ -67,7 +67,7 @@ static void write_stubdesc(int expr_eval_routines)
  6048. print_proxy( "1, /* -error bounds_check flag */\n");
  6049. print_proxy( "0x%x, /* Ndr library version */\n", get_stub_mode() == MODE_Oif ? 0x50002 : 0x10001);
  6050. print_proxy( "0,\n");
  6051. - print_proxy( "0x50100a4, /* MIDL Version 5.1.164 */\n");
  6052. + print_proxy( "0x50200ca, /* MIDL Version 5.2.202 */\n");
  6053. print_proxy( "0,\n");
  6054. print_proxy("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
  6055. print_proxy( "0, /* notify & notify_flag routine table */\n");
  6056. @@ -105,15 +105,15 @@ static void clear_output_vars( const var_list_t *args )
  6057. {
  6058. if (is_attr(arg->attrs, ATTR_IN)) continue;
  6059. if (!is_attr(arg->attrs, ATTR_OUT)) continue;
  6060. - if (is_ptr(arg->type))
  6061. + if (is_ptr(arg->declspec.type))
  6062. {
  6063. - if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_BASIC) continue;
  6064. - if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_ENUM) continue;
  6065. + if (type_get_type(type_pointer_get_ref_type(arg->declspec.type)) == TYPE_BASIC) continue;
  6066. + if (type_get_type(type_pointer_get_ref_type(arg->declspec.type)) == TYPE_ENUM) continue;
  6067. }
  6068. print_proxy( "if (%s) MIDL_memset( %s, 0, ", arg->name, arg->name );
  6069. - if (is_array(arg->type) && type_array_has_conformance(arg->type))
  6070. + if (is_array(arg->declspec.type) && type_array_has_conformance(arg->declspec.type))
  6071. {
  6072. - write_expr( proxy, type_array_get_conformance(arg->type), 1, 1, NULL, NULL, "" );
  6073. + write_expr( proxy, type_array_get_conformance(arg->declspec.type), 1, 1, NULL, NULL, "" );
  6074. fprintf( proxy, " * " );
  6075. }
  6076. fprintf( proxy, "sizeof( *%s ));\n", arg->name );
  6077. @@ -147,7 +147,7 @@ static int need_delegation_indirect(const type_t *iface)
  6078. static void free_variable( const var_t *arg, const char *local_var_prefix )
  6079. {
  6080. unsigned int type_offset = arg->typestring_offset;
  6081. - type_t *type = arg->type;
  6082. + type_t *type = arg->declspec.type;
  6083. write_parameter_conf_or_var_exprs(proxy, indent, local_var_prefix, PHASE_FREE, arg, FALSE);
  6084. @@ -191,18 +191,18 @@ static void proxy_free_variables( var_list_t *args, const char *local_var_prefix
  6085. static void gen_proxy(type_t *iface, const var_t *func, int idx,
  6086. unsigned int proc_offset)
  6087. {
  6088. - var_t *retval = type_function_get_retval(func->type);
  6089. - int has_ret = !is_void(retval->type);
  6090. + var_t *retval = type_function_get_retval(func->declspec.type);
  6091. + int has_ret = !is_void(retval->declspec.type);
  6092. int has_full_pointer = is_full_pointer_function(func);
  6093. - const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
  6094. - const var_list_t *args = type_get_function_args(func->type);
  6095. + const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
  6096. + const var_list_t *args = type_function_get_args(func->declspec.type);
  6097. if (!callconv) callconv = "STDMETHODCALLTYPE";
  6098. indent = 0;
  6099. if (is_interpreted_func( iface, func ))
  6100. {
  6101. if (get_stub_mode() == MODE_Oif && !is_callas( func->attrs )) return;
  6102. - write_type_decl_left(proxy, retval->type);
  6103. + write_declspec_decl_left(proxy, &retval->declspec);
  6104. print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
  6105. write_args(proxy, args, iface->name, 1, TRUE);
  6106. print_proxy( ")\n");
  6107. @@ -219,7 +219,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
  6108. print_proxy( "}\n");
  6109. print_proxy( "\n");
  6110. - write_type_decl_left(proxy, retval->type);
  6111. + write_declspec_decl_left(proxy, &retval->declspec);
  6112. print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
  6113. write_args(proxy, args, iface->name, 1, TRUE);
  6114. print_proxy( ")\n");
  6115. @@ -229,12 +229,12 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
  6116. /* local variables */
  6117. if (has_ret) {
  6118. print_proxy( "%s", "" );
  6119. - write_type_decl(proxy, retval->type, retval->name);
  6120. + write_declspec_decl(proxy, &retval->declspec, retval->name);
  6121. fprintf( proxy, ";\n" );
  6122. }
  6123. print_proxy( "RPC_MESSAGE _RpcMessage;\n" );
  6124. if (has_ret) {
  6125. - if (decl_indirect(retval->type))
  6126. + if (decl_indirect(retval->declspec.type))
  6127. print_proxy("void *_p_%s = &%s;\n", retval->name, retval->name);
  6128. }
  6129. print_proxy( "\n");
  6130. @@ -246,7 +246,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
  6131. write_full_pointer_init(proxy, indent, func, FALSE);
  6132. /* FIXME: trace */
  6133. - clear_output_vars( type_get_function_args(func->type) );
  6134. + clear_output_vars( type_function_get_args(func->declspec.type) );
  6135. print_proxy( "RpcTryExcept\n" );
  6136. print_proxy( "{\n" );
  6137. @@ -279,9 +279,9 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
  6138. if (has_ret)
  6139. {
  6140. - if (decl_indirect(retval->type))
  6141. + if (decl_indirect(retval->declspec.type))
  6142. print_proxy("MIDL_memset(&%s, 0, sizeof(%s));\n", retval->name, retval->name);
  6143. - else if (is_ptr(retval->type) || is_array(retval->type))
  6144. + else if (is_ptr(retval->declspec.type) || is_array(retval->declspec.type))
  6145. print_proxy("%s = 0;\n", retval->name);
  6146. write_remoting_arguments(proxy, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL);
  6147. }
  6148. @@ -301,7 +301,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
  6149. print_proxy( "{\n" );
  6150. if (has_ret) {
  6151. indent++;
  6152. - proxy_free_variables( type_get_function_args(func->type), "" );
  6153. + proxy_free_variables( type_function_get_args(func->declspec.type), "" );
  6154. print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
  6155. indent--;
  6156. }
  6157. @@ -320,7 +320,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
  6158. unsigned int proc_offset)
  6159. {
  6160. const var_t *arg;
  6161. - int has_ret = !is_void(type_function_get_rettype(func->type));
  6162. + int has_ret = !is_void(type_function_get_rettype(func->declspec.type));
  6163. int has_full_pointer = is_full_pointer_function(func);
  6164. if (is_interpreted_func( iface, func )) return;
  6165. @@ -389,10 +389,10 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
  6166. else fprintf(proxy, "__frame->_This->lpVtbl->%s", get_name(func));
  6167. fprintf(proxy, "(__frame->_This");
  6168. - if (type_get_function_args(func->type))
  6169. + if (type_function_get_args(func->declspec.type))
  6170. {
  6171. - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
  6172. - fprintf(proxy, ", %s__frame->%s", is_array(arg->type) && !type_array_is_decl_as_ptr(arg->type) ? "*" :"" , arg->name);
  6173. + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry )
  6174. + fprintf(proxy, ", %s__frame->%s", is_array(arg->declspec.type) && !type_array_is_decl_as_ptr(arg->declspec.type) ? "*" :"" , arg->name);
  6175. }
  6176. fprintf(proxy, ");\n");
  6177. fprintf(proxy, "\n");
  6178. @@ -401,7 +401,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
  6179. write_remoting_arguments(proxy, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE);
  6180. - if (!is_void(type_function_get_rettype(func->type)))
  6181. + if (!is_void(type_function_get_rettype(func->declspec.type)))
  6182. write_remoting_arguments(proxy, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE);
  6183. print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &__frame->_StubMsg);\n");
  6184. @@ -410,7 +410,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
  6185. fprintf(proxy, "\n");
  6186. /* marshall the return value */
  6187. - if (!is_void(type_function_get_rettype(func->type)))
  6188. + if (!is_void(type_function_get_rettype(func->declspec.type)))
  6189. write_remoting_arguments(proxy, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL);
  6190. indent--;
  6191. @@ -432,16 +432,16 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
  6192. static void gen_stub_thunk( type_t *iface, const var_t *func, unsigned int proc_offset )
  6193. {
  6194. - int has_ret = !is_void( type_function_get_rettype( func->type ));
  6195. + int has_ret = !is_void( type_function_get_rettype( func->declspec.type ));
  6196. const var_t *arg, *callas = is_callas( func->attrs );
  6197. - const var_list_t *args = type_get_function_args( func->type );
  6198. + const var_list_t *args = type_function_get_args( func->declspec.type );
  6199. indent = 0;
  6200. print_proxy( "void __RPC_API %s_%s_Thunk( PMIDL_STUB_MESSAGE pStubMsg )\n",
  6201. iface->name, get_name(func) );
  6202. print_proxy( "{\n");
  6203. indent++;
  6204. - write_func_param_struct( proxy, iface, func->type,
  6205. + write_func_param_struct( proxy, iface, func->declspec.type,
  6206. "*pParamStruct = (struct _PARAM_STRUCT *)pStubMsg->StackTop", has_ret );
  6207. print_proxy( "%s%s_%s_Stub( pParamStruct->This",
  6208. has_ret ? "pParamStruct->_RetVal = " : "", iface->name, callas->name );
  6209. @@ -526,6 +526,7 @@ static int write_proxy_methods(type_t *iface, int skip)
  6210. if (skip || (is_local(func->attrs) && !get_callas_source(iface, func)))
  6211. print_proxy( "0, /* %s::%s */\n", iface->name, get_name(func));
  6212. else if (is_interpreted_func( iface, func ) &&
  6213. + get_stub_mode() == MODE_Oif &&
  6214. !is_local( func->attrs ) &&
  6215. type_iface_get_inherit(iface))
  6216. print_proxy( "(void *)-1, /* %s::%s */\n", iface->name, get_name(func));
  6217. @@ -613,14 +614,14 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
  6218. if (!is_local(func->attrs)) {
  6219. const var_t *cas = is_callas(func->attrs);
  6220. const char *cname = cas ? cas->name : NULL;
  6221. - int idx = func->type->details.function->idx;
  6222. + int idx = type_get_details(func->declspec.type)->function->idx;
  6223. if (cname) {
  6224. const statement_t *stmt2;
  6225. STATEMENTS_FOR_EACH_FUNC(stmt2, type_iface_get_stmts(iface)) {
  6226. const var_t *m = stmt2->u.var;
  6227. if (!strcmp(m->name, cname))
  6228. {
  6229. - idx = m->type->details.function->idx;
  6230. + idx = type_get_details(m->declspec.type)->function->idx;
  6231. break;
  6232. }
  6233. }
  6234. @@ -738,7 +739,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
  6235. print_proxy( "{\n");
  6236. indent++;
  6237. print_proxy( "%s_%s\n",
  6238. - iface->details.iface->async_iface == iface ? "CStdAsyncStubBuffer" : "CStdStubBuffer",
  6239. + type_get_details(iface)->iface->async_iface == iface ? "CStdAsyncStubBuffer" : "CStdStubBuffer",
  6240. need_delegation_indirect(iface) ? "DELEGATING_METHODS" : "METHODS");
  6241. indent--;
  6242. print_proxy( "}\n");
  6243. @@ -839,8 +840,8 @@ static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_
  6244. if (need_proxy(iface))
  6245. {
  6246. write_proxy(iface, proc_offset);
  6247. - if (iface->details.iface->async_iface)
  6248. - write_proxy(iface->details.iface->async_iface, proc_offset);
  6249. + if (type_get_details(iface)->iface->async_iface)
  6250. + write_proxy(type_get_details(iface)->iface->async_iface, proc_offset);
  6251. }
  6252. }
  6253. }
  6254. @@ -869,9 +870,9 @@ static void build_iface_list( const statement_list_t *stmts, type_t **ifaces[],
  6255. {
  6256. *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) );
  6257. (*ifaces)[(*count)++] = iface;
  6258. - if (iface->details.iface->async_iface)
  6259. + if (type_get_details(iface)->iface->async_iface)
  6260. {
  6261. - iface = iface->details.iface->async_iface;
  6262. + iface = type_get_details(iface)->iface->async_iface;
  6263. *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) );
  6264. (*ifaces)[(*count)++] = iface;
  6265. }
  6266. @@ -942,7 +943,7 @@ static void write_proxy_routines(const statement_list_t *stmts)
  6267. write_stubdesc(expr_eval_routines);
  6268. print_proxy( "#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
  6269. - print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
  6270. + print_proxy( "#error Invalid build platform for this proxy.\n");
  6271. print_proxy( "#endif\n");
  6272. print_proxy( "\n");
  6273. write_procformatstring(proxy, stmts, need_proxy);
  6274. @@ -1011,7 +1012,7 @@ static void write_proxy_routines(const statement_list_t *stmts)
  6275. table_version = get_stub_mode() == MODE_Oif ? 2 : 1;
  6276. for (i = 0; i < count; i++)
  6277. {
  6278. - if (interfaces[i]->details.iface->async_iface != interfaces[i]) continue;
  6279. + if (type_get_details(interfaces[i])->iface->async_iface != interfaces[i]) continue;
  6280. if (table_version != 6)
  6281. {
  6282. fprintf(proxy, "static const IID *_AsyncInterfaceTable[] =\n");
  6283. @@ -1053,26 +1054,6 @@ void write_proxies(const statement_list_t *stmts)
  6284. init_proxy(stmts);
  6285. if(!proxy) return;
  6286. - if (do_win32 && do_win64)
  6287. - {
  6288. - fprintf(proxy, "\n#ifndef _WIN64\n\n");
  6289. - pointer_size = 4;
  6290. - write_proxy_routines( stmts );
  6291. - fprintf(proxy, "\n#else /* _WIN64 */\n\n");
  6292. - pointer_size = 8;
  6293. - write_proxy_routines( stmts );
  6294. - fprintf(proxy, "\n#endif /* _WIN64 */\n");
  6295. - }
  6296. - else if (do_win32)
  6297. - {
  6298. - pointer_size = 4;
  6299. - write_proxy_routines( stmts );
  6300. - }
  6301. - else if (do_win64)
  6302. - {
  6303. - pointer_size = 8;
  6304. - write_proxy_routines( stmts );
  6305. - }
  6306. -
  6307. + write_proxy_routines( stmts );
  6308. fclose(proxy);
  6309. }
  6310. diff --git a/mingw-w64-tools/widl/src/register.c b/mingw-w64-tools/widl/src/register.c
  6311. index 210fb747..1c369e7c 100644
  6312. --- a/mingw-w64-tools/widl/src/register.c
  6313. +++ b/mingw-w64-tools/widl/src/register.c
  6314. @@ -325,7 +325,7 @@ void output_typelib_regscript( const typelib_t *typelib )
  6315. sprintf(resname, "%s\\%d", typelib_name, expr->cval);
  6316. }
  6317. put_str( indent, "'%x' { %s = s '%%MODULE%%%s' }\n",
  6318. - lcid_expr ? lcid_expr->cval : 0, typelib_kind == SYS_WIN64 ? "win64" : "win32", id_part );
  6319. + lcid_expr ? lcid_expr->cval : 0, pointer_size == 8 ? "win64" : "win32", id_part );
  6320. put_str( indent, "FLAGS = s '%u'\n", flags );
  6321. put_str( --indent, "}\n" );
  6322. put_str( --indent, "}\n" );
  6323. diff --git a/mingw-w64-tools/widl/src/server.c b/mingw-w64-tools/widl/src/server.c
  6324. index 783ff900..dbed870a 100644
  6325. --- a/mingw-w64-tools/widl/src/server.c
  6326. +++ b/mingw-w64-tools/widl/src/server.c
  6327. @@ -55,6 +55,8 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
  6328. unsigned char explicit_fc, implicit_fc;
  6329. int has_full_pointer = is_full_pointer_function(func);
  6330. const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
  6331. + const decl_spec_t *ret_declspec = type_function_get_retdeclspec(func->declspec.type);
  6332. + type_t *ret_type = ret_declspec->type;
  6333. if (is_interpreted_func( iface, func )) return;
  6334. @@ -75,7 +77,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
  6335. indent++;
  6336. write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE);
  6337. - if (!is_void(type_function_get_rettype(func->type)))
  6338. + if (!is_void(ret_type))
  6339. write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_FREE);
  6340. if (has_full_pointer)
  6341. @@ -120,7 +122,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
  6342. if (has_full_pointer)
  6343. write_full_pointer_init(server, indent, func, TRUE);
  6344. - if (type_get_function_args(func->type))
  6345. + if (type_function_get_args(func->declspec.type))
  6346. {
  6347. print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
  6348. indent++;
  6349. @@ -154,35 +156,42 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
  6350. assign_stub_out_args(server, indent, func, "__frame->");
  6351. /* Call the real server function */
  6352. - print_server("%s%s%s",
  6353. - is_void(type_function_get_rettype(func->type)) ? "" : "__frame->_RetVal = ",
  6354. - prefix_server, get_name(func));
  6355. + if (is_context_handle(ret_type))
  6356. + {
  6357. + print_server("__frame->_RetVal = NDRSContextUnmarshall((char*)0, _pRpcMessage->DataRepresentation);\n");
  6358. + print_server("*((");
  6359. + write_declspec_decl(server, ret_declspec, NULL);
  6360. + fprintf(server, "*)NDRSContextValue(__frame->_RetVal)) = ");
  6361. + }
  6362. + else
  6363. + print_server("%s", is_void(ret_type) ? "" : "__frame->_RetVal = ");
  6364. + fprintf(server, "%s%s", prefix_server, get_name(func));
  6365. - if (type_get_function_args(func->type))
  6366. + if (type_function_get_args(func->declspec.type))
  6367. {
  6368. int first_arg = 1;
  6369. fprintf(server, "(\n");
  6370. indent++;
  6371. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  6372. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  6373. {
  6374. if (first_arg)
  6375. first_arg = 0;
  6376. else
  6377. fprintf(server, ",\n");
  6378. - if (is_context_handle(var->type))
  6379. + if (is_context_handle(var->declspec.type))
  6380. {
  6381. /* if the context_handle attribute appears in the chain of types
  6382. * without pointers being followed, then the context handle must
  6383. * be direct, otherwise it is a pointer */
  6384. - const char *ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? "*" : "";
  6385. + const char *ch_ptr = is_aliaschain_attr(var->declspec.type, ATTR_CONTEXTHANDLE) ? "*" : "";
  6386. print_server("(");
  6387. - write_type_decl_left(server, var->type);
  6388. + write_declspec_decl_left(server, &var->declspec);
  6389. fprintf(server, ")%sNDRSContextValue(__frame->%s)", ch_ptr, var->name);
  6390. }
  6391. else
  6392. {
  6393. - print_server("%s__frame->%s", is_array(var->type) && !type_array_is_decl_as_ptr(var->type) ? "*" : "", var->name);
  6394. + print_server("%s__frame->%s", is_array(var->declspec.type) && !type_array_is_decl_as_ptr(var->declspec.type) ? "*" : "", var->name);
  6395. }
  6396. }
  6397. fprintf(server, ");\n");
  6398. @@ -197,7 +206,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
  6399. {
  6400. write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE);
  6401. - if (!is_void(type_function_get_rettype(func->type)))
  6402. + if (!is_void(ret_type))
  6403. write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE);
  6404. print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.BufferLength;\n");
  6405. @@ -216,7 +225,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
  6406. write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_MARSHAL);
  6407. /* marshall the return value */
  6408. - if (!is_void(type_function_get_rettype(func->type)))
  6409. + if (!is_void(ret_type))
  6410. write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL);
  6411. indent--;
  6412. @@ -378,7 +387,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
  6413. print_server("1, /* -error bounds_check flag */\n");
  6414. print_server("0x%x, /* Ndr library version */\n", get_stub_mode() == MODE_Oif ? 0x50002 : 0x10001);
  6415. print_server("0,\n");
  6416. - print_server("0x50100a4, /* MIDL Version 5.1.164 */\n");
  6417. + print_server("0x50200ca, /* MIDL Version 5.2.202 */\n");
  6418. print_server("0,\n");
  6419. print_server("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
  6420. print_server("0, /* notify & notify_flag routine table */\n");
  6421. @@ -544,26 +553,6 @@ void write_server(const statement_list_t *stmts)
  6422. if (!server)
  6423. return;
  6424. - if (do_win32 && do_win64)
  6425. - {
  6426. - fprintf(server, "#ifndef _WIN64\n\n");
  6427. - pointer_size = 4;
  6428. - write_server_routines( stmts );
  6429. - fprintf(server, "\n#else /* _WIN64 */\n\n");
  6430. - pointer_size = 8;
  6431. - write_server_routines( stmts );
  6432. - fprintf(server, "\n#endif /* _WIN64 */\n");
  6433. - }
  6434. - else if (do_win32)
  6435. - {
  6436. - pointer_size = 4;
  6437. - write_server_routines( stmts );
  6438. - }
  6439. - else if (do_win64)
  6440. - {
  6441. - pointer_size = 8;
  6442. - write_server_routines( stmts );
  6443. - }
  6444. -
  6445. + write_server_routines( stmts );
  6446. fclose(server);
  6447. }
  6448. diff --git a/mingw-w64-tools/widl/src/typegen.c b/mingw-w64-tools/widl/src/typegen.c
  6449. index 27ba60fc..eebb99f0 100644
  6450. --- a/mingw-w64-tools/widl/src/typegen.c
  6451. +++ b/mingw-w64-tools/widl/src/typegen.c
  6452. @@ -67,6 +67,7 @@ enum type_context
  6453. TYPE_CONTEXT_PARAM,
  6454. TYPE_CONTEXT_CONTAINER,
  6455. TYPE_CONTEXT_CONTAINER_NO_POINTERS,
  6456. + TYPE_CONTEXT_RETVAL,
  6457. };
  6458. /* parameter flags in Oif mode */
  6459. @@ -84,14 +85,14 @@ static const unsigned short IsSimpleRef = 0x0100;
  6460. static unsigned int field_memsize(const type_t *type, unsigned int *offset);
  6461. static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align);
  6462. -static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type,
  6463. +static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  6464. const char *name, unsigned int *typestring_offset);
  6465. -static unsigned int write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff);
  6466. -static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type,
  6467. +static unsigned int write_struct_tfs(FILE *file, const decl_spec_t *declspec, const char *name, unsigned int *tfsoff);
  6468. +static int write_embedded_types(FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  6469. const char *name, int write_ptr, unsigned int *tfsoff);
  6470. static const var_t *find_array_or_string_in_struct(const type_t *type);
  6471. static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
  6472. - type_t *type, enum type_context context,
  6473. + const decl_spec_t *declspec, enum type_context context,
  6474. const char *name, unsigned int *typestring_offset);
  6475. static unsigned int get_required_buffer_size_type( const type_t *type, const char *name,
  6476. const attr_list_t *attrs, int toplevel_param,
  6477. @@ -196,7 +197,7 @@ static void *get_aliaschain_attrp(const type_t *type, enum attr_type attr)
  6478. if (is_attr(t->attrs, attr))
  6479. return get_attrp(t->attrs, attr);
  6480. else if (type_is_alias(t))
  6481. - t = type_alias_get_aliasee(t);
  6482. + t = type_alias_get_aliasee_type(t);
  6483. else return NULL;
  6484. }
  6485. }
  6486. @@ -266,7 +267,7 @@ unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int t
  6487. if (pointer_type)
  6488. return pointer_type;
  6489. - for (t = type; type_is_alias(t); t = type_alias_get_aliasee(t))
  6490. + for (t = type; type_is_alias(t); t = type_alias_get_aliasee_type(t))
  6491. {
  6492. pointer_type = get_attrv(t->attrs, ATTR_POINTERTYPE);
  6493. if (pointer_type)
  6494. @@ -287,7 +288,7 @@ static unsigned char get_pointer_fc_context( const type_t *type, const attr_list
  6495. int pointer_fc = get_pointer_fc(type, attrs, context == TYPE_CONTEXT_TOPLEVELPARAM);
  6496. if (pointer_fc == FC_UP && is_attr( attrs, ATTR_OUT ) &&
  6497. - context == TYPE_CONTEXT_PARAM && is_object( current_iface ))
  6498. + (context == TYPE_CONTEXT_PARAM || context == TYPE_CONTEXT_RETVAL) && is_object( current_iface ))
  6499. pointer_fc = FC_OP;
  6500. return pointer_fc;
  6501. @@ -315,7 +316,7 @@ static type_t *get_user_type(const type_t *t, const char **pname)
  6502. }
  6503. if (type_is_alias(t))
  6504. - t = type_alias_get_aliasee(t);
  6505. + t = type_alias_get_aliasee_type(t);
  6506. else
  6507. return NULL;
  6508. }
  6509. @@ -350,10 +351,10 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
  6510. return TGT_RANGE;
  6511. return TGT_ENUM;
  6512. case TYPE_POINTER:
  6513. - if (type_get_type(type_pointer_get_ref(type)) == TYPE_INTERFACE ||
  6514. - (type_get_type(type_pointer_get_ref(type)) == TYPE_VOID && is_attr(attrs, ATTR_IIDIS)))
  6515. + if (type_get_type(type_pointer_get_ref_type(type)) == TYPE_INTERFACE ||
  6516. + (type_get_type(type_pointer_get_ref_type(type)) == TYPE_VOID && is_attr(attrs, ATTR_IIDIS)))
  6517. return TGT_IFACE_POINTER;
  6518. - else if (is_aliaschain_attr(type_pointer_get_ref(type), ATTR_CONTEXTHANDLE))
  6519. + else if (is_aliaschain_attr(type_pointer_get_ref_type(type), ATTR_CONTEXTHANDLE))
  6520. return TGT_CTXT_HANDLE_POINTER;
  6521. else
  6522. return TGT_POINTER;
  6523. @@ -378,13 +379,13 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
  6524. static int cant_be_null(const var_t *v)
  6525. {
  6526. - switch (typegen_detect_type(v->type, v->attrs, TDT_IGNORE_STRINGS))
  6527. + switch (typegen_detect_type(v->declspec.type, v->attrs, TDT_IGNORE_STRINGS))
  6528. {
  6529. case TGT_ARRAY:
  6530. - if (!type_array_is_decl_as_ptr( v->type )) return 0;
  6531. + if (!type_array_is_decl_as_ptr( v->declspec.type )) return 0;
  6532. /* fall through */
  6533. case TGT_POINTER:
  6534. - return (get_pointer_fc(v->type, v->attrs, TRUE) == FC_RP);
  6535. + return (get_pointer_fc(v->declspec.type, v->attrs, TRUE) == FC_RP);
  6536. case TGT_CTXT_HANDLE_POINTER:
  6537. return TRUE;
  6538. default:
  6539. @@ -404,7 +405,7 @@ static int get_padding(const var_list_t *fields)
  6540. LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry)
  6541. {
  6542. - type_t *ft = f->type;
  6543. + type_t *ft = f->declspec.type;
  6544. unsigned int align = 0;
  6545. unsigned int size = type_memsize_and_alignment(ft, &align);
  6546. align = clamp_align(align);
  6547. @@ -421,7 +422,7 @@ static unsigned int get_stack_size( const var_t *var, int *by_value )
  6548. unsigned int stack_size;
  6549. int by_val;
  6550. - switch (typegen_detect_type( var->type, var->attrs, TDT_ALL_TYPES ))
  6551. + switch (typegen_detect_type( var->declspec.type, var->attrs, TDT_ALL_TYPES ))
  6552. {
  6553. case TGT_BASIC:
  6554. case TGT_ENUM:
  6555. @@ -429,7 +430,7 @@ static unsigned int get_stack_size( const var_t *var, int *by_value )
  6556. case TGT_STRUCT:
  6557. case TGT_UNION:
  6558. case TGT_USER_TYPE:
  6559. - stack_size = type_memsize( var->type );
  6560. + stack_size = type_memsize( var->declspec.type );
  6561. by_val = (pointer_size < 8 || stack_size <= pointer_size); /* FIXME: should be platform-specific */
  6562. break;
  6563. default:
  6564. @@ -442,23 +443,27 @@ static unsigned int get_stack_size( const var_t *var, int *by_value )
  6565. }
  6566. static unsigned char get_contexthandle_flags( const type_t *iface, const attr_list_t *attrs,
  6567. - const type_t *type )
  6568. + const type_t *type, int is_return )
  6569. {
  6570. unsigned char flags = 0;
  6571. + int is_out;
  6572. if (is_attr(iface->attrs, ATTR_STRICTCONTEXTHANDLE)) flags |= NDR_STRICT_CONTEXT_HANDLE;
  6573. if (is_ptr(type) &&
  6574. !is_attr( type->attrs, ATTR_CONTEXTHANDLE ) &&
  6575. !is_attr( attrs, ATTR_CONTEXTHANDLE ))
  6576. - flags |= 0x80;
  6577. + flags |= HANDLE_PARAM_IS_VIA_PTR;
  6578. - if (is_attr(attrs, ATTR_IN))
  6579. + if (is_return) return flags | HANDLE_PARAM_IS_OUT | HANDLE_PARAM_IS_RETURN;
  6580. +
  6581. + is_out = is_attr(attrs, ATTR_OUT);
  6582. + if (is_attr(attrs, ATTR_IN) || !is_out)
  6583. {
  6584. - flags |= 0x40;
  6585. - if (!is_attr(attrs, ATTR_OUT)) flags |= NDR_CONTEXT_HANDLE_CANNOT_BE_NULL;
  6586. + flags |= HANDLE_PARAM_IS_IN;
  6587. + if (!is_out) flags |= NDR_CONTEXT_HANDLE_CANNOT_BE_NULL;
  6588. }
  6589. - if (is_attr(attrs, ATTR_OUT)) flags |= 0x20;
  6590. + if (is_out) flags |= HANDLE_PARAM_IS_OUT;
  6591. return flags;
  6592. }
  6593. @@ -490,14 +495,14 @@ unsigned char get_struct_fc(const type_t *type)
  6594. if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry )
  6595. {
  6596. - type_t *t = field->type;
  6597. + type_t *t = field->declspec.type;
  6598. enum typegen_type typegen_type;
  6599. typegen_type = typegen_detect_type(t, field->attrs, TDT_IGNORE_STRINGS);
  6600. if (typegen_type == TGT_ARRAY && !type_array_is_decl_as_ptr(t))
  6601. {
  6602. - if (is_string_type(field->attrs, field->type))
  6603. + if (is_string_type(field->attrs, field->declspec.type))
  6604. {
  6605. if (is_conformant_array(t))
  6606. has_conformance = 1;
  6607. @@ -505,10 +510,10 @@ unsigned char get_struct_fc(const type_t *type)
  6608. continue;
  6609. }
  6610. - if (is_array(type_array_get_element(field->type)))
  6611. + if (is_array(type_array_get_element_type(field->declspec.type)))
  6612. return FC_BOGUS_STRUCT;
  6613. - if (type_array_has_conformance(field->type))
  6614. + if (type_array_has_conformance(field->declspec.type))
  6615. {
  6616. has_conformance = 1;
  6617. if (list_next(fields, &field->entry))
  6618. @@ -518,7 +523,7 @@ unsigned char get_struct_fc(const type_t *type)
  6619. if (type_array_has_variance(t))
  6620. has_variance = 1;
  6621. - t = type_array_get_element(t);
  6622. + t = type_array_get_element_type(t);
  6623. typegen_type = typegen_detect_type(t, field->attrs, TDT_IGNORE_STRINGS);
  6624. }
  6625. @@ -620,7 +625,7 @@ static unsigned char get_array_fc(const type_t *type)
  6626. const expr_t *size_is;
  6627. const type_t *elem_type;
  6628. - elem_type = type_array_get_element(type);
  6629. + elem_type = type_array_get_element_type(type);
  6630. size_is = type_array_get_conformance(type);
  6631. if (!size_is)
  6632. @@ -709,14 +714,14 @@ static int type_has_pointers(const type_t *type)
  6633. case TGT_POINTER:
  6634. return TRUE;
  6635. case TGT_ARRAY:
  6636. - return type_array_is_decl_as_ptr(type) || type_has_pointers(type_array_get_element(type));
  6637. + return type_array_is_decl_as_ptr(type) || type_has_pointers(type_array_get_element_type(type));
  6638. case TGT_STRUCT:
  6639. {
  6640. var_list_t *fields = type_struct_get_fields(type);
  6641. const var_t *field;
  6642. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  6643. {
  6644. - if (type_has_pointers(field->type))
  6645. + if (type_has_pointers(field->declspec.type))
  6646. return TRUE;
  6647. }
  6648. break;
  6649. @@ -728,7 +733,7 @@ static int type_has_pointers(const type_t *type)
  6650. fields = type_union_get_cases(type);
  6651. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  6652. {
  6653. - if (field->type && type_has_pointers(field->type))
  6654. + if (field->declspec.type && type_has_pointers(field->declspec.type))
  6655. return TRUE;
  6656. }
  6657. break;
  6658. @@ -763,14 +768,14 @@ static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs,
  6659. if (get_pointer_fc(type, attrs, toplevel_param) == FC_FP)
  6660. return TRUE;
  6661. else
  6662. - return type_has_full_pointer(type_array_get_element(type), NULL, FALSE);
  6663. + return type_has_full_pointer(type_array_get_element_type(type), NULL, FALSE);
  6664. case TGT_STRUCT:
  6665. {
  6666. var_list_t *fields = type_struct_get_fields(type);
  6667. const var_t *field;
  6668. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  6669. {
  6670. - if (type_has_full_pointer(field->type, field->attrs, FALSE))
  6671. + if (type_has_full_pointer(field->declspec.type, field->attrs, FALSE))
  6672. return TRUE;
  6673. }
  6674. break;
  6675. @@ -782,7 +787,7 @@ static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs,
  6676. fields = type_union_get_cases(type);
  6677. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  6678. {
  6679. - if (field->type && type_has_full_pointer(field->type, field->attrs, FALSE))
  6680. + if (field->declspec.type && type_has_full_pointer(field->declspec.type, field->attrs, FALSE))
  6681. return TRUE;
  6682. }
  6683. break;
  6684. @@ -852,7 +857,7 @@ static const char *get_context_handle_type_name(const type_t *type)
  6685. const type_t *t;
  6686. for (t = type;
  6687. is_ptr(t) || type_is_alias(t);
  6688. - t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t))
  6689. + t = type_is_alias(t) ? type_alias_get_aliasee_type(t) : type_pointer_get_ref_type(t))
  6690. if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
  6691. return t->name;
  6692. assert(0);
  6693. @@ -902,16 +907,16 @@ static void write_var_init(FILE *file, int indent, const type_t *t, const char *
  6694. void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix)
  6695. {
  6696. - const var_t *var = type_function_get_retval(func->type);
  6697. + const var_t *var = type_function_get_retval(func->declspec.type);
  6698. - if (!is_void(var->type))
  6699. - write_var_init(file, indent, var->type, var->name, local_var_prefix);
  6700. + if (!is_void(var->declspec.type))
  6701. + write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
  6702. - if (!type_get_function_args(func->type))
  6703. + if (!type_function_get_args(func->declspec.type))
  6704. return;
  6705. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  6706. - write_var_init(file, indent, var->type, var->name, local_var_prefix);
  6707. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  6708. + write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
  6709. fprintf(file, "\n");
  6710. }
  6711. @@ -975,14 +980,14 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
  6712. if (is_out) *flags |= IsOut;
  6713. if (is_return) *flags |= IsReturn;
  6714. - if (!is_string_type( var->attrs, var->type ))
  6715. - buffer_size = get_required_buffer_size_type( var->type, NULL, var->attrs, TRUE, &alignment );
  6716. + if (!is_string_type( var->attrs, var->declspec.type ))
  6717. + buffer_size = get_required_buffer_size_type( var->declspec.type, NULL, var->attrs, TRUE, &alignment );
  6718. - switch (typegen_detect_type( var->type, var->attrs, TDT_ALL_TYPES ))
  6719. + switch (typegen_detect_type( var->declspec.type, var->attrs, TDT_ALL_TYPES ))
  6720. {
  6721. case TGT_BASIC:
  6722. *flags |= IsBasetype;
  6723. - fc = get_basic_fc_signed( var->type );
  6724. + fc = get_basic_fc_signed( var->declspec.type );
  6725. if (fc == FC_BIND_PRIMITIVE)
  6726. {
  6727. buffer_size = 4; /* actually 0 but avoids setting MustSize */
  6728. @@ -991,7 +996,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
  6729. break;
  6730. case TGT_ENUM:
  6731. *flags |= IsBasetype;
  6732. - fc = get_enum_fc( var->type );
  6733. + fc = get_enum_fc( var->declspec.type );
  6734. break;
  6735. case TGT_RANGE:
  6736. *flags |= IsByValue;
  6737. @@ -1006,19 +1011,19 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
  6738. break;
  6739. case TGT_ARRAY:
  6740. *flags |= MustFree;
  6741. - if (type_array_is_decl_as_ptr(var->type) && var->type->details.array.ptr_tfsoff &&
  6742. - get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
  6743. + if (type_array_is_decl_as_ptr(var->declspec.type) && type_get_details(var->declspec.type)->array.ptr_tfsoff &&
  6744. + get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP)
  6745. {
  6746. - *typestring_offset = var->type->typestring_offset;
  6747. + *typestring_offset = var->declspec.type->typestring_offset;
  6748. *flags |= IsSimpleRef;
  6749. }
  6750. break;
  6751. case TGT_STRING:
  6752. *flags |= MustFree;
  6753. - if (is_declptr( var->type ) && get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
  6754. + if (is_declptr( var->declspec.type ) && get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP)
  6755. {
  6756. /* skip over pointer description straight to string description */
  6757. - if (is_conformant_array( var->type )) *typestring_offset += 4;
  6758. + if (is_conformant_array( var->declspec.type )) *typestring_offset += 4;
  6759. else *typestring_offset += 2;
  6760. *flags |= IsSimpleRef;
  6761. }
  6762. @@ -1031,9 +1036,9 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
  6763. buffer_size = 20;
  6764. break;
  6765. case TGT_POINTER:
  6766. - if (get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
  6767. + if (get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP)
  6768. {
  6769. - const type_t *ref = type_pointer_get_ref( var->type );
  6770. + const type_t *ref = type_pointer_get_ref_type( var->declspec.type );
  6771. if (!is_string_type( var->attrs, ref ))
  6772. buffer_size = get_required_buffer_size_type( ref, NULL, NULL, TRUE, &alignment );
  6773. @@ -1059,11 +1064,19 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
  6774. case TGT_UNION:
  6775. case TGT_USER_TYPE:
  6776. case TGT_RANGE:
  6777. - case TGT_ARRAY:
  6778. - *flags |= IsSimpleRef | MustFree;
  6779. + *flags |= MustFree | IsSimpleRef;
  6780. *typestring_offset = ref->typestring_offset;
  6781. if (!is_in && is_out) server_size = type_memsize( ref );
  6782. break;
  6783. + case TGT_ARRAY:
  6784. + *flags |= MustFree;
  6785. + if (!type_array_is_decl_as_ptr(ref))
  6786. + {
  6787. + *flags |= IsSimpleRef;
  6788. + *typestring_offset = ref->typestring_offset;
  6789. + }
  6790. + if (!is_in && is_out) server_size = type_memsize( ref );
  6791. + break;
  6792. case TGT_STRING:
  6793. case TGT_POINTER:
  6794. case TGT_CTXT_HANDLE:
  6795. @@ -1115,8 +1128,8 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
  6796. static unsigned char get_func_oi2_flags( const var_t *func )
  6797. {
  6798. const var_t *var;
  6799. - var_list_t *args = type_get_function_args( func->type );
  6800. - var_t *retval = type_function_get_retval( func->type );
  6801. + var_list_t *args = type_function_get_args( func->declspec.type );
  6802. + var_t *retval = type_function_get_retval( func->declspec.type );
  6803. unsigned char oi2_flags = 0x40; /* HasExtensions */
  6804. unsigned short flags;
  6805. unsigned int stack_size, typestring_offset;
  6806. @@ -1131,7 +1144,7 @@ static unsigned char get_func_oi2_flags( const var_t *func )
  6807. }
  6808. }
  6809. - if (!is_void( retval->type ))
  6810. + if (!is_void( retval->declspec.type ))
  6811. {
  6812. oi2_flags |= 0x04; /* HasRet */
  6813. get_parameter_fc( retval, 1, &flags, &stack_size, &typestring_offset );
  6814. @@ -1185,8 +1198,8 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
  6815. if (!is_in && !is_out) is_in = TRUE;
  6816. - if (type_get_type(var->type) == TYPE_BASIC ||
  6817. - type_get_type(var->type) == TYPE_ENUM)
  6818. + if (type_get_type(var->declspec.type) == TYPE_BASIC ||
  6819. + type_get_type(var->declspec.type) == TYPE_ENUM)
  6820. {
  6821. unsigned char fc;
  6822. @@ -1195,13 +1208,13 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
  6823. else
  6824. print_file(file, indent, "0x4e, /* FC_IN_PARAM_BASETYPE */\n");
  6825. - if (type_get_type(var->type) == TYPE_ENUM)
  6826. + if (type_get_type(var->declspec.type) == TYPE_ENUM)
  6827. {
  6828. - fc = get_enum_fc(var->type);
  6829. + fc = get_enum_fc(var->declspec.type);
  6830. }
  6831. else
  6832. {
  6833. - fc = get_basic_fc_signed(var->type);
  6834. + fc = get_basic_fc_signed(var->declspec.type);
  6835. if (fc == FC_BIND_PRIMITIVE)
  6836. fc = FC_IGNORE;
  6837. @@ -1215,10 +1228,12 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
  6838. {
  6839. unsigned short offset = var->typestring_offset;
  6840. - if (!is_interpreted && is_array(var->type) &&
  6841. - type_array_is_decl_as_ptr(var->type) &&
  6842. - var->type->details.array.ptr_tfsoff)
  6843. - offset = var->type->typestring_offset;
  6844. + if (!is_interpreted && is_array(var->declspec.type) &&
  6845. + type_array_is_decl_as_ptr(var->declspec.type) &&
  6846. + type_get_details(var->declspec.type)->array.ptr_tfsoff)
  6847. + {
  6848. + offset = var->declspec.type->typestring_offset;
  6849. + }
  6850. if (is_return)
  6851. print_file(file, indent, "0x52, /* FC_RETURN_PARAM */\n");
  6852. @@ -1241,8 +1256,8 @@ int is_interpreted_func( const type_t *iface, const var_t *func )
  6853. {
  6854. const char *str;
  6855. const var_t *var;
  6856. - const var_list_t *args = type_get_function_args( func->type );
  6857. - const type_t *ret_type = type_function_get_rettype( func->type );
  6858. + const var_list_t *args = type_function_get_args( func->declspec.type );
  6859. + const type_t *ret_type = type_function_get_rettype( func->declspec.type );
  6860. if (type_get_type( ret_type ) == TYPE_BASIC)
  6861. {
  6862. @@ -1264,10 +1279,10 @@ int is_interpreted_func( const type_t *iface, const var_t *func )
  6863. if (get_stub_mode() != MODE_Oif && args)
  6864. {
  6865. LIST_FOR_EACH_ENTRY( var, args, const var_t, entry )
  6866. - switch (type_get_type( var->type ))
  6867. + switch (type_get_type( var->declspec.type ))
  6868. {
  6869. case TYPE_BASIC:
  6870. - switch (type_basic_get_type( var->type ))
  6871. + switch (type_basic_get_type( var->declspec.type ))
  6872. {
  6873. /* floating point arguments are not supported in Oi mode */
  6874. case TYPE_BASIC_FLOAT: return 0;
  6875. @@ -1292,7 +1307,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
  6876. unsigned short num_proc )
  6877. {
  6878. var_t *var;
  6879. - var_list_t *args = type_get_function_args( func->type );
  6880. + var_list_t *args = type_function_get_args( func->declspec.type );
  6881. unsigned char explicit_fc, implicit_fc;
  6882. unsigned char handle_flags;
  6883. const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
  6884. @@ -1323,7 +1338,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
  6885. param_num++;
  6886. nb_args++;
  6887. }
  6888. - if (!is_void( type_function_get_rettype( func->type )))
  6889. + if (!is_void( type_function_get_rettype( func->declspec.type )))
  6890. {
  6891. stack_size += pointer_size;
  6892. nb_args++;
  6893. @@ -1351,22 +1366,22 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
  6894. *offset += 4;
  6895. break;
  6896. case FC_BIND_GENERIC:
  6897. - handle_flags = type_memsize( handle_var->type );
  6898. + handle_flags = type_memsize( handle_var->declspec.type );
  6899. print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) );
  6900. print_file( file, indent, "0x%02x,\n", handle_flags );
  6901. print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n",
  6902. handle_stack_offset, handle_stack_offset );
  6903. - print_file( file, indent, "0x%02x,\n", get_generic_handle_offset( handle_var->type ) );
  6904. + print_file( file, indent, "0x%02x,\n", get_generic_handle_offset( handle_var->declspec.type ) );
  6905. print_file( file, indent, "0x%x,\t/* FC_PAD */\n", FC_PAD);
  6906. *offset += 6;
  6907. break;
  6908. case FC_BIND_CONTEXT:
  6909. - handle_flags = get_contexthandle_flags( iface, handle_var->attrs, handle_var->type );
  6910. + handle_flags = get_contexthandle_flags( iface, handle_var->attrs, handle_var->declspec.type, 0 );
  6911. print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) );
  6912. print_file( file, indent, "0x%02x,\n", handle_flags );
  6913. print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n",
  6914. handle_stack_offset, handle_stack_offset );
  6915. - print_file( file, indent, "0x%02x,\n", get_context_handle_offset( handle_var->type ) );
  6916. + print_file( file, indent, "0x%02x,\n", get_context_handle_offset( handle_var->declspec.type ) );
  6917. print_file( file, indent, "0x%02x,\t/* param %hu */\n", handle_param_num, handle_param_num );
  6918. *offset += 6;
  6919. break;
  6920. @@ -1381,7 +1396,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
  6921. if (is_attr( func->attrs, ATTR_NOTIFY )) ext_flags |= 0x08; /* HasNotify */
  6922. if (is_attr( func->attrs, ATTR_NOTIFYFLAG )) ext_flags |= 0x10; /* HasNotify2 */
  6923. - if (iface == iface->details.iface->async_iface) oi2_flags |= 0x20;
  6924. + if (iface == type_get_const_details(iface)->iface->async_iface) oi2_flags |= 0x20;
  6925. size = get_function_buffer_size( func, PASS_IN );
  6926. print_file( file, indent, "NdrFcShort(0x%x),\t/* client buffer = %u */\n", size, size );
  6927. @@ -1402,9 +1417,9 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
  6928. if (is_object( iface )) pos += 2;
  6929. if (args) LIST_FOR_EACH_ENTRY( var, args, var_t, entry )
  6930. {
  6931. - if (type_get_type( var->type ) == TYPE_BASIC)
  6932. + if (type_get_type( var->declspec.type ) == TYPE_BASIC)
  6933. {
  6934. - switch (type_basic_get_type( var->type ))
  6935. + switch (type_basic_get_type( var->declspec.type ))
  6936. {
  6937. case TYPE_BASIC_FLOAT: fpu_mask |= 1 << pos; break;
  6938. case TYPE_BASIC_DOUBLE: fpu_mask |= 2 << pos; break;
  6939. @@ -1427,15 +1442,15 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i
  6940. unsigned int stack_offset = is_object( iface ) ? pointer_size : 0;
  6941. int is_interpreted = is_interpreted_func( iface, func );
  6942. int is_new_style = is_interpreted && (get_stub_mode() == MODE_Oif);
  6943. - var_t *retval = type_function_get_retval( func->type );
  6944. + var_t *retval = type_function_get_retval( func->declspec.type );
  6945. if (is_interpreted) write_proc_func_header( file, indent, iface, func, offset, num_proc );
  6946. /* emit argument data */
  6947. - if (type_get_function_args(func->type))
  6948. + if (type_function_get_args(func->declspec.type))
  6949. {
  6950. const var_t *var;
  6951. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  6952. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  6953. {
  6954. print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name );
  6955. if (is_new_style)
  6956. @@ -1446,7 +1461,7 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i
  6957. }
  6958. /* emit return value data */
  6959. - if (is_void(retval->type))
  6960. + if (is_void(retval->declspec.type))
  6961. {
  6962. if (!is_new_style)
  6963. {
  6964. @@ -1475,13 +1490,13 @@ static void for_each_iface(const statement_list_t *stmts,
  6965. if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
  6966. {
  6967. - if (stmt->type != STMT_TYPE || type_get_type(stmt->u.type) != TYPE_INTERFACE)
  6968. + if (stmt->type != STMT_TYPE || type_get_type_detect_alias(stmt->u.type) != TYPE_INTERFACE)
  6969. continue;
  6970. iface = stmt->u.type;
  6971. if (!pred(iface)) continue;
  6972. proc(iface, file, indent, offset);
  6973. - if (iface->details.iface->async_iface)
  6974. - proc(iface->details.iface->async_iface, file, indent, offset);
  6975. + if (type_get_const_details(iface)->iface->async_iface)
  6976. + proc(type_get_const_details(iface)->iface->async_iface, file, indent, offset);
  6977. }
  6978. }
  6979. @@ -1593,7 +1608,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
  6980. {
  6981. conftype = FC_TOP_LEVEL_CONFORMANCE;
  6982. conftype_string = "parameter";
  6983. - cont_type = current_func->type;
  6984. + cont_type = current_func->declspec.type;
  6985. name = current_func->name;
  6986. iface = current_iface;
  6987. }
  6988. @@ -1656,7 +1671,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
  6989. if (type_get_type(cont_type) == TYPE_FUNCTION)
  6990. {
  6991. - var_list_t *args = type_get_function_args( cont_type );
  6992. + var_list_t *args = type_function_get_args( cont_type );
  6993. if (is_object( iface )) offset += pointer_size;
  6994. if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry )
  6995. @@ -1664,7 +1679,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
  6996. if (var->name && !strcmp(var->name, subexpr->u.sval))
  6997. {
  6998. expr_loc.v = var;
  6999. - correlation_variable = var->type;
  7000. + correlation_variable = var->declspec.type;
  7001. break;
  7002. }
  7003. offset += get_stack_size( var, NULL );
  7004. @@ -1676,11 +1691,11 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
  7005. if (fields) LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
  7006. {
  7007. - unsigned int size = field_memsize( var->type, &offset );
  7008. + unsigned int size = field_memsize( var->declspec.type, &offset );
  7009. if (var->name && !strcmp(var->name, subexpr->u.sval))
  7010. {
  7011. expr_loc.v = var;
  7012. - correlation_variable = var->type;
  7013. + correlation_variable = var->declspec.type;
  7014. break;
  7015. }
  7016. offset += size;
  7017. @@ -1819,7 +1834,7 @@ static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align
  7018. LIST_FOR_EACH_ENTRY( v, fields, const var_t, entry )
  7019. {
  7020. unsigned int falign = 0;
  7021. - unsigned int fsize = type_memsize_and_alignment(v->type, &falign);
  7022. + unsigned int fsize = type_memsize_and_alignment(v->declspec.type, &falign);
  7023. if (*align < falign) *align = falign;
  7024. falign = clamp_align(falign);
  7025. size = ROUND_SIZE(size, falign);
  7026. @@ -1841,9 +1856,9 @@ static unsigned int union_memsize(const var_list_t *fields, unsigned int *pmaxa)
  7027. if (fields) LIST_FOR_EACH_ENTRY( v, fields, const var_t, entry )
  7028. {
  7029. /* we could have an empty default field with NULL type */
  7030. - if (v->type)
  7031. + if (v->declspec.type)
  7032. {
  7033. - size = type_memsize_and_alignment(v->type, &align);
  7034. + size = type_memsize_and_alignment(v->declspec.type, &align);
  7035. if (maxs < size) maxs = size;
  7036. if (*pmaxa < align) *pmaxa = align;
  7037. }
  7038. @@ -1931,12 +1946,12 @@ unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align)
  7039. {
  7040. if (is_conformant_array(t))
  7041. {
  7042. - type_memsize_and_alignment(type_array_get_element(t), align);
  7043. + type_memsize_and_alignment(type_array_get_element_type(t), align);
  7044. size = 0;
  7045. }
  7046. else
  7047. size = type_array_get_dim(t) *
  7048. - type_memsize_and_alignment(type_array_get_element(t), align);
  7049. + type_memsize_and_alignment(type_array_get_element_type(t), align);
  7050. }
  7051. else /* declared as a pointer */
  7052. {
  7053. @@ -2016,8 +2031,8 @@ static unsigned int type_buffer_alignment(const type_t *t)
  7054. if (!(fields = type_struct_get_fields(t))) break;
  7055. LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
  7056. {
  7057. - if (!var->type) continue;
  7058. - align = type_buffer_alignment( var->type );
  7059. + if (!var->declspec.type) continue;
  7060. + align = type_buffer_alignment( var->declspec.type );
  7061. if (max < align) max = align;
  7062. }
  7063. break;
  7064. @@ -2025,8 +2040,8 @@ static unsigned int type_buffer_alignment(const type_t *t)
  7065. if (!(fields = type_encapsulated_union_get_fields(t))) break;
  7066. LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
  7067. {
  7068. - if (!var->type) continue;
  7069. - align = type_buffer_alignment( var->type );
  7070. + if (!var->declspec.type) continue;
  7071. + align = type_buffer_alignment( var->declspec.type );
  7072. if (max < align) max = align;
  7073. }
  7074. break;
  7075. @@ -2034,14 +2049,14 @@ static unsigned int type_buffer_alignment(const type_t *t)
  7076. if (!(fields = type_union_get_cases(t))) break;
  7077. LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
  7078. {
  7079. - if (!var->type) continue;
  7080. - align = type_buffer_alignment( var->type );
  7081. + if (!var->declspec.type) continue;
  7082. + align = type_buffer_alignment( var->declspec.type );
  7083. if (max < align) max = align;
  7084. }
  7085. break;
  7086. case TYPE_ARRAY:
  7087. if (!type_array_is_decl_as_ptr(t))
  7088. - return type_buffer_alignment( type_array_get_element(t) );
  7089. + return type_buffer_alignment( type_array_get_element_type(t) );
  7090. /* else fall through */
  7091. case TYPE_POINTER:
  7092. return 4;
  7093. @@ -2064,12 +2079,12 @@ static unsigned int type_buffer_alignment(const type_t *t)
  7094. int is_full_pointer_function(const var_t *func)
  7095. {
  7096. const var_t *var;
  7097. - if (type_has_full_pointer(type_function_get_rettype(func->type), func->attrs, TRUE))
  7098. + if (type_has_full_pointer(type_function_get_rettype(func->declspec.type), func->attrs, TRUE))
  7099. return TRUE;
  7100. - if (!type_get_function_args(func->type))
  7101. + if (!type_function_get_args(func->declspec.type))
  7102. return FALSE;
  7103. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  7104. - if (type_has_full_pointer( var->type, var->attrs, TRUE ))
  7105. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  7106. + if (type_has_full_pointer( var->declspec.type, var->attrs, TRUE ))
  7107. return TRUE;
  7108. return FALSE;
  7109. }
  7110. @@ -2114,12 +2129,13 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
  7111. {
  7112. if (context == TYPE_CONTEXT_TOPLEVELPARAM && is_ptr(type) && pointer_type == FC_RP)
  7113. {
  7114. - switch (typegen_detect_type(type_pointer_get_ref(type), NULL, TDT_ALL_TYPES))
  7115. + switch (typegen_detect_type(type_pointer_get_ref_type(type), NULL, TDT_ALL_TYPES))
  7116. {
  7117. case TGT_STRING:
  7118. case TGT_POINTER:
  7119. case TGT_CTXT_HANDLE:
  7120. case TGT_CTXT_HANDLE_POINTER:
  7121. + case TGT_ARRAY:
  7122. flags |= FC_ALLOCED_ON_STACK;
  7123. break;
  7124. case TGT_IFACE_POINTER:
  7125. @@ -2134,7 +2150,7 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
  7126. if (is_ptr(type))
  7127. {
  7128. - type_t *ref = type_pointer_get_ref(type);
  7129. + type_t *ref = type_pointer_get_ref_type(type);
  7130. if(is_declptr(ref) && !is_user_type(ref))
  7131. flags |= FC_POINTER_DEREF;
  7132. }
  7133. @@ -2175,7 +2191,7 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs,
  7134. pointer_fc = get_pointer_fc_context(type, attrs, context);
  7135. - ref = type_pointer_get_ref(type);
  7136. + ref = type_pointer_get_ref_type(type);
  7137. if (type_get_type(ref) == TYPE_ENUM)
  7138. fc = get_enum_fc(ref);
  7139. else
  7140. @@ -2200,22 +2216,23 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs,
  7141. return 4;
  7142. }
  7143. -static void print_start_tfs_comment(FILE *file, type_t *t, unsigned int tfsoff)
  7144. +static void print_start_tfs_comment(FILE *file, const decl_spec_t *ds, unsigned int tfsoff)
  7145. {
  7146. print_file(file, 0, "/* %u (", tfsoff);
  7147. - write_type_decl(file, t, NULL);
  7148. + write_declspec_decl(file, ds, NULL);
  7149. print_file(file, 0, ") */\n");
  7150. }
  7151. static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs,
  7152. - type_t *type, unsigned int ref_offset,
  7153. + const decl_spec_t *declspec, unsigned int ref_offset,
  7154. enum type_context context,
  7155. unsigned int *typestring_offset)
  7156. {
  7157. unsigned int offset = *typestring_offset;
  7158. - type_t *ref = type_pointer_get_ref(type);
  7159. + type_t *type = declspec->type;
  7160. + type_t *ref = type_pointer_get_ref_type(type);
  7161. - print_start_tfs_comment(file, type, offset);
  7162. + print_start_tfs_comment(file, declspec, offset);
  7163. update_tfsoff(type, offset, file);
  7164. switch (typegen_detect_type(ref, attrs, TDT_ALL_TYPES))
  7165. @@ -2258,10 +2275,11 @@ static int user_type_has_variable_size(const type_t *t)
  7166. return FALSE;
  7167. }
  7168. -static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff)
  7169. +static unsigned int write_user_tfs(FILE *file, const decl_spec_t *declspec, unsigned int *tfsoff)
  7170. {
  7171. unsigned int start, absoff, flags;
  7172. const char *name = NULL;
  7173. + type_t *type = declspec->type;
  7174. type_t *utype = get_user_type(type, &name);
  7175. unsigned int usize = type_memsize(utype);
  7176. unsigned int ualign = type_buffer_alignment(utype);
  7177. @@ -2279,6 +2297,7 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof
  7178. type_get_type(utype) == TYPE_ENUM)
  7179. {
  7180. unsigned char fc;
  7181. + decl_spec_t ds;
  7182. if (type_get_type(utype) == TYPE_ENUM)
  7183. fc = get_enum_fc(utype);
  7184. @@ -2286,7 +2305,7 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof
  7185. fc = get_basic_fc(utype);
  7186. absoff = *tfsoff;
  7187. - print_start_tfs_comment(file, utype, absoff);
  7188. + print_start_tfs_comment(file, init_declspec(&ds, utype), absoff);
  7189. print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc));
  7190. print_file(file, 2, "0x5c,\t/* FC_PAD */\n");
  7191. *tfsoff += 2;
  7192. @@ -2294,7 +2313,10 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof
  7193. else
  7194. {
  7195. if (!processed(utype))
  7196. - write_embedded_types(file, NULL, utype, utype->name, TRUE, tfsoff);
  7197. + {
  7198. + decl_spec_t ds;
  7199. + write_embedded_types(file, NULL, init_declspec(&ds, utype), utype->name, TRUE, tfsoff);
  7200. + }
  7201. absoff = utype->typestring_offset;
  7202. }
  7203. @@ -2307,7 +2329,7 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof
  7204. start = *tfsoff;
  7205. update_tfsoff(type, start, file);
  7206. - print_start_tfs_comment(file, type, start);
  7207. + print_start_tfs_comment(file, declspec, start);
  7208. print_file(file, 2, "0x%x,\t/* FC_USER_MARSHAL */\n", FC_USER_MARSHAL);
  7209. print_file(file, 2, "0x%x,\t/* Alignment= %d, Flags= %02x */\n",
  7210. flags | (ualign - 1), ualign - 1, flags);
  7211. @@ -2364,11 +2386,12 @@ static void write_member_type(FILE *file, const type_t *cont,
  7212. static void write_array_element_type(FILE *file, const attr_list_t *attrs, const type_t *type,
  7213. int cont_is_complex, unsigned int *tfsoff)
  7214. {
  7215. - type_t *elem = type_array_get_element(type);
  7216. + const decl_spec_t *element = type_array_get_element(type);
  7217. + type_t *elem = element->type;
  7218. if (!is_embedded_complex(elem) && is_ptr(elem))
  7219. {
  7220. - type_t *ref = type_pointer_get_ref(elem);
  7221. + type_t *ref = type_pointer_get_ref_type(elem);
  7222. if (processed(ref))
  7223. {
  7224. @@ -2378,7 +2401,7 @@ static void write_array_element_type(FILE *file, const attr_list_t *attrs, const
  7225. }
  7226. if (cont_is_complex && is_string_type(attrs, elem))
  7227. {
  7228. - write_string_tfs(file, NULL, elem, TYPE_CONTEXT_CONTAINER, NULL, tfsoff);
  7229. + write_string_tfs(file, NULL, element, TYPE_CONTEXT_CONTAINER, NULL, tfsoff);
  7230. return;
  7231. }
  7232. if (!is_string_type(NULL, elem) &&
  7233. @@ -2410,7 +2433,7 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
  7234. if (fs) LIST_FOR_EACH_ENTRY(f, fs, var_t, entry)
  7235. {
  7236. - type_t *ft = f->type;
  7237. + type_t *ft = f->declspec.type;
  7238. unsigned int size = field_memsize( ft, &offset );
  7239. if (type_get_type(ft) == TYPE_UNION && is_attr(f->attrs, ATTR_SWITCHIS))
  7240. {
  7241. @@ -2433,13 +2456,14 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
  7242. }
  7243. static int write_pointer_description_offsets(
  7244. - FILE *file, const attr_list_t *attrs, type_t *type,
  7245. + FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  7246. unsigned int *offset_in_memory, unsigned int *offset_in_buffer,
  7247. unsigned int *typestring_offset)
  7248. {
  7249. + type_t *type = declspec->type;
  7250. int written = 0;
  7251. - if ((is_ptr(type) && type_get_type(type_pointer_get_ref(type)) != TYPE_INTERFACE) ||
  7252. + if ((is_ptr(type) && type_get_type(type_pointer_get_ref_type(type)) != TYPE_INTERFACE) ||
  7253. (is_array(type) && type_array_is_decl_as_ptr(type)))
  7254. {
  7255. if (offset_in_memory && offset_in_buffer)
  7256. @@ -2464,10 +2488,10 @@ static int write_pointer_description_offsets(
  7257. if (is_ptr(type))
  7258. {
  7259. - type_t *ref = type_pointer_get_ref(type);
  7260. + type_t *ref = type_pointer_get_ref_type(type);
  7261. if (is_string_type(attrs, type))
  7262. - write_string_tfs(file, attrs, type, TYPE_CONTEXT_CONTAINER, NULL, typestring_offset);
  7263. + write_string_tfs(file, attrs, declspec, TYPE_CONTEXT_CONTAINER, NULL, typestring_offset);
  7264. else if (processed(ref))
  7265. write_nonsimple_pointer(file, attrs, type, TYPE_CONTEXT_CONTAINER,
  7266. ref->typestring_offset, typestring_offset);
  7267. @@ -2505,13 +2529,13 @@ static int write_pointer_description_offsets(
  7268. {
  7269. unsigned int padding;
  7270. unsigned int align = 0;
  7271. - type_memsize_and_alignment(v->type, &align);
  7272. + type_memsize_and_alignment(v->declspec.type, &align);
  7273. padding = ROUNDING(*offset_in_memory, align);
  7274. *offset_in_memory += padding;
  7275. *offset_in_buffer += padding;
  7276. }
  7277. written += write_pointer_description_offsets(
  7278. - file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
  7279. + file, v->attrs, &v->declspec, offset_in_memory, offset_in_buffer,
  7280. typestring_offset);
  7281. }
  7282. }
  7283. @@ -2531,10 +2555,11 @@ static int write_pointer_description_offsets(
  7284. }
  7285. static int write_no_repeat_pointer_descriptions(
  7286. - FILE *file, const attr_list_t *attrs, type_t *type,
  7287. + FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  7288. unsigned int *offset_in_memory, unsigned int *offset_in_buffer,
  7289. unsigned int *typestring_offset)
  7290. {
  7291. + type_t *type = declspec->type;
  7292. int written = 0;
  7293. if (is_ptr(type) ||
  7294. @@ -2544,7 +2569,7 @@ static int write_no_repeat_pointer_descriptions(
  7295. print_file(file, 2, "0x%02x, /* FC_PAD */\n", FC_PAD);
  7296. *typestring_offset += 2;
  7297. - return write_pointer_description_offsets(file, attrs, type,
  7298. + return write_pointer_description_offsets(file, attrs, declspec,
  7299. offset_in_memory, offset_in_buffer, typestring_offset);
  7300. }
  7301. @@ -2557,13 +2582,13 @@ static int write_no_repeat_pointer_descriptions(
  7302. {
  7303. unsigned int padding;
  7304. unsigned int align = 0;
  7305. - type_memsize_and_alignment(v->type, &align);
  7306. + type_memsize_and_alignment(v->declspec.type, &align);
  7307. padding = ROUNDING(*offset_in_memory, align);
  7308. *offset_in_memory += padding;
  7309. *offset_in_buffer += padding;
  7310. }
  7311. written += write_no_repeat_pointer_descriptions(
  7312. - file, v->attrs, v->type,
  7313. + file, v->attrs, &v->declspec,
  7314. offset_in_memory, offset_in_buffer, typestring_offset);
  7315. }
  7316. }
  7317. @@ -2582,10 +2607,11 @@ static int write_no_repeat_pointer_descriptions(
  7318. /* Note: if file is NULL return value is number of pointers to write, else
  7319. * it is the number of type format characters written */
  7320. static int write_fixed_array_pointer_descriptions(
  7321. - FILE *file, const attr_list_t *attrs, type_t *type,
  7322. + FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  7323. unsigned int *offset_in_memory, unsigned int *offset_in_buffer,
  7324. unsigned int *typestring_offset)
  7325. {
  7326. + type_t *type = declspec->type;
  7327. int pointer_count = 0;
  7328. if (type_get_type(type) == TYPE_ARRAY &&
  7329. @@ -2602,7 +2628,7 @@ static int write_fixed_array_pointer_descriptions(
  7330. unsigned int offset_of_array_pointer_mem = 0;
  7331. unsigned int offset_of_array_pointer_buf = 0;
  7332. - increment_size = type_memsize(type_array_get_element(type));
  7333. + increment_size = type_memsize(type_array_get_element_type(type));
  7334. print_file(file, 2, "0x%02x, /* FC_FIXED_REPEAT */\n", FC_FIXED_REPEAT);
  7335. print_file(file, 2, "0x%02x, /* FC_PAD */\n", FC_PAD);
  7336. @@ -2613,7 +2639,7 @@ static int write_fixed_array_pointer_descriptions(
  7337. *typestring_offset += 10;
  7338. pointer_count = write_pointer_description_offsets(
  7339. - file, attrs, type, &offset_of_array_pointer_mem,
  7340. + file, attrs, declspec, &offset_of_array_pointer_mem,
  7341. &offset_of_array_pointer_buf, typestring_offset);
  7342. }
  7343. }
  7344. @@ -2626,13 +2652,13 @@ static int write_fixed_array_pointer_descriptions(
  7345. {
  7346. unsigned int padding;
  7347. unsigned int align = 0;
  7348. - type_memsize_and_alignment(v->type, &align);
  7349. + type_memsize_and_alignment(v->declspec.type, &align);
  7350. padding = ROUNDING(*offset_in_memory, align);
  7351. *offset_in_memory += padding;
  7352. *offset_in_buffer += padding;
  7353. }
  7354. pointer_count += write_fixed_array_pointer_descriptions(
  7355. - file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
  7356. + file, v->attrs, &v->declspec, offset_in_memory, offset_in_buffer,
  7357. typestring_offset);
  7358. }
  7359. }
  7360. @@ -2673,7 +2699,7 @@ static int write_conformant_array_pointer_descriptions(
  7361. unsigned int offset_of_array_pointer_mem = offset_in_memory;
  7362. unsigned int offset_of_array_pointer_buf = offset_in_memory;
  7363. - increment_size = type_memsize(type_array_get_element(type));
  7364. + increment_size = type_memsize(type_array_get_element_type(type));
  7365. if (increment_size > USHRT_MAX)
  7366. error("array size of %u bytes is too large\n", increment_size);
  7367. @@ -2715,7 +2741,7 @@ static int write_varying_array_pointer_descriptions(
  7368. {
  7369. unsigned int increment_size;
  7370. - increment_size = type_memsize(type_array_get_element(type));
  7371. + increment_size = type_memsize(type_array_get_element_type(type));
  7372. if (increment_size > USHRT_MAX)
  7373. error("array size of %u bytes is too large\n", increment_size);
  7374. @@ -2741,20 +2767,20 @@ static int write_varying_array_pointer_descriptions(
  7375. {
  7376. unsigned int align = 0, padding;
  7377. - if (is_array(v->type) && type_array_has_variance(v->type))
  7378. + if (is_array(v->declspec.type) && type_array_has_variance(v->declspec.type))
  7379. {
  7380. *offset_in_buffer = ROUND_SIZE(*offset_in_buffer, 4);
  7381. /* skip over variance and offset in buffer */
  7382. *offset_in_buffer += 8;
  7383. }
  7384. - type_memsize_and_alignment(v->type, &align);
  7385. + type_memsize_and_alignment(v->declspec.type, &align);
  7386. padding = ROUNDING(*offset_in_memory, align);
  7387. *offset_in_memory += padding;
  7388. *offset_in_buffer += padding;
  7389. }
  7390. pointer_count += write_varying_array_pointer_descriptions(
  7391. - file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
  7392. + file, v->attrs, v->declspec.type, offset_in_memory, offset_in_buffer,
  7393. typestring_offset);
  7394. }
  7395. }
  7396. @@ -2773,9 +2799,10 @@ static int write_varying_array_pointer_descriptions(
  7397. return pointer_count;
  7398. }
  7399. -static void write_pointer_description(FILE *file, const attr_list_t *attrs, type_t *type,
  7400. +static void write_pointer_description(FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  7401. unsigned int *typestring_offset)
  7402. {
  7403. + type_t *type = declspec->type;
  7404. unsigned int offset_in_buffer;
  7405. unsigned int offset_in_memory;
  7406. @@ -2786,7 +2813,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type
  7407. offset_in_memory = 0;
  7408. offset_in_buffer = 0;
  7409. write_no_repeat_pointer_descriptions(
  7410. - file, NULL, type,
  7411. + file, NULL, declspec,
  7412. &offset_in_memory, &offset_in_buffer, typestring_offset);
  7413. }
  7414. @@ -2794,7 +2821,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type
  7415. offset_in_memory = 0;
  7416. offset_in_buffer = 0;
  7417. write_fixed_array_pointer_descriptions(
  7418. - file, NULL, type,
  7419. + file, NULL, declspec,
  7420. &offset_in_memory, &offset_in_buffer, typestring_offset);
  7421. /* pass 3: search for pointers in conformant only arrays (but don't descend
  7422. @@ -2806,7 +2833,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type
  7423. else if (type_get_type(type) == TYPE_STRUCT &&
  7424. get_struct_fc(type) == FC_CPSTRUCT)
  7425. {
  7426. - type_t *carray = find_array_or_string_in_struct(type)->type;
  7427. + type_t *carray = find_array_or_string_in_struct(type)->declspec.type;
  7428. write_conformant_array_pointer_descriptions( file, NULL, carray,
  7429. type_memsize(type), typestring_offset);
  7430. }
  7431. @@ -2820,9 +2847,10 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type
  7432. }
  7433. static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
  7434. - type_t *type, enum type_context context,
  7435. + const decl_spec_t *declspec, enum type_context context,
  7436. const char *name, unsigned int *typestring_offset)
  7437. {
  7438. + type_t *type = declspec->type;
  7439. unsigned int start_offset;
  7440. unsigned char rtype;
  7441. type_t *elem_type;
  7442. @@ -2836,7 +2864,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
  7443. int pointer_type = get_pointer_fc_context(type, attrs, context);
  7444. if (!pointer_type)
  7445. pointer_type = FC_RP;
  7446. - print_start_tfs_comment(file, type, *typestring_offset);
  7447. + print_start_tfs_comment(file, declspec, *typestring_offset);
  7448. print_file(file, 2,"0x%x, 0x%x,\t/* %s%s */\n",
  7449. pointer_type, flag, string_of_type(pointer_type),
  7450. flag ? " [simple_pointer]" : "");
  7451. @@ -2850,12 +2878,12 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
  7452. }
  7453. if (is_array(type))
  7454. - elem_type = type_array_get_element(type);
  7455. + elem_type = type_array_get_element_type(type);
  7456. else
  7457. - elem_type = type_pointer_get_ref(type);
  7458. + elem_type = type_pointer_get_ref_type(type);
  7459. if (type_get_type(elem_type) == TYPE_POINTER && is_array(type))
  7460. - return write_array_tfs(file, attrs, type, name, typestring_offset);
  7461. + return write_array_tfs(file, attrs, declspec, name, typestring_offset);
  7462. if (type_get_type(elem_type) != TYPE_BASIC)
  7463. {
  7464. @@ -2929,34 +2957,31 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
  7465. }
  7466. }
  7467. -static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type,
  7468. +static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  7469. const char *name, unsigned int *typestring_offset)
  7470. {
  7471. + type_t *type = declspec->type;
  7472. const expr_t *length_is = type_array_get_variance(type);
  7473. const expr_t *size_is = type_array_get_conformance(type);
  7474. unsigned int align;
  7475. unsigned int size;
  7476. unsigned int start_offset;
  7477. unsigned char fc;
  7478. - int pointer_type = get_attrv(attrs, ATTR_POINTERTYPE);
  7479. unsigned int baseoff
  7480. = !type_array_is_decl_as_ptr(type) && current_structure
  7481. ? type_memsize(current_structure)
  7482. : 0;
  7483. - if (!pointer_type)
  7484. - pointer_type = FC_RP;
  7485. -
  7486. - if (!is_string_type(attrs, type_array_get_element(type)))
  7487. + if (!is_string_type(attrs, type_array_get_element_type(type)))
  7488. write_embedded_types(file, attrs, type_array_get_element(type), name, FALSE, typestring_offset);
  7489. - size = type_memsize(is_conformant_array(type) ? type_array_get_element(type) : type);
  7490. - align = type_buffer_alignment(is_conformant_array(type) ? type_array_get_element(type) : type);
  7491. + size = type_memsize(is_conformant_array(type) ? type_array_get_element_type(type) : type);
  7492. + align = type_buffer_alignment(is_conformant_array(type) ? type_array_get_element_type(type) : type);
  7493. fc = get_array_fc(type);
  7494. start_offset = *typestring_offset;
  7495. update_tfsoff(type, start_offset, file);
  7496. - print_start_tfs_comment(file, type, start_offset);
  7497. + print_start_tfs_comment(file, declspec, start_offset);
  7498. print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc));
  7499. print_file(file, 2, "0x%x,\t/* %d */\n", align - 1, align - 1);
  7500. *typestring_offset += 2;
  7501. @@ -2982,7 +3007,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
  7502. if (fc == FC_SMVARRAY || fc == FC_LGVARRAY)
  7503. {
  7504. - unsigned int elsize = type_memsize(type_array_get_element(type));
  7505. + unsigned int elsize = type_memsize(type_array_get_element_type(type));
  7506. unsigned int dim = type_array_get_dim(type);
  7507. if (fc == FC_LGVARRAY)
  7508. @@ -3005,13 +3030,13 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
  7509. += write_conf_or_var_desc(file, current_structure, baseoff,
  7510. type, length_is);
  7511. - if (type_has_pointers(type_array_get_element(type)) &&
  7512. + if (type_has_pointers(type_array_get_element_type(type)) &&
  7513. (type_array_is_decl_as_ptr(type) || !current_structure))
  7514. {
  7515. print_file(file, 2, "0x%x,\t/* FC_PP */\n", FC_PP);
  7516. print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD);
  7517. *typestring_offset += 2;
  7518. - write_pointer_description(file, is_string_type(attrs, type) ? attrs : NULL, type, typestring_offset);
  7519. + write_pointer_description(file, is_string_type(attrs, type) ? attrs : NULL, declspec, typestring_offset);
  7520. print_file(file, 2, "0x%x,\t/* FC_END */\n", FC_END);
  7521. *typestring_offset += 1;
  7522. }
  7523. @@ -3048,7 +3073,7 @@ static const var_t *find_array_or_string_in_struct(const type_t *type)
  7524. return NULL;
  7525. last_field = LIST_ENTRY( list_tail(fields), const var_t, entry );
  7526. - ft = last_field->type;
  7527. + ft = last_field->declspec.type;
  7528. if (is_conformant_array(ft) && !type_array_is_decl_as_ptr(ft))
  7529. return last_field;
  7530. @@ -3071,7 +3096,7 @@ static void write_struct_members(FILE *file, const type_t *type,
  7531. if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
  7532. {
  7533. - type_t *ft = field->type;
  7534. + type_t *ft = field->declspec.type;
  7535. unsigned int align = 0;
  7536. unsigned int size = type_memsize_and_alignment(ft, &align);
  7537. align = clamp_align(align);
  7538. @@ -3100,7 +3125,7 @@ static void write_struct_members(FILE *file, const type_t *type,
  7539. offset = ROUND_SIZE(offset, align);
  7540. *typestring_offset += 1;
  7541. }
  7542. - write_member_type(file, type, is_complex, field->attrs, field->type, corroff,
  7543. + write_member_type(file, type, is_complex, field->attrs, field->declspec.type, corroff,
  7544. typestring_offset);
  7545. offset += size;
  7546. }
  7547. @@ -3118,9 +3143,10 @@ static void write_struct_members(FILE *file, const type_t *type,
  7548. write_end(file, typestring_offset);
  7549. }
  7550. -static unsigned int write_struct_tfs(FILE *file, type_t *type,
  7551. +static unsigned int write_struct_tfs(FILE *file, const decl_spec_t *declspec,
  7552. const char *name, unsigned int *tfsoff)
  7553. {
  7554. + type_t *type = declspec->type;
  7555. const type_t *save_current_structure = current_structure;
  7556. unsigned int total_size;
  7557. const var_t *array;
  7558. @@ -3143,15 +3169,15 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
  7559. name, USHRT_MAX, total_size - USHRT_MAX);
  7560. if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
  7561. - write_embedded_types(file, f->attrs, f->type, f->name, FALSE, tfsoff);
  7562. + write_embedded_types(file, f->attrs, &f->declspec, f->name, FALSE, tfsoff);
  7563. array = find_array_or_string_in_struct(type);
  7564. - if (array && !processed(array->type))
  7565. + if (array && !processed(array->declspec.type))
  7566. {
  7567. - if(is_string_type(array->attrs, array->type))
  7568. - write_string_tfs(file, array->attrs, array->type, TYPE_CONTEXT_CONTAINER, array->name, tfsoff);
  7569. + if(is_string_type(array->attrs, array->declspec.type))
  7570. + write_string_tfs(file, array->attrs, &array->declspec, TYPE_CONTEXT_CONTAINER, array->name, tfsoff);
  7571. else
  7572. - write_array_tfs(file, array->attrs, array->type, array->name, tfsoff);
  7573. + write_array_tfs(file, array->attrs, &array->declspec, array->name, tfsoff);
  7574. }
  7575. corroff = *tfsoff;
  7576. @@ -3159,7 +3185,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
  7577. start_offset = *tfsoff;
  7578. update_tfsoff(type, start_offset, file);
  7579. - print_start_tfs_comment(file, type, start_offset);
  7580. + print_start_tfs_comment(file, declspec, start_offset);
  7581. print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc));
  7582. print_file(file, 2, "0x%x,\t/* %d */\n", align - 1, align - 1);
  7583. print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)total_size, total_size);
  7584. @@ -3167,7 +3193,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
  7585. if (array)
  7586. {
  7587. - unsigned int absoff = array->type->typestring_offset;
  7588. + unsigned int absoff = array->declspec.type->typestring_offset;
  7589. short reloff = absoff - *tfsoff;
  7590. print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n",
  7591. reloff, reloff, absoff);
  7592. @@ -3198,7 +3224,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
  7593. print_file(file, 2, "0x%x,\t/* FC_PP */\n", FC_PP);
  7594. print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD);
  7595. *tfsoff += 2;
  7596. - write_pointer_description(file, NULL, type, tfsoff);
  7597. + write_pointer_description(file, NULL, declspec, tfsoff);
  7598. print_file(file, 2, "0x%x,\t/* FC_END */\n", FC_END);
  7599. *tfsoff += 1;
  7600. }
  7601. @@ -3213,15 +3239,16 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
  7602. type->ptrdesc = *tfsoff;
  7603. if (fields) LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry)
  7604. {
  7605. - type_t *ft = f->type;
  7606. + const decl_spec_t *fds = &f->declspec;
  7607. + type_t *ft = fds->type;
  7608. switch (typegen_detect_type(ft, f->attrs, TDT_IGNORE_STRINGS))
  7609. {
  7610. case TGT_POINTER:
  7611. if (is_string_type(f->attrs, ft))
  7612. - write_string_tfs(file, f->attrs, ft, TYPE_CONTEXT_CONTAINER, f->name, tfsoff);
  7613. + write_string_tfs(file, f->attrs, fds, TYPE_CONTEXT_CONTAINER, f->name, tfsoff);
  7614. else
  7615. - write_pointer_tfs(file, f->attrs, ft,
  7616. - type_pointer_get_ref(ft)->typestring_offset,
  7617. + write_pointer_tfs(file, f->attrs, fds,
  7618. + type_pointer_get_ref_type(ft)->typestring_offset,
  7619. TYPE_CONTEXT_CONTAINER, tfsoff);
  7620. break;
  7621. case TGT_ARRAY:
  7622. @@ -3283,8 +3310,9 @@ static void write_branch_type(FILE *file, const type_t *t, unsigned int *tfsoff)
  7623. }
  7624. static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
  7625. - type_t *type, unsigned int *tfsoff)
  7626. + const decl_spec_t *declspec, unsigned int *tfsoff)
  7627. {
  7628. + type_t* type = declspec->type;
  7629. unsigned int start_offset;
  7630. unsigned int size;
  7631. var_list_t *fields;
  7632. @@ -3309,17 +3337,17 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
  7633. expr_list_t *cases = get_attrp(f->attrs, ATTR_CASE);
  7634. if (cases)
  7635. nbranch += list_count(cases);
  7636. - if (f->type)
  7637. - write_embedded_types(file, f->attrs, f->type, f->name, TRUE, tfsoff);
  7638. + if (f->declspec.type)
  7639. + write_embedded_types(file, f->attrs, &f->declspec, f->name, TRUE, tfsoff);
  7640. }
  7641. start_offset = *tfsoff;
  7642. update_tfsoff(type, start_offset, file);
  7643. - print_start_tfs_comment(file, type, start_offset);
  7644. + print_start_tfs_comment(file, declspec, start_offset);
  7645. if (type_get_type(type) == TYPE_ENCAPSULATED_UNION)
  7646. {
  7647. const var_t *sv = type_union_get_switch_value(type);
  7648. - const type_t *st = sv->type;
  7649. + const type_t *st = sv->declspec.type;
  7650. unsigned int align = 0;
  7651. unsigned char fc;
  7652. @@ -3351,8 +3379,8 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
  7653. type_memsize_and_alignment(st, &align);
  7654. if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
  7655. {
  7656. - if (f->type)
  7657. - type_memsize_and_alignment(f->type, &align);
  7658. + if (f->declspec.type)
  7659. + type_memsize_and_alignment(f->declspec.type, &align);
  7660. }
  7661. print_file(file, 2, "0x%x,\t/* FC_ENCAPSULATED_UNION */\n", FC_ENCAPSULATED_UNION);
  7662. @@ -3407,7 +3435,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
  7663. if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
  7664. {
  7665. - type_t *ft = f->type;
  7666. + type_t *ft = f->declspec.type;
  7667. expr_list_t *cases = get_attrp(f->attrs, ATTR_CASE);
  7668. int deflt = is_attr(f->attrs, ATTR_DEFAULT);
  7669. expr_t *c;
  7670. @@ -3448,16 +3476,17 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
  7671. return start_offset;
  7672. }
  7673. -static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *type,
  7674. +static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  7675. unsigned int *typeformat_offset)
  7676. {
  7677. unsigned int i;
  7678. + type_t *type = declspec->type;
  7679. unsigned int start_offset = *typeformat_offset;
  7680. expr_t *iid = get_attrp(attrs, ATTR_IIDIS);
  7681. if (!iid && processed(type)) return type->typestring_offset;
  7682. - print_start_tfs_comment(file, type, start_offset);
  7683. + print_start_tfs_comment(file, declspec, start_offset);
  7684. update_tfsoff(type, start_offset, file);
  7685. if (iid)
  7686. @@ -3469,7 +3498,7 @@ static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *t
  7687. }
  7688. else
  7689. {
  7690. - const type_t *base = is_ptr(type) ? type_pointer_get_ref(type) : type;
  7691. + const type_t *base = is_ptr(type) ? type_pointer_get_ref_type(type) : type;
  7692. const UUID *uuid = get_attrp(base->attrs, ATTR_UUID);
  7693. if (! uuid)
  7694. @@ -3493,18 +3522,19 @@ static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *t
  7695. static unsigned int write_contexthandle_tfs(FILE *file,
  7696. const attr_list_t *attrs,
  7697. - type_t *type,
  7698. - int toplevel_param,
  7699. + const decl_spec_t *declspec,
  7700. + enum type_context context,
  7701. unsigned int *typeformat_offset)
  7702. {
  7703. + type_t *type = declspec->type;
  7704. unsigned int start_offset = *typeformat_offset;
  7705. - unsigned char flags = get_contexthandle_flags( current_iface, attrs, type );
  7706. + unsigned char flags = get_contexthandle_flags( current_iface, attrs, type, context == TYPE_CONTEXT_RETVAL );
  7707. - print_start_tfs_comment(file, type, start_offset);
  7708. + print_start_tfs_comment(file, declspec, start_offset);
  7709. if (flags & 0x80) /* via ptr */
  7710. {
  7711. - int pointer_type = get_pointer_fc( type, attrs, toplevel_param );
  7712. + int pointer_type = get_pointer_fc( type, attrs, context == TYPE_CONTEXT_TOPLEVELPARAM );
  7713. if (!pointer_type) pointer_type = FC_RP;
  7714. *typeformat_offset += 4;
  7715. print_file(file, 2,"0x%x, 0x0,\t/* %s */\n", pointer_type, string_of_type(pointer_type) );
  7716. @@ -3514,8 +3544,7 @@ static unsigned int write_contexthandle_tfs(FILE *file,
  7717. print_file(file, 2, "0x%02x,\t/* FC_BIND_CONTEXT */\n", FC_BIND_CONTEXT);
  7718. print_file(file, 2, "0x%x,\t/* Context flags: ", flags);
  7719. - /* return and can't be null values overlap */
  7720. - if (((flags & 0x21) != 0x21) && (flags & NDR_CONTEXT_HANDLE_CANNOT_BE_NULL))
  7721. + if (flags & NDR_CONTEXT_HANDLE_CANNOT_BE_NULL)
  7722. print_file(file, 0, "can't be null, ");
  7723. if (flags & NDR_CONTEXT_HANDLE_SERIALIZE)
  7724. print_file(file, 0, "serialize, ");
  7725. @@ -3523,13 +3552,13 @@ static unsigned int write_contexthandle_tfs(FILE *file,
  7726. print_file(file, 0, "no serialize, ");
  7727. if (flags & NDR_STRICT_CONTEXT_HANDLE)
  7728. print_file(file, 0, "strict, ");
  7729. - if ((flags & 0x21) == 0x20)
  7730. - print_file(file, 0, "out, ");
  7731. - if ((flags & 0x21) == 0x21)
  7732. + if (flags & HANDLE_PARAM_IS_RETURN)
  7733. print_file(file, 0, "return, ");
  7734. - if (flags & 0x40)
  7735. + if (flags & HANDLE_PARAM_IS_OUT)
  7736. + print_file(file, 0, "out, ");
  7737. + if (flags & HANDLE_PARAM_IS_IN)
  7738. print_file(file, 0, "in, ");
  7739. - if (flags & 0x80)
  7740. + if (flags & HANDLE_PARAM_IS_VIA_PTR)
  7741. print_file(file, 0, "via ptr, ");
  7742. print_file(file, 0, "*/\n");
  7743. print_file(file, 2, "0x%x,\t/* rundown routine */\n", get_context_handle_offset( type ));
  7744. @@ -3568,24 +3597,23 @@ static unsigned int write_range_tfs(FILE *file, const attr_list_t *attrs,
  7745. return start_offset;
  7746. }
  7747. -static unsigned int write_type_tfs(FILE *file, int indent,
  7748. - const attr_list_t *attrs, type_t *type,
  7749. - const char *name,
  7750. +static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs,
  7751. + const decl_spec_t *declspec, const char *name,
  7752. enum type_context context,
  7753. unsigned int *typeformat_offset)
  7754. {
  7755. unsigned int offset;
  7756. + type_t *type = declspec->type;
  7757. switch (typegen_detect_type(type, attrs, TDT_ALL_TYPES))
  7758. {
  7759. case TGT_CTXT_HANDLE:
  7760. case TGT_CTXT_HANDLE_POINTER:
  7761. - return write_contexthandle_tfs(file, attrs, type,
  7762. - context == TYPE_CONTEXT_TOPLEVELPARAM, typeformat_offset);
  7763. + return write_contexthandle_tfs(file, attrs, declspec, context, typeformat_offset);
  7764. case TGT_USER_TYPE:
  7765. - return write_user_tfs(file, type, typeformat_offset);
  7766. + return write_user_tfs(file, declspec, typeformat_offset);
  7767. case TGT_STRING:
  7768. - return write_string_tfs(file, attrs, type, context, name, typeformat_offset);
  7769. + return write_string_tfs(file, attrs, declspec, context, name, typeformat_offset);
  7770. case TGT_ARRAY:
  7771. {
  7772. unsigned int off;
  7773. @@ -3593,15 +3621,14 @@ static unsigned int write_type_tfs(FILE *file, int indent,
  7774. if ((context != TYPE_CONTEXT_CONTAINER &&
  7775. context != TYPE_CONTEXT_CONTAINER_NO_POINTERS) ||
  7776. !is_conformant_array(type) || type_array_is_decl_as_ptr(type))
  7777. - off = write_array_tfs(file, attrs, type, name, typeformat_offset);
  7778. + off = write_array_tfs(file, attrs, declspec, name, typeformat_offset);
  7779. else
  7780. off = 0;
  7781. if (context != TYPE_CONTEXT_CONTAINER &&
  7782. context != TYPE_CONTEXT_CONTAINER_NO_POINTERS)
  7783. {
  7784. int ptr_type;
  7785. - ptr_type = get_pointer_fc(type, attrs,
  7786. - context == TYPE_CONTEXT_TOPLEVELPARAM);
  7787. + ptr_type = get_pointer_fc_context(type, attrs, context);
  7788. if (ptr_type != FC_RP || type_array_is_decl_as_ptr(type))
  7789. {
  7790. unsigned int absoff = type->typestring_offset;
  7791. @@ -3615,14 +3642,14 @@ static unsigned int write_type_tfs(FILE *file, int indent,
  7792. if (ptr_type != FC_RP) update_tfsoff( type, off, file );
  7793. *typeformat_offset += 4;
  7794. }
  7795. - type->details.array.ptr_tfsoff = off;
  7796. + type_get_details(type)->array.ptr_tfsoff = off;
  7797. }
  7798. return off;
  7799. }
  7800. case TGT_STRUCT:
  7801. - return write_struct_tfs(file, type, name, typeformat_offset);
  7802. + return write_struct_tfs(file, declspec, name, typeformat_offset);
  7803. case TGT_UNION:
  7804. - return write_union_tfs(file, attrs, type, typeformat_offset);
  7805. + return write_union_tfs(file, attrs, declspec, typeformat_offset);
  7806. case TGT_ENUM:
  7807. case TGT_BASIC:
  7808. /* nothing to do */
  7809. @@ -3635,11 +3662,11 @@ static unsigned int write_type_tfs(FILE *file, int indent,
  7810. return write_range_tfs(file, attrs, type, range_list, typeformat_offset);
  7811. }
  7812. case TGT_IFACE_POINTER:
  7813. - return write_ip_tfs(file, attrs, type, typeformat_offset);
  7814. + return write_ip_tfs(file, attrs, declspec, typeformat_offset);
  7815. case TGT_POINTER:
  7816. {
  7817. enum type_context ref_context;
  7818. - type_t *ref = type_pointer_get_ref(type);
  7819. + const decl_spec_t *ref = type_pointer_get_ref(type);
  7820. if (context == TYPE_CONTEXT_TOPLEVELPARAM)
  7821. ref_context = TYPE_CONTEXT_PARAM;
  7822. @@ -3648,22 +3675,22 @@ static unsigned int write_type_tfs(FILE *file, int indent,
  7823. else
  7824. ref_context = context;
  7825. - if (is_string_type(attrs, ref))
  7826. + if (is_string_type(attrs, ref->type))
  7827. {
  7828. if (context != TYPE_CONTEXT_CONTAINER_NO_POINTERS)
  7829. - write_pointer_tfs(file, attrs, type, *typeformat_offset + 4, context, typeformat_offset);
  7830. + write_pointer_tfs(file, attrs, declspec, *typeformat_offset + 4, context, typeformat_offset);
  7831. - offset = write_type_tfs(file, indent, attrs, ref, name, ref_context, typeformat_offset);
  7832. + offset = write_type_tfs(file, attrs, ref, name, ref_context, typeformat_offset);
  7833. if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS)
  7834. return 0;
  7835. return offset;
  7836. }
  7837. - offset = write_type_tfs( file, indent, attrs, type_pointer_get_ref(type), name,
  7838. + offset = write_type_tfs( file, attrs, type_pointer_get_ref(type), name,
  7839. ref_context, typeformat_offset);
  7840. if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS)
  7841. return 0;
  7842. - return write_pointer_tfs(file, attrs, type, offset, context, typeformat_offset);
  7843. + return write_pointer_tfs(file, attrs, declspec, offset, context, typeformat_offset);
  7844. }
  7845. case TGT_INVALID:
  7846. break;
  7847. @@ -3672,10 +3699,10 @@ static unsigned int write_type_tfs(FILE *file, int indent,
  7848. return 0;
  7849. }
  7850. -static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type,
  7851. +static int write_embedded_types(FILE *file, const attr_list_t *attrs, const decl_spec_t *declspec,
  7852. const char *name, int write_ptr, unsigned int *tfsoff)
  7853. {
  7854. - return write_type_tfs(file, 2, attrs, type, name, write_ptr ? TYPE_CONTEXT_CONTAINER : TYPE_CONTEXT_CONTAINER_NO_POINTERS, tfsoff);
  7855. + return write_type_tfs(file, attrs, declspec, name, write_ptr ? TYPE_CONTEXT_CONTAINER : TYPE_CONTEXT_CONTAINER_NO_POINTERS, tfsoff);
  7856. }
  7857. static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned int *offset)
  7858. @@ -3693,21 +3720,21 @@ static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned in
  7859. {
  7860. const var_t *func = stmt->u.var;
  7861. - if(stmt->u.var->stgclass != STG_NONE
  7862. - || type_get_type_detect_alias(stmt->u.var->type) != TYPE_FUNCTION)
  7863. + if(stmt->u.var->declspec.stgclass != STG_NONE
  7864. + || type_get_type_detect_alias(stmt->u.var->declspec.type) != TYPE_FUNCTION)
  7865. continue;
  7866. current_func = func;
  7867. if (is_local(func->attrs)) continue;
  7868. - var = type_function_get_retval(func->type);
  7869. - if (!is_void(var->type))
  7870. - var->typestring_offset = write_type_tfs( file, 2, func->attrs, var->type, func->name,
  7871. - TYPE_CONTEXT_PARAM, offset);
  7872. + var = type_function_get_retval(func->declspec.type);
  7873. + if (!is_void(var->declspec.type))
  7874. + var->typestring_offset = write_type_tfs( file, var->attrs, &var->declspec, func->name,
  7875. + TYPE_CONTEXT_RETVAL, offset);
  7876. - if (type_get_function_args(func->type))
  7877. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), var_t, entry )
  7878. - var->typestring_offset = write_type_tfs( file, 2, var->attrs, var->type, var->name,
  7879. + if (type_function_get_args(func->declspec.type))
  7880. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), var_t, entry )
  7881. + var->typestring_offset = write_type_tfs( file, var->attrs, &var->declspec, var->name,
  7882. TYPE_CONTEXT_TOPLEVELPARAM, offset );
  7883. break;
  7884. @@ -3719,9 +3746,12 @@ static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned in
  7885. {
  7886. if (is_attr(type_entry->type->attrs, ATTR_ENCODE)
  7887. || is_attr(type_entry->type->attrs, ATTR_DECODE))
  7888. - type_entry->type->typestring_offset = write_type_tfs( file, 2,
  7889. - type_entry->type->attrs, type_entry->type, type_entry->type->name,
  7890. + {
  7891. + decl_spec_t ds;
  7892. + type_entry->type->typestring_offset = write_type_tfs( file,
  7893. + type_entry->type->attrs, init_declspec(&ds, type_entry->type), type_entry->type->name,
  7894. TYPE_CONTEXT_CONTAINER, offset);
  7895. + }
  7896. }
  7897. break;
  7898. }
  7899. @@ -3842,7 +3872,7 @@ static unsigned int get_required_buffer_size_type(
  7900. case TGT_POINTER:
  7901. {
  7902. unsigned int size, align;
  7903. - const type_t *ref = type_pointer_get_ref(type);
  7904. + const type_t *ref = type_pointer_get_ref_type(type);
  7905. if (is_string_type( attrs, ref )) break;
  7906. if (!(size = get_required_buffer_size_type( ref, name, NULL, FALSE, &align ))) break;
  7907. if (get_pointer_fc(type, attrs, toplevel_param) != FC_RP)
  7908. @@ -3862,7 +3892,7 @@ static unsigned int get_required_buffer_size_type(
  7909. case FC_SMFARRAY:
  7910. case FC_LGFARRAY:
  7911. return type_array_get_dim(type) *
  7912. - get_required_buffer_size_type(type_array_get_element(type), name,
  7913. + get_required_buffer_size_type(type_array_get_element_type(type), name,
  7914. NULL, FALSE, alignment);
  7915. }
  7916. }
  7917. @@ -3893,8 +3923,8 @@ static unsigned int get_required_buffer_size(const var_t *var, unsigned int *ali
  7918. return 20;
  7919. }
  7920. - if (!is_string_type(var->attrs, var->type))
  7921. - return get_required_buffer_size_type(var->type, var->name,
  7922. + if (!is_string_type(var->attrs, var->declspec.type))
  7923. + return get_required_buffer_size_type(var->declspec.type, var->name,
  7924. var->attrs, TRUE, alignment);
  7925. }
  7926. return 0;
  7927. @@ -3905,19 +3935,19 @@ static unsigned int get_function_buffer_size( const var_t *func, enum pass pass
  7928. const var_t *var;
  7929. unsigned int total_size = 0, alignment;
  7930. - if (type_get_function_args(func->type))
  7931. + if (type_function_get_args(func->declspec.type))
  7932. {
  7933. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  7934. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  7935. {
  7936. total_size += get_required_buffer_size(var, &alignment, pass);
  7937. total_size += alignment;
  7938. }
  7939. }
  7940. - if (pass == PASS_OUT && !is_void(type_function_get_rettype(func->type)))
  7941. + if (pass == PASS_OUT && !is_void(type_function_get_rettype(func->declspec.type)))
  7942. {
  7943. var_t v = *func;
  7944. - v.type = type_function_get_rettype(func->type);
  7945. + v.declspec.type = type_function_get_rettype(func->declspec.type);
  7946. total_size += get_required_buffer_size(&v, &alignment, PASS_RETURN);
  7947. total_size += alignment;
  7948. }
  7949. @@ -3953,9 +3983,9 @@ static void print_phase_function(FILE *file, int indent, const char *type,
  7950. print_file(file, indent, "&__frame->_StubMsg,\n");
  7951. print_file(file, indent, "%s%s%s%s%s,\n",
  7952. (phase == PHASE_UNMARSHAL) ? "(unsigned char **)" : "(unsigned char *)",
  7953. - (phase == PHASE_UNMARSHAL || decl_indirect(var->type)) ? "&" : "",
  7954. + (phase == PHASE_UNMARSHAL || decl_indirect(var->declspec.type)) ? "&" : "",
  7955. local_var_prefix,
  7956. - (phase == PHASE_UNMARSHAL && decl_indirect(var->type)) ? "_p_" : "",
  7957. + (phase == PHASE_UNMARSHAL && decl_indirect(var->declspec.type)) ? "_p_" : "",
  7958. var->name);
  7959. print_file(file, indent, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]%s\n",
  7960. type_offset, (phase == PHASE_UNMARSHAL) ? "," : ");");
  7961. @@ -3968,7 +3998,8 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
  7962. enum remoting_phase phase, enum pass pass, const var_t *var,
  7963. const char *varname)
  7964. {
  7965. - type_t *type = var->type;
  7966. + const decl_spec_t *declspec = &var->declspec;
  7967. + type_t *type = declspec->type;
  7968. unsigned int alignment = 0;
  7969. /* no work to do for other phases, buffer sizing is done elsewhere */
  7970. @@ -3999,8 +4030,8 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
  7971. }
  7972. else
  7973. {
  7974. - const type_t *ref = is_ptr(type) ? type_pointer_get_ref(type) : type;
  7975. - switch (get_basic_fc(ref))
  7976. + const decl_spec_t *ref = is_ptr(type) ? type_pointer_get_ref(type) : declspec;
  7977. + switch (get_basic_fc(ref->type))
  7978. {
  7979. case FC_BYTE:
  7980. case FC_CHAR:
  7981. @@ -4037,7 +4068,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
  7982. default:
  7983. error("print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)\n",
  7984. - var->name, get_basic_fc(ref));
  7985. + var->name, get_basic_fc(ref->type));
  7986. }
  7987. if (phase == PHASE_MARSHAL && alignment > 1)
  7988. @@ -4048,7 +4079,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
  7989. if (phase == PHASE_MARSHAL)
  7990. {
  7991. print_file(file, indent, "*(");
  7992. - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
  7993. + write_declspec_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : declspec, NULL);
  7994. if (is_ptr(type))
  7995. fprintf(file, " *)__frame->_StubMsg.Buffer = *");
  7996. else
  7997. @@ -4059,7 +4090,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
  7998. else if (phase == PHASE_UNMARSHAL)
  7999. {
  8000. print_file(file, indent, "if (__frame->_StubMsg.Buffer + sizeof(");
  8001. - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
  8002. + write_declspec_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : declspec, NULL);
  8003. fprintf(file, ") > __frame->_StubMsg.BufferEnd)\n");
  8004. print_file(file, indent, "{\n");
  8005. print_file(file, indent + 1, "RpcRaiseException(RPC_X_BAD_STUB_DATA);\n");
  8006. @@ -4071,12 +4102,12 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
  8007. fprintf(file, " = (");
  8008. else
  8009. fprintf(file, " = *(");
  8010. - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
  8011. + write_declspec_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : declspec, NULL);
  8012. fprintf(file, " *)__frame->_StubMsg.Buffer;\n");
  8013. }
  8014. print_file(file, indent, "__frame->_StubMsg.Buffer += sizeof(");
  8015. - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
  8016. + write_declspec_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : declspec, NULL);
  8017. fprintf(file, ");\n");
  8018. }
  8019. }
  8020. @@ -4092,7 +4123,7 @@ expr_t *get_size_is_expr(const type_t *t, const char *name)
  8021. {
  8022. expr_t *x = NULL;
  8023. - for ( ; is_array(t); t = type_array_get_element(t))
  8024. + for ( ; is_array(t); t = type_array_get_element_type(t))
  8025. if (type_array_has_conformance(t) &&
  8026. type_array_get_conformance(t)->type != EXPR_VOID)
  8027. {
  8028. @@ -4110,7 +4141,7 @@ expr_t *get_size_is_expr(const type_t *t, const char *name)
  8029. void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix,
  8030. enum remoting_phase phase, const var_t *var, int valid_variance)
  8031. {
  8032. - const type_t *type = var->type;
  8033. + const type_t *type = var->declspec.type;
  8034. /* get fundamental type for the argument */
  8035. for (;;)
  8036. {
  8037. @@ -4162,7 +4193,7 @@ void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local
  8038. break;
  8039. }
  8040. case TGT_POINTER:
  8041. - type = type_pointer_get_ref(type);
  8042. + type = type_pointer_get_ref_type(type);
  8043. continue;
  8044. case TGT_INVALID:
  8045. case TGT_USER_TYPE:
  8046. @@ -4184,7 +4215,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
  8047. {
  8048. int in_attr, out_attr, pointer_type;
  8049. const char *type_str = NULL;
  8050. - const type_t *type = var->type;
  8051. + const type_t *type = var->declspec.type;
  8052. unsigned int alignment, start_offset = type->typestring_offset;
  8053. if (is_ptr(type) || is_array(type))
  8054. @@ -4237,19 +4268,20 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
  8055. print_file(file, indent, "NdrServerContextNewMarshall(\n");
  8056. print_file(file, indent + 1, "&__frame->_StubMsg,\n");
  8057. print_file(file, indent + 1, "(NDR_SCONTEXT)%s%s,\n", local_var_prefix, var->name);
  8058. - print_file(file, indent + 1, "(NDR_RUNDOWN)%s_rundown,\n", get_context_handle_type_name(var->type));
  8059. + print_file(file, indent + 1, "(NDR_RUNDOWN)%s_rundown,\n", get_context_handle_type_name(var->declspec.type));
  8060. print_file(file, indent + 1, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);\n", start_offset);
  8061. }
  8062. }
  8063. else if (phase == PHASE_UNMARSHAL)
  8064. {
  8065. - if (pass == PASS_OUT)
  8066. + if (pass == PASS_OUT || pass == PASS_RETURN)
  8067. {
  8068. if (!in_attr)
  8069. print_file(file, indent, "*%s%s = 0;\n", local_var_prefix, var->name);
  8070. print_file(file, indent, "NdrClientContextUnmarshall(\n");
  8071. print_file(file, indent + 1, "&__frame->_StubMsg,\n");
  8072. - print_file(file, indent + 1, "(NDR_CCONTEXT *)%s%s,\n", local_var_prefix, var->name);
  8073. + print_file(file, indent + 1, "(NDR_CCONTEXT *)%s%s%s,\n",
  8074. + pass == PASS_RETURN ? "&" : "", local_var_prefix, var->name);
  8075. print_file(file, indent + 1, "__frame->_Handle);\n");
  8076. }
  8077. else
  8078. @@ -4343,10 +4375,10 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
  8079. ((tc == FC_SMVARRAY || tc == FC_LGVARRAY) && in_attr) ||
  8080. (tc == FC_CARRAY && !in_attr))
  8081. {
  8082. - if (type_array_is_decl_as_ptr(type) && type->details.array.ptr_tfsoff)
  8083. + if (type_array_is_decl_as_ptr(type) && type_get_const_details(type)->array.ptr_tfsoff)
  8084. {
  8085. print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var,
  8086. - type->details.array.ptr_tfsoff);
  8087. + type_get_const_details(type)->array.ptr_tfsoff);
  8088. break;
  8089. }
  8090. print_phase_function(file, indent, array_type, local_var_prefix, phase, var, start_offset);
  8091. @@ -4380,9 +4412,9 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
  8092. range_max = LIST_ENTRY(list_next(range_list, list_head(range_list)), const expr_t, entry);
  8093. print_file(file, indent, "if ((%s%s < (", local_var_prefix, var->name);
  8094. - write_type_decl(file, var->type, NULL);
  8095. + write_declspec_decl(file, &var->declspec, NULL);
  8096. fprintf(file, ")0x%x) || (%s%s > (", range_min->cval, local_var_prefix, var->name);
  8097. - write_type_decl(file, var->type, NULL);
  8098. + write_declspec_decl(file, &var->declspec, NULL);
  8099. fprintf(file, ")0x%x))\n", range_max->cval);
  8100. print_file(file, indent, "{\n");
  8101. print_file(file, indent+1, "RpcRaiseException(RPC_S_INVALID_BOUND);\n");
  8102. @@ -4428,7 +4460,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
  8103. }
  8104. case TGT_POINTER:
  8105. {
  8106. - const type_t *ref = type_pointer_get_ref(type);
  8107. + const type_t *ref = type_pointer_get_ref_type(type);
  8108. if (pointer_type == FC_RP) switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES))
  8109. {
  8110. case TGT_BASIC:
  8111. @@ -4549,14 +4581,14 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c
  8112. if (pass == PASS_RETURN)
  8113. {
  8114. write_remoting_arg( file, indent, func, local_var_prefix, pass, phase,
  8115. - type_function_get_retval(func->type) );
  8116. + type_function_get_retval(func->declspec.type) );
  8117. }
  8118. else
  8119. {
  8120. const var_t *var;
  8121. - if (!type_get_function_args(func->type))
  8122. + if (!type_function_get_args(func->declspec.type))
  8123. return;
  8124. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  8125. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  8126. write_remoting_arg( file, indent, func, local_var_prefix, pass, phase, var );
  8127. }
  8128. }
  8129. @@ -4597,57 +4629,62 @@ void declare_stub_args( FILE *file, int indent, const var_t *func )
  8130. {
  8131. int in_attr, out_attr;
  8132. int i = 0;
  8133. - const var_t *var = type_function_get_retval(func->type);
  8134. + const var_t *var = type_function_get_retval(func->declspec.type);
  8135. /* declare return value */
  8136. - if (!is_void(var->type))
  8137. + if (!is_void(var->declspec.type))
  8138. {
  8139. - print_file(file, indent, "%s", "");
  8140. - write_type_decl(file, var->type, var->name);
  8141. - fprintf(file, ";\n");
  8142. + if (is_context_handle(var->declspec.type))
  8143. + print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
  8144. + else
  8145. + {
  8146. + print_file(file, indent, "%s", "");
  8147. + write_declspec_decl(file, &var->declspec, var->name);
  8148. + fprintf(file, ";\n");
  8149. + }
  8150. }
  8151. - if (!type_get_function_args(func->type))
  8152. + if (!type_function_get_args(func->declspec.type))
  8153. return;
  8154. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  8155. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  8156. {
  8157. in_attr = is_attr(var->attrs, ATTR_IN);
  8158. out_attr = is_attr(var->attrs, ATTR_OUT);
  8159. if (!out_attr && !in_attr)
  8160. in_attr = 1;
  8161. - if (is_context_handle(var->type))
  8162. + if (is_context_handle(var->declspec.type))
  8163. print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
  8164. else
  8165. {
  8166. - if (!in_attr && !is_conformant_array(var->type))
  8167. + if (!in_attr && !is_conformant_array(var->declspec.type))
  8168. {
  8169. - type_t *type_to_print;
  8170. + const decl_spec_t *declspec_to_print;
  8171. char name[16];
  8172. print_file(file, indent, "%s", "");
  8173. - if (type_get_type(var->type) == TYPE_ARRAY &&
  8174. - !type_array_is_decl_as_ptr(var->type))
  8175. - type_to_print = var->type;
  8176. + if (type_get_type(var->declspec.type) == TYPE_ARRAY &&
  8177. + !type_array_is_decl_as_ptr(var->declspec.type))
  8178. + declspec_to_print = &var->declspec;
  8179. else
  8180. - type_to_print = type_pointer_get_ref(var->type);
  8181. + declspec_to_print = type_pointer_get_ref(var->declspec.type);
  8182. sprintf(name, "_W%u", i++);
  8183. - write_type_decl(file, type_to_print, name);
  8184. + write_declspec_decl(file, declspec_to_print, name);
  8185. fprintf(file, ";\n");
  8186. }
  8187. print_file(file, indent, "%s", "");
  8188. - write_type_decl_left(file, var->type);
  8189. + write_declspec_decl_left(file, &var->declspec);
  8190. fprintf(file, " ");
  8191. - if (type_get_type(var->type) == TYPE_ARRAY &&
  8192. - !type_array_is_decl_as_ptr(var->type)) {
  8193. + if (type_get_type(var->declspec.type) == TYPE_ARRAY &&
  8194. + !type_array_is_decl_as_ptr(var->declspec.type)) {
  8195. fprintf(file, "(*%s)", var->name);
  8196. } else
  8197. fprintf(file, "%s", var->name);
  8198. - write_type_right(file, var->type, FALSE);
  8199. + write_type_right(file, var->declspec.type, FALSE);
  8200. fprintf(file, ";\n");
  8201. - if (decl_indirect(var->type))
  8202. + if (decl_indirect(var->declspec.type))
  8203. print_file(file, indent, "void *_p_%s;\n", var->name);
  8204. }
  8205. }
  8206. @@ -4661,10 +4698,10 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
  8207. const var_t *var;
  8208. type_t *ref;
  8209. - if (!type_get_function_args(func->type))
  8210. + if (!type_function_get_args(func->declspec.type))
  8211. return;
  8212. - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
  8213. + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
  8214. {
  8215. in_attr = is_attr(var->attrs, ATTR_IN);
  8216. out_attr = is_attr(var->attrs, ATTR_OUT);
  8217. @@ -4675,7 +4712,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
  8218. {
  8219. print_file(file, indent, "%s%s", local_var_prefix, var->name);
  8220. - switch (typegen_detect_type(var->type, var->attrs, TDT_IGNORE_STRINGS))
  8221. + switch (typegen_detect_type(var->declspec.type, var->attrs, TDT_IGNORE_STRINGS))
  8222. {
  8223. case TGT_CTXT_HANDLE_POINTER:
  8224. fprintf(file, " = NdrContextHandleInitialize(\n");
  8225. @@ -4684,15 +4721,15 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
  8226. var->typestring_offset);
  8227. break;
  8228. case TGT_ARRAY:
  8229. - if (type_array_has_conformance(var->type))
  8230. + if (type_array_has_conformance(var->declspec.type))
  8231. {
  8232. unsigned int size;
  8233. type_t *type;
  8234. fprintf(file, " = NdrAllocate(&__frame->_StubMsg, ");
  8235. - for (type = var->type;
  8236. + for (type = var->declspec.type;
  8237. is_array(type) && type_array_has_conformance(type);
  8238. - type = type_array_get_element(type))
  8239. + type = type_array_get_element_type(type))
  8240. {
  8241. write_expr(file, type_array_get_conformance(type), TRUE,
  8242. TRUE, NULL, NULL, local_var_prefix);
  8243. @@ -4702,9 +4739,9 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
  8244. fprintf(file, "%u);\n", size);
  8245. print_file(file, indent, "memset(%s%s, 0, ", local_var_prefix, var->name);
  8246. - for (type = var->type;
  8247. + for (type = var->declspec.type;
  8248. is_array(type) && type_array_has_conformance(type);
  8249. - type = type_array_get_element(type))
  8250. + type = type_array_get_element_type(type))
  8251. {
  8252. write_expr(file, type_array_get_conformance(type), TRUE,
  8253. TRUE, NULL, NULL, local_var_prefix);
  8254. @@ -4718,7 +4755,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
  8255. break;
  8256. case TGT_POINTER:
  8257. fprintf(file, " = &%s_W%u;\n", local_var_prefix, i);
  8258. - ref = type_pointer_get_ref(var->type);
  8259. + ref = type_pointer_get_ref_type(var->declspec.type);
  8260. switch (typegen_detect_type(ref, var->attrs, TDT_IGNORE_STRINGS))
  8261. {
  8262. case TGT_BASIC:
  8263. @@ -4738,7 +4775,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
  8264. print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i);
  8265. break;
  8266. }
  8267. - ref = type_array_get_element(ref);
  8268. + ref = type_array_get_element_type(ref);
  8269. /* fall through */
  8270. case TGT_STRUCT:
  8271. case TGT_UNION:
  8272. @@ -4771,14 +4808,14 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
  8273. const char *var_decl, int add_retval )
  8274. {
  8275. var_t *retval = type_function_get_retval( func );
  8276. - const var_list_t *args = type_get_function_args( func );
  8277. + const var_list_t *args = type_function_get_args( func );
  8278. const var_t *arg;
  8279. int needs_packing;
  8280. unsigned int align = 0;
  8281. if (args)
  8282. LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
  8283. - if (!is_array( arg->type )) type_memsize_and_alignment( arg->type, &align );
  8284. + if (!is_array( arg->declspec.type )) type_memsize_and_alignment( arg->declspec.type, &align );
  8285. needs_packing = (align > pointer_size);
  8286. @@ -4790,26 +4827,26 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
  8287. if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
  8288. {
  8289. print_file(file, 2, "%s", "");
  8290. - write_type_left( file, (type_t *)arg->type, NAME_DEFAULT, TRUE );
  8291. - if (needs_space_after( arg->type )) fputc( ' ', file );
  8292. - if (is_array( arg->type ) && !type_array_is_decl_as_ptr( arg->type )) fputc( '*', file );
  8293. + write_declspec_left( file, &arg->declspec, NAME_DEFAULT, TRUE );
  8294. + if (needs_space_after( arg->declspec.type )) fputc( ' ', file );
  8295. + if (is_array( arg->declspec.type ) && !type_array_is_decl_as_ptr( arg->declspec.type )) fputc( '*', file );
  8296. /* FIXME: should check for large args being passed by pointer */
  8297. align = 0;
  8298. - if (is_array( arg->type ) || is_ptr( arg->type )) align = pointer_size;
  8299. - else type_memsize_and_alignment( arg->type, &align );
  8300. + if (is_array( arg->declspec.type ) || is_ptr( arg->declspec.type )) align = pointer_size;
  8301. + else type_memsize_and_alignment( arg->declspec.type, &align );
  8302. if (align >= pointer_size)
  8303. fprintf( file, "%s;\n", arg->name );
  8304. else
  8305. fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size );
  8306. }
  8307. - if (add_retval && !is_void( retval->type ))
  8308. + if (add_retval && !is_void( retval->declspec.type ))
  8309. {
  8310. print_file(file, 2, "%s", "");
  8311. - write_type_decl( file, retval->type, retval->name );
  8312. - if (is_array( retval->type ) || is_ptr( retval->type ) ||
  8313. - type_memsize( retval->type ) == pointer_size)
  8314. + write_declspec_decl( file, &retval->declspec, retval->name );
  8315. + if (is_array( retval->declspec.type ) || is_ptr( retval->declspec.type ) ||
  8316. + type_memsize( retval->declspec.type ) == pointer_size)
  8317. fprintf( file, ";\n" );
  8318. else
  8319. fprintf( file, " DECLSPEC_ALIGN(%u);\n", pointer_size );
  8320. @@ -4821,7 +4858,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
  8321. void write_pointer_checks( FILE *file, int indent, const var_t *func )
  8322. {
  8323. - const var_list_t *args = type_get_function_args( func->type );
  8324. + const var_list_t *args = type_function_get_args( func->declspec.type );
  8325. const var_t *var;
  8326. if (!args) return;
  8327. @@ -4854,10 +4891,11 @@ int write_expr_eval_routines(FILE *file, const char *iface)
  8328. }
  8329. else
  8330. {
  8331. + decl_spec_t declspec;
  8332. print_file(file, 1, "%s", "");
  8333. - write_type_left(file, (type_t *)eval->cont_type, NAME_DEFAULT, TRUE);
  8334. + write_declspec_left(file, init_declspec(&declspec, (type_t*)eval->cont_type), NAME_DEFAULT, TRUE);
  8335. fprintf(file, " *%s = (", var_name);
  8336. - write_type_left(file, (type_t *)eval->cont_type, NAME_DEFAULT, TRUE);
  8337. + write_declspec_left(file, init_declspec(&declspec, (type_t*)eval->cont_type), NAME_DEFAULT, TRUE);
  8338. fprintf(file, " *)(pStubMsg->StackTop - %u);\n", eval->baseoff);
  8339. }
  8340. print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */
  8341. @@ -4951,9 +4989,10 @@ error:
  8342. void write_client_call_routine( FILE *file, const type_t *iface, const var_t *func,
  8343. const char *prefix, unsigned int proc_offset )
  8344. {
  8345. - type_t *rettype = type_function_get_rettype( func->type );
  8346. + const decl_spec_t *retdeclspec = type_function_get_retdeclspec(func->declspec.type);
  8347. + type_t *rettype = retdeclspec->type;
  8348. int has_ret = !is_void( rettype );
  8349. - const var_list_t *args = type_get_function_args( func->type );
  8350. + const var_list_t *args = type_function_get_args( func->declspec.type );
  8351. const var_t *arg;
  8352. int len, needs_params = 0;
  8353. @@ -4964,7 +5003,7 @@ void write_client_call_routine( FILE *file, const type_t *iface, const var_t *fu
  8354. if (needs_params)
  8355. {
  8356. if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n" );
  8357. - write_func_param_struct( file, iface, func->type, "__params", FALSE );
  8358. + write_func_param_struct( file, iface, func->declspec.type, "__params", FALSE );
  8359. if (is_object( iface )) print_file( file, 1, "__params.This = This;\n" );
  8360. if (args)
  8361. LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
  8362. @@ -5001,7 +5040,7 @@ void write_client_call_routine( FILE *file, const type_t *iface, const var_t *fu
  8363. if (has_ret)
  8364. {
  8365. print_file( file, 1, "return (" );
  8366. - write_type_decl_left(file, rettype);
  8367. + write_declspec_decl_left(file, retdeclspec);
  8368. fprintf( file, ")%s;\n", pointer_size == 8 ? "_RetVal.Simple" : "*(LONG_PTR *)&_RetVal" );
  8369. }
  8370. print_file( file, 0, "}\n\n");
  8371. @@ -5029,7 +5068,7 @@ void write_exceptions( FILE *file )
  8372. fprintf( file, " EXCEPTION_REGISTRATION_RECORD frame; \\\n");
  8373. fprintf( file, " __filter_func filter; \\\n");
  8374. fprintf( file, " __finally_func finally; \\\n");
  8375. - fprintf( file, " sigjmp_buf jmp; \\\n");
  8376. + fprintf( file, " __wine_jmp_buf jmp; \\\n");
  8377. fprintf( file, " DWORD code; \\\n");
  8378. fprintf( file, " unsigned char abnormal_termination; \\\n");
  8379. fprintf( file, " unsigned char filter_level; \\\n");
  8380. @@ -5049,13 +5088,13 @@ void write_exceptions( FILE *file )
  8381. fprintf( file, " __wine_pop_frame( &exc_frame->frame );\n");
  8382. fprintf( file, " }\n");
  8383. fprintf( file, " exc_frame->filter_level = 0;\n");
  8384. - fprintf( file, " siglongjmp( exc_frame->jmp, 1 );\n");
  8385. + fprintf( file, " __wine_longjmp( &exc_frame->jmp, 1 );\n");
  8386. fprintf( file, "}\n");
  8387. fprintf( file, "\n");
  8388. - fprintf( file, "static DWORD __widl_exception_handler( EXCEPTION_RECORD *record,\n");
  8389. - fprintf( file, " EXCEPTION_REGISTRATION_RECORD *frame,\n");
  8390. - fprintf( file, " CONTEXT *context,\n");
  8391. - fprintf( file, " EXCEPTION_REGISTRATION_RECORD **pdispatcher )\n");
  8392. + fprintf( file, "static DWORD __cdecl __widl_exception_handler( EXCEPTION_RECORD *record,\n");
  8393. + fprintf( file, " EXCEPTION_REGISTRATION_RECORD *frame,\n");
  8394. + fprintf( file, " CONTEXT *context,\n");
  8395. + fprintf( file, " EXCEPTION_REGISTRATION_RECORD **pdispatcher )\n");
  8396. fprintf( file, "{\n");
  8397. fprintf( file, " struct __exception_frame *exc_frame = (struct __exception_frame *)frame;\n");
  8398. fprintf( file, "\n");
  8399. @@ -5075,7 +5114,7 @@ void write_exceptions( FILE *file )
  8400. fprintf( file, "}\n");
  8401. fprintf( file, "\n");
  8402. fprintf( file, "#define RpcTryExcept \\\n");
  8403. - fprintf( file, " if (!sigsetjmp( __frame->jmp, 0 )) \\\n");
  8404. + fprintf( file, " if (!__wine_setjmpex( &__frame->jmp, &__frame->frame )) \\\n");
  8405. fprintf( file, " { \\\n");
  8406. fprintf( file, " if (!__frame->finally_level) \\\n" );
  8407. fprintf( file, " __wine_push_frame( &__frame->frame ); \\\n");
  8408. diff --git a/mingw-w64-tools/widl/src/typelib.c b/mingw-w64-tools/widl/src/typelib.c
  8409. index 9b1de2c8..2c2b1276 100644
  8410. --- a/mingw-w64-tools/widl/src/typelib.c
  8411. +++ b/mingw-w64-tools/widl/src/typelib.c
  8412. @@ -97,9 +97,9 @@ static unsigned short builtin_vt(const type_t *t)
  8413. {
  8414. const type_t *elem_type;
  8415. if (is_array(t))
  8416. - elem_type = type_array_get_element(t);
  8417. + elem_type = type_array_get_element_type(t);
  8418. else
  8419. - elem_type = type_pointer_get_ref(t);
  8420. + elem_type = type_pointer_get_ref_type(t);
  8421. if (type_get_type(elem_type) == TYPE_BASIC)
  8422. {
  8423. switch (type_basic_get_type(elem_type))
  8424. @@ -129,7 +129,8 @@ unsigned short get_type_vt(type_t *t)
  8425. if (vt) return vt;
  8426. }
  8427. - if (type_is_alias(t) && is_attr(t->attrs, ATTR_PUBLIC))
  8428. + if (type_is_alias(t) &&
  8429. + (is_attr(t->attrs, ATTR_PUBLIC) || is_attr(t->attrs, ATTR_WIREMARSHAL)))
  8430. return VT_USERDEFINED;
  8431. switch (type_get_type(t)) {
  8432. @@ -169,7 +170,7 @@ unsigned short get_type_vt(type_t *t)
  8433. else
  8434. return VT_I8;
  8435. case TYPE_BASIC_INT3264:
  8436. - if (typelib_kind == SYS_WIN64)
  8437. + if (pointer_size == 8)
  8438. {
  8439. if (type_basic_get_sign(t) > 0)
  8440. return VT_UI8;
  8441. @@ -198,7 +199,7 @@ unsigned short get_type_vt(type_t *t)
  8442. case TYPE_ARRAY:
  8443. if (type_array_is_decl_as_ptr(t))
  8444. {
  8445. - if (match(type_array_get_element(t)->name, "SAFEARRAY"))
  8446. + if (match(type_array_get_element_type(t)->name, "SAFEARRAY"))
  8447. return VT_SAFEARRAY;
  8448. return VT_PTR;
  8449. }
  8450. diff --git a/mingw-w64-tools/widl/src/typetree.c b/mingw-w64-tools/widl/src/typetree.c
  8451. index b93806be..488f7a49 100644
  8452. --- a/mingw-w64-tools/widl/src/typetree.c
  8453. +++ b/mingw-w64-tools/widl/src/typetree.c
  8454. @@ -30,12 +30,16 @@
  8455. #include "typetree.h"
  8456. #include "header.h"
  8457. -type_t *duptype(type_t *t, int dupname)
  8458. +/* this function is only used in declare_var in parser.y, see FIXME note */
  8459. +type_t *dup_pointer_type(type_t *t)
  8460. {
  8461. - type_t *d = alloc_type();
  8462. + type_t *d;
  8463. + assert(is_ptr(t) && t->details.pointer.def_fc != FC_RP);
  8464. +
  8465. + d = alloc_type();
  8466. *d = *t;
  8467. - if (dupname && t->name)
  8468. + if (t->name)
  8469. d->name = xstrdup(t->name);
  8470. return d;
  8471. @@ -49,7 +53,6 @@ type_t *make_type(enum type_type type)
  8472. t->type_type = type;
  8473. t->attrs = NULL;
  8474. t->c_name = NULL;
  8475. - t->orig = NULL;
  8476. memset(&t->details, 0, sizeof(t->details));
  8477. t->typestring_offset = 0;
  8478. t->ptrdesc = 0;
  8479. @@ -137,7 +140,7 @@ type_t *type_new_function(var_list_t *args)
  8480. if (args)
  8481. {
  8482. arg = LIST_ENTRY(list_head(args), var_t, entry);
  8483. - if (list_count(args) == 1 && !arg->name && arg->type && type_get_type(arg->type) == TYPE_VOID)
  8484. + if (list_count(args) == 1 && !arg->name && arg->declspec.type && type_get_type(arg->declspec.type) == TYPE_VOID)
  8485. {
  8486. list_remove(&arg->entry);
  8487. free(arg);
  8488. @@ -147,7 +150,7 @@ type_t *type_new_function(var_list_t *args)
  8489. }
  8490. if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
  8491. {
  8492. - if (arg->type && type_get_type(arg->type) == TYPE_VOID)
  8493. + if (arg->declspec.type && type_get_type(arg->declspec.type) == TYPE_VOID)
  8494. error_loc("argument '%s' has void type\n", arg->name);
  8495. if (!arg->name)
  8496. {
  8497. @@ -178,34 +181,28 @@ type_t *type_new_function(var_list_t *args)
  8498. return t;
  8499. }
  8500. -type_t *type_new_pointer(unsigned char pointer_default, type_t *ref, attr_list_t *attrs)
  8501. +type_t *type_new_pointer(unsigned char pointer_default, type_t *ref)
  8502. {
  8503. type_t *t = make_type(TYPE_POINTER);
  8504. t->details.pointer.def_fc = pointer_default;
  8505. - t->details.pointer.ref = ref;
  8506. - t->attrs = attrs;
  8507. + t->details.pointer.ref.type = ref;
  8508. return t;
  8509. }
  8510. -type_t *type_new_alias(type_t *t, const char *name)
  8511. +type_t *type_new_alias(const decl_spec_t *ds, const char *name)
  8512. {
  8513. - type_t *a = duptype(t, 0);
  8514. -
  8515. + type_t *a = make_type(ds->type->type_type);
  8516. a->name = xstrdup(name);
  8517. a->attrs = NULL;
  8518. - a->orig = t;
  8519. + a->details.alias.aliasee = *ds;
  8520. a->is_alias = TRUE;
  8521. - /* for pointer types */
  8522. - a->details = t->details;
  8523. - init_loc_info(&a->loc_info);
  8524. -
  8525. return a;
  8526. }
  8527. type_t *type_new_module(char *name)
  8528. {
  8529. type_t *type = get_type(TYPE_MODULE, name, NULL, 0);
  8530. - if (type->type_type != TYPE_MODULE || type->defined)
  8531. + if (type->type_type != TYPE_MODULE || type_is_defined(type))
  8532. error_loc("%s: redefinition error; original definition was at %s:%d\n",
  8533. type->name, type->loc_info.input_name, type->loc_info.line_number);
  8534. type->name = name;
  8535. @@ -215,7 +212,7 @@ type_t *type_new_module(char *name)
  8536. type_t *type_new_coclass(char *name)
  8537. {
  8538. type_t *type = get_type(TYPE_COCLASS, name, NULL, 0);
  8539. - if (type->type_type != TYPE_COCLASS || type->defined)
  8540. + if (type->type_type != TYPE_COCLASS || type_is_defined(type))
  8541. error_loc("%s: redefinition error; original definition was at %s:%d\n",
  8542. type->name, type->loc_info.input_name, type->loc_info.line_number);
  8543. type->name = name;
  8544. @@ -223,7 +220,7 @@ type_t *type_new_coclass(char *name)
  8545. }
  8546. -type_t *type_new_array(const char *name, type_t *element, int declptr,
  8547. +type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr,
  8548. unsigned int dim, expr_t *size_is, expr_t *length_is,
  8549. unsigned char ptr_default_fc)
  8550. {
  8551. @@ -235,7 +232,9 @@ type_t *type_new_array(const char *name, type_t *element, int declptr,
  8552. t->details.array.size_is = size_is;
  8553. else
  8554. t->details.array.dim = dim;
  8555. - t->details.array.elem = element;
  8556. + if (element) {
  8557. + t->details.array.elem = *element;
  8558. + }
  8559. t->details.array.ptr_def_fc = ptr_default_fc;
  8560. return t;
  8561. }
  8562. @@ -273,80 +272,99 @@ type_t *type_new_void(void)
  8563. type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums)
  8564. {
  8565. - type_t *tag_type = name ? find_type(name, namespace, tsENUM) : NULL;
  8566. - type_t *t = make_type(TYPE_ENUM);
  8567. - t->name = name;
  8568. - t->namespace = namespace;
  8569. -
  8570. - if (tag_type && tag_type->details.enumeration)
  8571. - t->details.enumeration = tag_type->details.enumeration;
  8572. - else if (defined)
  8573. + type_t *t = NULL;
  8574. +
  8575. + if (name)
  8576. + t = find_type(name, namespace, tsENUM);
  8577. +
  8578. + if (!t)
  8579. {
  8580. - t->details.enumeration = xmalloc(sizeof(*t->details.enumeration));
  8581. - t->details.enumeration->enums = enums;
  8582. - t->defined = TRUE;
  8583. + t = make_type(TYPE_ENUM);
  8584. + t->name = name;
  8585. + t->namespace = namespace;
  8586. + if (name)
  8587. + reg_type(t, name, namespace, tsENUM);
  8588. }
  8589. - if (name)
  8590. + if (!type_is_defined(t))
  8591. {
  8592. if (defined)
  8593. - reg_type(t, name, namespace, tsENUM);
  8594. + {
  8595. + t->details.enumeration = xmalloc(sizeof(*t->details.enumeration));
  8596. + t->details.enumeration->enums = enums;
  8597. + t->defined = TRUE;
  8598. + }
  8599. else
  8600. + {
  8601. add_incomplete(t);
  8602. + }
  8603. }
  8604. +
  8605. return t;
  8606. }
  8607. type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields)
  8608. {
  8609. - type_t *tag_type = name ? find_type(name, namespace, tsSTRUCT) : NULL;
  8610. - type_t *t;
  8611. -
  8612. - /* avoid creating duplicate typelib type entries */
  8613. - if (tag_type && do_typelib) return tag_type;
  8614. + type_t *t = NULL;
  8615. - t = make_type(TYPE_STRUCT);
  8616. - t->name = name;
  8617. - t->namespace = namespace;
  8618. + if (name)
  8619. + t = find_type(name, namespace, tsSTRUCT);
  8620. - if (tag_type && tag_type->details.structure)
  8621. - t->details.structure = tag_type->details.structure;
  8622. - else if (defined)
  8623. + if (!t)
  8624. {
  8625. - t->details.structure = xmalloc(sizeof(*t->details.structure));
  8626. - t->details.structure->fields = fields;
  8627. - t->defined = TRUE;
  8628. + t = make_type(TYPE_STRUCT);
  8629. + t->name = name;
  8630. + t->namespace = namespace;
  8631. + if (name)
  8632. + reg_type(t, name, namespace, tsSTRUCT);
  8633. }
  8634. - if (name)
  8635. +
  8636. + if (!type_is_defined(t))
  8637. {
  8638. if (defined)
  8639. - reg_type(t, name, namespace, tsSTRUCT);
  8640. + {
  8641. + t->details.structure = xmalloc(sizeof(*t->details.structure));
  8642. + t->details.structure->fields = fields;
  8643. + t->defined = TRUE;
  8644. + }
  8645. else
  8646. + {
  8647. add_incomplete(t);
  8648. + }
  8649. }
  8650. +
  8651. return t;
  8652. }
  8653. type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields)
  8654. {
  8655. - type_t *tag_type = name ? find_type(name, NULL, tsUNION) : NULL;
  8656. - type_t *t = make_type(TYPE_UNION);
  8657. - t->name = name;
  8658. - if (tag_type && tag_type->details.structure)
  8659. - t->details.structure = tag_type->details.structure;
  8660. - else if (defined)
  8661. + type_t *t = NULL;
  8662. +
  8663. + if (name)
  8664. + t = find_type(name, NULL, tsUNION);
  8665. +
  8666. + if (!t)
  8667. {
  8668. - t->details.structure = xmalloc(sizeof(*t->details.structure));
  8669. - t->details.structure->fields = fields;
  8670. - t->defined = TRUE;
  8671. + t = make_type(TYPE_UNION);
  8672. + t->name = name;
  8673. + if (name)
  8674. + reg_type(t, name, NULL, tsUNION);
  8675. }
  8676. - if (name)
  8677. +
  8678. + if (!type_is_defined(t))
  8679. {
  8680. if (defined)
  8681. - reg_type(t, name, NULL, tsUNION);
  8682. + {
  8683. + t->details.structure = xmalloc(sizeof(*t->details.structure));
  8684. + t->details.structure->fields = fields;
  8685. + t->defined = TRUE;
  8686. + }
  8687. else
  8688. + {
  8689. add_incomplete(t);
  8690. + }
  8691. }
  8692. +
  8693. return t;
  8694. }
  8695. @@ -354,7 +372,7 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
  8696. {
  8697. type_t *t = get_type(TYPE_ENCAPSULATED_UNION, name, NULL, tsUNION);
  8698. if (!union_field) union_field = make_var( xstrdup("tagged_union") );
  8699. - union_field->type = type_new_nonencapsulated_union(NULL, TRUE, cases);
  8700. + union_field->declspec.type = type_new_nonencapsulated_union(NULL, TRUE, cases);
  8701. t->details.structure = xmalloc(sizeof(*t->details.structure));
  8702. t->details.structure->fields = append_var( NULL, switch_field );
  8703. t->details.structure->fields = append_var( t->details.structure->fields, union_field );
  8704. @@ -430,7 +448,7 @@ static int compute_method_indexes(type_t *iface)
  8705. {
  8706. var_t *func = stmt->u.var;
  8707. if (!is_callas(func->attrs))
  8708. - func->type->details.function->idx = idx++;
  8709. + func->declspec.type->details.function->idx = idx++;
  8710. }
  8711. return idx;
  8712. @@ -438,6 +456,7 @@ static int compute_method_indexes(type_t *iface)
  8713. void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts)
  8714. {
  8715. + assert(type_get_type_detect_alias(iface) == TYPE_INTERFACE);
  8716. iface->details.iface = xmalloc(sizeof(*iface->details.iface));
  8717. iface->details.iface->disp_props = NULL;
  8718. iface->details.iface->disp_methods = NULL;
  8719. @@ -451,6 +470,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
  8720. void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
  8721. {
  8722. + assert(type_get_type_detect_alias(iface) == TYPE_INTERFACE);
  8723. iface->details.iface = xmalloc(sizeof(*iface->details.iface));
  8724. iface->details.iface->disp_props = props;
  8725. iface->details.iface->disp_methods = methods;
  8726. @@ -465,6 +485,7 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met
  8727. void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
  8728. {
  8729. + assert(type_get_type_detect_alias(iface) == TYPE_INTERFACE);
  8730. dispiface->details.iface = xmalloc(sizeof(*dispiface->details.iface));
  8731. dispiface->details.iface->disp_props = NULL;
  8732. dispiface->details.iface->disp_methods = NULL;
  8733. @@ -479,6 +500,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
  8734. void type_module_define(type_t *module, statement_list_t *stmts)
  8735. {
  8736. + assert(type_get_type_detect_alias(module) == TYPE_MODULE);
  8737. if (module->details.module) error_loc("multiple definition error\n");
  8738. module->details.module = xmalloc(sizeof(*module->details.module));
  8739. module->details.module->stmts = stmts;
  8740. @@ -487,6 +509,7 @@ void type_module_define(type_t *module, statement_list_t *stmts)
  8741. type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces)
  8742. {
  8743. + assert(type_get_type_detect_alias(coclass) == TYPE_COCLASS);
  8744. coclass->details.coclass.ifaces = ifaces;
  8745. coclass->defined = TRUE;
  8746. return coclass;
  8747. diff --git a/mingw-w64-tools/widl/src/typetree.h b/mingw-w64-tools/widl/src/typetree.h
  8748. index fc134cd5..96fcae8d 100644
  8749. --- a/mingw-w64-tools/widl/src/typetree.h
  8750. +++ b/mingw-w64-tools/widl/src/typetree.h
  8751. @@ -30,10 +30,10 @@ enum name_type {
  8752. };
  8753. type_t *type_new_function(var_list_t *args);
  8754. -type_t *type_new_pointer(unsigned char pointer_default, type_t *ref, attr_list_t *attrs);
  8755. -type_t *type_new_alias(type_t *t, const char *name);
  8756. +type_t *type_new_pointer(unsigned char pointer_default, type_t *ref);
  8757. +type_t *type_new_alias(const decl_spec_t *aliasee, const char *name);
  8758. type_t *type_new_module(char *name);
  8759. -type_t *type_new_array(const char *name, type_t *element, int declptr,
  8760. +type_t *type_new_array(const char* name, const decl_spec_t *element, int declptr,
  8761. unsigned int dim, expr_t *size_is, expr_t *length_is,
  8762. unsigned char ptr_default_fc);
  8763. type_t *type_new_basic(enum type_basic_type basic_type);
  8764. @@ -53,14 +53,38 @@ type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
  8765. int type_is_equal(const type_t *type1, const type_t *type2);
  8766. const char *type_get_name(const type_t *type, enum name_type name_type);
  8767. -/* FIXME: shouldn't need to export this */
  8768. -type_t *duptype(type_t *t, int dupname);
  8769. +/* copy pointer type to deal with need for duplicate typeformat strings */
  8770. +type_t *dup_pointer_type(type_t *t);
  8771. +
  8772. +#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
  8773. + if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
  8774. + if (stmt->type == STMT_DECLARATION && stmt->u.var->declspec.stgclass == STG_NONE && \
  8775. + type_get_type_detect_alias(stmt->u.var->declspec.type) == TYPE_FUNCTION)
  8776. +
  8777. +static inline enum type_type type_get_type_detect_alias(const type_t *type)
  8778. +{
  8779. + if (type->is_alias)
  8780. + return TYPE_ALIAS;
  8781. + return type->type_type;
  8782. +}
  8783. +
  8784. +static inline int statements_has_func(const statement_list_t *stmts)
  8785. +{
  8786. + const statement_t *stmt;
  8787. + int has_func = 0;
  8788. + STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
  8789. + {
  8790. + has_func = 1;
  8791. + break;
  8792. + }
  8793. + return has_func;
  8794. +}
  8795. /* un-alias the type until finding the non-alias type */
  8796. static inline type_t *type_get_real_type(const type_t *type)
  8797. {
  8798. if (type->is_alias)
  8799. - return type_get_real_type(type->orig);
  8800. + return type_get_real_type(type->details.alias.aliasee.type);
  8801. else
  8802. return (type_t *)type;
  8803. }
  8804. @@ -105,9 +129,14 @@ static inline var_t *type_function_get_retval(const type_t *type)
  8805. return type->details.function->retval;
  8806. }
  8807. +static inline const decl_spec_t *type_function_get_retdeclspec(const type_t *type)
  8808. +{
  8809. + return &type_function_get_retval(type)->declspec;
  8810. +}
  8811. +
  8812. static inline type_t *type_function_get_rettype(const type_t *type)
  8813. {
  8814. - return type_function_get_retval(type)->type;
  8815. + return type_function_get_retdeclspec(type)->type;
  8816. }
  8817. static inline var_list_t *type_enum_get_values(const type_t *type)
  8818. @@ -142,7 +171,7 @@ static inline var_list_t *type_union_get_cases(const type_t *type)
  8819. if (type_type == TYPE_ENCAPSULATED_UNION)
  8820. {
  8821. const var_t *uv = LIST_ENTRY(list_tail(type->details.structure->fields), const var_t, entry);
  8822. - return uv->type->details.structure->fields;
  8823. + return uv->declspec.type->details.structure->fields;
  8824. }
  8825. else
  8826. return type->details.structure->fields;
  8827. @@ -250,11 +279,16 @@ static inline expr_t *type_array_get_variance(const type_t *type)
  8828. return type->details.array.length_is;
  8829. }
  8830. -static inline type_t *type_array_get_element(const type_t *type)
  8831. +static inline const decl_spec_t *type_array_get_element(const type_t *type)
  8832. {
  8833. type = type_get_real_type(type);
  8834. assert(type_get_type(type) == TYPE_ARRAY);
  8835. - return type->details.array.elem;
  8836. + return &type->details.array.elem;
  8837. +}
  8838. +
  8839. +static inline type_t *type_array_get_element_type(const type_t *type)
  8840. +{
  8841. + return type_array_get_element(type)->type;
  8842. }
  8843. static inline int type_array_is_decl_as_ptr(const type_t *type)
  8844. @@ -276,10 +310,15 @@ static inline int type_is_alias(const type_t *type)
  8845. return type->is_alias;
  8846. }
  8847. -static inline type_t *type_alias_get_aliasee(const type_t *type)
  8848. +static inline const decl_spec_t *type_alias_get_aliasee(const type_t *type)
  8849. {
  8850. assert(type_is_alias(type));
  8851. - return type->orig;
  8852. + return &type->details.alias.aliasee;
  8853. +}
  8854. +
  8855. +static inline type_t *type_alias_get_aliasee_type(const type_t *type)
  8856. +{
  8857. + return type_alias_get_aliasee(type)->type;
  8858. }
  8859. static inline ifref_list_t *type_coclass_get_ifaces(const type_t *type)
  8860. @@ -289,11 +328,16 @@ static inline ifref_list_t *type_coclass_get_ifaces(const type_t *type)
  8861. return type->details.coclass.ifaces;
  8862. }
  8863. -static inline type_t *type_pointer_get_ref(const type_t *type)
  8864. +static inline const decl_spec_t *type_pointer_get_ref(const type_t *type)
  8865. {
  8866. type = type_get_real_type(type);
  8867. assert(type_get_type(type) == TYPE_POINTER);
  8868. - return type->details.pointer.ref;
  8869. + return &type->details.pointer.ref;
  8870. +}
  8871. +
  8872. +static inline type_t *type_pointer_get_ref_type(const type_t *type)
  8873. +{
  8874. + return type_pointer_get_ref(type)->type;
  8875. }
  8876. static inline unsigned char type_pointer_get_default_fc(const type_t *type)
  8877. @@ -317,4 +361,54 @@ static inline const expr_t *type_bitfield_get_bits(const type_t *type)
  8878. return type->details.bitfield.bits;
  8879. }
  8880. +/* gets pointer to details_t union with the assumption the caller wants to write to it
  8881. + * so assert if we're actually dealing with an alias and writing to the details would
  8882. + * overwrite the alias_details
  8883. + */
  8884. +static inline details_t *type_get_details(type_t* type)
  8885. +{
  8886. + assert(!type_is_alias(type));
  8887. + return &type->details;
  8888. +}
  8889. +
  8890. +/* const overload of type_get_details */
  8891. +
  8892. +static inline const details_t *type_get_const_details(const type_t* type)
  8893. +{
  8894. + assert(!type_is_alias(type));
  8895. + return &type->details;
  8896. +}
  8897. +
  8898. +static inline int type_is_pointerish(const type_t *type)
  8899. +{
  8900. + type = type_get_real_type(type);
  8901. + return type_get_type(type) == TYPE_ARRAY || type_get_type(type) == TYPE_POINTER;
  8902. +}
  8903. +
  8904. +static inline type_t * type_get_pointer_chain_tail(const type_t *type)
  8905. +{
  8906. + type_t *pointee = NULL;
  8907. + type_t *pointer = type_get_real_type(type);
  8908. +
  8909. + if (type_get_type(pointer) == TYPE_ARRAY)
  8910. + {
  8911. + pointee = type_array_get_element_type(pointer);
  8912. + }
  8913. + else if (type_get_type(pointer) == TYPE_POINTER)
  8914. + {
  8915. + pointee = type_pointer_get_ref_type(pointer);
  8916. + }
  8917. + else
  8918. + {
  8919. + assert(FALSE);
  8920. + }
  8921. +
  8922. + if (type_is_pointerish(pointee))
  8923. + {
  8924. + return type_get_pointer_chain_tail(pointee);
  8925. + }
  8926. +
  8927. + return pointee;
  8928. +}
  8929. +
  8930. #endif /* WIDL_TYPE_TREE_H */
  8931. diff --git a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
  8932. index 1af42509..8542e518 100644
  8933. --- a/mingw-w64-tools/widl/src/widl.c
  8934. +++ b/mingw-w64-tools/widl/src/widl.c
  8935. @@ -44,11 +44,6 @@
  8936. #include "header.h"
  8937. #include "pathtools.h"
  8938. -/* future options to reserve characters for: */
  8939. -/* A = ACF input filename */
  8940. -/* J = do not search standard include path */
  8941. -/* w = select win16/win32 output (?) */
  8942. -
  8943. static const char usage[] =
  8944. "Usage: widl [options...] infile.idl\n"
  8945. " or: widl [options...] --dlldata-only name1 [name2...]\n"
  8946. @@ -64,7 +59,7 @@ static const char usage[] =
  8947. " -H file Name of header file (default is infile.h)\n"
  8948. " -I path Set include search dir to path (multiple -I allowed)\n"
  8949. " --local-stubs=file Write empty stubs for call_as/local methods to file\n"
  8950. -" -m32, -m64 Set the kind of typelib to build (Win32 or Win64)\n"
  8951. +" -m32, -m64 Set the target architecture (Win32 or Win64)\n"
  8952. " -N Do not preprocess input\n"
  8953. " --oldnames Use old naming conventions\n"
  8954. " -o, --output=NAME Set the output file name\n"
  8955. @@ -82,8 +77,7 @@ static const char usage[] =
  8956. " -u Generate interface identifiers file\n"
  8957. " -V Print version and exit\n"
  8958. " -W Enable pedantic warnings\n"
  8959. -" --win32 Only generate 32-bit code\n"
  8960. -" --win64 Only generate 64-bit code\n"
  8961. +" --win32, --win64 Set the target architecture (Win32 or Win64)\n"
  8962. " --win32-align n Set win32 structure alignment to 'n'\n"
  8963. " --win64-align n Set win64 structure alignment to 'n'\n"
  8964. "Debug level 'n' is a bitmask with following meaning:\n"
  8965. @@ -98,6 +92,20 @@ static const char usage[] =
  8966. static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSION "\n"
  8967. "Copyright 2002 Ove Kaaven\n";
  8968. +#ifdef __i386__
  8969. +enum target_cpu target_cpu = CPU_x86;
  8970. +#elif defined(__x86_64__)
  8971. +enum target_cpu target_cpu = CPU_x86_64;
  8972. +#elif defined(__powerpc__)
  8973. +enum target_cpu target_cpu = CPU_POWERPC;
  8974. +#elif defined(__arm__)
  8975. +enum target_cpu target_cpu = CPU_ARM;
  8976. +#elif defined(__aarch64__)
  8977. +enum target_cpu target_cpu = CPU_ARM64;
  8978. +#else
  8979. +#error Unsupported CPU
  8980. +#endif
  8981. +
  8982. int debuglevel = DEBUGLEVEL_NONE;
  8983. int parser_debug, yy_flex_debug;
  8984. @@ -114,8 +122,6 @@ int do_idfile = 0;
  8985. int do_dlldata = 0;
  8986. static int no_preprocess = 0;
  8987. int old_names = 0;
  8988. -int do_win32 = 1;
  8989. -int do_win64 = 1;
  8990. int win32_packing = 8;
  8991. int win64_packing = 8;
  8992. int winrt_mode = 0;
  8993. @@ -148,7 +154,6 @@ int line_number = 1;
  8994. static FILE *idfile;
  8995. unsigned int pointer_size = 0;
  8996. -syskind_t typelib_kind = sizeof(void*) == 8 ? SYS_WIN64 : SYS_WIN32;
  8997. time_t now;
  8998. @@ -188,6 +193,7 @@ static const struct option long_options[] = {
  8999. { "prefix-client", 1, NULL, PREFIX_CLIENT_OPTION },
  9000. { "prefix-server", 1, NULL, PREFIX_SERVER_OPTION },
  9001. { "robust", 0, NULL, ROBUST_OPTION },
  9002. + { "target", 0, NULL, 'b' },
  9003. { "winrt", 0, NULL, RT_OPTION },
  9004. { "win32", 0, NULL, WIN32_OPTION },
  9005. { "win64", 0, NULL, WIN64_OPTION },
  9006. @@ -269,20 +275,25 @@ static void set_target( const char *target )
  9007. {
  9008. static const struct
  9009. {
  9010. - const char *name;
  9011. - syskind_t kind;
  9012. + const char *name;
  9013. + enum target_cpu cpu;
  9014. } cpu_names[] =
  9015. {
  9016. - { "i386", SYS_WIN32 },
  9017. - { "i486", SYS_WIN32 },
  9018. - { "i586", SYS_WIN32 },
  9019. - { "i686", SYS_WIN32 },
  9020. - { "i786", SYS_WIN32 },
  9021. - { "amd64", SYS_WIN64 },
  9022. - { "x86_64", SYS_WIN64 },
  9023. - { "powerpc", SYS_WIN32 },
  9024. - { "arm", SYS_WIN32 },
  9025. - { "aarch64", SYS_WIN64 }
  9026. + { "i386", CPU_x86 },
  9027. + { "i486", CPU_x86 },
  9028. + { "i586", CPU_x86 },
  9029. + { "i686", CPU_x86 },
  9030. + { "i786", CPU_x86 },
  9031. + { "amd64", CPU_x86_64 },
  9032. + { "x86_64", CPU_x86_64 },
  9033. + { "powerpc", CPU_POWERPC },
  9034. + { "arm", CPU_ARM },
  9035. + { "armv5", CPU_ARM },
  9036. + { "armv6", CPU_ARM },
  9037. + { "armv7", CPU_ARM },
  9038. + { "armv7a", CPU_ARM },
  9039. + { "arm64", CPU_ARM64 },
  9040. + { "aarch64", CPU_ARM64 },
  9041. };
  9042. unsigned int i;
  9043. @@ -296,7 +307,7 @@ static void set_target( const char *target )
  9044. {
  9045. if (!strcmp( cpu_names[i].name, spec ))
  9046. {
  9047. - typelib_kind = cpu_names[i].kind;
  9048. + target_cpu = cpu_names[i].cpu;
  9049. free( spec );
  9050. return;
  9051. }
  9052. @@ -484,6 +495,7 @@ static void write_id_data_stmts(const statement_list_t *stmts)
  9053. uuid = get_attrp(type->attrs, ATTR_UUID);
  9054. write_id_guid(idfile, "IID", is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID",
  9055. type->name, uuid);
  9056. + assert(type_get_type_detect_alias(type) == TYPE_INTERFACE);
  9057. if (type->details.iface->async_iface)
  9058. {
  9059. uuid = get_attrp(type->details.iface->async_iface->attrs, ATTR_UUID);
  9060. @@ -606,12 +618,10 @@ int main(int argc,char *argv[])
  9061. use_abi_namespace = 1;
  9062. break;
  9063. case WIN32_OPTION:
  9064. - do_win32 = 1;
  9065. - do_win64 = 0;
  9066. + pointer_size = 4;
  9067. break;
  9068. case WIN64_OPTION:
  9069. - do_win32 = 0;
  9070. - do_win64 = 1;
  9071. + pointer_size = 8;
  9072. break;
  9073. case WIN32_ALIGN_OPTION:
  9074. win32_packing = strtol(optarg, NULL, 0);
  9075. @@ -664,8 +674,8 @@ int main(int argc,char *argv[])
  9076. wpp_add_include_path(optarg);
  9077. break;
  9078. case 'm':
  9079. - if (!strcmp( optarg, "32" )) typelib_kind = SYS_WIN32;
  9080. - else if (!strcmp( optarg, "64" )) typelib_kind = SYS_WIN64;
  9081. + if (!strcmp( optarg, "32" )) pointer_size = 4;
  9082. + else if (!strcmp( optarg, "64" )) pointer_size = 8;
  9083. break;
  9084. case 'N':
  9085. no_preprocess = 1;
  9086. @@ -726,6 +736,7 @@ int main(int argc,char *argv[])
  9087. }
  9088. #ifdef DEFAULT_INCLUDE_DIR
  9089. + wpp_add_include_path(DEFAULT_INCLUDE_DIR);
  9090. char exe_path[PATH_MAX];
  9091. get_executable_path (argv[0], &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0]));
  9092. char * rel_to_includedir = get_relative_path (DEFAULT_BINDIR, DEFAULT_INCLUDE_DIR);
  9093. @@ -739,6 +750,26 @@ int main(int argc,char *argv[])
  9094. wpp_add_include_path(relocated_default_include_dir);
  9095. #endif
  9096. + switch (target_cpu)
  9097. + {
  9098. + case CPU_x86:
  9099. + if (pointer_size == 8) target_cpu = CPU_x86_64;
  9100. + else pointer_size = 4;
  9101. + break;
  9102. + case CPU_x86_64:
  9103. + if (pointer_size == 4) target_cpu = CPU_x86;
  9104. + else pointer_size = 8;
  9105. + break;
  9106. + case CPU_ARM64:
  9107. + if (pointer_size == 4) error( "Cannot build 32-bit code for this CPU\n" );
  9108. + pointer_size = 8;
  9109. + break;
  9110. + default:
  9111. + if (pointer_size == 8) error( "Cannot build 64-bit code for this CPU\n" );
  9112. + pointer_size = 4;
  9113. + break;
  9114. + }
  9115. +
  9116. /* if nothing specified, try to guess output type from the output file name */
  9117. if (output_name && do_everything && !do_header && !do_typelib && !do_proxies &&
  9118. !do_client && !do_server && !do_regscript && !do_idfile && !do_dlldata)
  9119. diff --git a/mingw-w64-tools/widl/src/widl.h b/mingw-w64-tools/widl/src/widl.h
  9120. index 118e2245..4f4252e3 100644
  9121. --- a/mingw-w64-tools/widl/src/widl.h
  9122. +++ b/mingw-w64-tools/widl/src/widl.h
  9123. @@ -45,8 +45,6 @@ extern int do_regscript;
  9124. extern int do_idfile;
  9125. extern int do_dlldata;
  9126. extern int old_names;
  9127. -extern int do_win32;
  9128. -extern int do_win64;
  9129. extern int win32_packing;
  9130. extern int win64_packing;
  9131. extern int winrt_mode;
  9132. @@ -76,6 +74,13 @@ extern time_t now;
  9133. extern int line_number;
  9134. extern int char_number;
  9135. +enum target_cpu
  9136. +{
  9137. + CPU_x86, CPU_x86_64, CPU_POWERPC, CPU_ARM, CPU_ARM64, CPU_LAST = CPU_ARM64
  9138. +};
  9139. +
  9140. +extern enum target_cpu target_cpu;
  9141. +
  9142. enum stub_mode
  9143. {
  9144. MODE_Os, /* inline stubs */
  9145. diff --git a/mingw-w64-tools/widl/src/widltypes.h b/mingw-w64-tools/widl/src/widltypes.h
  9146. index 08584de5..cd71e9af 100644
  9147. --- a/mingw-w64-tools/widl/src/widltypes.h
  9148. +++ b/mingw-w64-tools/widl/src/widltypes.h
  9149. @@ -40,6 +40,7 @@ typedef struct _attr_t attr_t;
  9150. typedef struct _expr_t expr_t;
  9151. typedef struct _type_t type_t;
  9152. typedef struct _var_t var_t;
  9153. +typedef struct _decl_spec_t decl_spec_t;
  9154. typedef struct _declarator_t declarator_t;
  9155. typedef struct _ifref_t ifref_t;
  9156. typedef struct _typelib_entry_t typelib_entry_t;
  9157. @@ -80,7 +81,6 @@ enum attr_type
  9158. ATTR_CASE,
  9159. ATTR_CODE,
  9160. ATTR_COMMSTATUS,
  9161. - ATTR_CONST, /* const pseudo-attribute */
  9162. ATTR_CONTEXTHANDLE,
  9163. ATTR_CONTROL,
  9164. ATTR_DECODE,
  9165. @@ -115,7 +115,6 @@ enum attr_type
  9166. ATTR_IMMEDIATEBIND,
  9167. ATTR_IMPLICIT_HANDLE,
  9168. ATTR_IN,
  9169. - ATTR_INLINE,
  9170. ATTR_INPUTSYNC,
  9171. ATTR_LENGTHIS,
  9172. ATTR_LIBLCID,
  9173. @@ -234,6 +233,18 @@ enum storage_class
  9174. STG_REGISTER,
  9175. };
  9176. +enum type_qualifier
  9177. +{
  9178. + TYPE_QUALIFIER_NONE = 0,
  9179. + TYPE_QUALIFIER_CONST = 1,
  9180. +};
  9181. +
  9182. +enum function_specifier
  9183. +{
  9184. + FUNCTION_SPECIFIER_NONE,
  9185. + FUNCTION_SPECIFIER_INLINE,
  9186. +};
  9187. +
  9188. enum statement_type
  9189. {
  9190. STMT_LIBRARY,
  9191. @@ -293,6 +304,14 @@ struct str_list_entry_t
  9192. struct list entry;
  9193. };
  9194. +struct _decl_spec_t
  9195. +{
  9196. + type_t *type;
  9197. + enum storage_class stgclass;
  9198. + enum type_qualifier typequalifier;
  9199. + enum function_specifier funcspecifier;
  9200. +};
  9201. +
  9202. struct _attr_t {
  9203. enum attr_type type;
  9204. union {
  9205. @@ -356,7 +375,7 @@ struct array_details
  9206. {
  9207. expr_t *size_is;
  9208. expr_t *length_is;
  9209. - struct _type_t *elem;
  9210. + struct _decl_spec_t elem;
  9211. unsigned int dim;
  9212. unsigned char ptr_def_fc;
  9213. unsigned char declptr; /* if declared as a pointer */
  9214. @@ -376,7 +395,7 @@ struct basic_details
  9215. struct pointer_details
  9216. {
  9217. - struct _type_t *ref;
  9218. + struct _decl_spec_t ref;
  9219. unsigned char def_fc;
  9220. };
  9221. @@ -386,6 +405,11 @@ struct bitfield_details
  9222. const expr_t *bits;
  9223. };
  9224. +struct alias_details
  9225. +{
  9226. + struct _decl_spec_t aliasee;
  9227. +};
  9228. +
  9229. #define HASHMAX 64
  9230. struct namespace {
  9231. @@ -414,26 +438,28 @@ enum type_type
  9232. TYPE_BITFIELD,
  9233. };
  9234. +typedef union _details_t
  9235. +{
  9236. + struct struct_details *structure;
  9237. + struct enumeration_details *enumeration;
  9238. + struct func_details *function;
  9239. + struct iface_details *iface;
  9240. + struct module_details *module;
  9241. + struct array_details array;
  9242. + struct coclass_details coclass;
  9243. + struct basic_details basic;
  9244. + struct pointer_details pointer;
  9245. + struct bitfield_details bitfield;
  9246. + struct alias_details alias;
  9247. +} details_t;
  9248. +
  9249. struct _type_t {
  9250. const char *name;
  9251. struct namespace *namespace;
  9252. enum type_type type_type;
  9253. attr_list_t *attrs;
  9254. - union
  9255. - {
  9256. - struct struct_details *structure;
  9257. - struct enumeration_details *enumeration;
  9258. - struct func_details *function;
  9259. - struct iface_details *iface;
  9260. - struct module_details *module;
  9261. - struct array_details array;
  9262. - struct coclass_details coclass;
  9263. - struct basic_details basic;
  9264. - struct pointer_details pointer;
  9265. - struct bitfield_details bitfield;
  9266. - } details;
  9267. + details_t details;
  9268. const char *c_name;
  9269. - type_t *orig; /* dup'd types */
  9270. unsigned int typestring_offset;
  9271. unsigned int ptrdesc; /* used for complex structs */
  9272. int typelib_idx;
  9273. @@ -449,14 +475,20 @@ struct _type_t {
  9274. struct _var_t {
  9275. char *name;
  9276. - type_t *type;
  9277. + decl_spec_t declspec;
  9278. attr_list_t *attrs;
  9279. expr_t *eval;
  9280. - enum storage_class stgclass;
  9281. unsigned int procstring_offset;
  9282. unsigned int typestring_offset;
  9283. struct _loc_info_t loc_info;
  9284. + /* this flag indicates that this var's type (or pointed to type in the case of
  9285. + * array or pointer) was not fully defined at the time of declaration.
  9286. + * If this flag is set to TRUE then the type definition will not be written for this var
  9287. + * If this flag is set to FALSE then the type definition will only be written if it has not
  9288. + * been written yet (determined by the type_t's 'written' flag)
  9289. + */
  9290. + int declonly : 1;
  9291. /* parser-internal */
  9292. struct list entry;
  9293. @@ -464,7 +496,7 @@ struct _var_t {
  9294. struct _declarator_t {
  9295. var_t *var;
  9296. - type_t *type;
  9297. + decl_spec_t declspec;
  9298. type_t *func_type;
  9299. expr_t *bits;
  9300. @@ -497,6 +529,7 @@ struct _importinfo_t {
  9301. };
  9302. struct _importlib_t {
  9303. + int offset;
  9304. char *name;
  9305. int version;
  9306. @@ -539,6 +572,13 @@ struct _statement_t {
  9307. typelib_t *lib;
  9308. type_list_t *type_list;
  9309. } u;
  9310. + /* this flag indicates that this statement's type (or pointed to type in the case of
  9311. + * array or pointer) was not fully defined at the time of declaration.
  9312. + * If this flag is set to TRUE then the type definition will not be written for this statement
  9313. + * If this flag is set to FALSE then the type definition will only be written if it has not
  9314. + * been written yet (determined by the type_t's 'written' flag)
  9315. + */
  9316. + int declonly : 1;
  9317. };
  9318. struct _warning_t {
  9319. @@ -553,11 +593,10 @@ typedef enum {
  9320. SYS_WIN64
  9321. } syskind_t;
  9322. -extern syskind_t typelib_kind;
  9323. extern user_type_list_t user_type_list;
  9324. extern context_handle_list_t context_handle_list;
  9325. extern generic_handle_list_t generic_handle_list;
  9326. -void check_for_additional_prototype_types(const var_list_t *list);
  9327. +void check_for_additional_prototype_types(type_t *type);
  9328. void init_types(void);
  9329. type_t *alloc_type(void);
  9330. @@ -582,38 +621,18 @@ void init_loc_info(loc_info_t *);
  9331. char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
  9332. -static inline var_list_t *type_get_function_args(const type_t *func_type)
  9333. -{
  9334. - return func_type->details.function->args;
  9335. -}
  9336. -
  9337. -static inline enum type_type type_get_type_detect_alias(const type_t *type)
  9338. -{
  9339. - if (type->is_alias)
  9340. - return TYPE_ALIAS;
  9341. - return type->type_type;
  9342. -}
  9343. -
  9344. -#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
  9345. - if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
  9346. - if (stmt->type == STMT_DECLARATION && stmt->u.var->stgclass == STG_NONE && \
  9347. - type_get_type_detect_alias(stmt->u.var->type) == TYPE_FUNCTION)
  9348. -
  9349. -static inline int statements_has_func(const statement_list_t *stmts)
  9350. +static inline int is_global_namespace(const struct namespace *namespace)
  9351. {
  9352. - const statement_t *stmt;
  9353. - int has_func = 0;
  9354. - STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
  9355. - {
  9356. - has_func = 1;
  9357. - break;
  9358. - }
  9359. - return has_func;
  9360. + return !namespace->name;
  9361. }
  9362. -static inline int is_global_namespace(const struct namespace *namespace)
  9363. +static inline decl_spec_t *init_declspec(decl_spec_t *declspec, type_t *type)
  9364. {
  9365. - return !namespace->name;
  9366. + declspec->type = type;
  9367. + declspec->stgclass = STG_NONE;
  9368. + declspec->typequalifier=TYPE_QUALIFIER_NONE;
  9369. + declspec->funcspecifier=FUNCTION_SPECIFIER_NONE;
  9370. + return declspec;
  9371. }
  9372. #endif
  9373. diff --git a/mingw-w64-tools/widl/src/write_msft.c b/mingw-w64-tools/widl/src/write_msft.c
  9374. index 88a80d12..da7ce89d 100644
  9375. --- a/mingw-w64-tools/widl/src/write_msft.c
  9376. +++ b/mingw-w64-tools/widl/src/write_msft.c
  9377. @@ -702,15 +702,15 @@ static void alloc_importinfo(msft_typelib_t *typelib, importinfo_t *importinfo)
  9378. guid_idx = ctl2_alloc_guid(typelib, &guid);
  9379. - alloc_importfile(typelib, guid_idx, importlib->version&0xffff,
  9380. - importlib->version>>16, importlib->name);
  9381. + importlib->offset = alloc_importfile(typelib, guid_idx, importlib->version & 0xffff,
  9382. + importlib->version >> 16, importlib->name);
  9383. }
  9384. if(importinfo->offset == -1 || !(importinfo->flags & MSFT_IMPINFO_OFFSET_IS_GUID)) {
  9385. MSFT_ImpInfo impinfo;
  9386. impinfo.flags = importinfo->flags;
  9387. - impinfo.oImpFile = 0;
  9388. + impinfo.oImpFile = importlib->offset;
  9389. if(importinfo->flags & MSFT_IMPINFO_OFFSET_IS_GUID) {
  9390. MSFT_GuidEntry guid;
  9391. @@ -763,7 +763,7 @@ static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration);
  9392. static void add_union_typeinfo(msft_typelib_t *typelib, type_t *tunion);
  9393. static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls);
  9394. static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinterface);
  9395. -
  9396. +static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef);
  9397. /****************************************************************************
  9398. * encode_type
  9399. @@ -862,8 +862,8 @@ static int encode_type(
  9400. case VT_PTR:
  9401. {
  9402. int next_vt;
  9403. - for(next_vt = 0; is_ptr(type); type = type_pointer_get_ref(type)) {
  9404. - next_vt = get_type_vt(type_pointer_get_ref(type));
  9405. + for(next_vt = 0; is_ptr(type); type = type_pointer_get_ref_type(type)) {
  9406. + next_vt = get_type_vt(type_pointer_get_ref_type(type));
  9407. if (next_vt != 0)
  9408. break;
  9409. }
  9410. @@ -871,7 +871,7 @@ static int encode_type(
  9411. if (next_vt == 0)
  9412. next_vt = VT_VOID;
  9413. - encode_type(typelib, next_vt, type_pointer_get_ref(type),
  9414. + encode_type(typelib, next_vt, type_pointer_get_ref_type(type),
  9415. &target_type, &child_size);
  9416. /* these types already have an implicit pointer, so we don't need to
  9417. * add another */
  9418. @@ -912,10 +912,10 @@ static int encode_type(
  9419. case VT_SAFEARRAY:
  9420. {
  9421. - type_t *element_type = type_alias_get_aliasee(type_array_get_element(type));
  9422. + type_t *element_type = type_alias_get_aliasee_type(type_array_get_element_type(type));
  9423. int next_vt = get_type_vt(element_type);
  9424. - encode_type(typelib, next_vt, type_alias_get_aliasee(type_array_get_element(type)),
  9425. + encode_type(typelib, next_vt, type_alias_get_aliasee_type(type_array_get_element_type(type)),
  9426. &target_type, &child_size);
  9427. for (typeoffset = 0; typeoffset < typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) {
  9428. @@ -966,33 +966,61 @@ static int encode_type(
  9429. }
  9430. else
  9431. {
  9432. - /* typedef'd types without public attribute aren't included in the typelib */
  9433. - while (type_is_alias(type) && !is_attr(type->attrs, ATTR_PUBLIC))
  9434. - type = type_alias_get_aliasee(type);
  9435. + /* typedef'd types without public attribute aren't included in the typelib
  9436. + * typedef'd types with a wire_marshal attribute must be included
  9437. + */
  9438. + while (type_is_alias(type))
  9439. + {
  9440. + if (is_attr(type->attrs, ATTR_WIREMARSHAL))
  9441. + {
  9442. + type = get_attrp(type->attrs, ATTR_WIREMARSHAL);
  9443. + break;
  9444. + }
  9445. + else if(!is_attr(type->attrs, ATTR_PUBLIC))
  9446. + {
  9447. + type = type_alias_get_aliasee_type(type);
  9448. + }
  9449. + else
  9450. + {
  9451. + break;
  9452. + }
  9453. + }
  9454. chat("encode_type: VT_USERDEFINED - adding new type %s, real type %d\n",
  9455. type->name, type_get_type(type));
  9456. - switch (type_get_type(type))
  9457. + /* we've either fully resolved the typedef down to an actual type or
  9458. + * we must include the typedef because it's a wiremarshal (or public) type
  9459. + */
  9460. + if (type_is_alias(type))
  9461. {
  9462. - case TYPE_STRUCT:
  9463. - add_structure_typeinfo(typelib, type);
  9464. - break;
  9465. - case TYPE_INTERFACE:
  9466. - add_interface_typeinfo(typelib, type);
  9467. - break;
  9468. - case TYPE_ENUM:
  9469. - add_enum_typeinfo(typelib, type);
  9470. - break;
  9471. - case TYPE_UNION:
  9472. - add_union_typeinfo(typelib, type);
  9473. - break;
  9474. - case TYPE_COCLASS:
  9475. - add_coclass_typeinfo(typelib, type);
  9476. - break;
  9477. - default:
  9478. - error("encode_type: VT_USERDEFINED - unhandled type %d\n",
  9479. - type_get_type(type));
  9480. + add_typedef_typeinfo(typelib, type);
  9481. + }
  9482. + else
  9483. + {
  9484. + switch (type_get_type(type))
  9485. + {
  9486. + case TYPE_STRUCT:
  9487. + add_structure_typeinfo(typelib, type);
  9488. + break;
  9489. + case TYPE_INTERFACE:
  9490. + add_interface_typeinfo(typelib, type);
  9491. + break;
  9492. + case TYPE_ENUM:
  9493. + add_enum_typeinfo(typelib, type);
  9494. + break;
  9495. + /* fallthrough */
  9496. + case TYPE_UNION:
  9497. + case TYPE_ENCAPSULATED_UNION:
  9498. + add_union_typeinfo(typelib, type);
  9499. + break;
  9500. + case TYPE_COCLASS:
  9501. + add_coclass_typeinfo(typelib, type);
  9502. + break;
  9503. + default:
  9504. + error("encode_type: VT_USERDEFINED - unhandled type %d\n",
  9505. + type_get_type(type));
  9506. + }
  9507. }
  9508. typeinfo_offset = typelib->typelib_typeinfo_offsets[type->typelib_idx];
  9509. @@ -1056,7 +1084,7 @@ static int encode_var(
  9510. num_dims = 0;
  9511. for (atype = type;
  9512. is_array(atype) && !type_array_is_decl_as_ptr(atype);
  9513. - atype = type_array_get_element(atype))
  9514. + atype = type_array_get_element_type(atype))
  9515. ++num_dims;
  9516. chat("array with %d dimensions\n", num_dims);
  9517. @@ -1071,7 +1099,7 @@ static int encode_var(
  9518. arraydata += 2;
  9519. for (atype = type;
  9520. is_array(atype) && !type_array_is_decl_as_ptr(atype);
  9521. - atype = type_array_get_element(atype))
  9522. + atype = type_array_get_element_type(atype))
  9523. {
  9524. arraydata[0] = type_array_get_dim(atype);
  9525. arraydata[1] = 0;
  9526. @@ -1093,7 +1121,7 @@ static int encode_var(
  9527. vt = get_type_vt(type);
  9528. if (vt == VT_PTR) {
  9529. type_t *ref = is_ptr(type) ?
  9530. - type_pointer_get_ref(type) : type_array_get_element(type);
  9531. + type_pointer_get_ref_type(type) : type_array_get_element_type(type);
  9532. int skip_ptr = encode_var(typelib, ref, var, &target_type, &child_size);
  9533. if(skip_ptr == 2) {
  9534. @@ -1114,7 +1142,7 @@ static int encode_var(
  9535. if (target_type & 0x80000000) {
  9536. mix_field = ((target_type >> 16) & 0x3fff) | VT_BYREF;
  9537. } else if (get_type_vt(ref) == VT_SAFEARRAY) {
  9538. - type_t *element_type = type_alias_get_aliasee(type_array_get_element(ref));
  9539. + type_t *element_type = type_alias_get_aliasee_type(type_array_get_element_type(ref));
  9540. mix_field = get_type_vt(element_type) | VT_ARRAY | VT_BYREF;
  9541. } else {
  9542. typedata = (void *)&typelib->typelib_segment_data[MSFT_SEG_TYPEDESC][target_type];
  9543. @@ -1204,7 +1232,7 @@ static void write_default_value(msft_typelib_t *typelib, type_t *type, expr_t *e
  9544. if (type_get_type(type) == TYPE_ENUM) {
  9545. vt = VT_I4;
  9546. } else if (is_ptr(type)) {
  9547. - vt = get_type_vt(type_pointer_get_ref(type));
  9548. + vt = get_type_vt(type_pointer_get_ref_type(type));
  9549. if (vt == VT_USERDEFINED)
  9550. vt = VT_I4;
  9551. if (expr->cval)
  9552. @@ -1301,8 +1329,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
  9553. return S_FALSE;
  9554. }
  9555. - if (type_get_function_args(func->type))
  9556. - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), var_t, entry )
  9557. + if (type_function_get_args(func->declspec.type))
  9558. + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), var_t, entry )
  9559. {
  9560. num_params++;
  9561. if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
  9562. @@ -1444,7 +1472,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
  9563. /* fill out the basic type information */
  9564. typedata[0] = typedata_size | (index << 16);
  9565. - encode_var(typeinfo->typelib, type_function_get_rettype(func->type), func,
  9566. + encode_var(typeinfo->typelib, type_function_get_rettype(func->declspec.type), func,
  9567. &typedata[1], &decoded_size);
  9568. typedata[2] = funcflags;
  9569. typedata[3] = ((52 /*sizeof(FUNCDESC)*/ + decoded_size) << 16) | typeinfo->typeinfo->cbSizeVft;
  9570. @@ -1471,10 +1499,10 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
  9571. warning("unknown number of optional attrs\n");
  9572. }
  9573. - if (type_get_function_args(func->type))
  9574. + if (type_function_get_args(func->declspec.type))
  9575. {
  9576. i = 0;
  9577. - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), var_t, entry )
  9578. + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), var_t, entry )
  9579. {
  9580. int paramflags = 0;
  9581. int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
  9582. @@ -1482,13 +1510,13 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
  9583. if(defaultdata) *defaultdata = -1;
  9584. - encode_var(typeinfo->typelib, arg->type, arg, paramdata, &decoded_size);
  9585. + encode_var(typeinfo->typelib, arg->declspec.type, arg, paramdata, &decoded_size);
  9586. if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
  9587. switch(attr->type) {
  9588. case ATTR_DEFAULTVALUE:
  9589. {
  9590. paramflags |= 0x30; /* PARAMFLAG_FHASDEFAULT | PARAMFLAG_FOPT */
  9591. - write_default_value(typeinfo->typelib, arg->type, (expr_t *)attr->u.pval, defaultdata);
  9592. + write_default_value(typeinfo->typelib, arg->declspec.type, (expr_t *)attr->u.pval, defaultdata);
  9593. break;
  9594. }
  9595. case ATTR_IN:
  9596. @@ -1572,10 +1600,10 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
  9597. if(typeinfo->typekind == TKIND_MODULE)
  9598. namedata[9] |= 0x20;
  9599. - if (type_get_function_args(func->type))
  9600. + if (type_function_get_args(func->declspec.type))
  9601. {
  9602. i = 0;
  9603. - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), var_t, entry )
  9604. + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), var_t, entry )
  9605. {
  9606. /* don't give the last arg of a [propput*] func a name */
  9607. if(i != num_params - 1 || (invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */))
  9608. @@ -1697,8 +1725,8 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
  9609. typeinfo->var_offsets[var_num] = offset;
  9610. /* figure out type widths and whatnot */
  9611. - var_datawidth = type_memsize_and_alignment(var->type, &var_alignment);
  9612. - encode_var(typeinfo->typelib, var->type, var, &typedata[1], &var_type_size);
  9613. + var_datawidth = type_memsize_and_alignment(var->declspec.type, &var_alignment);
  9614. + encode_var(typeinfo->typelib, var->declspec.type, var, &typedata[1], &var_type_size);
  9615. /* pad out starting position to data width */
  9616. typeinfo->datawidth += var_alignment - 1;
  9617. @@ -1977,6 +2005,7 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
  9618. var_t *var;
  9619. msft_typeinfo_t *msft_typeinfo;
  9620. + assert(type_get_type_detect_alias(dispinterface) == TYPE_INTERFACE);
  9621. if (-1 < dispinterface->typelib_idx)
  9622. return;
  9623. @@ -2181,7 +2210,7 @@ static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
  9624. if (-1 < tdef->typelib_idx)
  9625. return;
  9626. - type = type_alias_get_aliasee(tdef);
  9627. + type = type_alias_get_aliasee_type(tdef);
  9628. if (!type->name || strcmp(tdef->name, type->name) != 0)
  9629. {
  9630. @@ -2297,6 +2326,7 @@ static void add_module_typeinfo(msft_typelib_t *typelib, type_t *module)
  9631. const statement_t *stmt;
  9632. msft_typeinfo_t *msft_typeinfo;
  9633. + assert(type_get_type_detect_alias(module) == TYPE_MODULE);
  9634. if (-1 < module->typelib_idx)
  9635. return;
  9636. @@ -2364,7 +2394,7 @@ static void add_entry(msft_typelib_t *typelib, const statement_t *stmt)
  9637. if (is_attr(type_entry->type->attrs, ATTR_PUBLIC))
  9638. add_typedef_typeinfo(typelib, type_entry->type);
  9639. else
  9640. - add_type_typeinfo(typelib, type_alias_get_aliasee(type_entry->type));
  9641. + add_type_typeinfo(typelib, type_alias_get_aliasee_type(type_entry->type));
  9642. }
  9643. break;
  9644. }
  9645. @@ -2653,8 +2683,6 @@ int create_msft_typelib(typelib_t *typelib)
  9646. GUID midl_info_guid = {0xde77ba65,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}};
  9647. char info_string[128];
  9648. - pointer_size = (typelib_kind == SYS_WIN64) ? 8 : 4;
  9649. -
  9650. msft = xmalloc(sizeof(*msft));
  9651. memset(msft, 0, sizeof(*msft));
  9652. msft->typelib = typelib;
  9653. @@ -2662,7 +2690,7 @@ int create_msft_typelib(typelib_t *typelib)
  9654. ctl2_init_header(msft);
  9655. ctl2_init_segdir(msft);
  9656. - msft->typelib_header.varflags |= typelib_kind;
  9657. + msft->typelib_header.varflags |= (pointer_size == 8) ? SYS_WIN64 : SYS_WIN32;
  9658. /*
  9659. * The following two calls return an offset or -1 if out of memory. We