0075-scripts-dtc-Update-to-upstream-version-with-overlay-.patch 161 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175
  1. From c0b05569c40e9a8817c2d655335251e2253428cd Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <phil@raspberrypi.org>
  3. Date: Fri, 23 Jan 2015 14:48:55 +0000
  4. Subject: [PATCH 075/114] scripts/dtc: Update to upstream version with overlay
  5. patches
  6. ---
  7. scripts/dtc/checks.c | 151 ++-
  8. scripts/dtc/data.c | 12 +-
  9. scripts/dtc/dtc-lexer.l | 70 +-
  10. scripts/dtc/dtc-lexer.lex.c_shipped | 540 +++++-----
  11. scripts/dtc/dtc-parser.tab.c_shipped | 1783 ++++++++++++++++------------------
  12. scripts/dtc/dtc-parser.tab.h_shipped | 116 ++-
  13. scripts/dtc/dtc-parser.y | 158 +--
  14. scripts/dtc/dtc.c | 23 +-
  15. scripts/dtc/dtc.h | 56 +-
  16. scripts/dtc/flattree.c | 145 ++-
  17. scripts/dtc/fstree.c | 16 +-
  18. scripts/dtc/livetree.c | 4 +-
  19. scripts/dtc/srcpos.c | 49 +-
  20. scripts/dtc/srcpos.h | 15 +-
  21. scripts/dtc/treesource.c | 14 +-
  22. scripts/dtc/util.c | 18 +-
  23. scripts/dtc/util.h | 4 +-
  24. scripts/dtc/version_gen.h | 2 +-
  25. 18 files changed, 1697 insertions(+), 1479 deletions(-)
  26. --- a/scripts/dtc/checks.c
  27. +++ b/scripts/dtc/checks.c
  28. @@ -53,7 +53,7 @@ struct check {
  29. void *data;
  30. bool warn, error;
  31. enum checkstatus status;
  32. - int inprogress;
  33. + bool inprogress;
  34. int num_prereqs;
  35. struct check **prereq;
  36. };
  37. @@ -113,6 +113,7 @@ static inline void check_msg(struct chec
  38. vfprintf(stderr, fmt, ap);
  39. fprintf(stderr, "\n");
  40. }
  41. + va_end(ap);
  42. }
  43. #define FAIL(c, ...) \
  44. @@ -141,9 +142,9 @@ static void check_nodes_props(struct che
  45. check_nodes_props(c, dt, child);
  46. }
  47. -static int run_check(struct check *c, struct node *dt)
  48. +static bool run_check(struct check *c, struct node *dt)
  49. {
  50. - int error = 0;
  51. + bool error = false;
  52. int i;
  53. assert(!c->inprogress);
  54. @@ -151,11 +152,11 @@ static int run_check(struct check *c, st
  55. if (c->status != UNCHECKED)
  56. goto out;
  57. - c->inprogress = 1;
  58. + c->inprogress = true;
  59. for (i = 0; i < c->num_prereqs; i++) {
  60. struct check *prq = c->prereq[i];
  61. - error |= run_check(prq, dt);
  62. + error = error || run_check(prq, dt);
  63. if (prq->status != PASSED) {
  64. c->status = PREREQ;
  65. check_msg(c, "Failed prerequisite '%s'",
  66. @@ -177,9 +178,9 @@ static int run_check(struct check *c, st
  67. TRACE(c, "\tCompleted, status %d", c->status);
  68. out:
  69. - c->inprogress = 0;
  70. + c->inprogress = false;
  71. if ((c->status != PASSED) && (c->error))
  72. - error = 1;
  73. + error = true;
  74. return error;
  75. }
  76. @@ -457,22 +458,93 @@ static void fixup_phandle_references(str
  77. struct node *node, struct property *prop)
  78. {
  79. struct marker *m = prop->val.markers;
  80. + struct fixup *f, **fp;
  81. + struct fixup_entry *fe, **fep;
  82. struct node *refnode;
  83. cell_t phandle;
  84. + int has_phandle_refs;
  85. +
  86. + has_phandle_refs = 0;
  87. + for_each_marker_of_type(m, REF_PHANDLE) {
  88. + has_phandle_refs = 1;
  89. + break;
  90. + }
  91. +
  92. + if (!has_phandle_refs)
  93. + return;
  94. for_each_marker_of_type(m, REF_PHANDLE) {
  95. assert(m->offset + sizeof(cell_t) <= prop->val.len);
  96. refnode = get_node_by_ref(dt, m->ref);
  97. - if (! refnode) {
  98. + if (!refnode && !symbol_fixup_support) {
  99. FAIL(c, "Reference to non-existent node or label \"%s\"\n",
  100. - m->ref);
  101. + m->ref);
  102. continue;
  103. }
  104. - phandle = get_node_phandle(dt, refnode);
  105. - *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
  106. + if (!refnode) {
  107. + /* allocate fixup entry */
  108. + fe = xmalloc(sizeof(*fe));
  109. +
  110. + fe->node = node;
  111. + fe->prop = prop;
  112. + fe->offset = m->offset;
  113. + fe->next = NULL;
  114. +
  115. + /* search for an already existing fixup */
  116. + for_each_fixup(dt, f)
  117. + if (strcmp(f->ref, m->ref) == 0)
  118. + break;
  119. +
  120. + /* no fixup found, add new */
  121. + if (f == NULL) {
  122. + f = xmalloc(sizeof(*f));
  123. + f->ref = m->ref;
  124. + f->entries = NULL;
  125. + f->next = NULL;
  126. +
  127. + /* add it to the tree */
  128. + fp = &dt->fixups;
  129. + while (*fp)
  130. + fp = &(*fp)->next;
  131. + *fp = f;
  132. + }
  133. +
  134. + /* and now append fixup entry */
  135. + fep = &f->entries;
  136. + while (*fep)
  137. + fep = &(*fep)->next;
  138. + *fep = fe;
  139. +
  140. + /* mark the entry as unresolved */
  141. + phandle = 0xdeadbeef;
  142. + } else {
  143. + phandle = get_node_phandle(dt, refnode);
  144. +
  145. + /* if it's a plugin, we need to record it */
  146. + if (symbol_fixup_support && dt->is_plugin) {
  147. +
  148. + /* allocate a new local fixup entry */
  149. + fe = xmalloc(sizeof(*fe));
  150. +
  151. + fe->node = node;
  152. + fe->prop = prop;
  153. + fe->offset = m->offset;
  154. + fe->next = NULL;
  155. +
  156. + /* append it to the local fixups */
  157. + fep = &dt->local_fixups;
  158. + while (*fep)
  159. + fep = &(*fep)->next;
  160. + *fep = fe;
  161. + }
  162. + }
  163. +
  164. + *((cell_t *)(prop->val.val + m->offset)) =
  165. + cpu_to_fdt32(phandle);
  166. }
  167. +
  168. }
  169. ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
  170. &duplicate_node_names, &explicit_phandles);
  171. @@ -624,11 +696,11 @@ static void check_avoid_default_addr_siz
  172. if (!reg && !ranges)
  173. return;
  174. - if ((node->parent->addr_cells == -1))
  175. + if (node->parent->addr_cells == -1)
  176. FAIL(c, "Relying on default #address-cells value for %s",
  177. node->fullpath);
  178. - if ((node->parent->size_cells == -1))
  179. + if (node->parent->size_cells == -1)
  180. FAIL(c, "Relying on default #size-cells value for %s",
  181. node->fullpath);
  182. }
  183. @@ -651,6 +723,45 @@ static void check_obsolete_chosen_interr
  184. }
  185. TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
  186. +static void check_auto_label_phandles(struct check *c, struct node *dt,
  187. + struct node *node)
  188. +{
  189. + struct label *l;
  190. + struct symbol *s, **sp;
  191. + int has_label;
  192. +
  193. + if (!symbol_fixup_support)
  194. + return;
  195. +
  196. + has_label = 0;
  197. + for_each_label(node->labels, l) {
  198. + has_label = 1;
  199. + break;
  200. + }
  201. +
  202. + if (!has_label)
  203. + return;
  204. +
  205. + /* force allocation of a phandle for this node */
  206. + (void)get_node_phandle(dt, node);
  207. +
  208. + /* add the symbol */
  209. + for_each_label(node->labels, l) {
  210. +
  211. + s = xmalloc(sizeof(*s));
  212. + s->label = l;
  213. + s->node = node;
  214. + s->next = NULL;
  215. +
  216. + /* add it to the symbols list */
  217. + sp = &dt->symbols;
  218. + while (*sp)
  219. + sp = &((*sp)->next);
  220. + *sp = s;
  221. + }
  222. +}
  223. +NODE_WARNING(auto_label_phandles, NULL);
  224. +
  225. static struct check *check_table[] = {
  226. &duplicate_node_names, &duplicate_property_names,
  227. &node_name_chars, &node_name_format, &property_name_chars,
  228. @@ -669,6 +780,8 @@ static struct check *check_table[] = {
  229. &avoid_default_addr_size,
  230. &obsolete_chosen_interrupt_controller,
  231. + &auto_label_phandles,
  232. +
  233. &always_fail,
  234. };
  235. @@ -706,15 +819,15 @@ static void disable_warning_error(struct
  236. c->error = c->error && !error;
  237. }
  238. -void parse_checks_option(bool warn, bool error, const char *optarg)
  239. +void parse_checks_option(bool warn, bool error, const char *arg)
  240. {
  241. int i;
  242. - const char *name = optarg;
  243. + const char *name = arg;
  244. bool enable = true;
  245. - if ((strncmp(optarg, "no-", 3) == 0)
  246. - || (strncmp(optarg, "no_", 3) == 0)) {
  247. - name = optarg + 3;
  248. + if ((strncmp(arg, "no-", 3) == 0)
  249. + || (strncmp(arg, "no_", 3) == 0)) {
  250. + name = arg + 3;
  251. enable = false;
  252. }
  253. @@ -733,7 +846,7 @@ void parse_checks_option(bool warn, bool
  254. die("Unrecognized check name \"%s\"\n", name);
  255. }
  256. -void process_checks(int force, struct boot_info *bi)
  257. +void process_checks(bool force, struct boot_info *bi)
  258. {
  259. struct node *dt = bi->dt;
  260. int i;
  261. --- a/scripts/dtc/data.c
  262. +++ b/scripts/dtc/data.c
  263. @@ -74,7 +74,7 @@ struct data data_copy_escape_string(cons
  264. struct data d;
  265. char *q;
  266. - d = data_grow_for(empty_data, strlen(s)+1);
  267. + d = data_grow_for(empty_data, len + 1);
  268. q = d.val;
  269. while (i < len) {
  270. @@ -250,20 +250,20 @@ struct data data_add_marker(struct data
  271. return data_append_markers(d, m);
  272. }
  273. -int data_is_one_string(struct data d)
  274. +bool data_is_one_string(struct data d)
  275. {
  276. int i;
  277. int len = d.len;
  278. if (len == 0)
  279. - return 0;
  280. + return false;
  281. for (i = 0; i < len-1; i++)
  282. if (d.val[i] == '\0')
  283. - return 0;
  284. + return false;
  285. if (d.val[len-1] != '\0')
  286. - return 0;
  287. + return false;
  288. - return 1;
  289. + return true;
  290. }
  291. --- a/scripts/dtc/dtc-lexer.l
  292. +++ b/scripts/dtc/dtc-lexer.l
  293. @@ -20,7 +20,6 @@
  294. %option noyywrap nounput noinput never-interactive
  295. -%x INCLUDE
  296. %x BYTESTRING
  297. %x PROPNODENAME
  298. %s V1
  299. @@ -40,6 +39,7 @@ LINECOMMENT "//".*\n
  300. #include "dtc-parser.tab.h"
  301. YYLTYPE yylloc;
  302. +extern bool treesource_error;
  303. /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
  304. #define YY_USER_ACTION \
  305. @@ -61,7 +61,8 @@ static int dts_version = 1;
  306. BEGIN(V1); \
  307. static void push_input_file(const char *filename);
  308. -static int pop_input_file(void);
  309. +static bool pop_input_file(void);
  310. +static void lexical_error(const char *fmt, ...);
  311. %}
  312. %%
  313. @@ -75,11 +76,11 @@ static int pop_input_file(void);
  314. char *line, *tmp, *fn;
  315. /* skip text before line # */
  316. line = yytext;
  317. - while (!isdigit(*line))
  318. + while (!isdigit((unsigned char)*line))
  319. line++;
  320. /* skip digits in line # */
  321. tmp = line;
  322. - while (!isspace(*tmp))
  323. + while (!isspace((unsigned char)*tmp))
  324. tmp++;
  325. /* "NULL"-terminate line # */
  326. *tmp = '\0';
  327. @@ -112,6 +113,11 @@ static int pop_input_file(void);
  328. return DT_V1;
  329. }
  330. +<*>"/plugin/" {
  331. + DPRINT("Keyword: /plugin/\n");
  332. + return DT_PLUGIN;
  333. + }
  334. +
  335. <*>"/memreserve/" {
  336. DPRINT("Keyword: /memreserve/\n");
  337. BEGIN_DEFAULT();
  338. @@ -146,15 +152,42 @@ static int pop_input_file(void);
  339. }
  340. <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? {
  341. - yylval.literal = xstrdup(yytext);
  342. - DPRINT("Literal: '%s'\n", yylval.literal);
  343. + char *e;
  344. + DPRINT("Integer Literal: '%s'\n", yytext);
  345. +
  346. + errno = 0;
  347. + yylval.integer = strtoull(yytext, &e, 0);
  348. +
  349. + assert(!(*e) || !e[strspn(e, "UL")]);
  350. +
  351. + if (errno == ERANGE)
  352. + lexical_error("Integer literal '%s' out of range",
  353. + yytext);
  354. + else
  355. + /* ERANGE is the only strtoull error triggerable
  356. + * by strings matching the pattern */
  357. + assert(errno == 0);
  358. return DT_LITERAL;
  359. }
  360. <*>{CHAR_LITERAL} {
  361. - yytext[yyleng-1] = '\0';
  362. - yylval.literal = xstrdup(yytext+1);
  363. - DPRINT("Character literal: %s\n", yylval.literal);
  364. + struct data d;
  365. + DPRINT("Character literal: %s\n", yytext);
  366. +
  367. + d = data_copy_escape_string(yytext+1, yyleng-2);
  368. + if (d.len == 1) {
  369. + lexical_error("Empty character literal");
  370. + yylval.integer = 0;
  371. + return DT_CHAR_LITERAL;
  372. + }
  373. +
  374. + yylval.integer = (unsigned char)d.val[0];
  375. +
  376. + if (d.len > 2)
  377. + lexical_error("Character literal has %d"
  378. + " characters instead of 1",
  379. + d.len - 1);
  380. +
  381. return DT_CHAR_LITERAL;
  382. }
  383. @@ -164,7 +197,7 @@ static int pop_input_file(void);
  384. return DT_REF;
  385. }
  386. -<*>"&{/"{PATHCHAR}+\} { /* new-style path reference */
  387. +<*>"&{/"{PATHCHAR}*\} { /* new-style path reference */
  388. yytext[yyleng-1] = '\0';
  389. DPRINT("Ref: %s\n", yytext+2);
  390. yylval.labelref = xstrdup(yytext+2);
  391. @@ -238,13 +271,24 @@ static void push_input_file(const char *
  392. }
  393. -static int pop_input_file(void)
  394. +static bool pop_input_file(void)
  395. {
  396. if (srcfile_pop() == 0)
  397. - return 0;
  398. + return false;
  399. yypop_buffer_state();
  400. yyin = current_srcfile->f;
  401. - return 1;
  402. + return true;
  403. +}
  404. +
  405. +static void lexical_error(const char *fmt, ...)
  406. +{
  407. + va_list ap;
  408. +
  409. + va_start(ap, fmt);
  410. + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
  411. + va_end(ap);
  412. +
  413. + treesource_error = true;
  414. }
  415. --- a/scripts/dtc/dtc-lexer.lex.c_shipped
  416. +++ b/scripts/dtc/dtc-lexer.lex.c_shipped
  417. @@ -372,8 +372,8 @@ static void yy_fatal_error (yyconst char
  418. *yy_cp = '\0'; \
  419. (yy_c_buf_p) = yy_cp;
  420. -#define YY_NUM_RULES 30
  421. -#define YY_END_OF_BUFFER 31
  422. +#define YY_NUM_RULES 31
  423. +#define YY_END_OF_BUFFER 32
  424. /* This struct is not used in this scanner,
  425. but its presence is necessary. */
  426. struct yy_trans_info
  427. @@ -381,25 +381,26 @@ struct yy_trans_info
  428. flex_int32_t yy_verify;
  429. flex_int32_t yy_nxt;
  430. };
  431. -static yyconst flex_int16_t yy_accept[161] =
  432. +static yyconst flex_int16_t yy_accept[166] =
  433. { 0,
  434. + 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
  435. + 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
  436. + 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
  437. + 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
  438. + 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
  439. + 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
  440. + 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
  441. + 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
  442. + 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
  443. + 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
  444. +
  445. + 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
  446. + 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
  447. + 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
  448. + 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
  449. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  450. - 31, 29, 18, 18, 29, 29, 29, 29, 29, 29,
  451. - 29, 29, 29, 29, 29, 29, 29, 29, 15, 16,
  452. - 16, 29, 16, 10, 10, 18, 26, 0, 3, 0,
  453. - 27, 12, 0, 0, 11, 0, 0, 0, 0, 0,
  454. - 0, 0, 21, 23, 25, 24, 22, 0, 9, 28,
  455. - 0, 0, 0, 14, 14, 16, 16, 16, 10, 10,
  456. - 10, 0, 12, 0, 11, 0, 0, 0, 20, 0,
  457. - 0, 0, 0, 0, 0, 0, 0, 16, 10, 10,
  458. - 10, 0, 19, 0, 0, 0, 0, 0, 0, 0,
  459. -
  460. - 0, 0, 16, 13, 0, 0, 0, 0, 0, 0,
  461. - 0, 0, 0, 16, 6, 0, 0, 0, 0, 0,
  462. - 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
  463. - 4, 17, 0, 0, 2, 0, 0, 0, 0, 0,
  464. - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
  465. - 0, 0, 5, 8, 0, 0, 0, 0, 7, 0
  466. + 0, 0, 1, 0, 0, 0, 0, 6, 9, 0,
  467. + 0, 0, 0, 8, 0
  468. } ;
  469. static yyconst flex_int32_t yy_ec[256] =
  470. @@ -415,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] =
  471. 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
  472. 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
  473. - 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
  474. - 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
  475. - 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
  476. + 31, 21, 32, 22, 33, 22, 22, 34, 35, 36,
  477. + 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
  478. + 44, 22, 45, 46, 47, 1, 1, 1, 1, 1,
  479. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  480. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  481. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  482. @@ -434,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] =
  483. 1, 1, 1, 1, 1
  484. } ;
  485. -static yyconst flex_int32_t yy_meta[47] =
  486. +static yyconst flex_int32_t yy_meta[48] =
  487. { 0,
  488. 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
  489. 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
  490. 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
  491. 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  492. - 8, 8, 8, 3, 1, 1
  493. + 8, 8, 8, 8, 3, 1, 4
  494. } ;
  495. -static yyconst flex_int16_t yy_base[175] =
  496. +static yyconst flex_int16_t yy_base[180] =
  497. { 0,
  498. - 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
  499. - 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
  500. - 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
  501. - 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
  502. - 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
  503. - 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
  504. - 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
  505. - 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
  506. - 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
  507. - 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
  508. -
  509. - 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
  510. - 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
  511. - 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
  512. - 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
  513. - 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
  514. - 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
  515. - 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
  516. - 304, 310, 318, 326
  517. + 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
  518. + 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
  519. + 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
  520. + 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
  521. + 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
  522. + 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
  523. + 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
  524. + 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
  525. + 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
  526. + 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
  527. +
  528. + 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
  529. + 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
  530. + 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
  531. + 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
  532. + 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
  533. + 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
  534. + 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
  535. + 281, 288, 292, 300, 308, 312, 318, 326, 334
  536. } ;
  537. -static yyconst flex_int16_t yy_def[175] =
  538. +static yyconst flex_int16_t yy_def[180] =
  539. { 0,
  540. - 160, 1, 1, 1, 1, 5, 160, 7, 1, 1,
  541. - 160, 160, 160, 160, 160, 161, 162, 163, 160, 160,
  542. - 160, 160, 164, 160, 160, 160, 165, 164, 160, 166,
  543. - 167, 166, 166, 160, 160, 160, 160, 161, 160, 161,
  544. - 160, 168, 160, 163, 160, 163, 169, 170, 160, 160,
  545. - 160, 160, 160, 160, 160, 160, 160, 164, 160, 160,
  546. - 160, 160, 160, 160, 164, 166, 167, 166, 160, 160,
  547. - 160, 171, 168, 172, 163, 169, 169, 170, 160, 160,
  548. - 160, 160, 160, 160, 160, 160, 160, 166, 160, 160,
  549. - 171, 172, 160, 160, 160, 160, 160, 160, 160, 160,
  550. -
  551. - 160, 160, 166, 160, 160, 160, 160, 160, 160, 160,
  552. - 160, 173, 160, 166, 160, 160, 160, 160, 160, 160,
  553. - 173, 160, 173, 160, 160, 160, 160, 160, 160, 160,
  554. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  555. - 160, 160, 174, 160, 160, 160, 174, 160, 174, 160,
  556. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 0,
  557. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  558. - 160, 160, 160, 160
  559. + 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
  560. + 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
  561. + 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
  562. + 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
  563. + 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
  564. + 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
  565. + 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
  566. + 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
  567. + 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
  568. + 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
  569. +
  570. + 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
  571. + 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
  572. + 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
  573. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  574. + 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
  575. + 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
  576. + 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
  577. + 165, 165, 165, 165, 165, 165, 165, 165, 165
  578. } ;
  579. -static yyconst flex_int16_t yy_nxt[440] =
  580. +static yyconst flex_int16_t yy_nxt[449] =
  581. { 0,
  582. - 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
  583. - 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
  584. - 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
  585. - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  586. - 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
  587. - 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
  588. - 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
  589. - 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
  590. - 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
  591. - 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
  592. -
  593. - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
  594. - 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
  595. - 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
  596. - 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
  597. - 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
  598. - 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
  599. - 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
  600. - 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
  601. - 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
  602. - 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
  603. -
  604. - 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
  605. - 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
  606. - 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
  607. - 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
  608. - 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
  609. - 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
  610. - 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
  611. - 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
  612. - 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
  613. - 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
  614. -
  615. - 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
  616. - 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
  617. - 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
  618. - 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
  619. - 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
  620. - 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
  621. - 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
  622. - 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
  623. - 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
  624. - 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
  625. -
  626. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  627. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  628. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  629. - 160, 160, 160, 160, 160, 160, 160, 160, 160
  630. + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
  631. + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
  632. + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
  633. + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
  634. + 21, 21, 21, 21, 10, 22, 10, 24, 25, 25,
  635. + 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
  636. + 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
  637. + 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
  638. + 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
  639. + 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
  640. +
  641. + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
  642. + 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
  643. + 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
  644. + 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
  645. + 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
  646. + 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
  647. + 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
  648. + 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
  649. + 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
  650. + 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
  651. +
  652. + 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
  653. + 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
  654. + 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
  655. + 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
  656. + 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
  657. + 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
  658. + 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
  659. + 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
  660. + 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
  661. + 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
  662. +
  663. + 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
  664. + 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
  665. + 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
  666. + 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
  667. + 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
  668. + 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
  669. + 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
  670. + 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
  671. + 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
  672. + 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
  673. +
  674. + 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  675. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  676. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  677. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  678. + 165, 165, 165, 165, 165, 165, 165, 165
  679. } ;
  680. -static yyconst flex_int16_t yy_chk[440] =
  681. +static yyconst flex_int16_t yy_chk[449] =
  682. { 0,
  683. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  684. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  685. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  686. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  687. - 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
  688. - 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
  689. - 50, 5, 13, 13, 13, 20, 20, 5, 5, 5,
  690. - 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
  691. - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  692. - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  693. -
  694. - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  695. - 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
  696. - 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
  697. - 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
  698. - 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
  699. - 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
  700. - 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
  701. - 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
  702. - 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
  703. - 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
  704. -
  705. - 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
  706. - 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
  707. - 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
  708. - 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
  709. - 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
  710. - 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
  711. - 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
  712. - 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
  713. - 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
  714. - 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
  715. -
  716. - 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
  717. - 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
  718. - 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
  719. - 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
  720. - 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
  721. - 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
  722. - 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
  723. - 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
  724. - 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
  725. - 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
  726. -
  727. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  728. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  729. - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
  730. - 160, 160, 160, 160, 160, 160, 160, 160, 160
  731. + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
  732. + 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
  733. + 18, 3, 3, 3, 3, 3, 5, 5, 5, 5,
  734. + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  735. + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  736. + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  737. +
  738. + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  739. + 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
  740. + 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
  741. + 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
  742. + 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
  743. + 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
  744. + 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
  745. + 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
  746. + 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
  747. + 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
  748. +
  749. + 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
  750. + 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
  751. + 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
  752. + 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
  753. + 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
  754. + 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
  755. + 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
  756. + 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
  757. + 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
  758. + 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
  759. +
  760. + 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
  761. + 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
  762. + 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
  763. + 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
  764. + 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
  765. + 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
  766. + 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
  767. + 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
  768. + 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
  769. + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
  770. +
  771. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  772. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  773. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  774. + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  775. + 165, 165, 165, 165, 165, 165, 165, 165
  776. } ;
  777. static yy_state_type yy_last_accepting_state;
  778. @@ -631,13 +634,13 @@ char *yytext;
  779. -
  780. -#line 38 "dtc-lexer.l"
  781. +#line 37 "dtc-lexer.l"
  782. #include "dtc.h"
  783. #include "srcpos.h"
  784. #include "dtc-parser.tab.h"
  785. YYLTYPE yylloc;
  786. +extern bool treesource_error;
  787. /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
  788. #define YY_USER_ACTION \
  789. @@ -659,14 +662,14 @@ static int dts_version = 1;
  790. BEGIN(V1); \
  791. static void push_input_file(const char *filename);
  792. -static int pop_input_file(void);
  793. -#line 664 "dtc-lexer.lex.c"
  794. +static bool pop_input_file(void);
  795. +static void lexical_error(const char *fmt, ...);
  796. +#line 668 "dtc-lexer.lex.c"
  797. #define INITIAL 0
  798. -#define INCLUDE 1
  799. -#define BYTESTRING 2
  800. -#define PROPNODENAME 3
  801. -#define V1 4
  802. +#define BYTESTRING 1
  803. +#define PROPNODENAME 2
  804. +#define V1 3
  805. #ifndef YY_NO_UNISTD_H
  806. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  807. @@ -852,9 +855,9 @@ YY_DECL
  808. register char *yy_cp, *yy_bp;
  809. register int yy_act;
  810. -#line 67 "dtc-lexer.l"
  811. +#line 68 "dtc-lexer.l"
  812. -#line 858 "dtc-lexer.lex.c"
  813. +#line 861 "dtc-lexer.lex.c"
  814. if ( !(yy_init) )
  815. {
  816. @@ -908,13 +911,13 @@ yy_match:
  817. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  818. {
  819. yy_current_state = (int) yy_def[yy_current_state];
  820. - if ( yy_current_state >= 161 )
  821. + if ( yy_current_state >= 166 )
  822. yy_c = yy_meta[(unsigned int) yy_c];
  823. }
  824. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  825. ++yy_cp;
  826. }
  827. - while ( yy_current_state != 160 );
  828. + while ( yy_current_state != 165 );
  829. yy_cp = (yy_last_accepting_cpos);
  830. yy_current_state = (yy_last_accepting_state);
  831. @@ -937,7 +940,7 @@ do_action: /* This label is used only to
  832. case 1:
  833. /* rule 1 can match eol */
  834. YY_RULE_SETUP
  835. -#line 68 "dtc-lexer.l"
  836. +#line 69 "dtc-lexer.l"
  837. {
  838. char *name = strchr(yytext, '\"') + 1;
  839. yytext[yyleng-1] = '\0';
  840. @@ -947,16 +950,16 @@ YY_RULE_SETUP
  841. case 2:
  842. /* rule 2 can match eol */
  843. YY_RULE_SETUP
  844. -#line 74 "dtc-lexer.l"
  845. +#line 75 "dtc-lexer.l"
  846. {
  847. char *line, *tmp, *fn;
  848. /* skip text before line # */
  849. line = yytext;
  850. - while (!isdigit(*line))
  851. + while (!isdigit((unsigned char)*line))
  852. line++;
  853. /* skip digits in line # */
  854. tmp = line;
  855. - while (!isspace(*tmp))
  856. + while (!isspace((unsigned char)*tmp))
  857. tmp++;
  858. /* "NULL"-terminate line # */
  859. *tmp = '\0';
  860. @@ -970,11 +973,10 @@ YY_RULE_SETUP
  861. }
  862. YY_BREAK
  863. case YY_STATE_EOF(INITIAL):
  864. -case YY_STATE_EOF(INCLUDE):
  865. case YY_STATE_EOF(BYTESTRING):
  866. case YY_STATE_EOF(PROPNODENAME):
  867. case YY_STATE_EOF(V1):
  868. -#line 95 "dtc-lexer.l"
  869. +#line 96 "dtc-lexer.l"
  870. {
  871. if (!pop_input_file()) {
  872. yyterminate();
  873. @@ -984,7 +986,7 @@ case YY_STATE_EOF(V1):
  874. case 3:
  875. /* rule 3 can match eol */
  876. YY_RULE_SETUP
  877. -#line 101 "dtc-lexer.l"
  878. +#line 102 "dtc-lexer.l"
  879. {
  880. DPRINT("String: %s\n", yytext);
  881. yylval.data = data_copy_escape_string(yytext+1,
  882. @@ -994,7 +996,7 @@ YY_RULE_SETUP
  883. YY_BREAK
  884. case 4:
  885. YY_RULE_SETUP
  886. -#line 108 "dtc-lexer.l"
  887. +#line 109 "dtc-lexer.l"
  888. {
  889. DPRINT("Keyword: /dts-v1/\n");
  890. dts_version = 1;
  891. @@ -1004,25 +1006,33 @@ YY_RULE_SETUP
  892. YY_BREAK
  893. case 5:
  894. YY_RULE_SETUP
  895. -#line 115 "dtc-lexer.l"
  896. +#line 116 "dtc-lexer.l"
  897. +{
  898. + DPRINT("Keyword: /plugin/\n");
  899. + return DT_PLUGIN;
  900. + }
  901. + YY_BREAK
  902. +case 6:
  903. +YY_RULE_SETUP
  904. +#line 121 "dtc-lexer.l"
  905. {
  906. DPRINT("Keyword: /memreserve/\n");
  907. BEGIN_DEFAULT();
  908. return DT_MEMRESERVE;
  909. }
  910. YY_BREAK
  911. -case 6:
  912. +case 7:
  913. YY_RULE_SETUP
  914. -#line 121 "dtc-lexer.l"
  915. +#line 127 "dtc-lexer.l"
  916. {
  917. DPRINT("Keyword: /bits/\n");
  918. BEGIN_DEFAULT();
  919. return DT_BITS;
  920. }
  921. YY_BREAK
  922. -case 7:
  923. +case 8:
  924. YY_RULE_SETUP
  925. -#line 127 "dtc-lexer.l"
  926. +#line 133 "dtc-lexer.l"
  927. {
  928. DPRINT("Keyword: /delete-property/\n");
  929. DPRINT("<PROPNODENAME>\n");
  930. @@ -1030,9 +1040,9 @@ YY_RULE_SETUP
  931. return DT_DEL_PROP;
  932. }
  933. YY_BREAK
  934. -case 8:
  935. +case 9:
  936. YY_RULE_SETUP
  937. -#line 134 "dtc-lexer.l"
  938. +#line 140 "dtc-lexer.l"
  939. {
  940. DPRINT("Keyword: /delete-node/\n");
  941. DPRINT("<PROPNODENAME>\n");
  942. @@ -1040,9 +1050,9 @@ YY_RULE_SETUP
  943. return DT_DEL_NODE;
  944. }
  945. YY_BREAK
  946. -case 9:
  947. +case 10:
  948. YY_RULE_SETUP
  949. -#line 141 "dtc-lexer.l"
  950. +#line 147 "dtc-lexer.l"
  951. {
  952. DPRINT("Label: %s\n", yytext);
  953. yylval.labelref = xstrdup(yytext);
  954. @@ -1050,38 +1060,65 @@ YY_RULE_SETUP
  955. return DT_LABEL;
  956. }
  957. YY_BREAK
  958. -case 10:
  959. +case 11:
  960. YY_RULE_SETUP
  961. -#line 148 "dtc-lexer.l"
  962. +#line 154 "dtc-lexer.l"
  963. {
  964. - yylval.literal = xstrdup(yytext);
  965. - DPRINT("Literal: '%s'\n", yylval.literal);
  966. + char *e;
  967. + DPRINT("Integer Literal: '%s'\n", yytext);
  968. +
  969. + errno = 0;
  970. + yylval.integer = strtoull(yytext, &e, 0);
  971. +
  972. + assert(!(*e) || !e[strspn(e, "UL")]);
  973. +
  974. + if (errno == ERANGE)
  975. + lexical_error("Integer literal '%s' out of range",
  976. + yytext);
  977. + else
  978. + /* ERANGE is the only strtoull error triggerable
  979. + * by strings matching the pattern */
  980. + assert(errno == 0);
  981. return DT_LITERAL;
  982. }
  983. YY_BREAK
  984. -case 11:
  985. -/* rule 11 can match eol */
  986. +case 12:
  987. +/* rule 12 can match eol */
  988. YY_RULE_SETUP
  989. -#line 154 "dtc-lexer.l"
  990. +#line 173 "dtc-lexer.l"
  991. {
  992. - yytext[yyleng-1] = '\0';
  993. - yylval.literal = xstrdup(yytext+1);
  994. - DPRINT("Character literal: %s\n", yylval.literal);
  995. + struct data d;
  996. + DPRINT("Character literal: %s\n", yytext);
  997. +
  998. + d = data_copy_escape_string(yytext+1, yyleng-2);
  999. + if (d.len == 1) {
  1000. + lexical_error("Empty character literal");
  1001. + yylval.integer = 0;
  1002. + return DT_CHAR_LITERAL;
  1003. + }
  1004. +
  1005. + yylval.integer = (unsigned char)d.val[0];
  1006. +
  1007. + if (d.len > 2)
  1008. + lexical_error("Character literal has %d"
  1009. + " characters instead of 1",
  1010. + d.len - 1);
  1011. +
  1012. return DT_CHAR_LITERAL;
  1013. }
  1014. YY_BREAK
  1015. -case 12:
  1016. +case 13:
  1017. YY_RULE_SETUP
  1018. -#line 161 "dtc-lexer.l"
  1019. +#line 194 "dtc-lexer.l"
  1020. { /* label reference */
  1021. DPRINT("Ref: %s\n", yytext+1);
  1022. yylval.labelref = xstrdup(yytext+1);
  1023. return DT_REF;
  1024. }
  1025. YY_BREAK
  1026. -case 13:
  1027. +case 14:
  1028. YY_RULE_SETUP
  1029. -#line 167 "dtc-lexer.l"
  1030. +#line 200 "dtc-lexer.l"
  1031. { /* new-style path reference */
  1032. yytext[yyleng-1] = '\0';
  1033. DPRINT("Ref: %s\n", yytext+2);
  1034. @@ -1089,27 +1126,27 @@ YY_RULE_SETUP
  1035. return DT_REF;
  1036. }
  1037. YY_BREAK
  1038. -case 14:
  1039. +case 15:
  1040. YY_RULE_SETUP
  1041. -#line 174 "dtc-lexer.l"
  1042. +#line 207 "dtc-lexer.l"
  1043. {
  1044. yylval.byte = strtol(yytext, NULL, 16);
  1045. DPRINT("Byte: %02x\n", (int)yylval.byte);
  1046. return DT_BYTE;
  1047. }
  1048. YY_BREAK
  1049. -case 15:
  1050. +case 16:
  1051. YY_RULE_SETUP
  1052. -#line 180 "dtc-lexer.l"
  1053. +#line 213 "dtc-lexer.l"
  1054. {
  1055. DPRINT("/BYTESTRING\n");
  1056. BEGIN_DEFAULT();
  1057. return ']';
  1058. }
  1059. YY_BREAK
  1060. -case 16:
  1061. +case 17:
  1062. YY_RULE_SETUP
  1063. -#line 186 "dtc-lexer.l"
  1064. +#line 219 "dtc-lexer.l"
  1065. {
  1066. DPRINT("PropNodeName: %s\n", yytext);
  1067. yylval.propnodename = xstrdup((yytext[0] == '\\') ?
  1068. @@ -1118,75 +1155,75 @@ YY_RULE_SETUP
  1069. return DT_PROPNODENAME;
  1070. }
  1071. YY_BREAK
  1072. -case 17:
  1073. +case 18:
  1074. YY_RULE_SETUP
  1075. -#line 194 "dtc-lexer.l"
  1076. +#line 227 "dtc-lexer.l"
  1077. {
  1078. DPRINT("Binary Include\n");
  1079. return DT_INCBIN;
  1080. }
  1081. YY_BREAK
  1082. -case 18:
  1083. -/* rule 18 can match eol */
  1084. -YY_RULE_SETUP
  1085. -#line 199 "dtc-lexer.l"
  1086. -/* eat whitespace */
  1087. - YY_BREAK
  1088. case 19:
  1089. /* rule 19 can match eol */
  1090. YY_RULE_SETUP
  1091. -#line 200 "dtc-lexer.l"
  1092. -/* eat C-style comments */
  1093. +#line 232 "dtc-lexer.l"
  1094. +/* eat whitespace */
  1095. YY_BREAK
  1096. case 20:
  1097. /* rule 20 can match eol */
  1098. YY_RULE_SETUP
  1099. -#line 201 "dtc-lexer.l"
  1100. -/* eat C++-style comments */
  1101. +#line 233 "dtc-lexer.l"
  1102. +/* eat C-style comments */
  1103. YY_BREAK
  1104. case 21:
  1105. +/* rule 21 can match eol */
  1106. YY_RULE_SETUP
  1107. -#line 203 "dtc-lexer.l"
  1108. -{ return DT_LSHIFT; };
  1109. +#line 234 "dtc-lexer.l"
  1110. +/* eat C++-style comments */
  1111. YY_BREAK
  1112. case 22:
  1113. YY_RULE_SETUP
  1114. -#line 204 "dtc-lexer.l"
  1115. -{ return DT_RSHIFT; };
  1116. +#line 236 "dtc-lexer.l"
  1117. +{ return DT_LSHIFT; };
  1118. YY_BREAK
  1119. case 23:
  1120. YY_RULE_SETUP
  1121. -#line 205 "dtc-lexer.l"
  1122. -{ return DT_LE; };
  1123. +#line 237 "dtc-lexer.l"
  1124. +{ return DT_RSHIFT; };
  1125. YY_BREAK
  1126. case 24:
  1127. YY_RULE_SETUP
  1128. -#line 206 "dtc-lexer.l"
  1129. -{ return DT_GE; };
  1130. +#line 238 "dtc-lexer.l"
  1131. +{ return DT_LE; };
  1132. YY_BREAK
  1133. case 25:
  1134. YY_RULE_SETUP
  1135. -#line 207 "dtc-lexer.l"
  1136. -{ return DT_EQ; };
  1137. +#line 239 "dtc-lexer.l"
  1138. +{ return DT_GE; };
  1139. YY_BREAK
  1140. case 26:
  1141. YY_RULE_SETUP
  1142. -#line 208 "dtc-lexer.l"
  1143. -{ return DT_NE; };
  1144. +#line 240 "dtc-lexer.l"
  1145. +{ return DT_EQ; };
  1146. YY_BREAK
  1147. case 27:
  1148. YY_RULE_SETUP
  1149. -#line 209 "dtc-lexer.l"
  1150. -{ return DT_AND; };
  1151. +#line 241 "dtc-lexer.l"
  1152. +{ return DT_NE; };
  1153. YY_BREAK
  1154. case 28:
  1155. YY_RULE_SETUP
  1156. -#line 210 "dtc-lexer.l"
  1157. -{ return DT_OR; };
  1158. +#line 242 "dtc-lexer.l"
  1159. +{ return DT_AND; };
  1160. YY_BREAK
  1161. case 29:
  1162. YY_RULE_SETUP
  1163. -#line 212 "dtc-lexer.l"
  1164. +#line 243 "dtc-lexer.l"
  1165. +{ return DT_OR; };
  1166. + YY_BREAK
  1167. +case 30:
  1168. +YY_RULE_SETUP
  1169. +#line 245 "dtc-lexer.l"
  1170. {
  1171. DPRINT("Char: %c (\\x%02x)\n", yytext[0],
  1172. (unsigned)yytext[0]);
  1173. @@ -1202,12 +1239,12 @@ YY_RULE_SETUP
  1174. return yytext[0];
  1175. }
  1176. YY_BREAK
  1177. -case 30:
  1178. +case 31:
  1179. YY_RULE_SETUP
  1180. -#line 227 "dtc-lexer.l"
  1181. +#line 260 "dtc-lexer.l"
  1182. ECHO;
  1183. YY_BREAK
  1184. -#line 1211 "dtc-lexer.lex.c"
  1185. +#line 1248 "dtc-lexer.lex.c"
  1186. case YY_END_OF_BUFFER:
  1187. {
  1188. @@ -1499,7 +1536,7 @@ static int yy_get_next_buffer (void)
  1189. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1190. {
  1191. yy_current_state = (int) yy_def[yy_current_state];
  1192. - if ( yy_current_state >= 161 )
  1193. + if ( yy_current_state >= 166 )
  1194. yy_c = yy_meta[(unsigned int) yy_c];
  1195. }
  1196. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1197. @@ -1527,11 +1564,11 @@ static int yy_get_next_buffer (void)
  1198. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1199. {
  1200. yy_current_state = (int) yy_def[yy_current_state];
  1201. - if ( yy_current_state >= 161 )
  1202. + if ( yy_current_state >= 166 )
  1203. yy_c = yy_meta[(unsigned int) yy_c];
  1204. }
  1205. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1206. - yy_is_jam = (yy_current_state == 160);
  1207. + yy_is_jam = (yy_current_state == 165);
  1208. return yy_is_jam ? 0 : yy_current_state;
  1209. }
  1210. @@ -2166,7 +2203,7 @@ void yyfree (void * ptr )
  1211. #define YYTABLES_NAME "yytables"
  1212. -#line 227 "dtc-lexer.l"
  1213. +#line 260 "dtc-lexer.l"
  1214. @@ -2182,14 +2219,25 @@ static void push_input_file(const char *
  1215. }
  1216. -static int pop_input_file(void)
  1217. +static bool pop_input_file(void)
  1218. {
  1219. if (srcfile_pop() == 0)
  1220. - return 0;
  1221. + return false;
  1222. yypop_buffer_state();
  1223. yyin = current_srcfile->f;
  1224. - return 1;
  1225. + return true;
  1226. +}
  1227. +
  1228. +static void lexical_error(const char *fmt, ...)
  1229. +{
  1230. + va_list ap;
  1231. +
  1232. + va_start(ap, fmt);
  1233. + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
  1234. + va_end(ap);
  1235. +
  1236. + treesource_error = true;
  1237. }
  1238. --- a/scripts/dtc/dtc-parser.tab.c_shipped
  1239. +++ b/scripts/dtc/dtc-parser.tab.c_shipped
  1240. @@ -1,19 +1,19 @@
  1241. -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
  1242. +/* A Bison parser, made by GNU Bison 3.0.2. */
  1243. /* Bison implementation for Yacc-like parsers in C
  1244. -
  1245. - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
  1246. -
  1247. +
  1248. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
  1249. +
  1250. This program is free software: you can redistribute it and/or modify
  1251. it under the terms of the GNU General Public License as published by
  1252. the Free Software Foundation, either version 3 of the License, or
  1253. (at your option) any later version.
  1254. -
  1255. +
  1256. This program is distributed in the hope that it will be useful,
  1257. but WITHOUT ANY WARRANTY; without even the implied warranty of
  1258. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1259. GNU General Public License for more details.
  1260. -
  1261. +
  1262. You should have received a copy of the GNU General Public License
  1263. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  1264. @@ -26,7 +26,7 @@
  1265. special exception, which will cause the skeleton and the resulting
  1266. Bison output files to be licensed under the GNU General Public
  1267. License without this special exception.
  1268. -
  1269. +
  1270. This special exception was added by the Free Software Foundation in
  1271. version 2.2 of Bison. */
  1272. @@ -44,7 +44,7 @@
  1273. #define YYBISON 1
  1274. /* Bison version. */
  1275. -#define YYBISON_VERSION "2.7.12-4996"
  1276. +#define YYBISON_VERSION "3.0.2"
  1277. /* Skeleton name. */
  1278. #define YYSKELETON_NAME "yacc.c"
  1279. @@ -62,34 +62,32 @@
  1280. /* Copy the first part of user declarations. */
  1281. -/* Line 371 of yacc.c */
  1282. -#line 21 "dtc-parser.y"
  1283. +#line 20 "dtc-parser.y" /* yacc.c:339 */
  1284. #include <stdio.h>
  1285. +#include <inttypes.h>
  1286. #include "dtc.h"
  1287. #include "srcpos.h"
  1288. -YYLTYPE yylloc;
  1289. -
  1290. extern int yylex(void);
  1291. -extern void print_error(char const *fmt, ...);
  1292. extern void yyerror(char const *s);
  1293. +#define ERROR(loc, ...) \
  1294. + do { \
  1295. + srcpos_error((loc), "Error", __VA_ARGS__); \
  1296. + treesource_error = true; \
  1297. + } while (0)
  1298. extern struct boot_info *the_boot_info;
  1299. -extern int treesource_error;
  1300. -
  1301. -static unsigned long long eval_literal(const char *s, int base, int bits);
  1302. -static unsigned char eval_char_literal(const char *s);
  1303. +extern bool treesource_error;
  1304. -/* Line 371 of yacc.c */
  1305. -#line 87 "dtc-parser.tab.c"
  1306. +#line 85 "dtc-parser.tab.c" /* yacc.c:339 */
  1307. -# ifndef YY_NULL
  1308. +# ifndef YY_NULLPTR
  1309. # if defined __cplusplus && 201103L <= __cplusplus
  1310. -# define YY_NULL nullptr
  1311. +# define YY_NULLPTR nullptr
  1312. # else
  1313. -# define YY_NULL 0
  1314. +# define YY_NULLPTR 0
  1315. # endif
  1316. # endif
  1317. @@ -105,7 +103,7 @@ static unsigned char eval_char_literal(c
  1318. by #include "dtc-parser.tab.h". */
  1319. #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
  1320. # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
  1321. -/* Enabling traces. */
  1322. +/* Debug traces. */
  1323. #ifndef YYDEBUG
  1324. # define YYDEBUG 0
  1325. #endif
  1326. @@ -113,48 +111,45 @@ static unsigned char eval_char_literal(c
  1327. extern int yydebug;
  1328. #endif
  1329. -/* Tokens. */
  1330. +/* Token type. */
  1331. #ifndef YYTOKENTYPE
  1332. # define YYTOKENTYPE
  1333. - /* Put the tokens into the symbol table, so that GDB and other debuggers
  1334. - know about them. */
  1335. - enum yytokentype {
  1336. - DT_V1 = 258,
  1337. - DT_MEMRESERVE = 259,
  1338. - DT_LSHIFT = 260,
  1339. - DT_RSHIFT = 261,
  1340. - DT_LE = 262,
  1341. - DT_GE = 263,
  1342. - DT_EQ = 264,
  1343. - DT_NE = 265,
  1344. - DT_AND = 266,
  1345. - DT_OR = 267,
  1346. - DT_BITS = 268,
  1347. - DT_DEL_PROP = 269,
  1348. - DT_DEL_NODE = 270,
  1349. - DT_PROPNODENAME = 271,
  1350. - DT_LITERAL = 272,
  1351. - DT_CHAR_LITERAL = 273,
  1352. - DT_BASE = 274,
  1353. - DT_BYTE = 275,
  1354. - DT_STRING = 276,
  1355. - DT_LABEL = 277,
  1356. - DT_REF = 278,
  1357. - DT_INCBIN = 279
  1358. - };
  1359. + enum yytokentype
  1360. + {
  1361. + DT_V1 = 258,
  1362. + DT_PLUGIN = 259,
  1363. + DT_MEMRESERVE = 260,
  1364. + DT_LSHIFT = 261,
  1365. + DT_RSHIFT = 262,
  1366. + DT_LE = 263,
  1367. + DT_GE = 264,
  1368. + DT_EQ = 265,
  1369. + DT_NE = 266,
  1370. + DT_AND = 267,
  1371. + DT_OR = 268,
  1372. + DT_BITS = 269,
  1373. + DT_DEL_PROP = 270,
  1374. + DT_DEL_NODE = 271,
  1375. + DT_PROPNODENAME = 272,
  1376. + DT_LITERAL = 273,
  1377. + DT_CHAR_LITERAL = 274,
  1378. + DT_BYTE = 275,
  1379. + DT_STRING = 276,
  1380. + DT_LABEL = 277,
  1381. + DT_REF = 278,
  1382. + DT_INCBIN = 279
  1383. + };
  1384. #endif
  1385. -
  1386. +/* Value type. */
  1387. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  1388. -typedef union YYSTYPE
  1389. +typedef union YYSTYPE YYSTYPE;
  1390. +union YYSTYPE
  1391. {
  1392. -/* Line 387 of yacc.c */
  1393. -#line 40 "dtc-parser.y"
  1394. +#line 39 "dtc-parser.y" /* yacc.c:355 */
  1395. char *propnodename;
  1396. - char *literal;
  1397. char *labelref;
  1398. - unsigned int cbase;
  1399. uint8_t byte;
  1400. struct data data;
  1401. @@ -169,38 +164,38 @@ typedef union YYSTYPE
  1402. struct node *nodelist;
  1403. struct reserve_info *re;
  1404. uint64_t integer;
  1405. + int is_plugin;
  1406. -
  1407. -/* Line 387 of yacc.c */
  1408. -#line 176 "dtc-parser.tab.c"
  1409. -} YYSTYPE;
  1410. +#line 170 "dtc-parser.tab.c" /* yacc.c:355 */
  1411. +};
  1412. # define YYSTYPE_IS_TRIVIAL 1
  1413. -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
  1414. # define YYSTYPE_IS_DECLARED 1
  1415. #endif
  1416. -extern YYSTYPE yylval;
  1417. -
  1418. -#ifdef YYPARSE_PARAM
  1419. -#if defined __STDC__ || defined __cplusplus
  1420. -int yyparse (void *YYPARSE_PARAM);
  1421. -#else
  1422. -int yyparse ();
  1423. +/* Location type. */
  1424. +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
  1425. +typedef struct YYLTYPE YYLTYPE;
  1426. +struct YYLTYPE
  1427. +{
  1428. + int first_line;
  1429. + int first_column;
  1430. + int last_line;
  1431. + int last_column;
  1432. +};
  1433. +# define YYLTYPE_IS_DECLARED 1
  1434. +# define YYLTYPE_IS_TRIVIAL 1
  1435. #endif
  1436. -#else /* ! YYPARSE_PARAM */
  1437. -#if defined __STDC__ || defined __cplusplus
  1438. +
  1439. +
  1440. +extern YYSTYPE yylval;
  1441. +extern YYLTYPE yylloc;
  1442. int yyparse (void);
  1443. -#else
  1444. -int yyparse ();
  1445. -#endif
  1446. -#endif /* ! YYPARSE_PARAM */
  1447. #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
  1448. /* Copy the second part of user declarations. */
  1449. -/* Line 390 of yacc.c */
  1450. -#line 204 "dtc-parser.tab.c"
  1451. +#line 199 "dtc-parser.tab.c" /* yacc.c:358 */
  1452. #ifdef short
  1453. # undef short
  1454. @@ -214,11 +209,8 @@ typedef unsigned char yytype_uint8;
  1455. #ifdef YYTYPE_INT8
  1456. typedef YYTYPE_INT8 yytype_int8;
  1457. -#elif (defined __STDC__ || defined __C99__FUNC__ \
  1458. - || defined __cplusplus || defined _MSC_VER)
  1459. -typedef signed char yytype_int8;
  1460. #else
  1461. -typedef short int yytype_int8;
  1462. +typedef signed char yytype_int8;
  1463. #endif
  1464. #ifdef YYTYPE_UINT16
  1465. @@ -238,8 +230,7 @@ typedef short int yytype_int16;
  1466. # define YYSIZE_T __SIZE_TYPE__
  1467. # elif defined size_t
  1468. # define YYSIZE_T size_t
  1469. -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  1470. - || defined __cplusplus || defined _MSC_VER)
  1471. +# elif ! defined YYSIZE_T
  1472. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  1473. # define YYSIZE_T size_t
  1474. # else
  1475. @@ -261,11 +252,30 @@ typedef short int yytype_int16;
  1476. # endif
  1477. #endif
  1478. -#ifndef __attribute__
  1479. -/* This feature is available in gcc versions 2.5 and later. */
  1480. -# if (! defined __GNUC__ || __GNUC__ < 2 \
  1481. - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
  1482. -# define __attribute__(Spec) /* empty */
  1483. +#ifndef YY_ATTRIBUTE
  1484. +# if (defined __GNUC__ \
  1485. + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
  1486. + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
  1487. +# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
  1488. +# else
  1489. +# define YY_ATTRIBUTE(Spec) /* empty */
  1490. +# endif
  1491. +#endif
  1492. +
  1493. +#ifndef YY_ATTRIBUTE_PURE
  1494. +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
  1495. +#endif
  1496. +
  1497. +#ifndef YY_ATTRIBUTE_UNUSED
  1498. +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
  1499. +#endif
  1500. +
  1501. +#if !defined _Noreturn \
  1502. + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
  1503. +# if defined _MSC_VER && 1200 <= _MSC_VER
  1504. +# define _Noreturn __declspec (noreturn)
  1505. +# else
  1506. +# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
  1507. # endif
  1508. #endif
  1509. @@ -276,24 +286,25 @@ typedef short int yytype_int16;
  1510. # define YYUSE(E) /* empty */
  1511. #endif
  1512. -
  1513. -/* Identity function, used to suppress warnings about constant conditions. */
  1514. -#ifndef lint
  1515. -# define YYID(N) (N)
  1516. -#else
  1517. -#if (defined __STDC__ || defined __C99__FUNC__ \
  1518. - || defined __cplusplus || defined _MSC_VER)
  1519. -static int
  1520. -YYID (int yyi)
  1521. +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  1522. +/* Suppress an incorrect diagnostic about yylval being uninitialized. */
  1523. +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  1524. + _Pragma ("GCC diagnostic push") \
  1525. + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
  1526. + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  1527. +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  1528. + _Pragma ("GCC diagnostic pop")
  1529. #else
  1530. -static int
  1531. -YYID (yyi)
  1532. - int yyi;
  1533. +# define YY_INITIAL_VALUE(Value) Value
  1534. #endif
  1535. -{
  1536. - return yyi;
  1537. -}
  1538. +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1539. +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1540. +# define YY_IGNORE_MAYBE_UNINITIALIZED_END
  1541. #endif
  1542. +#ifndef YY_INITIAL_VALUE
  1543. +# define YY_INITIAL_VALUE(Value) /* Nothing. */
  1544. +#endif
  1545. +
  1546. #if ! defined yyoverflow || YYERROR_VERBOSE
  1547. @@ -312,8 +323,7 @@ YYID (yyi)
  1548. # define alloca _alloca
  1549. # else
  1550. # define YYSTACK_ALLOC alloca
  1551. -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  1552. - || defined __cplusplus || defined _MSC_VER)
  1553. +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  1554. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  1555. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  1556. # ifndef EXIT_SUCCESS
  1557. @@ -325,8 +335,8 @@ YYID (yyi)
  1558. # endif
  1559. # ifdef YYSTACK_ALLOC
  1560. - /* Pacify GCC's `empty if-body' warning. */
  1561. -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  1562. + /* Pacify GCC's 'empty if-body' warning. */
  1563. +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  1564. # ifndef YYSTACK_ALLOC_MAXIMUM
  1565. /* The OS might guarantee only one guard page at the bottom of the stack,
  1566. and a page size can be as small as 4096 bytes. So we cannot safely
  1567. @@ -342,7 +352,7 @@ YYID (yyi)
  1568. # endif
  1569. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  1570. && ! ((defined YYMALLOC || defined malloc) \
  1571. - && (defined YYFREE || defined free)))
  1572. + && (defined YYFREE || defined free)))
  1573. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  1574. # ifndef EXIT_SUCCESS
  1575. # define EXIT_SUCCESS 0
  1576. @@ -350,15 +360,13 @@ YYID (yyi)
  1577. # endif
  1578. # ifndef YYMALLOC
  1579. # define YYMALLOC malloc
  1580. -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  1581. - || defined __cplusplus || defined _MSC_VER)
  1582. +# if ! defined malloc && ! defined EXIT_SUCCESS
  1583. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  1584. # endif
  1585. # endif
  1586. # ifndef YYFREE
  1587. # define YYFREE free
  1588. -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  1589. - || defined __cplusplus || defined _MSC_VER)
  1590. +# if ! defined free && ! defined EXIT_SUCCESS
  1591. void free (void *); /* INFRINGES ON USER NAME SPACE */
  1592. # endif
  1593. # endif
  1594. @@ -368,13 +376,15 @@ void free (void *); /* INFRINGES ON USER
  1595. #if (! defined yyoverflow \
  1596. && (! defined __cplusplus \
  1597. - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  1598. + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
  1599. + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  1600. /* A type that is properly aligned for any stack member. */
  1601. union yyalloc
  1602. {
  1603. yytype_int16 yyss_alloc;
  1604. YYSTYPE yyvs_alloc;
  1605. + YYLTYPE yyls_alloc;
  1606. };
  1607. /* The size of the maximum gap between one aligned stack and the next. */
  1608. @@ -383,8 +393,8 @@ union yyalloc
  1609. /* The size of an array large to enough to hold all stacks, each with
  1610. N elements. */
  1611. # define YYSTACK_BYTES(N) \
  1612. - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  1613. - + YYSTACK_GAP_MAXIMUM)
  1614. + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
  1615. + + 2 * YYSTACK_GAP_MAXIMUM)
  1616. # define YYCOPY_NEEDED 1
  1617. @@ -393,16 +403,16 @@ union yyalloc
  1618. elements in the stack, and YYPTR gives the new location of the
  1619. stack. Advance YYPTR to a properly aligned location for the next
  1620. stack. */
  1621. -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  1622. - do \
  1623. - { \
  1624. - YYSIZE_T yynewbytes; \
  1625. - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  1626. - Stack = &yyptr->Stack_alloc; \
  1627. - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  1628. - yyptr += yynewbytes / sizeof (*yyptr); \
  1629. - } \
  1630. - while (YYID (0))
  1631. +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  1632. + do \
  1633. + { \
  1634. + YYSIZE_T yynewbytes; \
  1635. + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  1636. + Stack = &yyptr->Stack_alloc; \
  1637. + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  1638. + yyptr += yynewbytes / sizeof (*yyptr); \
  1639. + } \
  1640. + while (0)
  1641. #endif
  1642. @@ -421,7 +431,7 @@ union yyalloc
  1643. for (yyi = 0; yyi < (Count); yyi++) \
  1644. (Dst)[yyi] = (Src)[yyi]; \
  1645. } \
  1646. - while (YYID (0))
  1647. + while (0)
  1648. # endif
  1649. # endif
  1650. #endif /* !YYCOPY_NEEDED */
  1651. @@ -429,25 +439,27 @@ union yyalloc
  1652. /* YYFINAL -- State number of the termination state. */
  1653. #define YYFINAL 4
  1654. /* YYLAST -- Last index in YYTABLE. */
  1655. -#define YYLAST 133
  1656. +#define YYLAST 135
  1657. /* YYNTOKENS -- Number of terminals. */
  1658. #define YYNTOKENS 48
  1659. /* YYNNTS -- Number of nonterminals. */
  1660. -#define YYNNTS 28
  1661. +#define YYNNTS 29
  1662. /* YYNRULES -- Number of rules. */
  1663. -#define YYNRULES 79
  1664. -/* YYNRULES -- Number of states. */
  1665. -#define YYNSTATES 141
  1666. +#define YYNRULES 81
  1667. +/* YYNSTATES -- Number of states. */
  1668. +#define YYNSTATES 144
  1669. -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  1670. +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
  1671. + by yylex, with out-of-bounds checking. */
  1672. #define YYUNDEFTOK 2
  1673. #define YYMAXUTOK 279
  1674. -#define YYTRANSLATE(YYX) \
  1675. +#define YYTRANSLATE(YYX) \
  1676. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  1677. -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
  1678. +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  1679. + as returned by yylex, without out-of-bounds checking. */
  1680. static const yytype_uint8 yytranslate[] =
  1681. {
  1682. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  1683. @@ -481,63 +493,18 @@ static const yytype_uint8 yytranslate[]
  1684. };
  1685. #if YYDEBUG
  1686. -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  1687. - YYRHS. */
  1688. -static const yytype_uint16 yyprhs[] =
  1689. -{
  1690. - 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
  1691. - 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
  1692. - 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
  1693. - 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
  1694. - 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
  1695. - 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
  1696. - 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
  1697. - 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
  1698. -};
  1699. -
  1700. -/* YYRHS -- A `-1'-separated list of the rules' RHS. */
  1701. -static const yytype_int8 yyrhs[] =
  1702. -{
  1703. - 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
  1704. - 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
  1705. - 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
  1706. - -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
  1707. - 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
  1708. - -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
  1709. - -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
  1710. - 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
  1711. - 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
  1712. - 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
  1713. - 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
  1714. - -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
  1715. - -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
  1716. - 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
  1717. - -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
  1718. - 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
  1719. - -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
  1720. - -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
  1721. - -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
  1722. - 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
  1723. - -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
  1724. - -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
  1725. - -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
  1726. - 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
  1727. - 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
  1728. - 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
  1729. - 75, -1
  1730. -};
  1731. -
  1732. -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  1733. + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  1734. static const yytype_uint16 yyrline[] =
  1735. {
  1736. - 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
  1737. - 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
  1738. - 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
  1739. - 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
  1740. - 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
  1741. - 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
  1742. - 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
  1743. - 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
  1744. + 0, 108, 108, 119, 122, 130, 133, 140, 144, 152,
  1745. + 156, 160, 170, 185, 193, 196, 203, 207, 211, 215,
  1746. + 223, 227, 231, 235, 239, 255, 265, 273, 276, 280,
  1747. + 287, 303, 308, 327, 341, 348, 349, 350, 357, 361,
  1748. + 362, 366, 367, 371, 372, 376, 377, 381, 382, 386,
  1749. + 387, 391, 392, 393, 397, 398, 399, 400, 401, 405,
  1750. + 406, 407, 411, 412, 413, 417, 418, 419, 420, 424,
  1751. + 425, 426, 427, 432, 435, 439, 447, 450, 454, 462,
  1752. + 466, 470
  1753. };
  1754. #endif
  1755. @@ -546,25 +513,25 @@ static const yytype_uint16 yyrline[] =
  1756. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  1757. static const char *const yytname[] =
  1758. {
  1759. - "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
  1760. - "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
  1761. - "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
  1762. - "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
  1763. + "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE",
  1764. + "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND",
  1765. + "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME",
  1766. + "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL",
  1767. "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
  1768. "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
  1769. "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
  1770. - "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
  1771. - "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
  1772. - "integer_expr", "integer_trinary", "integer_or", "integer_and",
  1773. - "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
  1774. - "integer_rela", "integer_shift", "integer_add", "integer_mul",
  1775. - "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL
  1776. + "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef",
  1777. + "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix",
  1778. + "integer_prim", "integer_expr", "integer_trinary", "integer_or",
  1779. + "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand",
  1780. + "integer_eq", "integer_rela", "integer_shift", "integer_add",
  1781. + "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR
  1782. };
  1783. #endif
  1784. # ifdef YYPRINT
  1785. -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  1786. - token YYLEX-NUM. */
  1787. +/* YYTOKNUM[NUM] -- (External) token number corresponding to the
  1788. + (internal) symbol number NUM (which must be that of a token). */
  1789. static const yytype_uint16 yytoknum[] =
  1790. {
  1791. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  1792. @@ -575,183 +542,173 @@ static const yytype_uint16 yytoknum[] =
  1793. };
  1794. # endif
  1795. -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  1796. -static const yytype_uint8 yyr1[] =
  1797. -{
  1798. - 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
  1799. - 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
  1800. - 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
  1801. - 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
  1802. - 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
  1803. - 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
  1804. - 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
  1805. - 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
  1806. -};
  1807. +#define YYPACT_NINF -41
  1808. -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  1809. -static const yytype_uint8 yyr2[] =
  1810. +#define yypact_value_is_default(Yystate) \
  1811. + (!!((Yystate) == (-41)))
  1812. +
  1813. +#define YYTABLE_NINF -1
  1814. +
  1815. +#define yytable_value_is_error(Yytable_value) \
  1816. + 0
  1817. +
  1818. + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  1819. + STATE-NUM. */
  1820. +static const yytype_int8 yypact[] =
  1821. {
  1822. - 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
  1823. - 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
  1824. - 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
  1825. - 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
  1826. - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
  1827. - 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
  1828. - 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
  1829. - 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
  1830. + 37, 10, 24, 78, -41, 20, 9, -41, 8, 9,
  1831. + 59, 9, -41, -41, -10, 8, -41, 60, 39, -41,
  1832. + -10, -10, -10, -41, 51, -41, -7, 76, 50, 52,
  1833. + 53, 49, 2, 65, 32, -1, -41, 66, -41, -41,
  1834. + 67, 60, 60, -41, -41, -41, -41, -10, -10, -10,
  1835. + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
  1836. + -10, -10, -10, -10, -10, -10, -41, 41, 68, -41,
  1837. + -41, 76, 57, 50, 52, 53, 49, 2, 2, 65,
  1838. + 65, 65, 65, 32, 32, -1, -1, -41, -41, -41,
  1839. + 79, 80, -12, 41, -41, 70, 41, -41, -10, 74,
  1840. + 75, -41, -41, -41, -41, -41, 77, -41, -41, -41,
  1841. + -41, -41, 17, -2, -41, -41, -41, -41, 83, -41,
  1842. + -41, -41, 71, -41, -41, 31, 69, 82, -4, -41,
  1843. + -41, -41, -41, -41, 42, -41, -41, -41, 8, -41,
  1844. + 72, 8, 73, -41
  1845. };
  1846. -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
  1847. - Performed when YYTABLE doesn't specify something else to do. Zero
  1848. - means the default is an error. */
  1849. + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  1850. + Performed when YYTABLE does not specify something else to do. Zero
  1851. + means the default is an error. */
  1852. static const yytype_uint8 yydefact[] =
  1853. {
  1854. - 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
  1855. - 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
  1856. - 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
  1857. - 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
  1858. - 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
  1859. + 0, 0, 0, 3, 1, 0, 5, 4, 0, 0,
  1860. + 0, 5, 35, 36, 0, 0, 8, 0, 2, 6,
  1861. + 0, 0, 0, 69, 0, 38, 39, 41, 43, 45,
  1862. + 47, 49, 51, 54, 61, 64, 68, 0, 14, 9,
  1863. + 0, 0, 0, 70, 71, 72, 37, 0, 0, 0,
  1864. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1865. - 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
  1866. - 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
  1867. - 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
  1868. - 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
  1869. - 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
  1870. - 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
  1871. - 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
  1872. - 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
  1873. - 22
  1874. + 0, 0, 0, 0, 0, 0, 7, 76, 0, 11,
  1875. + 10, 42, 0, 44, 46, 48, 50, 52, 53, 57,
  1876. + 58, 56, 55, 59, 60, 62, 63, 66, 65, 67,
  1877. + 0, 0, 0, 0, 15, 0, 76, 12, 0, 0,
  1878. + 0, 17, 27, 79, 19, 81, 0, 78, 77, 40,
  1879. + 18, 80, 0, 0, 13, 26, 16, 28, 0, 20,
  1880. + 29, 23, 0, 73, 31, 0, 0, 0, 0, 34,
  1881. + 33, 21, 32, 30, 0, 74, 75, 22, 0, 25,
  1882. + 0, 0, 0, 24
  1883. };
  1884. -/* YYDEFGOTO[NTERM-NUM]. */
  1885. -static const yytype_int8 yydefgoto[] =
  1886. + /* YYPGOTO[NTERM-NUM]. */
  1887. +static const yytype_int8 yypgoto[] =
  1888. {
  1889. - -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
  1890. - 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
  1891. - 29, 30, 31, 32, 33, 125, 92, 93
  1892. + -41, -41, -41, 96, 100, -41, -40, -41, -23, -41,
  1893. + -41, -41, -8, 62, 13, -41, 81, 63, 64, 84,
  1894. + 61, 25, 11, 21, 22, -17, -41, 19, 23
  1895. };
  1896. -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  1897. - STATE-NUM. */
  1898. -#define YYPACT_NINF -78
  1899. -static const yytype_int8 yypact[] =
  1900. + /* YYDEFGOTO[NTERM-NUM]. */
  1901. +static const yytype_int16 yydefgoto[] =
  1902. {
  1903. - 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
  1904. - -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
  1905. - -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
  1906. - 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
  1907. - -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
  1908. - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
  1909. - -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
  1910. - 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
  1911. - 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
  1912. - 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
  1913. - -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
  1914. - -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
  1915. - -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
  1916. - -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
  1917. - -78
  1918. + -1, 2, 6, 10, 11, 18, 39, 67, 94, 112,
  1919. + 113, 125, 23, 24, 25, 26, 27, 28, 29, 30,
  1920. + 31, 32, 33, 34, 35, 36, 128, 95, 96
  1921. };
  1922. -/* YYPGOTO[NTERM-NUM]. */
  1923. -static const yytype_int8 yypgoto[] =
  1924. + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  1925. + positive, shift that token. If negative, reduce the rule whose
  1926. + number is the opposite. If YYTABLE_NINF, syntax error. */
  1927. +static const yytype_uint8 yytable[] =
  1928. {
  1929. - -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
  1930. - -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
  1931. - 34, 20, 26, 28, -14, -78, 18, 24
  1932. + 15, 69, 70, 43, 44, 45, 47, 37, 12, 13,
  1933. + 55, 56, 118, 101, 8, 38, 135, 102, 136, 119,
  1934. + 120, 121, 122, 14, 4, 63, 12, 13, 137, 123,
  1935. + 48, 9, 57, 20, 124, 3, 21, 22, 58, 115,
  1936. + 1, 14, 116, 64, 65, 7, 87, 88, 89, 12,
  1937. + 13, 117, 103, 129, 130, 40, 90, 91, 92, 53,
  1938. + 54, 131, 41, 93, 14, 42, 79, 80, 81, 82,
  1939. + 104, 59, 60, 107, 61, 62, 138, 139, 77, 78,
  1940. + 83, 84, 5, 85, 86, 17, 46, 38, 49, 50,
  1941. + 68, 66, 51, 97, 52, 98, 99, 100, 106, 110,
  1942. + 111, 126, 114, 134, 127, 133, 141, 19, 143, 16,
  1943. + 72, 109, 73, 76, 74, 108, 105, 132, 0, 0,
  1944. + 0, 0, 0, 0, 0, 0, 0, 0, 71, 0,
  1945. + 140, 0, 0, 142, 0, 75
  1946. };
  1947. -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  1948. - positive, shift that token. If negative, reduce the rule which
  1949. - number is the opposite. If YYTABLE_NINF, syntax error. */
  1950. -#define YYTABLE_NINF -1
  1951. -static const yytype_uint8 yytable[] =
  1952. +static const yytype_int16 yycheck[] =
  1953. {
  1954. - 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
  1955. - 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
  1956. - 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
  1957. - 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
  1958. - 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
  1959. - 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
  1960. - 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
  1961. - 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
  1962. - 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
  1963. - 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
  1964. - 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
  1965. - 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
  1966. - 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
  1967. - 137, 0, 73, 139
  1968. + 8, 41, 42, 20, 21, 22, 13, 15, 18, 19,
  1969. + 8, 9, 14, 25, 5, 27, 20, 29, 22, 21,
  1970. + 22, 23, 24, 33, 0, 26, 18, 19, 32, 31,
  1971. + 37, 22, 30, 43, 36, 25, 46, 47, 36, 22,
  1972. + 3, 33, 25, 44, 45, 25, 63, 64, 65, 18,
  1973. + 19, 34, 92, 22, 23, 16, 15, 16, 17, 10,
  1974. + 11, 30, 23, 22, 33, 26, 55, 56, 57, 58,
  1975. + 93, 6, 7, 96, 42, 43, 34, 35, 53, 54,
  1976. + 59, 60, 4, 61, 62, 26, 35, 27, 12, 39,
  1977. + 23, 25, 40, 25, 41, 38, 17, 17, 28, 25,
  1978. + 25, 18, 25, 21, 33, 36, 34, 11, 35, 9,
  1979. + 48, 98, 49, 52, 50, 96, 93, 125, -1, -1,
  1980. + -1, -1, -1, -1, -1, -1, -1, -1, 47, -1,
  1981. + 138, -1, -1, 141, -1, 51
  1982. };
  1983. -#define yypact_value_is_default(Yystate) \
  1984. - (!!((Yystate) == (-78)))
  1985. -
  1986. -#define yytable_value_is_error(Yytable_value) \
  1987. - YYID (0)
  1988. + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  1989. + symbol of state STATE-NUM. */
  1990. +static const yytype_uint8 yystos[] =
  1991. +{
  1992. + 0, 3, 49, 25, 0, 4, 50, 25, 5, 22,
  1993. + 51, 52, 18, 19, 33, 60, 52, 26, 53, 51,
  1994. + 43, 46, 47, 60, 61, 62, 63, 64, 65, 66,
  1995. + 67, 68, 69, 70, 71, 72, 73, 60, 27, 54,
  1996. + 16, 23, 26, 73, 73, 73, 35, 13, 37, 12,
  1997. + 39, 40, 41, 10, 11, 8, 9, 30, 36, 6,
  1998. + 7, 42, 43, 26, 44, 45, 25, 55, 23, 54,
  1999. + 54, 64, 61, 65, 66, 67, 68, 69, 69, 70,
  2000. + 70, 70, 70, 71, 71, 72, 72, 73, 73, 73,
  2001. + 15, 16, 17, 22, 56, 75, 76, 25, 38, 17,
  2002. + 17, 25, 29, 54, 56, 76, 28, 56, 75, 62,
  2003. + 25, 25, 57, 58, 25, 22, 25, 34, 14, 21,
  2004. + 22, 23, 24, 31, 36, 59, 18, 33, 74, 22,
  2005. + 23, 30, 60, 36, 21, 20, 22, 32, 34, 35,
  2006. + 60, 34, 60, 35
  2007. +};
  2008. -static const yytype_int16 yycheck[] =
  2009. + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  2010. +static const yytype_uint8 yyr1[] =
  2011. {
  2012. - 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
  2013. - 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
  2014. - 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
  2015. - 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
  2016. - 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
  2017. - 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
  2018. - 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
  2019. - 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
  2020. - 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
  2021. - 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
  2022. - 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
  2023. - 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
  2024. - 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
  2025. - 135, -1, 49, 138
  2026. + 0, 48, 49, 50, 50, 51, 51, 52, 52, 53,
  2027. + 53, 53, 53, 54, 55, 55, 56, 56, 56, 56,
  2028. + 57, 57, 57, 57, 57, 57, 57, 58, 58, 58,
  2029. + 59, 59, 59, 59, 59, 60, 60, 60, 61, 62,
  2030. + 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
  2031. + 67, 68, 68, 68, 69, 69, 69, 69, 69, 70,
  2032. + 70, 70, 71, 71, 71, 72, 72, 72, 72, 73,
  2033. + 73, 73, 73, 74, 74, 74, 75, 75, 75, 76,
  2034. + 76, 76
  2035. };
  2036. -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  2037. - symbol of state STATE-NUM. */
  2038. -static const yytype_uint8 yystos[] =
  2039. + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  2040. +static const yytype_uint8 yyr2[] =
  2041. {
  2042. - 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
  2043. - 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
  2044. - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
  2045. - 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
  2046. - 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
  2047. - 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
  2048. - 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
  2049. - 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
  2050. - 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
  2051. - 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
  2052. - 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
  2053. - 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
  2054. - 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
  2055. - 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
  2056. - 35
  2057. + 0, 2, 5, 0, 2, 0, 2, 4, 2, 2,
  2058. + 3, 3, 4, 5, 0, 2, 4, 2, 3, 2,
  2059. + 2, 3, 4, 2, 9, 5, 2, 0, 2, 2,
  2060. + 3, 1, 2, 2, 2, 1, 1, 3, 1, 1,
  2061. + 5, 1, 3, 1, 3, 1, 3, 1, 3, 1,
  2062. + 3, 1, 3, 3, 1, 3, 3, 3, 3, 3,
  2063. + 3, 1, 3, 3, 1, 3, 3, 3, 1, 1,
  2064. + 2, 2, 2, 0, 2, 2, 0, 2, 2, 2,
  2065. + 3, 2
  2066. };
  2067. -#define yyerrok (yyerrstatus = 0)
  2068. -#define yyclearin (yychar = YYEMPTY)
  2069. -#define YYEMPTY (-2)
  2070. -#define YYEOF 0
  2071. -
  2072. -#define YYACCEPT goto yyacceptlab
  2073. -#define YYABORT goto yyabortlab
  2074. -#define YYERROR goto yyerrorlab
  2075. -
  2076. -
  2077. -/* Like YYERROR except do call yyerror. This remains here temporarily
  2078. - to ease the transition to the new meaning of YYERROR, for GCC.
  2079. - Once GCC version 2 has supplanted version 1, this can go. However,
  2080. - YYFAIL appears to be in use. Nevertheless, it is formally deprecated
  2081. - in Bison 2.4.2's NEWS entry, where a plan to phase it out is
  2082. - discussed. */
  2083. -
  2084. -#define YYFAIL goto yyerrlab
  2085. -#if defined YYFAIL
  2086. - /* This is here to suppress warnings from the GCC cpp's
  2087. - -Wunused-macros. Normally we don't worry about that warning, but
  2088. - some users do, and we want to make it easy for users to remove
  2089. - YYFAIL uses, which will produce warnings from Bison 2.5. */
  2090. -#endif
  2091. +
  2092. +#define yyerrok (yyerrstatus = 0)
  2093. +#define yyclearin (yychar = YYEMPTY)
  2094. +#define YYEMPTY (-2)
  2095. +#define YYEOF 0
  2096. +
  2097. +#define YYACCEPT goto yyacceptlab
  2098. +#define YYABORT goto yyabortlab
  2099. +#define YYERROR goto yyerrorlab
  2100. +
  2101. #define YYRECOVERING() (!!yyerrstatus)
  2102. @@ -768,27 +725,41 @@ do
  2103. else \
  2104. { \
  2105. yyerror (YY_("syntax error: cannot back up")); \
  2106. - YYERROR; \
  2107. - } \
  2108. -while (YYID (0))
  2109. + YYERROR; \
  2110. + } \
  2111. +while (0)
  2112. /* Error token number */
  2113. -#define YYTERROR 1
  2114. -#define YYERRCODE 256
  2115. +#define YYTERROR 1
  2116. +#define YYERRCODE 256
  2117. -/* This macro is provided for backward compatibility. */
  2118. -#ifndef YY_LOCATION_PRINT
  2119. -# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  2120. +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  2121. + If N is 0, then set CURRENT to the empty location which ends
  2122. + the previous symbol: RHS[0] (always defined). */
  2123. +
  2124. +#ifndef YYLLOC_DEFAULT
  2125. +# define YYLLOC_DEFAULT(Current, Rhs, N) \
  2126. + do \
  2127. + if (N) \
  2128. + { \
  2129. + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
  2130. + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
  2131. + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
  2132. + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
  2133. + } \
  2134. + else \
  2135. + { \
  2136. + (Current).first_line = (Current).last_line = \
  2137. + YYRHSLOC (Rhs, 0).last_line; \
  2138. + (Current).first_column = (Current).last_column = \
  2139. + YYRHSLOC (Rhs, 0).last_column; \
  2140. + } \
  2141. + while (0)
  2142. #endif
  2143. +#define YYRHSLOC(Rhs, K) ((Rhs)[K])
  2144. -/* YYLEX -- calling `yylex' with the right arguments. */
  2145. -#ifdef YYLEX_PARAM
  2146. -# define YYLEX yylex (YYLEX_PARAM)
  2147. -#else
  2148. -# define YYLEX yylex ()
  2149. -#endif
  2150. /* Enable debugging if requested. */
  2151. #if YYDEBUG
  2152. @@ -798,50 +769,84 @@ while (YYID (0))
  2153. # define YYFPRINTF fprintf
  2154. # endif
  2155. -# define YYDPRINTF(Args) \
  2156. -do { \
  2157. - if (yydebug) \
  2158. - YYFPRINTF Args; \
  2159. -} while (YYID (0))
  2160. -
  2161. -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  2162. -do { \
  2163. - if (yydebug) \
  2164. - { \
  2165. - YYFPRINTF (stderr, "%s ", Title); \
  2166. - yy_symbol_print (stderr, \
  2167. - Type, Value); \
  2168. - YYFPRINTF (stderr, "\n"); \
  2169. - } \
  2170. -} while (YYID (0))
  2171. +# define YYDPRINTF(Args) \
  2172. +do { \
  2173. + if (yydebug) \
  2174. + YYFPRINTF Args; \
  2175. +} while (0)
  2176. -/*--------------------------------.
  2177. -| Print this symbol on YYOUTPUT. |
  2178. -`--------------------------------*/
  2179. +/* YY_LOCATION_PRINT -- Print the location on the stream.
  2180. + This macro was not mandated originally: define only if we know
  2181. + we won't break user code: when these are the locations we know. */
  2182. -/*ARGSUSED*/
  2183. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2184. - || defined __cplusplus || defined _MSC_VER)
  2185. -static void
  2186. -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  2187. -#else
  2188. -static void
  2189. -yy_symbol_value_print (yyoutput, yytype, yyvaluep)
  2190. - FILE *yyoutput;
  2191. - int yytype;
  2192. - YYSTYPE const * const yyvaluep;
  2193. +#ifndef YY_LOCATION_PRINT
  2194. +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  2195. +
  2196. +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
  2197. +
  2198. +YY_ATTRIBUTE_UNUSED
  2199. +static unsigned
  2200. +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
  2201. +{
  2202. + unsigned res = 0;
  2203. + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
  2204. + if (0 <= yylocp->first_line)
  2205. + {
  2206. + res += YYFPRINTF (yyo, "%d", yylocp->first_line);
  2207. + if (0 <= yylocp->first_column)
  2208. + res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
  2209. + }
  2210. + if (0 <= yylocp->last_line)
  2211. + {
  2212. + if (yylocp->first_line < yylocp->last_line)
  2213. + {
  2214. + res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
  2215. + if (0 <= end_col)
  2216. + res += YYFPRINTF (yyo, ".%d", end_col);
  2217. + }
  2218. + else if (0 <= end_col && yylocp->first_column < end_col)
  2219. + res += YYFPRINTF (yyo, "-%d", end_col);
  2220. + }
  2221. + return res;
  2222. + }
  2223. +
  2224. +# define YY_LOCATION_PRINT(File, Loc) \
  2225. + yy_location_print_ (File, &(Loc))
  2226. +
  2227. +# else
  2228. +# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  2229. +# endif
  2230. #endif
  2231. +
  2232. +
  2233. +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  2234. +do { \
  2235. + if (yydebug) \
  2236. + { \
  2237. + YYFPRINTF (stderr, "%s ", Title); \
  2238. + yy_symbol_print (stderr, \
  2239. + Type, Value, Location); \
  2240. + YYFPRINTF (stderr, "\n"); \
  2241. + } \
  2242. +} while (0)
  2243. +
  2244. +
  2245. +/*----------------------------------------.
  2246. +| Print this symbol's value on YYOUTPUT. |
  2247. +`----------------------------------------*/
  2248. +
  2249. +static void
  2250. +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
  2251. {
  2252. FILE *yyo = yyoutput;
  2253. YYUSE (yyo);
  2254. + YYUSE (yylocationp);
  2255. if (!yyvaluep)
  2256. return;
  2257. # ifdef YYPRINT
  2258. if (yytype < YYNTOKENS)
  2259. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  2260. -# else
  2261. - YYUSE (yyoutput);
  2262. # endif
  2263. YYUSE (yytype);
  2264. }
  2265. @@ -851,24 +856,15 @@ yy_symbol_value_print (yyoutput, yytype,
  2266. | Print this symbol on YYOUTPUT. |
  2267. `--------------------------------*/
  2268. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2269. - || defined __cplusplus || defined _MSC_VER)
  2270. -static void
  2271. -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  2272. -#else
  2273. static void
  2274. -yy_symbol_print (yyoutput, yytype, yyvaluep)
  2275. - FILE *yyoutput;
  2276. - int yytype;
  2277. - YYSTYPE const * const yyvaluep;
  2278. -#endif
  2279. +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
  2280. {
  2281. - if (yytype < YYNTOKENS)
  2282. - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  2283. - else
  2284. - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  2285. + YYFPRINTF (yyoutput, "%s %s (",
  2286. + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  2287. - yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  2288. + YY_LOCATION_PRINT (yyoutput, *yylocationp);
  2289. + YYFPRINTF (yyoutput, ": ");
  2290. + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
  2291. YYFPRINTF (yyoutput, ")");
  2292. }
  2293. @@ -877,16 +873,8 @@ yy_symbol_print (yyoutput, yytype, yyval
  2294. | TOP (included). |
  2295. `------------------------------------------------------------------*/
  2296. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2297. - || defined __cplusplus || defined _MSC_VER)
  2298. static void
  2299. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  2300. -#else
  2301. -static void
  2302. -yy_stack_print (yybottom, yytop)
  2303. - yytype_int16 *yybottom;
  2304. - yytype_int16 *yytop;
  2305. -#endif
  2306. {
  2307. YYFPRINTF (stderr, "Stack now");
  2308. for (; yybottom <= yytop; yybottom++)
  2309. @@ -897,49 +885,42 @@ yy_stack_print (yybottom, yytop)
  2310. YYFPRINTF (stderr, "\n");
  2311. }
  2312. -# define YY_STACK_PRINT(Bottom, Top) \
  2313. -do { \
  2314. - if (yydebug) \
  2315. - yy_stack_print ((Bottom), (Top)); \
  2316. -} while (YYID (0))
  2317. +# define YY_STACK_PRINT(Bottom, Top) \
  2318. +do { \
  2319. + if (yydebug) \
  2320. + yy_stack_print ((Bottom), (Top)); \
  2321. +} while (0)
  2322. /*------------------------------------------------.
  2323. | Report that the YYRULE is going to be reduced. |
  2324. `------------------------------------------------*/
  2325. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2326. - || defined __cplusplus || defined _MSC_VER)
  2327. -static void
  2328. -yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
  2329. -#else
  2330. static void
  2331. -yy_reduce_print (yyvsp, yyrule)
  2332. - YYSTYPE *yyvsp;
  2333. - int yyrule;
  2334. -#endif
  2335. +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
  2336. {
  2337. + unsigned long int yylno = yyrline[yyrule];
  2338. int yynrhs = yyr2[yyrule];
  2339. int yyi;
  2340. - unsigned long int yylno = yyrline[yyrule];
  2341. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  2342. - yyrule - 1, yylno);
  2343. + yyrule - 1, yylno);
  2344. /* The symbols being reduced. */
  2345. for (yyi = 0; yyi < yynrhs; yyi++)
  2346. {
  2347. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  2348. - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  2349. - &(yyvsp[(yyi + 1) - (yynrhs)])
  2350. - );
  2351. + yy_symbol_print (stderr,
  2352. + yystos[yyssp[yyi + 1 - yynrhs]],
  2353. + &(yyvsp[(yyi + 1) - (yynrhs)])
  2354. + , &(yylsp[(yyi + 1) - (yynrhs)]) );
  2355. YYFPRINTF (stderr, "\n");
  2356. }
  2357. }
  2358. -# define YY_REDUCE_PRINT(Rule) \
  2359. -do { \
  2360. - if (yydebug) \
  2361. - yy_reduce_print (yyvsp, Rule); \
  2362. -} while (YYID (0))
  2363. +# define YY_REDUCE_PRINT(Rule) \
  2364. +do { \
  2365. + if (yydebug) \
  2366. + yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
  2367. +} while (0)
  2368. /* Nonzero means print parse trace. It is left uninitialized so that
  2369. multiple parsers can coexist. */
  2370. @@ -953,7 +934,7 @@ int yydebug;
  2371. /* YYINITDEPTH -- initial size of the parser's stacks. */
  2372. -#ifndef YYINITDEPTH
  2373. +#ifndef YYINITDEPTH
  2374. # define YYINITDEPTH 200
  2375. #endif
  2376. @@ -976,15 +957,8 @@ int yydebug;
  2377. # define yystrlen strlen
  2378. # else
  2379. /* Return the length of YYSTR. */
  2380. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2381. - || defined __cplusplus || defined _MSC_VER)
  2382. static YYSIZE_T
  2383. yystrlen (const char *yystr)
  2384. -#else
  2385. -static YYSIZE_T
  2386. -yystrlen (yystr)
  2387. - const char *yystr;
  2388. -#endif
  2389. {
  2390. YYSIZE_T yylen;
  2391. for (yylen = 0; yystr[yylen]; yylen++)
  2392. @@ -1000,16 +974,8 @@ yystrlen (yystr)
  2393. # else
  2394. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  2395. YYDEST. */
  2396. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2397. - || defined __cplusplus || defined _MSC_VER)
  2398. static char *
  2399. yystpcpy (char *yydest, const char *yysrc)
  2400. -#else
  2401. -static char *
  2402. -yystpcpy (yydest, yysrc)
  2403. - char *yydest;
  2404. - const char *yysrc;
  2405. -#endif
  2406. {
  2407. char *yyd = yydest;
  2408. const char *yys = yysrc;
  2409. @@ -1039,27 +1005,27 @@ yytnamerr (char *yyres, const char *yyst
  2410. char const *yyp = yystr;
  2411. for (;;)
  2412. - switch (*++yyp)
  2413. - {
  2414. - case '\'':
  2415. - case ',':
  2416. - goto do_not_strip_quotes;
  2417. -
  2418. - case '\\':
  2419. - if (*++yyp != '\\')
  2420. - goto do_not_strip_quotes;
  2421. - /* Fall through. */
  2422. - default:
  2423. - if (yyres)
  2424. - yyres[yyn] = *yyp;
  2425. - yyn++;
  2426. - break;
  2427. -
  2428. - case '"':
  2429. - if (yyres)
  2430. - yyres[yyn] = '\0';
  2431. - return yyn;
  2432. - }
  2433. + switch (*++yyp)
  2434. + {
  2435. + case '\'':
  2436. + case ',':
  2437. + goto do_not_strip_quotes;
  2438. +
  2439. + case '\\':
  2440. + if (*++yyp != '\\')
  2441. + goto do_not_strip_quotes;
  2442. + /* Fall through. */
  2443. + default:
  2444. + if (yyres)
  2445. + yyres[yyn] = *yyp;
  2446. + yyn++;
  2447. + break;
  2448. +
  2449. + case '"':
  2450. + if (yyres)
  2451. + yyres[yyn] = '\0';
  2452. + return yyn;
  2453. + }
  2454. do_not_strip_quotes: ;
  2455. }
  2456. @@ -1082,11 +1048,11 @@ static int
  2457. yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  2458. yytype_int16 *yyssp, int yytoken)
  2459. {
  2460. - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
  2461. + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  2462. YYSIZE_T yysize = yysize0;
  2463. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  2464. /* Internationalized format string. */
  2465. - const char *yyformat = YY_NULL;
  2466. + const char *yyformat = YY_NULLPTR;
  2467. /* Arguments of yyformat. */
  2468. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  2469. /* Number of reported tokens (one for the "unexpected", one per
  2470. @@ -1094,10 +1060,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
  2471. int yycount = 0;
  2472. /* There are many possibilities here to consider:
  2473. - - Assume YYFAIL is not used. It's too flawed to consider. See
  2474. - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
  2475. - for details. YYERROR is fine as it does not invoke this
  2476. - function.
  2477. - If this state is a consistent state with a default action, then
  2478. the only way this function was invoked is if the default action
  2479. is an error action. In that case, don't check for expected
  2480. @@ -1147,7 +1109,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
  2481. }
  2482. yyarg[yycount++] = yytname[yyx];
  2483. {
  2484. - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
  2485. + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  2486. if (! (yysize <= yysize1
  2487. && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  2488. return 2;
  2489. @@ -1214,26 +1176,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
  2490. | Release the memory associated to this symbol. |
  2491. `-----------------------------------------------*/
  2492. -/*ARGSUSED*/
  2493. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2494. - || defined __cplusplus || defined _MSC_VER)
  2495. -static void
  2496. -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
  2497. -#else
  2498. static void
  2499. -yydestruct (yymsg, yytype, yyvaluep)
  2500. - const char *yymsg;
  2501. - int yytype;
  2502. - YYSTYPE *yyvaluep;
  2503. -#endif
  2504. +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
  2505. {
  2506. YYUSE (yyvaluep);
  2507. -
  2508. + YYUSE (yylocationp);
  2509. if (!yymsg)
  2510. yymsg = "Deleting";
  2511. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  2512. + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  2513. YYUSE (yytype);
  2514. + YY_IGNORE_MAYBE_UNINITIALIZED_END
  2515. }
  2516. @@ -1242,18 +1196,14 @@ yydestruct (yymsg, yytype, yyvaluep)
  2517. /* The lookahead symbol. */
  2518. int yychar;
  2519. -
  2520. -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  2521. -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  2522. -# define YY_IGNORE_MAYBE_UNINITIALIZED_END
  2523. -#endif
  2524. -#ifndef YY_INITIAL_VALUE
  2525. -# define YY_INITIAL_VALUE(Value) /* Nothing. */
  2526. -#endif
  2527. -
  2528. /* The semantic value of the lookahead symbol. */
  2529. -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
  2530. -
  2531. +YYSTYPE yylval;
  2532. +/* Location data for the lookahead symbol. */
  2533. +YYLTYPE yylloc
  2534. +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  2535. + = { 1, 1, 1, 1 }
  2536. +# endif
  2537. +;
  2538. /* Number of syntax errors so far. */
  2539. int yynerrs;
  2540. @@ -1262,35 +1212,17 @@ int yynerrs;
  2541. | yyparse. |
  2542. `----------*/
  2543. -#ifdef YYPARSE_PARAM
  2544. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2545. - || defined __cplusplus || defined _MSC_VER)
  2546. -int
  2547. -yyparse (void *YYPARSE_PARAM)
  2548. -#else
  2549. -int
  2550. -yyparse (YYPARSE_PARAM)
  2551. - void *YYPARSE_PARAM;
  2552. -#endif
  2553. -#else /* ! YYPARSE_PARAM */
  2554. -#if (defined __STDC__ || defined __C99__FUNC__ \
  2555. - || defined __cplusplus || defined _MSC_VER)
  2556. int
  2557. yyparse (void)
  2558. -#else
  2559. -int
  2560. -yyparse ()
  2561. -
  2562. -#endif
  2563. -#endif
  2564. {
  2565. int yystate;
  2566. /* Number of tokens to shift before error messages enabled. */
  2567. int yyerrstatus;
  2568. /* The stacks and their tools:
  2569. - `yyss': related to states.
  2570. - `yyvs': related to semantic values.
  2571. + 'yyss': related to states.
  2572. + 'yyvs': related to semantic values.
  2573. + 'yyls': related to locations.
  2574. Refer to the stacks through separate pointers, to allow yyoverflow
  2575. to reallocate them elsewhere. */
  2576. @@ -1305,6 +1237,14 @@ yyparse ()
  2577. YYSTYPE *yyvs;
  2578. YYSTYPE *yyvsp;
  2579. + /* The location stack. */
  2580. + YYLTYPE yylsa[YYINITDEPTH];
  2581. + YYLTYPE *yyls;
  2582. + YYLTYPE *yylsp;
  2583. +
  2584. + /* The locations where the error started and ended. */
  2585. + YYLTYPE yyerror_range[3];
  2586. +
  2587. YYSIZE_T yystacksize;
  2588. int yyn;
  2589. @@ -1314,6 +1254,7 @@ yyparse ()
  2590. /* The variables used to return semantic value and location from the
  2591. action routines. */
  2592. YYSTYPE yyval;
  2593. + YYLTYPE yyloc;
  2594. #if YYERROR_VERBOSE
  2595. /* Buffer for error messages, and its allocated size. */
  2596. @@ -1322,7 +1263,7 @@ yyparse ()
  2597. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  2598. #endif
  2599. -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  2600. +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
  2601. /* The number of symbols on the RHS of the reduced rule.
  2602. Keep to zero when no symbol should be popped. */
  2603. @@ -1330,6 +1271,7 @@ yyparse ()
  2604. yyssp = yyss = yyssa;
  2605. yyvsp = yyvs = yyvsa;
  2606. + yylsp = yyls = yylsa;
  2607. yystacksize = YYINITDEPTH;
  2608. YYDPRINTF ((stderr, "Starting parse\n"));
  2609. @@ -1338,6 +1280,7 @@ yyparse ()
  2610. yyerrstatus = 0;
  2611. yynerrs = 0;
  2612. yychar = YYEMPTY; /* Cause a token to be read. */
  2613. + yylsp[0] = yylloc;
  2614. goto yysetstate;
  2615. /*------------------------------------------------------------.
  2616. @@ -1358,23 +1301,26 @@ yyparse ()
  2617. #ifdef yyoverflow
  2618. {
  2619. - /* Give user a chance to reallocate the stack. Use copies of
  2620. - these so that the &'s don't force the real ones into
  2621. - memory. */
  2622. - YYSTYPE *yyvs1 = yyvs;
  2623. - yytype_int16 *yyss1 = yyss;
  2624. -
  2625. - /* Each stack pointer address is followed by the size of the
  2626. - data in use in that stack, in bytes. This used to be a
  2627. - conditional around just the two extra args, but that might
  2628. - be undefined if yyoverflow is a macro. */
  2629. - yyoverflow (YY_("memory exhausted"),
  2630. - &yyss1, yysize * sizeof (*yyssp),
  2631. - &yyvs1, yysize * sizeof (*yyvsp),
  2632. - &yystacksize);
  2633. -
  2634. - yyss = yyss1;
  2635. - yyvs = yyvs1;
  2636. + /* Give user a chance to reallocate the stack. Use copies of
  2637. + these so that the &'s don't force the real ones into
  2638. + memory. */
  2639. + YYSTYPE *yyvs1 = yyvs;
  2640. + yytype_int16 *yyss1 = yyss;
  2641. + YYLTYPE *yyls1 = yyls;
  2642. +
  2643. + /* Each stack pointer address is followed by the size of the
  2644. + data in use in that stack, in bytes. This used to be a
  2645. + conditional around just the two extra args, but that might
  2646. + be undefined if yyoverflow is a macro. */
  2647. + yyoverflow (YY_("memory exhausted"),
  2648. + &yyss1, yysize * sizeof (*yyssp),
  2649. + &yyvs1, yysize * sizeof (*yyvsp),
  2650. + &yyls1, yysize * sizeof (*yylsp),
  2651. + &yystacksize);
  2652. +
  2653. + yyls = yyls1;
  2654. + yyss = yyss1;
  2655. + yyvs = yyvs1;
  2656. }
  2657. #else /* no yyoverflow */
  2658. # ifndef YYSTACK_RELOCATE
  2659. @@ -1382,34 +1328,36 @@ yyparse ()
  2660. # else
  2661. /* Extend the stack our own way. */
  2662. if (YYMAXDEPTH <= yystacksize)
  2663. - goto yyexhaustedlab;
  2664. + goto yyexhaustedlab;
  2665. yystacksize *= 2;
  2666. if (YYMAXDEPTH < yystacksize)
  2667. - yystacksize = YYMAXDEPTH;
  2668. + yystacksize = YYMAXDEPTH;
  2669. {
  2670. - yytype_int16 *yyss1 = yyss;
  2671. - union yyalloc *yyptr =
  2672. - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  2673. - if (! yyptr)
  2674. - goto yyexhaustedlab;
  2675. - YYSTACK_RELOCATE (yyss_alloc, yyss);
  2676. - YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  2677. + yytype_int16 *yyss1 = yyss;
  2678. + union yyalloc *yyptr =
  2679. + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  2680. + if (! yyptr)
  2681. + goto yyexhaustedlab;
  2682. + YYSTACK_RELOCATE (yyss_alloc, yyss);
  2683. + YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  2684. + YYSTACK_RELOCATE (yyls_alloc, yyls);
  2685. # undef YYSTACK_RELOCATE
  2686. - if (yyss1 != yyssa)
  2687. - YYSTACK_FREE (yyss1);
  2688. + if (yyss1 != yyssa)
  2689. + YYSTACK_FREE (yyss1);
  2690. }
  2691. # endif
  2692. #endif /* no yyoverflow */
  2693. yyssp = yyss + yysize - 1;
  2694. yyvsp = yyvs + yysize - 1;
  2695. + yylsp = yyls + yysize - 1;
  2696. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  2697. - (unsigned long int) yystacksize));
  2698. + (unsigned long int) yystacksize));
  2699. if (yyss + yystacksize - 1 <= yyssp)
  2700. - YYABORT;
  2701. + YYABORT;
  2702. }
  2703. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  2704. @@ -1438,7 +1386,7 @@ yybackup:
  2705. if (yychar == YYEMPTY)
  2706. {
  2707. YYDPRINTF ((stderr, "Reading a token: "));
  2708. - yychar = YYLEX;
  2709. + yychar = yylex ();
  2710. }
  2711. if (yychar <= YYEOF)
  2712. @@ -1481,7 +1429,7 @@ yybackup:
  2713. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  2714. *++yyvsp = yylval;
  2715. YY_IGNORE_MAYBE_UNINITIALIZED_END
  2716. -
  2717. + *++yylsp = yylloc;
  2718. goto yynewstate;
  2719. @@ -1503,7 +1451,7 @@ yyreduce:
  2720. yylen = yyr2[yyn];
  2721. /* If YYLEN is nonzero, implement the default value of the action:
  2722. - `$$ = $1'.
  2723. + '$$ = $1'.
  2724. Otherwise, the following line sets YYVAL to garbage.
  2725. This behavior is undocumented and Bison
  2726. @@ -1512,287 +1460,306 @@ yyreduce:
  2727. GCC warning that YYVAL may be used uninitialized. */
  2728. yyval = yyvsp[1-yylen];
  2729. -
  2730. + /* Default location. */
  2731. + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  2732. YY_REDUCE_PRINT (yyn);
  2733. switch (yyn)
  2734. {
  2735. case 2:
  2736. -/* Line 1787 of yacc.c */
  2737. -#line 110 "dtc-parser.y"
  2738. +#line 109 "dtc-parser.y" /* yacc.c:1646 */
  2739. {
  2740. - the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
  2741. - guess_boot_cpuid((yyvsp[(4) - (4)].node)));
  2742. + (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin);
  2743. + (yyvsp[0].node)->is_root = 1;
  2744. + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node),
  2745. + guess_boot_cpuid((yyvsp[0].node)));
  2746. }
  2747. +#line 1477 "dtc-parser.tab.c" /* yacc.c:1646 */
  2748. break;
  2749. case 3:
  2750. -/* Line 1787 of yacc.c */
  2751. -#line 118 "dtc-parser.y"
  2752. +#line 119 "dtc-parser.y" /* yacc.c:1646 */
  2753. {
  2754. - (yyval.re) = NULL;
  2755. + (yyval.is_plugin) = 0;
  2756. }
  2757. +#line 1485 "dtc-parser.tab.c" /* yacc.c:1646 */
  2758. break;
  2759. case 4:
  2760. -/* Line 1787 of yacc.c */
  2761. -#line 122 "dtc-parser.y"
  2762. +#line 123 "dtc-parser.y" /* yacc.c:1646 */
  2763. {
  2764. - (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
  2765. + (yyval.is_plugin) = 1;
  2766. }
  2767. +#line 1493 "dtc-parser.tab.c" /* yacc.c:1646 */
  2768. break;
  2769. case 5:
  2770. -/* Line 1787 of yacc.c */
  2771. -#line 129 "dtc-parser.y"
  2772. +#line 130 "dtc-parser.y" /* yacc.c:1646 */
  2773. {
  2774. - (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
  2775. + (yyval.re) = NULL;
  2776. }
  2777. +#line 1501 "dtc-parser.tab.c" /* yacc.c:1646 */
  2778. break;
  2779. case 6:
  2780. -/* Line 1787 of yacc.c */
  2781. -#line 133 "dtc-parser.y"
  2782. +#line 134 "dtc-parser.y" /* yacc.c:1646 */
  2783. {
  2784. - add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
  2785. - (yyval.re) = (yyvsp[(2) - (2)].re);
  2786. + (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re));
  2787. }
  2788. +#line 1509 "dtc-parser.tab.c" /* yacc.c:1646 */
  2789. break;
  2790. case 7:
  2791. -/* Line 1787 of yacc.c */
  2792. -#line 141 "dtc-parser.y"
  2793. +#line 141 "dtc-parser.y" /* yacc.c:1646 */
  2794. {
  2795. - (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
  2796. + (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
  2797. }
  2798. +#line 1517 "dtc-parser.tab.c" /* yacc.c:1646 */
  2799. break;
  2800. case 8:
  2801. -/* Line 1787 of yacc.c */
  2802. -#line 145 "dtc-parser.y"
  2803. +#line 145 "dtc-parser.y" /* yacc.c:1646 */
  2804. {
  2805. - (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2806. + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref));
  2807. + (yyval.re) = (yyvsp[0].re);
  2808. }
  2809. +#line 1526 "dtc-parser.tab.c" /* yacc.c:1646 */
  2810. break;
  2811. case 9:
  2812. -/* Line 1787 of yacc.c */
  2813. -#line 149 "dtc-parser.y"
  2814. +#line 153 "dtc-parser.y" /* yacc.c:1646 */
  2815. {
  2816. - struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
  2817. -
  2818. - if (target)
  2819. - merge_nodes(target, (yyvsp[(3) - (3)].node));
  2820. - else
  2821. - print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
  2822. - (yyval.node) = (yyvsp[(1) - (3)].node);
  2823. + (yyval.node) = name_node((yyvsp[0].node), "");
  2824. }
  2825. +#line 1534 "dtc-parser.tab.c" /* yacc.c:1646 */
  2826. break;
  2827. case 10:
  2828. -/* Line 1787 of yacc.c */
  2829. -#line 159 "dtc-parser.y"
  2830. +#line 157 "dtc-parser.y" /* yacc.c:1646 */
  2831. {
  2832. - struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
  2833. -
  2834. - if (!target)
  2835. - print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
  2836. - else
  2837. - delete_node(target);
  2838. -
  2839. - (yyval.node) = (yyvsp[(1) - (4)].node);
  2840. + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
  2841. }
  2842. +#line 1542 "dtc-parser.tab.c" /* yacc.c:1646 */
  2843. break;
  2844. case 11:
  2845. -/* Line 1787 of yacc.c */
  2846. -#line 173 "dtc-parser.y"
  2847. +#line 161 "dtc-parser.y" /* yacc.c:1646 */
  2848. {
  2849. - (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
  2850. + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
  2851. +
  2852. + if (target)
  2853. + merge_nodes(target, (yyvsp[0].node));
  2854. + else
  2855. + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
  2856. + (yyval.node) = (yyvsp[-2].node);
  2857. }
  2858. +#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */
  2859. break;
  2860. case 12:
  2861. -/* Line 1787 of yacc.c */
  2862. -#line 180 "dtc-parser.y"
  2863. +#line 171 "dtc-parser.y" /* yacc.c:1646 */
  2864. {
  2865. - (yyval.proplist) = NULL;
  2866. + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
  2867. +
  2868. + if (target)
  2869. + delete_node(target);
  2870. + else
  2871. + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
  2872. +
  2873. +
  2874. + (yyval.node) = (yyvsp[-3].node);
  2875. }
  2876. +#line 1572 "dtc-parser.tab.c" /* yacc.c:1646 */
  2877. break;
  2878. case 13:
  2879. -/* Line 1787 of yacc.c */
  2880. -#line 184 "dtc-parser.y"
  2881. +#line 186 "dtc-parser.y" /* yacc.c:1646 */
  2882. {
  2883. - (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
  2884. + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist));
  2885. }
  2886. +#line 1580 "dtc-parser.tab.c" /* yacc.c:1646 */
  2887. break;
  2888. case 14:
  2889. -/* Line 1787 of yacc.c */
  2890. -#line 191 "dtc-parser.y"
  2891. +#line 193 "dtc-parser.y" /* yacc.c:1646 */
  2892. {
  2893. - (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
  2894. + (yyval.proplist) = NULL;
  2895. }
  2896. +#line 1588 "dtc-parser.tab.c" /* yacc.c:1646 */
  2897. break;
  2898. case 15:
  2899. -/* Line 1787 of yacc.c */
  2900. -#line 195 "dtc-parser.y"
  2901. +#line 197 "dtc-parser.y" /* yacc.c:1646 */
  2902. {
  2903. - (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
  2904. + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
  2905. }
  2906. +#line 1596 "dtc-parser.tab.c" /* yacc.c:1646 */
  2907. break;
  2908. case 16:
  2909. -/* Line 1787 of yacc.c */
  2910. -#line 199 "dtc-parser.y"
  2911. +#line 204 "dtc-parser.y" /* yacc.c:1646 */
  2912. {
  2913. - (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
  2914. + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data));
  2915. }
  2916. +#line 1604 "dtc-parser.tab.c" /* yacc.c:1646 */
  2917. break;
  2918. case 17:
  2919. -/* Line 1787 of yacc.c */
  2920. -#line 203 "dtc-parser.y"
  2921. +#line 208 "dtc-parser.y" /* yacc.c:1646 */
  2922. {
  2923. - add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
  2924. - (yyval.prop) = (yyvsp[(2) - (2)].prop);
  2925. + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data);
  2926. }
  2927. +#line 1612 "dtc-parser.tab.c" /* yacc.c:1646 */
  2928. break;
  2929. case 18:
  2930. -/* Line 1787 of yacc.c */
  2931. -#line 211 "dtc-parser.y"
  2932. +#line 212 "dtc-parser.y" /* yacc.c:1646 */
  2933. {
  2934. - (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
  2935. + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
  2936. }
  2937. +#line 1620 "dtc-parser.tab.c" /* yacc.c:1646 */
  2938. break;
  2939. case 19:
  2940. -/* Line 1787 of yacc.c */
  2941. -#line 215 "dtc-parser.y"
  2942. +#line 216 "dtc-parser.y" /* yacc.c:1646 */
  2943. {
  2944. - (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
  2945. + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref));
  2946. + (yyval.prop) = (yyvsp[0].prop);
  2947. }
  2948. +#line 1629 "dtc-parser.tab.c" /* yacc.c:1646 */
  2949. break;
  2950. case 20:
  2951. -/* Line 1787 of yacc.c */
  2952. -#line 219 "dtc-parser.y"
  2953. +#line 224 "dtc-parser.y" /* yacc.c:1646 */
  2954. {
  2955. - (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
  2956. + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
  2957. }
  2958. +#line 1637 "dtc-parser.tab.c" /* yacc.c:1646 */
  2959. break;
  2960. case 21:
  2961. -/* Line 1787 of yacc.c */
  2962. -#line 223 "dtc-parser.y"
  2963. +#line 228 "dtc-parser.y" /* yacc.c:1646 */
  2964. {
  2965. - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
  2966. + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data);
  2967. }
  2968. +#line 1645 "dtc-parser.tab.c" /* yacc.c:1646 */
  2969. break;
  2970. case 22:
  2971. -/* Line 1787 of yacc.c */
  2972. -#line 227 "dtc-parser.y"
  2973. +#line 232 "dtc-parser.y" /* yacc.c:1646 */
  2974. {
  2975. - FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
  2976. + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
  2977. + }
  2978. +#line 1653 "dtc-parser.tab.c" /* yacc.c:1646 */
  2979. + break;
  2980. +
  2981. + case 23:
  2982. +#line 236 "dtc-parser.y" /* yacc.c:1646 */
  2983. + {
  2984. + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
  2985. + }
  2986. +#line 1661 "dtc-parser.tab.c" /* yacc.c:1646 */
  2987. + break;
  2988. +
  2989. + case 24:
  2990. +#line 240 "dtc-parser.y" /* yacc.c:1646 */
  2991. + {
  2992. + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
  2993. struct data d;
  2994. - if ((yyvsp[(6) - (9)].integer) != 0)
  2995. - if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
  2996. - print_error("Couldn't seek to offset %llu in \"%s\": %s",
  2997. - (unsigned long long)(yyvsp[(6) - (9)].integer),
  2998. - (yyvsp[(4) - (9)].data).val,
  2999. - strerror(errno));
  3000. + if ((yyvsp[-3].integer) != 0)
  3001. + if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0)
  3002. + die("Couldn't seek to offset %llu in \"%s\": %s",
  3003. + (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val,
  3004. + strerror(errno));
  3005. - d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
  3006. + d = data_copy_file(f, (yyvsp[-1].integer));
  3007. - (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
  3008. + (yyval.data) = data_merge((yyvsp[-8].data), d);
  3009. fclose(f);
  3010. }
  3011. +#line 1681 "dtc-parser.tab.c" /* yacc.c:1646 */
  3012. break;
  3013. - case 23:
  3014. -/* Line 1787 of yacc.c */
  3015. -#line 244 "dtc-parser.y"
  3016. + case 25:
  3017. +#line 256 "dtc-parser.y" /* yacc.c:1646 */
  3018. {
  3019. - FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
  3020. + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL);
  3021. struct data d = empty_data;
  3022. d = data_copy_file(f, -1);
  3023. - (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
  3024. + (yyval.data) = data_merge((yyvsp[-4].data), d);
  3025. fclose(f);
  3026. }
  3027. +#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */
  3028. break;
  3029. - case 24:
  3030. -/* Line 1787 of yacc.c */
  3031. -#line 254 "dtc-parser.y"
  3032. + case 26:
  3033. +#line 266 "dtc-parser.y" /* yacc.c:1646 */
  3034. {
  3035. - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
  3036. + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
  3037. }
  3038. +#line 1703 "dtc-parser.tab.c" /* yacc.c:1646 */
  3039. break;
  3040. - case 25:
  3041. -/* Line 1787 of yacc.c */
  3042. -#line 261 "dtc-parser.y"
  3043. + case 27:
  3044. +#line 273 "dtc-parser.y" /* yacc.c:1646 */
  3045. {
  3046. (yyval.data) = empty_data;
  3047. }
  3048. +#line 1711 "dtc-parser.tab.c" /* yacc.c:1646 */
  3049. break;
  3050. - case 26:
  3051. -/* Line 1787 of yacc.c */
  3052. -#line 265 "dtc-parser.y"
  3053. + case 28:
  3054. +#line 277 "dtc-parser.y" /* yacc.c:1646 */
  3055. {
  3056. - (yyval.data) = (yyvsp[(1) - (2)].data);
  3057. + (yyval.data) = (yyvsp[-1].data);
  3058. }
  3059. +#line 1719 "dtc-parser.tab.c" /* yacc.c:1646 */
  3060. break;
  3061. - case 27:
  3062. -/* Line 1787 of yacc.c */
  3063. -#line 269 "dtc-parser.y"
  3064. + case 29:
  3065. +#line 281 "dtc-parser.y" /* yacc.c:1646 */
  3066. {
  3067. - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
  3068. + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
  3069. }
  3070. +#line 1727 "dtc-parser.tab.c" /* yacc.c:1646 */
  3071. break;
  3072. - case 28:
  3073. -/* Line 1787 of yacc.c */
  3074. -#line 276 "dtc-parser.y"
  3075. + case 30:
  3076. +#line 288 "dtc-parser.y" /* yacc.c:1646 */
  3077. {
  3078. - (yyval.array).data = empty_data;
  3079. - (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
  3080. + unsigned long long bits;
  3081. - if (((yyval.array).bits != 8) &&
  3082. - ((yyval.array).bits != 16) &&
  3083. - ((yyval.array).bits != 32) &&
  3084. - ((yyval.array).bits != 64))
  3085. - {
  3086. - print_error("Only 8, 16, 32 and 64-bit elements"
  3087. - " are currently supported");
  3088. - (yyval.array).bits = 32;
  3089. + bits = (yyvsp[-1].integer);
  3090. +
  3091. + if ((bits != 8) && (bits != 16) &&
  3092. + (bits != 32) && (bits != 64)) {
  3093. + ERROR(&(yylsp[-1]), "Array elements must be"
  3094. + " 8, 16, 32 or 64-bits");
  3095. + bits = 32;
  3096. }
  3097. +
  3098. + (yyval.array).data = empty_data;
  3099. + (yyval.array).bits = bits;
  3100. }
  3101. +#line 1747 "dtc-parser.tab.c" /* yacc.c:1646 */
  3102. break;
  3103. - case 29:
  3104. -/* Line 1787 of yacc.c */
  3105. -#line 291 "dtc-parser.y"
  3106. + case 31:
  3107. +#line 304 "dtc-parser.y" /* yacc.c:1646 */
  3108. {
  3109. (yyval.array).data = empty_data;
  3110. (yyval.array).bits = 32;
  3111. }
  3112. +#line 1756 "dtc-parser.tab.c" /* yacc.c:1646 */
  3113. break;
  3114. - case 30:
  3115. -/* Line 1787 of yacc.c */
  3116. -#line 296 "dtc-parser.y"
  3117. + case 32:
  3118. +#line 309 "dtc-parser.y" /* yacc.c:1646 */
  3119. {
  3120. - if ((yyvsp[(1) - (2)].array).bits < 64) {
  3121. - uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
  3122. + if ((yyvsp[-1].array).bits < 64) {
  3123. + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1;
  3124. /*
  3125. * Bits above mask must either be all zero
  3126. * (positive within range of mask) or all one
  3127. @@ -1801,275 +1768,258 @@ yyreduce:
  3128. * within the mask to one (i.e. | in the
  3129. * mask), all bits are one.
  3130. */
  3131. - if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
  3132. - print_error(
  3133. - "integer value out of range "
  3134. - "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
  3135. + if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL))
  3136. + ERROR(&(yylsp[0]), "Value out of range for"
  3137. + " %d-bit array element", (yyvsp[-1].array).bits);
  3138. }
  3139. - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
  3140. + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits);
  3141. }
  3142. +#line 1779 "dtc-parser.tab.c" /* yacc.c:1646 */
  3143. break;
  3144. - case 31:
  3145. -/* Line 1787 of yacc.c */
  3146. -#line 316 "dtc-parser.y"
  3147. + case 33:
  3148. +#line 328 "dtc-parser.y" /* yacc.c:1646 */
  3149. {
  3150. - uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
  3151. + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
  3152. - if ((yyvsp[(1) - (2)].array).bits == 32)
  3153. - (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data,
  3154. + if ((yyvsp[-1].array).bits == 32)
  3155. + (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data,
  3156. REF_PHANDLE,
  3157. - (yyvsp[(2) - (2)].labelref));
  3158. + (yyvsp[0].labelref));
  3159. else
  3160. - print_error("References are only allowed in "
  3161. + ERROR(&(yylsp[0]), "References are only allowed in "
  3162. "arrays with 32-bit elements.");
  3163. - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
  3164. - }
  3165. - break;
  3166. -
  3167. - case 32:
  3168. -/* Line 1787 of yacc.c */
  3169. -#line 330 "dtc-parser.y"
  3170. - {
  3171. - (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
  3172. - }
  3173. - break;
  3174. -
  3175. - case 33:
  3176. -/* Line 1787 of yacc.c */
  3177. -#line 337 "dtc-parser.y"
  3178. - {
  3179. - (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
  3180. + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits);
  3181. }
  3182. +#line 1797 "dtc-parser.tab.c" /* yacc.c:1646 */
  3183. break;
  3184. case 34:
  3185. -/* Line 1787 of yacc.c */
  3186. -#line 341 "dtc-parser.y"
  3187. +#line 342 "dtc-parser.y" /* yacc.c:1646 */
  3188. {
  3189. - (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
  3190. + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref));
  3191. }
  3192. +#line 1805 "dtc-parser.tab.c" /* yacc.c:1646 */
  3193. break;
  3194. - case 35:
  3195. -/* Line 1787 of yacc.c */
  3196. -#line 345 "dtc-parser.y"
  3197. + case 37:
  3198. +#line 351 "dtc-parser.y" /* yacc.c:1646 */
  3199. {
  3200. - (yyval.integer) = (yyvsp[(2) - (3)].integer);
  3201. + (yyval.integer) = (yyvsp[-1].integer);
  3202. }
  3203. - break;
  3204. -
  3205. - case 38:
  3206. -/* Line 1787 of yacc.c */
  3207. -#line 356 "dtc-parser.y"
  3208. - { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); }
  3209. +#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */
  3210. break;
  3211. case 40:
  3212. -/* Line 1787 of yacc.c */
  3213. -#line 361 "dtc-parser.y"
  3214. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); }
  3215. +#line 362 "dtc-parser.y" /* yacc.c:1646 */
  3216. + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); }
  3217. +#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */
  3218. break;
  3219. case 42:
  3220. -/* Line 1787 of yacc.c */
  3221. -#line 366 "dtc-parser.y"
  3222. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); }
  3223. +#line 367 "dtc-parser.y" /* yacc.c:1646 */
  3224. + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); }
  3225. +#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */
  3226. break;
  3227. case 44:
  3228. -/* Line 1787 of yacc.c */
  3229. -#line 371 "dtc-parser.y"
  3230. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); }
  3231. +#line 372 "dtc-parser.y" /* yacc.c:1646 */
  3232. + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); }
  3233. +#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */
  3234. break;
  3235. case 46:
  3236. -/* Line 1787 of yacc.c */
  3237. -#line 376 "dtc-parser.y"
  3238. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); }
  3239. +#line 377 "dtc-parser.y" /* yacc.c:1646 */
  3240. + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); }
  3241. +#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */
  3242. break;
  3243. case 48:
  3244. -/* Line 1787 of yacc.c */
  3245. -#line 381 "dtc-parser.y"
  3246. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); }
  3247. +#line 382 "dtc-parser.y" /* yacc.c:1646 */
  3248. + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); }
  3249. +#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */
  3250. break;
  3251. case 50:
  3252. -/* Line 1787 of yacc.c */
  3253. -#line 386 "dtc-parser.y"
  3254. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); }
  3255. +#line 387 "dtc-parser.y" /* yacc.c:1646 */
  3256. + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); }
  3257. +#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */
  3258. break;
  3259. - case 51:
  3260. -/* Line 1787 of yacc.c */
  3261. -#line 387 "dtc-parser.y"
  3262. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); }
  3263. + case 52:
  3264. +#line 392 "dtc-parser.y" /* yacc.c:1646 */
  3265. + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); }
  3266. +#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */
  3267. break;
  3268. case 53:
  3269. -/* Line 1787 of yacc.c */
  3270. -#line 392 "dtc-parser.y"
  3271. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); }
  3272. - break;
  3273. -
  3274. - case 54:
  3275. -/* Line 1787 of yacc.c */
  3276. -#line 393 "dtc-parser.y"
  3277. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); }
  3278. +#line 393 "dtc-parser.y" /* yacc.c:1646 */
  3279. + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); }
  3280. +#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */
  3281. break;
  3282. case 55:
  3283. -/* Line 1787 of yacc.c */
  3284. -#line 394 "dtc-parser.y"
  3285. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); }
  3286. +#line 398 "dtc-parser.y" /* yacc.c:1646 */
  3287. + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); }
  3288. +#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */
  3289. break;
  3290. case 56:
  3291. -/* Line 1787 of yacc.c */
  3292. -#line 395 "dtc-parser.y"
  3293. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); }
  3294. +#line 399 "dtc-parser.y" /* yacc.c:1646 */
  3295. + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); }
  3296. +#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */
  3297. break;
  3298. case 57:
  3299. -/* Line 1787 of yacc.c */
  3300. -#line 399 "dtc-parser.y"
  3301. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); }
  3302. +#line 400 "dtc-parser.y" /* yacc.c:1646 */
  3303. + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); }
  3304. +#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */
  3305. break;
  3306. case 58:
  3307. -/* Line 1787 of yacc.c */
  3308. -#line 400 "dtc-parser.y"
  3309. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); }
  3310. +#line 401 "dtc-parser.y" /* yacc.c:1646 */
  3311. + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); }
  3312. +#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */
  3313. break;
  3314. - case 60:
  3315. -/* Line 1787 of yacc.c */
  3316. -#line 405 "dtc-parser.y"
  3317. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); }
  3318. + case 59:
  3319. +#line 405 "dtc-parser.y" /* yacc.c:1646 */
  3320. + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); }
  3321. +#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */
  3322. break;
  3323. - case 61:
  3324. -/* Line 1787 of yacc.c */
  3325. -#line 406 "dtc-parser.y"
  3326. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); }
  3327. + case 60:
  3328. +#line 406 "dtc-parser.y" /* yacc.c:1646 */
  3329. + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); }
  3330. +#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */
  3331. break;
  3332. - case 63:
  3333. -/* Line 1787 of yacc.c */
  3334. -#line 411 "dtc-parser.y"
  3335. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); }
  3336. + case 62:
  3337. +#line 411 "dtc-parser.y" /* yacc.c:1646 */
  3338. + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); }
  3339. +#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */
  3340. break;
  3341. - case 64:
  3342. -/* Line 1787 of yacc.c */
  3343. -#line 412 "dtc-parser.y"
  3344. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); }
  3345. + case 63:
  3346. +#line 412 "dtc-parser.y" /* yacc.c:1646 */
  3347. + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); }
  3348. +#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */
  3349. break;
  3350. case 65:
  3351. -/* Line 1787 of yacc.c */
  3352. -#line 413 "dtc-parser.y"
  3353. - { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); }
  3354. +#line 417 "dtc-parser.y" /* yacc.c:1646 */
  3355. + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); }
  3356. +#line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */
  3357. break;
  3358. - case 68:
  3359. -/* Line 1787 of yacc.c */
  3360. -#line 419 "dtc-parser.y"
  3361. - { (yyval.integer) = -(yyvsp[(2) - (2)].integer); }
  3362. + case 66:
  3363. +#line 418 "dtc-parser.y" /* yacc.c:1646 */
  3364. + { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); }
  3365. +#line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */
  3366. break;
  3367. - case 69:
  3368. -/* Line 1787 of yacc.c */
  3369. -#line 420 "dtc-parser.y"
  3370. - { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); }
  3371. + case 67:
  3372. +#line 419 "dtc-parser.y" /* yacc.c:1646 */
  3373. + { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); }
  3374. +#line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */
  3375. break;
  3376. case 70:
  3377. -/* Line 1787 of yacc.c */
  3378. -#line 421 "dtc-parser.y"
  3379. - { (yyval.integer) = !(yyvsp[(2) - (2)].integer); }
  3380. +#line 425 "dtc-parser.y" /* yacc.c:1646 */
  3381. + { (yyval.integer) = -(yyvsp[0].integer); }
  3382. +#line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */
  3383. break;
  3384. case 71:
  3385. -/* Line 1787 of yacc.c */
  3386. -#line 426 "dtc-parser.y"
  3387. - {
  3388. - (yyval.data) = empty_data;
  3389. - }
  3390. +#line 426 "dtc-parser.y" /* yacc.c:1646 */
  3391. + { (yyval.integer) = ~(yyvsp[0].integer); }
  3392. +#line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */
  3393. break;
  3394. case 72:
  3395. -/* Line 1787 of yacc.c */
  3396. -#line 430 "dtc-parser.y"
  3397. - {
  3398. - (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
  3399. - }
  3400. +#line 427 "dtc-parser.y" /* yacc.c:1646 */
  3401. + { (yyval.integer) = !(yyvsp[0].integer); }
  3402. +#line 1945 "dtc-parser.tab.c" /* yacc.c:1646 */
  3403. break;
  3404. case 73:
  3405. -/* Line 1787 of yacc.c */
  3406. -#line 434 "dtc-parser.y"
  3407. +#line 432 "dtc-parser.y" /* yacc.c:1646 */
  3408. {
  3409. - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
  3410. + (yyval.data) = empty_data;
  3411. }
  3412. +#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */
  3413. break;
  3414. case 74:
  3415. -/* Line 1787 of yacc.c */
  3416. -#line 441 "dtc-parser.y"
  3417. +#line 436 "dtc-parser.y" /* yacc.c:1646 */
  3418. {
  3419. - (yyval.nodelist) = NULL;
  3420. + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
  3421. }
  3422. +#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */
  3423. break;
  3424. case 75:
  3425. -/* Line 1787 of yacc.c */
  3426. -#line 445 "dtc-parser.y"
  3427. +#line 440 "dtc-parser.y" /* yacc.c:1646 */
  3428. {
  3429. - (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
  3430. + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
  3431. }
  3432. +#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */
  3433. break;
  3434. case 76:
  3435. -/* Line 1787 of yacc.c */
  3436. -#line 449 "dtc-parser.y"
  3437. +#line 447 "dtc-parser.y" /* yacc.c:1646 */
  3438. {
  3439. - print_error("syntax error: properties must precede subnodes");
  3440. - YYERROR;
  3441. + (yyval.nodelist) = NULL;
  3442. }
  3443. +#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */
  3444. break;
  3445. case 77:
  3446. -/* Line 1787 of yacc.c */
  3447. -#line 457 "dtc-parser.y"
  3448. +#line 451 "dtc-parser.y" /* yacc.c:1646 */
  3449. {
  3450. - (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
  3451. + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
  3452. }
  3453. +#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */
  3454. break;
  3455. case 78:
  3456. -/* Line 1787 of yacc.c */
  3457. -#line 461 "dtc-parser.y"
  3458. +#line 455 "dtc-parser.y" /* yacc.c:1646 */
  3459. {
  3460. - (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
  3461. + ERROR(&(yylsp[0]), "Properties must precede subnodes");
  3462. + YYERROR;
  3463. }
  3464. +#line 1994 "dtc-parser.tab.c" /* yacc.c:1646 */
  3465. break;
  3466. case 79:
  3467. -/* Line 1787 of yacc.c */
  3468. -#line 465 "dtc-parser.y"
  3469. +#line 463 "dtc-parser.y" /* yacc.c:1646 */
  3470. {
  3471. - add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
  3472. - (yyval.node) = (yyvsp[(2) - (2)].node);
  3473. + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename));
  3474. }
  3475. +#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */
  3476. break;
  3477. + case 80:
  3478. +#line 467 "dtc-parser.y" /* yacc.c:1646 */
  3479. + {
  3480. + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename));
  3481. + }
  3482. +#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */
  3483. + break;
  3484. +
  3485. + case 81:
  3486. +#line 471 "dtc-parser.y" /* yacc.c:1646 */
  3487. + {
  3488. + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
  3489. + (yyval.node) = (yyvsp[0].node);
  3490. + }
  3491. +#line 2019 "dtc-parser.tab.c" /* yacc.c:1646 */
  3492. + break;
  3493. -/* Line 1787 of yacc.c */
  3494. -#line 2073 "dtc-parser.tab.c"
  3495. +
  3496. +#line 2023 "dtc-parser.tab.c" /* yacc.c:1646 */
  3497. default: break;
  3498. }
  3499. /* User semantic actions sometimes alter yychar, and that requires
  3500. @@ -2090,8 +2040,9 @@ yyreduce:
  3501. YY_STACK_PRINT (yyss, yyssp);
  3502. *++yyvsp = yyval;
  3503. + *++yylsp = yyloc;
  3504. - /* Now `shift' the result of the reduction. Determine what state
  3505. + /* Now 'shift' the result of the reduction. Determine what state
  3506. that goes to, based on the state we popped back to and the rule
  3507. number reduced by. */
  3508. @@ -2106,9 +2057,9 @@ yyreduce:
  3509. goto yynewstate;
  3510. -/*------------------------------------.
  3511. -| yyerrlab -- here on detecting error |
  3512. -`------------------------------------*/
  3513. +/*--------------------------------------.
  3514. +| yyerrlab -- here on detecting error. |
  3515. +`--------------------------------------*/
  3516. yyerrlab:
  3517. /* Make sure we have latest lookahead translation. See comments at
  3518. user semantic actions for why this is necessary. */
  3519. @@ -2154,25 +2105,25 @@ yyerrlab:
  3520. #endif
  3521. }
  3522. -
  3523. + yyerror_range[1] = yylloc;
  3524. if (yyerrstatus == 3)
  3525. {
  3526. /* If just tried and failed to reuse lookahead token after an
  3527. - error, discard it. */
  3528. + error, discard it. */
  3529. if (yychar <= YYEOF)
  3530. - {
  3531. - /* Return failure if at end of input. */
  3532. - if (yychar == YYEOF)
  3533. - YYABORT;
  3534. - }
  3535. + {
  3536. + /* Return failure if at end of input. */
  3537. + if (yychar == YYEOF)
  3538. + YYABORT;
  3539. + }
  3540. else
  3541. - {
  3542. - yydestruct ("Error: discarding",
  3543. - yytoken, &yylval);
  3544. - yychar = YYEMPTY;
  3545. - }
  3546. + {
  3547. + yydestruct ("Error: discarding",
  3548. + yytoken, &yylval, &yylloc);
  3549. + yychar = YYEMPTY;
  3550. + }
  3551. }
  3552. /* Else will try to reuse lookahead token after shifting the error
  3553. @@ -2191,7 +2142,8 @@ yyerrorlab:
  3554. if (/*CONSTCOND*/ 0)
  3555. goto yyerrorlab;
  3556. - /* Do not reclaim the symbols of the rule which action triggered
  3557. + yyerror_range[1] = yylsp[1-yylen];
  3558. + /* Do not reclaim the symbols of the rule whose action triggered
  3559. this YYERROR. */
  3560. YYPOPSTACK (yylen);
  3561. yylen = 0;
  3562. @@ -2204,29 +2156,29 @@ yyerrorlab:
  3563. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  3564. `-------------------------------------------------------------*/
  3565. yyerrlab1:
  3566. - yyerrstatus = 3; /* Each real token shifted decrements this. */
  3567. + yyerrstatus = 3; /* Each real token shifted decrements this. */
  3568. for (;;)
  3569. {
  3570. yyn = yypact[yystate];
  3571. if (!yypact_value_is_default (yyn))
  3572. - {
  3573. - yyn += YYTERROR;
  3574. - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  3575. - {
  3576. - yyn = yytable[yyn];
  3577. - if (0 < yyn)
  3578. - break;
  3579. - }
  3580. - }
  3581. + {
  3582. + yyn += YYTERROR;
  3583. + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  3584. + {
  3585. + yyn = yytable[yyn];
  3586. + if (0 < yyn)
  3587. + break;
  3588. + }
  3589. + }
  3590. /* Pop the current state because it cannot handle the error token. */
  3591. if (yyssp == yyss)
  3592. - YYABORT;
  3593. -
  3594. + YYABORT;
  3595. + yyerror_range[1] = *yylsp;
  3596. yydestruct ("Error: popping",
  3597. - yystos[yystate], yyvsp);
  3598. + yystos[yystate], yyvsp, yylsp);
  3599. YYPOPSTACK (1);
  3600. yystate = *yyssp;
  3601. YY_STACK_PRINT (yyss, yyssp);
  3602. @@ -2236,6 +2188,11 @@ yyerrlab1:
  3603. *++yyvsp = yylval;
  3604. YY_IGNORE_MAYBE_UNINITIALIZED_END
  3605. + yyerror_range[2] = yylloc;
  3606. + /* Using YYLLOC is tempting, but would change the location of
  3607. + the lookahead. YYLOC is available though. */
  3608. + YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
  3609. + *++yylsp = yyloc;
  3610. /* Shift the error token. */
  3611. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  3612. @@ -2275,16 +2232,16 @@ yyreturn:
  3613. user semantic actions for why this is necessary. */
  3614. yytoken = YYTRANSLATE (yychar);
  3615. yydestruct ("Cleanup: discarding lookahead",
  3616. - yytoken, &yylval);
  3617. + yytoken, &yylval, &yylloc);
  3618. }
  3619. - /* Do not reclaim the symbols of the rule which action triggered
  3620. + /* Do not reclaim the symbols of the rule whose action triggered
  3621. this YYABORT or YYACCEPT. */
  3622. YYPOPSTACK (yylen);
  3623. YY_STACK_PRINT (yyss, yyssp);
  3624. while (yyssp != yyss)
  3625. {
  3626. yydestruct ("Cleanup: popping",
  3627. - yystos[*yyssp], yyvsp);
  3628. + yystos[*yyssp], yyvsp, yylsp);
  3629. YYPOPSTACK (1);
  3630. }
  3631. #ifndef yyoverflow
  3632. @@ -2295,72 +2252,12 @@ yyreturn:
  3633. if (yymsg != yymsgbuf)
  3634. YYSTACK_FREE (yymsg);
  3635. #endif
  3636. - /* Make sure YYID is used. */
  3637. - return YYID (yyresult);
  3638. + return yyresult;
  3639. }
  3640. +#line 477 "dtc-parser.y" /* yacc.c:1906 */
  3641. -/* Line 2050 of yacc.c */
  3642. -#line 471 "dtc-parser.y"
  3643. -
  3644. -
  3645. -void print_error(char const *fmt, ...)
  3646. +void yyerror(char const *s)
  3647. {
  3648. - va_list va;
  3649. -
  3650. - va_start(va, fmt);
  3651. - srcpos_verror(&yylloc, fmt, va);
  3652. - va_end(va);
  3653. -
  3654. - treesource_error = 1;
  3655. -}
  3656. -
  3657. -void yyerror(char const *s) {
  3658. - print_error("%s", s);
  3659. -}
  3660. -
  3661. -static unsigned long long eval_literal(const char *s, int base, int bits)
  3662. -{
  3663. - unsigned long long val;
  3664. - char *e;
  3665. -
  3666. - errno = 0;
  3667. - val = strtoull(s, &e, base);
  3668. - if (*e) {
  3669. - size_t uls = strspn(e, "UL");
  3670. - if (e[uls])
  3671. - print_error("bad characters in literal");
  3672. - }
  3673. - if ((errno == ERANGE)
  3674. - || ((bits < 64) && (val >= (1ULL << bits))))
  3675. - print_error("literal out of range");
  3676. - else if (errno != 0)
  3677. - print_error("bad literal");
  3678. - return val;
  3679. -}
  3680. -
  3681. -static unsigned char eval_char_literal(const char *s)
  3682. -{
  3683. - int i = 1;
  3684. - char c = s[0];
  3685. -
  3686. - if (c == '\0')
  3687. - {
  3688. - print_error("empty character literal");
  3689. - return 0;
  3690. - }
  3691. -
  3692. - /*
  3693. - * If the first character in the character literal is a \ then process
  3694. - * the remaining characters as an escape encoding. If the first
  3695. - * character is neither an escape or a terminator it should be the only
  3696. - * character in the literal and will be returned.
  3697. - */
  3698. - if (c == '\\')
  3699. - c = get_escape_char(s, &i);
  3700. -
  3701. - if (s[i] != '\0')
  3702. - print_error("malformed character literal");
  3703. -
  3704. - return c;
  3705. + ERROR(&yylloc, "%s", s);
  3706. }
  3707. --- a/scripts/dtc/dtc-parser.tab.h_shipped
  3708. +++ b/scripts/dtc/dtc-parser.tab.h_shipped
  3709. @@ -1,19 +1,19 @@
  3710. -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
  3711. +/* A Bison parser, made by GNU Bison 3.0.2. */
  3712. /* Bison interface for Yacc-like parsers in C
  3713. -
  3714. - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
  3715. -
  3716. +
  3717. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
  3718. +
  3719. This program is free software: you can redistribute it and/or modify
  3720. it under the terms of the GNU General Public License as published by
  3721. the Free Software Foundation, either version 3 of the License, or
  3722. (at your option) any later version.
  3723. -
  3724. +
  3725. This program is distributed in the hope that it will be useful,
  3726. but WITHOUT ANY WARRANTY; without even the implied warranty of
  3727. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3728. GNU General Public License for more details.
  3729. -
  3730. +
  3731. You should have received a copy of the GNU General Public License
  3732. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  3733. @@ -26,13 +26,13 @@
  3734. special exception, which will cause the skeleton and the resulting
  3735. Bison output files to be licensed under the GNU General Public
  3736. License without this special exception.
  3737. -
  3738. +
  3739. This special exception was added by the Free Software Foundation in
  3740. version 2.2 of Bison. */
  3741. #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
  3742. # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
  3743. -/* Enabling traces. */
  3744. +/* Debug traces. */
  3745. #ifndef YYDEBUG
  3746. # define YYDEBUG 0
  3747. #endif
  3748. @@ -40,48 +40,45 @@
  3749. extern int yydebug;
  3750. #endif
  3751. -/* Tokens. */
  3752. +/* Token type. */
  3753. #ifndef YYTOKENTYPE
  3754. # define YYTOKENTYPE
  3755. - /* Put the tokens into the symbol table, so that GDB and other debuggers
  3756. - know about them. */
  3757. - enum yytokentype {
  3758. - DT_V1 = 258,
  3759. - DT_MEMRESERVE = 259,
  3760. - DT_LSHIFT = 260,
  3761. - DT_RSHIFT = 261,
  3762. - DT_LE = 262,
  3763. - DT_GE = 263,
  3764. - DT_EQ = 264,
  3765. - DT_NE = 265,
  3766. - DT_AND = 266,
  3767. - DT_OR = 267,
  3768. - DT_BITS = 268,
  3769. - DT_DEL_PROP = 269,
  3770. - DT_DEL_NODE = 270,
  3771. - DT_PROPNODENAME = 271,
  3772. - DT_LITERAL = 272,
  3773. - DT_CHAR_LITERAL = 273,
  3774. - DT_BASE = 274,
  3775. - DT_BYTE = 275,
  3776. - DT_STRING = 276,
  3777. - DT_LABEL = 277,
  3778. - DT_REF = 278,
  3779. - DT_INCBIN = 279
  3780. - };
  3781. + enum yytokentype
  3782. + {
  3783. + DT_V1 = 258,
  3784. + DT_PLUGIN = 259,
  3785. + DT_MEMRESERVE = 260,
  3786. + DT_LSHIFT = 261,
  3787. + DT_RSHIFT = 262,
  3788. + DT_LE = 263,
  3789. + DT_GE = 264,
  3790. + DT_EQ = 265,
  3791. + DT_NE = 266,
  3792. + DT_AND = 267,
  3793. + DT_OR = 268,
  3794. + DT_BITS = 269,
  3795. + DT_DEL_PROP = 270,
  3796. + DT_DEL_NODE = 271,
  3797. + DT_PROPNODENAME = 272,
  3798. + DT_LITERAL = 273,
  3799. + DT_CHAR_LITERAL = 274,
  3800. + DT_BYTE = 275,
  3801. + DT_STRING = 276,
  3802. + DT_LABEL = 277,
  3803. + DT_REF = 278,
  3804. + DT_INCBIN = 279
  3805. + };
  3806. #endif
  3807. -
  3808. +/* Value type. */
  3809. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  3810. -typedef union YYSTYPE
  3811. +typedef union YYSTYPE YYSTYPE;
  3812. +union YYSTYPE
  3813. {
  3814. -/* Line 2053 of yacc.c */
  3815. -#line 40 "dtc-parser.y"
  3816. +#line 39 "dtc-parser.y" /* yacc.c:1909 */
  3817. char *propnodename;
  3818. - char *literal;
  3819. char *labelref;
  3820. - unsigned int cbase;
  3821. uint8_t byte;
  3822. struct data data;
  3823. @@ -96,30 +93,31 @@ typedef union YYSTYPE
  3824. struct node *nodelist;
  3825. struct reserve_info *re;
  3826. uint64_t integer;
  3827. + int is_plugin;
  3828. -
  3829. -/* Line 2053 of yacc.c */
  3830. -#line 103 "dtc-parser.tab.h"
  3831. -} YYSTYPE;
  3832. +#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */
  3833. +};
  3834. # define YYSTYPE_IS_TRIVIAL 1
  3835. -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
  3836. # define YYSTYPE_IS_DECLARED 1
  3837. #endif
  3838. -extern YYSTYPE yylval;
  3839. -
  3840. -#ifdef YYPARSE_PARAM
  3841. -#if defined __STDC__ || defined __cplusplus
  3842. -int yyparse (void *YYPARSE_PARAM);
  3843. -#else
  3844. -int yyparse ();
  3845. +/* Location type. */
  3846. +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
  3847. +typedef struct YYLTYPE YYLTYPE;
  3848. +struct YYLTYPE
  3849. +{
  3850. + int first_line;
  3851. + int first_column;
  3852. + int last_line;
  3853. + int last_column;
  3854. +};
  3855. +# define YYLTYPE_IS_DECLARED 1
  3856. +# define YYLTYPE_IS_TRIVIAL 1
  3857. #endif
  3858. -#else /* ! YYPARSE_PARAM */
  3859. -#if defined __STDC__ || defined __cplusplus
  3860. +
  3861. +
  3862. +extern YYSTYPE yylval;
  3863. +extern YYLTYPE yylloc;
  3864. int yyparse (void);
  3865. -#else
  3866. -int yyparse ();
  3867. -#endif
  3868. -#endif /* ! YYPARSE_PARAM */
  3869. #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
  3870. --- a/scripts/dtc/dtc-parser.y
  3871. +++ b/scripts/dtc/dtc-parser.y
  3872. @@ -17,31 +17,28 @@
  3873. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  3874. * USA
  3875. */
  3876. -
  3877. %{
  3878. #include <stdio.h>
  3879. +#include <inttypes.h>
  3880. #include "dtc.h"
  3881. #include "srcpos.h"
  3882. -YYLTYPE yylloc;
  3883. -
  3884. extern int yylex(void);
  3885. -extern void print_error(char const *fmt, ...);
  3886. extern void yyerror(char const *s);
  3887. +#define ERROR(loc, ...) \
  3888. + do { \
  3889. + srcpos_error((loc), "Error", __VA_ARGS__); \
  3890. + treesource_error = true; \
  3891. + } while (0)
  3892. extern struct boot_info *the_boot_info;
  3893. -extern int treesource_error;
  3894. -
  3895. -static unsigned long long eval_literal(const char *s, int base, int bits);
  3896. -static unsigned char eval_char_literal(const char *s);
  3897. +extern bool treesource_error;
  3898. %}
  3899. %union {
  3900. char *propnodename;
  3901. - char *literal;
  3902. char *labelref;
  3903. - unsigned int cbase;
  3904. uint8_t byte;
  3905. struct data data;
  3906. @@ -56,18 +53,19 @@ static unsigned char eval_char_literal(c
  3907. struct node *nodelist;
  3908. struct reserve_info *re;
  3909. uint64_t integer;
  3910. + int is_plugin;
  3911. }
  3912. %token DT_V1
  3913. +%token DT_PLUGIN
  3914. %token DT_MEMRESERVE
  3915. %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
  3916. %token DT_BITS
  3917. %token DT_DEL_PROP
  3918. %token DT_DEL_NODE
  3919. %token <propnodename> DT_PROPNODENAME
  3920. -%token <literal> DT_LITERAL
  3921. -%token <literal> DT_CHAR_LITERAL
  3922. -%token <cbase> DT_BASE
  3923. +%token <integer> DT_LITERAL
  3924. +%token <integer> DT_CHAR_LITERAL
  3925. %token <byte> DT_BYTE
  3926. %token <data> DT_STRING
  3927. %token <labelref> DT_LABEL
  3928. @@ -76,6 +74,7 @@ static unsigned char eval_char_literal(c
  3929. %type <data> propdata
  3930. %type <data> propdataprefix
  3931. +%type <is_plugin> plugindecl
  3932. %type <re> memreserve
  3933. %type <re> memreserves
  3934. %type <array> arrayprefix
  3935. @@ -106,10 +105,23 @@ static unsigned char eval_char_literal(c
  3936. %%
  3937. sourcefile:
  3938. - DT_V1 ';' memreserves devicetree
  3939. + DT_V1 ';' plugindecl memreserves devicetree
  3940. + {
  3941. + $5->is_plugin = $3;
  3942. + $5->is_root = 1;
  3943. + the_boot_info = build_boot_info($4, $5,
  3944. + guess_boot_cpuid($5));
  3945. + }
  3946. + ;
  3947. +
  3948. +plugindecl:
  3949. + /* empty */
  3950. + {
  3951. + $$ = 0;
  3952. + }
  3953. + | DT_PLUGIN ';'
  3954. {
  3955. - the_boot_info = build_boot_info($3, $4,
  3956. - guess_boot_cpuid($4));
  3957. + $$ = 1;
  3958. }
  3959. ;
  3960. @@ -152,17 +164,18 @@ devicetree:
  3961. if (target)
  3962. merge_nodes(target, $3);
  3963. else
  3964. - print_error("label or path, '%s', not found", $2);
  3965. + ERROR(&@2, "Label or path %s not found", $2);
  3966. $$ = $1;
  3967. }
  3968. | devicetree DT_DEL_NODE DT_REF ';'
  3969. {
  3970. struct node *target = get_node_by_ref($1, $3);
  3971. - if (!target)
  3972. - print_error("label or path, '%s', not found", $3);
  3973. - else
  3974. + if (target)
  3975. delete_node(target);
  3976. + else
  3977. + ERROR(&@3, "Label or path %s not found", $3);
  3978. +
  3979. $$ = $1;
  3980. }
  3981. @@ -230,10 +243,9 @@ propdata:
  3982. if ($6 != 0)
  3983. if (fseek(f, $6, SEEK_SET) != 0)
  3984. - print_error("Couldn't seek to offset %llu in \"%s\": %s",
  3985. - (unsigned long long)$6,
  3986. - $4.val,
  3987. - strerror(errno));
  3988. + die("Couldn't seek to offset %llu in \"%s\": %s",
  3989. + (unsigned long long)$6, $4.val,
  3990. + strerror(errno));
  3991. d = data_copy_file(f, $8);
  3992. @@ -274,18 +286,19 @@ propdataprefix:
  3993. arrayprefix:
  3994. DT_BITS DT_LITERAL '<'
  3995. {
  3996. - $$.data = empty_data;
  3997. - $$.bits = eval_literal($2, 0, 7);
  3998. + unsigned long long bits;
  3999. - if (($$.bits != 8) &&
  4000. - ($$.bits != 16) &&
  4001. - ($$.bits != 32) &&
  4002. - ($$.bits != 64))
  4003. - {
  4004. - print_error("Only 8, 16, 32 and 64-bit elements"
  4005. - " are currently supported");
  4006. - $$.bits = 32;
  4007. + bits = $2;
  4008. +
  4009. + if ((bits != 8) && (bits != 16) &&
  4010. + (bits != 32) && (bits != 64)) {
  4011. + ERROR(&@2, "Array elements must be"
  4012. + " 8, 16, 32 or 64-bits");
  4013. + bits = 32;
  4014. }
  4015. +
  4016. + $$.data = empty_data;
  4017. + $$.bits = bits;
  4018. }
  4019. | '<'
  4020. {
  4021. @@ -305,9 +318,8 @@ arrayprefix:
  4022. * mask), all bits are one.
  4023. */
  4024. if (($2 > mask) && (($2 | mask) != -1ULL))
  4025. - print_error(
  4026. - "integer value out of range "
  4027. - "%016lx (%d bits)", $1.bits);
  4028. + ERROR(&@2, "Value out of range for"
  4029. + " %d-bit array element", $1.bits);
  4030. }
  4031. $$.data = data_append_integer($1.data, $2, $1.bits);
  4032. @@ -321,7 +333,7 @@ arrayprefix:
  4033. REF_PHANDLE,
  4034. $2);
  4035. else
  4036. - print_error("References are only allowed in "
  4037. + ERROR(&@2, "References are only allowed in "
  4038. "arrays with 32-bit elements.");
  4039. $$.data = data_append_integer($1.data, val, $1.bits);
  4040. @@ -334,13 +346,7 @@ arrayprefix:
  4041. integer_prim:
  4042. DT_LITERAL
  4043. - {
  4044. - $$ = eval_literal($1, 0, 64);
  4045. - }
  4046. | DT_CHAR_LITERAL
  4047. - {
  4048. - $$ = eval_char_literal($1);
  4049. - }
  4050. | '(' integer_expr ')'
  4051. {
  4052. $$ = $2;
  4053. @@ -447,7 +453,7 @@ subnodes:
  4054. }
  4055. | subnode propdef
  4056. {
  4057. - print_error("syntax error: properties must precede subnodes");
  4058. + ERROR(&@2, "Properties must precede subnodes");
  4059. YYERROR;
  4060. }
  4061. ;
  4062. @@ -470,63 +476,7 @@ subnode:
  4063. %%
  4064. -void print_error(char const *fmt, ...)
  4065. +void yyerror(char const *s)
  4066. {
  4067. - va_list va;
  4068. -
  4069. - va_start(va, fmt);
  4070. - srcpos_verror(&yylloc, fmt, va);
  4071. - va_end(va);
  4072. -
  4073. - treesource_error = 1;
  4074. -}
  4075. -
  4076. -void yyerror(char const *s) {
  4077. - print_error("%s", s);
  4078. -}
  4079. -
  4080. -static unsigned long long eval_literal(const char *s, int base, int bits)
  4081. -{
  4082. - unsigned long long val;
  4083. - char *e;
  4084. -
  4085. - errno = 0;
  4086. - val = strtoull(s, &e, base);
  4087. - if (*e) {
  4088. - size_t uls = strspn(e, "UL");
  4089. - if (e[uls])
  4090. - print_error("bad characters in literal");
  4091. - }
  4092. - if ((errno == ERANGE)
  4093. - || ((bits < 64) && (val >= (1ULL << bits))))
  4094. - print_error("literal out of range");
  4095. - else if (errno != 0)
  4096. - print_error("bad literal");
  4097. - return val;
  4098. -}
  4099. -
  4100. -static unsigned char eval_char_literal(const char *s)
  4101. -{
  4102. - int i = 1;
  4103. - char c = s[0];
  4104. -
  4105. - if (c == '\0')
  4106. - {
  4107. - print_error("empty character literal");
  4108. - return 0;
  4109. - }
  4110. -
  4111. - /*
  4112. - * If the first character in the character literal is a \ then process
  4113. - * the remaining characters as an escape encoding. If the first
  4114. - * character is neither an escape or a terminator it should be the only
  4115. - * character in the literal and will be returned.
  4116. - */
  4117. - if (c == '\\')
  4118. - c = get_escape_char(s, &i);
  4119. -
  4120. - if (s[i] != '\0')
  4121. - print_error("malformed character literal");
  4122. -
  4123. - return c;
  4124. + ERROR(&yylloc, "%s", s);
  4125. }
  4126. --- a/scripts/dtc/dtc.c
  4127. +++ b/scripts/dtc/dtc.c
  4128. @@ -29,6 +29,7 @@ int reservenum; /* Number of memory res
  4129. int minsize; /* Minimum blob size */
  4130. int padsize; /* Additional padding to blob */
  4131. int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
  4132. +int symbol_fixup_support = 0;
  4133. static void fill_fullpaths(struct node *tree, const char *prefix)
  4134. {
  4135. @@ -48,8 +49,10 @@ static void fill_fullpaths(struct node *
  4136. }
  4137. /* Usage related data. */
  4138. +#define FDT_VERSION(version) _FDT_VERSION(version)
  4139. +#define _FDT_VERSION(version) #version
  4140. static const char usage_synopsis[] = "dtc [options] <input file>";
  4141. -static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
  4142. +static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@";
  4143. static struct option const usage_long_opts[] = {
  4144. {"quiet", no_argument, NULL, 'q'},
  4145. {"in-format", a_argument, NULL, 'I'},
  4146. @@ -67,6 +70,7 @@ static struct option const usage_long_op
  4147. {"phandle", a_argument, NULL, 'H'},
  4148. {"warning", a_argument, NULL, 'W'},
  4149. {"error", a_argument, NULL, 'E'},
  4150. + {"symbols", a_argument, NULL, '@'},
  4151. {"help", no_argument, NULL, 'h'},
  4152. {"version", no_argument, NULL, 'v'},
  4153. {NULL, no_argument, NULL, 0x0},
  4154. @@ -82,9 +86,9 @@ static const char * const usage_opts_hel
  4155. "\t\tdts - device tree source text\n"
  4156. "\t\tdtb - device tree blob\n"
  4157. "\t\tasm - assembler source",
  4158. - "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
  4159. + "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
  4160. "\n\tOutput dependency file",
  4161. - "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
  4162. + "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
  4163. "\n\tMake the blob at least <bytes> long (extra space)",
  4164. "\n\tAdd padding to the blob of <bytes> long (extra space)",
  4165. "\n\tSet the physical boot cpu",
  4166. @@ -97,6 +101,7 @@ static const char * const usage_opts_hel
  4167. "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
  4168. "\n\tEnable/disable warnings (prefix with \"no-\")",
  4169. "\n\tEnable/disable errors (prefix with \"no-\")",
  4170. + "\n\tSymbols and Fixups support",
  4171. "\n\tPrint this help and exit",
  4172. "\n\tPrint version and exit",
  4173. NULL,
  4174. @@ -109,7 +114,7 @@ int main(int argc, char *argv[])
  4175. const char *outform = "dts";
  4176. const char *outname = "-";
  4177. const char *depname = NULL;
  4178. - int force = 0, sort = 0;
  4179. + bool force = false, sort = false;
  4180. const char *arg;
  4181. int opt;
  4182. FILE *outf = NULL;
  4183. @@ -148,7 +153,7 @@ int main(int argc, char *argv[])
  4184. padsize = strtol(optarg, NULL, 0);
  4185. break;
  4186. case 'f':
  4187. - force = 1;
  4188. + force = true;
  4189. break;
  4190. case 'q':
  4191. quiet++;
  4192. @@ -174,7 +179,7 @@ int main(int argc, char *argv[])
  4193. break;
  4194. case 's':
  4195. - sort = 1;
  4196. + sort = true;
  4197. break;
  4198. case 'W':
  4199. @@ -184,7 +189,9 @@ int main(int argc, char *argv[])
  4200. case 'E':
  4201. parse_checks_option(false, true, optarg);
  4202. break;
  4203. -
  4204. + case '@':
  4205. + symbol_fixup_support = 1;
  4206. + break;
  4207. case 'h':
  4208. usage(NULL);
  4209. default:
  4210. @@ -237,7 +244,7 @@ int main(int argc, char *argv[])
  4211. if (streq(outname, "-")) {
  4212. outf = stdout;
  4213. } else {
  4214. - outf = fopen(outname, "w");
  4215. + outf = fopen(outname, "wb");
  4216. if (! outf)
  4217. die("Couldn't open output file %s: %s\n",
  4218. outname, strerror(errno));
  4219. --- a/scripts/dtc/dtc.h
  4220. +++ b/scripts/dtc/dtc.h
  4221. @@ -38,9 +38,9 @@
  4222. #include "util.h"
  4223. #ifdef DEBUG
  4224. -#define debug(fmt,args...) printf(fmt, ##args)
  4225. +#define debug(...) printf(__VA_ARGS__)
  4226. #else
  4227. -#define debug(fmt,args...)
  4228. +#define debug(...)
  4229. #endif
  4230. @@ -54,6 +54,7 @@ extern int reservenum; /* Number of mem
  4231. extern int minsize; /* Minimum blob size */
  4232. extern int padsize; /* Additional padding to blob */
  4233. extern int phandle_format; /* Use linux,phandle or phandle properties */
  4234. +extern int symbol_fixup_support;/* enable symbols & fixup support */
  4235. #define PHANDLE_LEGACY 0x1
  4236. #define PHANDLE_EPAPR 0x2
  4237. @@ -88,7 +89,7 @@ struct data {
  4238. };
  4239. -#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
  4240. +#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
  4241. #define for_each_marker(m) \
  4242. for (; (m); (m) = (m)->next)
  4243. @@ -118,7 +119,7 @@ struct data data_append_align(struct dat
  4244. struct data data_add_marker(struct data d, enum markertype type, char *ref);
  4245. -int data_is_one_string(struct data d);
  4246. +bool data_is_one_string(struct data d);
  4247. /* DT constraints */
  4248. @@ -127,13 +128,32 @@ int data_is_one_string(struct data d);
  4249. /* Live trees */
  4250. struct label {
  4251. - int deleted;
  4252. + bool deleted;
  4253. char *label;
  4254. struct label *next;
  4255. };
  4256. +struct fixup_entry {
  4257. + int offset;
  4258. + struct node *node;
  4259. + struct property *prop;
  4260. + struct fixup_entry *next;
  4261. +};
  4262. +
  4263. +struct fixup {
  4264. + char *ref;
  4265. + struct fixup_entry *entries;
  4266. + struct fixup *next;
  4267. +};
  4268. +
  4269. +struct symbol {
  4270. + struct label *label;
  4271. + struct node *node;
  4272. + struct symbol *next;
  4273. +};
  4274. +
  4275. struct property {
  4276. - int deleted;
  4277. + bool deleted;
  4278. char *name;
  4279. struct data val;
  4280. @@ -143,7 +163,7 @@ struct property {
  4281. };
  4282. struct node {
  4283. - int deleted;
  4284. + bool deleted;
  4285. char *name;
  4286. struct property *proplist;
  4287. struct node *children;
  4288. @@ -158,6 +178,12 @@ struct node {
  4289. int addr_cells, size_cells;
  4290. struct label *labels;
  4291. +
  4292. + int is_root;
  4293. + int is_plugin;
  4294. + struct fixup *fixups;
  4295. + struct symbol *symbols;
  4296. + struct fixup_entry *local_fixups;
  4297. };
  4298. #define for_each_label_withdel(l0, l) \
  4299. @@ -181,6 +207,18 @@ struct node {
  4300. for_each_child_withdel(n, c) \
  4301. if (!(c)->deleted)
  4302. +#define for_each_fixup(n, f) \
  4303. + for ((f) = (n)->fixups; (f); (f) = (f)->next)
  4304. +
  4305. +#define for_each_fixup_entry(f, fe) \
  4306. + for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
  4307. +
  4308. +#define for_each_symbol(n, s) \
  4309. + for ((s) = (n)->symbols; (s); (s) = (s)->next)
  4310. +
  4311. +#define for_each_local_fixup_entry(n, fe) \
  4312. + for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
  4313. +
  4314. void add_label(struct label **labels, char *label);
  4315. void delete_labels(struct label **labels);
  4316. @@ -247,8 +285,8 @@ void sort_tree(struct boot_info *bi);
  4317. /* Checks */
  4318. -void parse_checks_option(bool warn, bool error, const char *optarg);
  4319. -void process_checks(int force, struct boot_info *bi);
  4320. +void parse_checks_option(bool warn, bool error, const char *arg);
  4321. +void process_checks(bool force, struct boot_info *bi);
  4322. /* Flattened trees */
  4323. --- a/scripts/dtc/flattree.c
  4324. +++ b/scripts/dtc/flattree.c
  4325. @@ -261,7 +261,13 @@ static void flatten_tree(struct node *tr
  4326. {
  4327. struct property *prop;
  4328. struct node *child;
  4329. - int seen_name_prop = 0;
  4330. + bool seen_name_prop = false;
  4331. + struct symbol *sym;
  4332. + struct fixup *f;
  4333. + struct fixup_entry *fe;
  4334. + char *name, *s;
  4335. + const char *fullpath;
  4336. + int namesz, nameoff, vallen;
  4337. if (tree->deleted)
  4338. return;
  4339. @@ -276,10 +282,8 @@ static void flatten_tree(struct node *tr
  4340. emit->align(etarget, sizeof(cell_t));
  4341. for_each_property(tree, prop) {
  4342. - int nameoff;
  4343. -
  4344. if (streq(prop->name, "name"))
  4345. - seen_name_prop = 1;
  4346. + seen_name_prop = true;
  4347. nameoff = stringtable_insert(strbuf, prop->name);
  4348. @@ -310,6 +314,139 @@ static void flatten_tree(struct node *tr
  4349. flatten_tree(child, emit, etarget, strbuf, vi);
  4350. }
  4351. + if (!symbol_fixup_support)
  4352. + goto no_symbols;
  4353. +
  4354. + /* add the symbol nodes (if any) */
  4355. + if (tree->symbols) {
  4356. +
  4357. + emit->beginnode(etarget, NULL);
  4358. + emit->string(etarget, "__symbols__", 0);
  4359. + emit->align(etarget, sizeof(cell_t));
  4360. +
  4361. + for_each_symbol(tree, sym) {
  4362. +
  4363. + vallen = strlen(sym->node->fullpath);
  4364. +
  4365. + nameoff = stringtable_insert(strbuf, sym->label->label);
  4366. +
  4367. + emit->property(etarget, NULL);
  4368. + emit->cell(etarget, vallen + 1);
  4369. + emit->cell(etarget, nameoff);
  4370. +
  4371. + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
  4372. + emit->align(etarget, 8);
  4373. +
  4374. + emit->string(etarget, sym->node->fullpath,
  4375. + strlen(sym->node->fullpath));
  4376. + emit->align(etarget, sizeof(cell_t));
  4377. + }
  4378. +
  4379. + emit->endnode(etarget, NULL);
  4380. + }
  4381. +
  4382. + /* add the fixup nodes */
  4383. + if (tree->fixups) {
  4384. +
  4385. + /* emit the external fixups */
  4386. + emit->beginnode(etarget, NULL);
  4387. + emit->string(etarget, "__fixups__", 0);
  4388. + emit->align(etarget, sizeof(cell_t));
  4389. +
  4390. + for_each_fixup(tree, f) {
  4391. +
  4392. + namesz = 0;
  4393. + for_each_fixup_entry(f, fe) {
  4394. + fullpath = fe->node->fullpath;
  4395. + if (fullpath[0] == '\0')
  4396. + fullpath = "/";
  4397. + namesz += strlen(fullpath) + 1;
  4398. + namesz += strlen(fe->prop->name) + 1;
  4399. + namesz += 32; /* space for :<number> + '\0' */
  4400. + }
  4401. +
  4402. + name = xmalloc(namesz);
  4403. +
  4404. + s = name;
  4405. + for_each_fixup_entry(f, fe) {
  4406. + fullpath = fe->node->fullpath;
  4407. + if (fullpath[0] == '\0')
  4408. + fullpath = "/";
  4409. + snprintf(s, name + namesz - s, "%s:%s:%d",
  4410. + fullpath,
  4411. + fe->prop->name, fe->offset);
  4412. + s += strlen(s) + 1;
  4413. + }
  4414. +
  4415. + nameoff = stringtable_insert(strbuf, f->ref);
  4416. + vallen = s - name - 1;
  4417. +
  4418. + emit->property(etarget, NULL);
  4419. + emit->cell(etarget, vallen + 1);
  4420. + emit->cell(etarget, nameoff);
  4421. +
  4422. + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
  4423. + emit->align(etarget, 8);
  4424. +
  4425. + emit->string(etarget, name, vallen);
  4426. + emit->align(etarget, sizeof(cell_t));
  4427. +
  4428. + free(name);
  4429. + }
  4430. +
  4431. + emit->endnode(etarget, tree->labels);
  4432. + }
  4433. +
  4434. + /* add the local fixup property */
  4435. + if (tree->local_fixups) {
  4436. +
  4437. + /* emit the external fixups */
  4438. + emit->beginnode(etarget, NULL);
  4439. + emit->string(etarget, "__local_fixups__", 0);
  4440. + emit->align(etarget, sizeof(cell_t));
  4441. +
  4442. + namesz = 0;
  4443. + for_each_local_fixup_entry(tree, fe) {
  4444. + fullpath = fe->node->fullpath;
  4445. + if (fullpath[0] == '\0')
  4446. + fullpath = "/";
  4447. + namesz += strlen(fullpath) + 1;
  4448. + namesz += strlen(fe->prop->name) + 1;
  4449. + namesz += 32; /* space for :<number> + '\0' */
  4450. + }
  4451. +
  4452. + name = xmalloc(namesz);
  4453. +
  4454. + s = name;
  4455. + for_each_local_fixup_entry(tree, fe) {
  4456. + fullpath = fe->node->fullpath;
  4457. + if (fullpath[0] == '\0')
  4458. + fullpath = "/";
  4459. + snprintf(s, name + namesz - s, "%s:%s:%d",
  4460. + fullpath, fe->prop->name,
  4461. + fe->offset);
  4462. + s += strlen(s) + 1;
  4463. + }
  4464. +
  4465. + nameoff = stringtable_insert(strbuf, "fixup");
  4466. + vallen = s - name - 1;
  4467. +
  4468. + emit->property(etarget, NULL);
  4469. + emit->cell(etarget, vallen + 1);
  4470. + emit->cell(etarget, nameoff);
  4471. +
  4472. + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
  4473. + emit->align(etarget, 8);
  4474. +
  4475. + emit->string(etarget, name, vallen);
  4476. + emit->align(etarget, sizeof(cell_t));
  4477. +
  4478. + free(name);
  4479. +
  4480. + emit->endnode(etarget, tree->labels);
  4481. + }
  4482. +
  4483. +no_symbols:
  4484. emit->endnode(etarget, tree->labels);
  4485. }
  4486. --- a/scripts/dtc/fstree.c
  4487. +++ b/scripts/dtc/fstree.c
  4488. @@ -37,26 +37,26 @@ static struct node *read_fstree(const ch
  4489. tree = build_node(NULL, NULL);
  4490. while ((de = readdir(d)) != NULL) {
  4491. - char *tmpnam;
  4492. + char *tmpname;
  4493. if (streq(de->d_name, ".")
  4494. || streq(de->d_name, ".."))
  4495. continue;
  4496. - tmpnam = join_path(dirname, de->d_name);
  4497. + tmpname = join_path(dirname, de->d_name);
  4498. - if (lstat(tmpnam, &st) < 0)
  4499. - die("stat(%s): %s\n", tmpnam, strerror(errno));
  4500. + if (lstat(tmpname, &st) < 0)
  4501. + die("stat(%s): %s\n", tmpname, strerror(errno));
  4502. if (S_ISREG(st.st_mode)) {
  4503. struct property *prop;
  4504. FILE *pfile;
  4505. - pfile = fopen(tmpnam, "r");
  4506. + pfile = fopen(tmpname, "rb");
  4507. if (! pfile) {
  4508. fprintf(stderr,
  4509. "WARNING: Cannot open %s: %s\n",
  4510. - tmpnam, strerror(errno));
  4511. + tmpname, strerror(errno));
  4512. } else {
  4513. prop = build_property(xstrdup(de->d_name),
  4514. data_copy_file(pfile,
  4515. @@ -67,12 +67,12 @@ static struct node *read_fstree(const ch
  4516. } else if (S_ISDIR(st.st_mode)) {
  4517. struct node *newchild;
  4518. - newchild = read_fstree(tmpnam);
  4519. + newchild = read_fstree(tmpname);
  4520. newchild = name_node(newchild, xstrdup(de->d_name));
  4521. add_child(tree, newchild);
  4522. }
  4523. - free(tmpnam);
  4524. + free(tmpname);
  4525. }
  4526. closedir(d);
  4527. --- a/scripts/dtc/livetree.c
  4528. +++ b/scripts/dtc/livetree.c
  4529. @@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct
  4530. struct node *get_node_by_ref(struct node *tree, const char *ref)
  4531. {
  4532. - if (ref[0] == '/')
  4533. + if (streq(ref, "/"))
  4534. + return tree;
  4535. + else if (ref[0] == '/')
  4536. return get_node_by_path(tree, ref);
  4537. else
  4538. return get_node_by_label(tree, ref);
  4539. --- a/scripts/dtc/srcpos.c
  4540. +++ b/scripts/dtc/srcpos.c
  4541. @@ -34,7 +34,7 @@ struct search_path {
  4542. static struct search_path *search_path_head, **search_path_tail;
  4543. -static char *dirname(const char *path)
  4544. +static char *get_dirname(const char *path)
  4545. {
  4546. const char *slash = strrchr(path, '/');
  4547. @@ -77,7 +77,7 @@ static char *try_open(const char *dirnam
  4548. else
  4549. fullname = join_path(dirname, fname);
  4550. - *fp = fopen(fullname, "r");
  4551. + *fp = fopen(fullname, "rb");
  4552. if (!*fp) {
  4553. free(fullname);
  4554. fullname = NULL;
  4555. @@ -150,7 +150,7 @@ void srcfile_push(const char *fname)
  4556. srcfile = xmalloc(sizeof(*srcfile));
  4557. srcfile->f = srcfile_relative_open(fname, &srcfile->name);
  4558. - srcfile->dir = dirname(srcfile->name);
  4559. + srcfile->dir = get_dirname(srcfile->name);
  4560. srcfile->prev = current_srcfile;
  4561. srcfile->lineno = 1;
  4562. @@ -159,7 +159,7 @@ void srcfile_push(const char *fname)
  4563. current_srcfile = srcfile;
  4564. }
  4565. -int srcfile_pop(void)
  4566. +bool srcfile_pop(void)
  4567. {
  4568. struct srcfile_state *srcfile = current_srcfile;
  4569. @@ -177,7 +177,7 @@ int srcfile_pop(void)
  4570. * fix this we could either allocate all the files from a
  4571. * table, or use a pool allocator. */
  4572. - return current_srcfile ? 1 : 0;
  4573. + return current_srcfile ? true : false;
  4574. }
  4575. void srcfile_add_search_path(const char *dirname)
  4576. @@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos)
  4577. return pos_str;
  4578. }
  4579. -void
  4580. -srcpos_verror(struct srcpos *pos, char const *fmt, va_list va)
  4581. +void srcpos_verror(struct srcpos *pos, const char *prefix,
  4582. + const char *fmt, va_list va)
  4583. {
  4584. - const char *srcstr;
  4585. -
  4586. - srcstr = srcpos_string(pos);
  4587. + char *srcstr;
  4588. - fprintf(stderr, "Error: %s ", srcstr);
  4589. - vfprintf(stderr, fmt, va);
  4590. - fprintf(stderr, "\n");
  4591. -}
  4592. + srcstr = srcpos_string(pos);
  4593. -void
  4594. -srcpos_error(struct srcpos *pos, char const *fmt, ...)
  4595. -{
  4596. - va_list va;
  4597. + fprintf(stderr, "%s: %s ", prefix, srcstr);
  4598. + vfprintf(stderr, fmt, va);
  4599. + fprintf(stderr, "\n");
  4600. - va_start(va, fmt);
  4601. - srcpos_verror(pos, fmt, va);
  4602. - va_end(va);
  4603. + free(srcstr);
  4604. }
  4605. -
  4606. -void
  4607. -srcpos_warn(struct srcpos *pos, char const *fmt, ...)
  4608. +void srcpos_error(struct srcpos *pos, const char *prefix,
  4609. + const char *fmt, ...)
  4610. {
  4611. - const char *srcstr;
  4612. va_list va;
  4613. - va_start(va, fmt);
  4614. -
  4615. - srcstr = srcpos_string(pos);
  4616. -
  4617. - fprintf(stderr, "Warning: %s ", srcstr);
  4618. - vfprintf(stderr, fmt, va);
  4619. - fprintf(stderr, "\n");
  4620. + va_start(va, fmt);
  4621. + srcpos_verror(pos, prefix, fmt, va);
  4622. va_end(va);
  4623. }
  4624. --- a/scripts/dtc/srcpos.h
  4625. +++ b/scripts/dtc/srcpos.h
  4626. @@ -21,6 +21,7 @@
  4627. #define _SRCPOS_H_
  4628. #include <stdio.h>
  4629. +#include <stdbool.h>
  4630. struct srcfile_state {
  4631. FILE *f;
  4632. @@ -55,7 +56,7 @@ extern struct srcfile_state *current_src
  4633. FILE *srcfile_relative_open(const char *fname, char **fullnamep);
  4634. void srcfile_push(const char *fname);
  4635. -int srcfile_pop(void);
  4636. +bool srcfile_pop(void);
  4637. /**
  4638. * Add a new directory to the search path for input files
  4639. @@ -106,12 +107,12 @@ extern struct srcpos *srcpos_copy(struct
  4640. extern char *srcpos_string(struct srcpos *pos);
  4641. extern void srcpos_dump(struct srcpos *pos);
  4642. -extern void srcpos_verror(struct srcpos *pos, char const *, va_list va)
  4643. - __attribute__((format(printf, 2, 0)));
  4644. -extern void srcpos_error(struct srcpos *pos, char const *, ...)
  4645. - __attribute__((format(printf, 2, 3)));
  4646. -extern void srcpos_warn(struct srcpos *pos, char const *, ...)
  4647. - __attribute__((format(printf, 2, 3)));
  4648. +extern void srcpos_verror(struct srcpos *pos, const char *prefix,
  4649. + const char *fmt, va_list va)
  4650. + __attribute__((format(printf, 3, 0)));
  4651. +extern void srcpos_error(struct srcpos *pos, const char *prefix,
  4652. + const char *fmt, ...)
  4653. + __attribute__((format(printf, 3, 4)));
  4654. extern void srcpos_set_line(char *f, int l);
  4655. --- a/scripts/dtc/treesource.c
  4656. +++ b/scripts/dtc/treesource.c
  4657. @@ -26,12 +26,12 @@ extern int yyparse(void);
  4658. extern YYLTYPE yylloc;
  4659. struct boot_info *the_boot_info;
  4660. -int treesource_error;
  4661. +bool treesource_error;
  4662. struct boot_info *dt_from_source(const char *fname)
  4663. {
  4664. the_boot_info = NULL;
  4665. - treesource_error = 0;
  4666. + treesource_error = false;
  4667. srcfile_push(fname);
  4668. yyin = current_srcfile->f;
  4669. @@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int le
  4670. fputc('\t', f);
  4671. }
  4672. -static int isstring(char c)
  4673. +static bool isstring(char c)
  4674. {
  4675. - return (isprint(c)
  4676. + return (isprint((unsigned char)c)
  4677. || (c == '\0')
  4678. || strchr("\a\b\t\n\v\f\r", c));
  4679. }
  4680. @@ -109,7 +109,7 @@ static void write_propval_string(FILE *f
  4681. break;
  4682. case '\0':
  4683. fprintf(f, "\", ");
  4684. - while (m && (m->offset < i)) {
  4685. + while (m && (m->offset <= (i + 1))) {
  4686. if (m->type == LABEL) {
  4687. assert(m->offset == (i+1));
  4688. fprintf(f, "%s: ", m->ref);
  4689. @@ -119,7 +119,7 @@ static void write_propval_string(FILE *f
  4690. fprintf(f, "\"");
  4691. break;
  4692. default:
  4693. - if (isprint(c))
  4694. + if (isprint((unsigned char)c))
  4695. fprintf(f, "%c", c);
  4696. else
  4697. fprintf(f, "\\x%02hhx", c);
  4698. @@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f,
  4699. m = m->next;
  4700. }
  4701. - fprintf(f, "%02hhx", *bp++);
  4702. + fprintf(f, "%02hhx", (unsigned char)(*bp++));
  4703. if ((const void *)bp >= propend)
  4704. break;
  4705. fprintf(f, " ");
  4706. --- a/scripts/dtc/util.c
  4707. +++ b/scripts/dtc/util.c
  4708. @@ -39,11 +39,11 @@
  4709. char *xstrdup(const char *s)
  4710. {
  4711. int len = strlen(s) + 1;
  4712. - char *dup = xmalloc(len);
  4713. + char *d = xmalloc(len);
  4714. - memcpy(dup, s, len);
  4715. + memcpy(d, s, len);
  4716. - return dup;
  4717. + return d;
  4718. }
  4719. char *join_path(const char *path, const char *name)
  4720. @@ -70,7 +70,7 @@ char *join_path(const char *path, const
  4721. return str;
  4722. }
  4723. -int util_is_printable_string(const void *data, int len)
  4724. +bool util_is_printable_string(const void *data, int len)
  4725. {
  4726. const char *s = data;
  4727. const char *ss, *se;
  4728. @@ -87,7 +87,7 @@ int util_is_printable_string(const void
  4729. while (s < se) {
  4730. ss = s;
  4731. - while (s < se && *s && isprint(*s))
  4732. + while (s < se && *s && isprint((unsigned char)*s))
  4733. s++;
  4734. /* not zero, or not done yet */
  4735. @@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *fil
  4736. if (offset == bufsize) {
  4737. bufsize *= 2;
  4738. buf = xrealloc(buf, bufsize);
  4739. - if (!buf) {
  4740. - ret = ENOMEM;
  4741. - break;
  4742. - }
  4743. }
  4744. ret = read(fd, &buf[offset], bufsize - offset);
  4745. @@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data
  4746. const uint32_t *cell = (const uint32_t *)data;
  4747. printf(" = <");
  4748. - for (i = 0; i < len; i += 4)
  4749. + for (i = 0, len /= 4; i < len; i++)
  4750. printf("0x%08x%s", fdt32_to_cpu(cell[i]),
  4751. - i < (len - 4) ? " " : "");
  4752. + i < (len - 1) ? " " : "");
  4753. printf(">");
  4754. } else {
  4755. printf(" = [");
  4756. --- a/scripts/dtc/util.h
  4757. +++ b/scripts/dtc/util.h
  4758. @@ -2,6 +2,7 @@
  4759. #define _UTIL_H
  4760. #include <stdarg.h>
  4761. +#include <stdbool.h>
  4762. #include <getopt.h>
  4763. /*
  4764. @@ -33,6 +34,7 @@ static inline void __attribute__((noretu
  4765. va_start(ap, str);
  4766. fprintf(stderr, "FATAL ERROR: ");
  4767. vfprintf(stderr, str, ap);
  4768. + va_end(ap);
  4769. exit(1);
  4770. }
  4771. @@ -68,7 +70,7 @@ extern char *join_path(const char *path,
  4772. * @param len The string length including terminator
  4773. * @return 1 if a valid printable string, 0 if not
  4774. */
  4775. -int util_is_printable_string(const void *data, int len);
  4776. +bool util_is_printable_string(const void *data, int len);
  4777. /*
  4778. * Parse an escaped character starting at index i in string s. The resulting
  4779. --- a/scripts/dtc/version_gen.h
  4780. +++ b/scripts/dtc/version_gen.h
  4781. @@ -1 +1 @@
  4782. -#define DTC_VERSION "DTC 1.4.0-dirty"
  4783. +#define DTC_VERSION "DTC 1.4.1-g36c70742"