pdecl.pas 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Does declaration (but not type) parsing for Free Pascal
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit pdecl;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. { global }
  23. globals,
  24. { symtable }
  25. symsym,
  26. { pass_1 }
  27. node;
  28. function readconstant(const orgname:string;const filepos:tfileposinfo):tconstsym;
  29. procedure const_dec;
  30. procedure label_dec;
  31. procedure type_dec;
  32. procedure var_dec;
  33. procedure threadvar_dec;
  34. procedure resourcestring_dec;
  35. implementation
  36. uses
  37. { common }
  38. cutils,cclasses,
  39. { global }
  40. globtype,tokens,verbose,
  41. systems,
  42. { aasm }
  43. aasmbase,aasmtai,fmodule,
  44. { symtable }
  45. symconst,symbase,symtype,symdef,symtable,paramgr,
  46. { pass 1 }
  47. nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nobj,
  48. { codegen }
  49. ncgutil,
  50. { parser }
  51. scanner,
  52. pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj,
  53. { cpu-information }
  54. cpuinfo
  55. ;
  56. function readconstant(const orgname:string;const filepos:tfileposinfo):tconstsym;
  57. var
  58. hp : tconstsym;
  59. p : tnode;
  60. ps : pconstset;
  61. pd : pbestreal;
  62. pg : pguid;
  63. sp : pchar;
  64. storetokenpos : tfileposinfo;
  65. begin
  66. readconstant:=nil;
  67. if orgname='' then
  68. internalerror(9584582);
  69. hp:=nil;
  70. p:=comp_expr(true);
  71. storetokenpos:=akttokenpos;
  72. akttokenpos:=filepos;
  73. case p.nodetype of
  74. ordconstn:
  75. begin
  76. if is_constintnode(p) then
  77. hp:=tconstsym.create_ord_typed(orgname,constint,tordconstnode(p).value,tordconstnode(p).resulttype)
  78. else if is_constcharnode(p) then
  79. hp:=tconstsym.create_ord(orgname,constchar,tordconstnode(p).value)
  80. else if is_constboolnode(p) then
  81. hp:=tconstsym.create_ord(orgname,constbool,tordconstnode(p).value)
  82. else if is_constwidecharnode(p) then
  83. hp:=tconstsym.create_ord(orgname,constwchar,tordconstnode(p).value)
  84. else if p.resulttype.def.deftype=enumdef then
  85. hp:=tconstsym.create_ord_typed(orgname,constord,tordconstnode(p).value,p.resulttype)
  86. else if p.resulttype.def.deftype=pointerdef then
  87. hp:=tconstsym.create_ordptr_typed(orgname,constpointer,tordconstnode(p).value,p.resulttype)
  88. else internalerror(111);
  89. end;
  90. stringconstn:
  91. begin
  92. getmem(sp,tstringconstnode(p).len+1);
  93. move(tstringconstnode(p).value_str^,sp^,tstringconstnode(p).len+1);
  94. hp:=tconstsym.create_string(orgname,conststring,sp,tstringconstnode(p).len);
  95. end;
  96. realconstn :
  97. begin
  98. new(pd);
  99. pd^:=trealconstnode(p).value_real;
  100. hp:=tconstsym.create_ptr(orgname,constreal,pd);
  101. end;
  102. setconstn :
  103. begin
  104. new(ps);
  105. ps^:=tsetconstnode(p).value_set^;
  106. hp:=tconstsym.create_ptr_typed(orgname,constset,ps,p.resulttype);
  107. end;
  108. pointerconstn :
  109. begin
  110. hp:=tconstsym.create_ordptr_typed(orgname,constpointer,tpointerconstnode(p).value,p.resulttype);
  111. end;
  112. niln :
  113. begin
  114. hp:=tconstsym.create_ord_typed(orgname,constnil,0,p.resulttype);
  115. end;
  116. typen :
  117. begin
  118. if is_interface(p.resulttype.def) then
  119. begin
  120. if assigned(tobjectdef(p.resulttype.def).iidguid) then
  121. begin
  122. new(pg);
  123. pg^:=tobjectdef(p.resulttype.def).iidguid^;
  124. hp:=tconstsym.create_ptr(orgname,constguid,pg);
  125. end
  126. else
  127. Message1(parser_e_interface_has_no_guid,tobjectdef(p.resulttype.def).objrealname^);
  128. end
  129. else
  130. Message(cg_e_illegal_expression);
  131. end;
  132. else
  133. Message(cg_e_illegal_expression);
  134. end;
  135. akttokenpos:=storetokenpos;
  136. p.free;
  137. readconstant:=hp;
  138. end;
  139. procedure const_dec;
  140. var
  141. orgname : stringid;
  142. tt : ttype;
  143. sym : tsym;
  144. storetokenpos,filepos : tfileposinfo;
  145. old_block_type : tblock_type;
  146. skipequal : boolean;
  147. begin
  148. consume(_CONST);
  149. old_block_type:=block_type;
  150. block_type:=bt_const;
  151. repeat
  152. orgname:=orgpattern;
  153. filepos:=akttokenpos;
  154. consume(_ID);
  155. case token of
  156. _EQUAL:
  157. begin
  158. consume(_EQUAL);
  159. sym:=readconstant(orgname,filepos);
  160. if assigned(sym) then
  161. symtablestack.insert(sym);
  162. try_consume_hintdirective(sym.symoptions);
  163. consume(_SEMICOLON);
  164. end;
  165. _COLON:
  166. begin
  167. { set the blocktype first so a consume also supports a
  168. caret, to support const s : ^string = nil }
  169. block_type:=bt_type;
  170. consume(_COLON);
  171. ignore_equal:=true;
  172. read_type(tt,'',false);
  173. ignore_equal:=false;
  174. block_type:=bt_const;
  175. skipequal:=false;
  176. { create symbol }
  177. storetokenpos:=akttokenpos;
  178. akttokenpos:=filepos;
  179. sym:=ttypedconstsym.createtype(orgname,tt,(cs_typed_const_writable in aktlocalswitches));
  180. akttokenpos:=storetokenpos;
  181. symtablestack.insert(sym);
  182. insertconstdata(ttypedconstsym(sym));
  183. { procvar can have proc directives, but not type references }
  184. if (tt.def.deftype=procvardef) and
  185. (tt.sym=nil) then
  186. begin
  187. { support p : procedure;stdcall=nil; }
  188. if try_to_consume(_SEMICOLON) then
  189. begin
  190. if is_proc_directive(token,true) then
  191. parse_var_proc_directives(sym)
  192. else
  193. begin
  194. Message(parser_e_proc_directive_expected);
  195. skipequal:=true;
  196. end;
  197. end
  198. else
  199. { support p : procedure stdcall=nil; }
  200. begin
  201. if is_proc_directive(token,true) then
  202. parse_var_proc_directives(sym);
  203. end;
  204. { add default calling convention }
  205. handle_calling_convention(tabstractprocdef(tt.def));
  206. calc_parast(tprocvardef(tt.def));
  207. end;
  208. if not skipequal then
  209. begin
  210. { get init value }
  211. consume(_EQUAL);
  212. readtypedconst(tt,ttypedconstsym(sym),(cs_typed_const_writable in aktlocalswitches));
  213. try_consume_hintdirective(sym.symoptions);
  214. consume(_SEMICOLON);
  215. end;
  216. end;
  217. else
  218. { generate an error }
  219. consume(_EQUAL);
  220. end;
  221. until token<>_ID;
  222. block_type:=old_block_type;
  223. end;
  224. procedure label_dec;
  225. var
  226. hl : tasmlabel;
  227. begin
  228. consume(_LABEL);
  229. if not(cs_support_goto in aktmoduleswitches) then
  230. Message(sym_e_goto_and_label_not_supported);
  231. repeat
  232. if not(token in [_ID,_INTCONST]) then
  233. consume(_ID)
  234. else
  235. begin
  236. if (cs_create_smart in aktmoduleswitches) then
  237. begin
  238. objectlibrary.getdatalabel(hl);
  239. { we still want a warning if unused }
  240. hl.decrefs;
  241. end
  242. else
  243. objectlibrary.getlabel(hl);
  244. if token=_ID then
  245. symtablestack.insert(tlabelsym.create(orgpattern,hl))
  246. else
  247. symtablestack.insert(tlabelsym.create(pattern,hl));
  248. consume(token);
  249. end;
  250. if token<>_SEMICOLON then consume(_COMMA);
  251. until not(token in [_ID,_INTCONST]);
  252. consume(_SEMICOLON);
  253. end;
  254. { search in symtablestack used, but not defined type }
  255. procedure resolve_type_forward(p : tnamedindexitem;arg:pointer);
  256. var
  257. hpd,pd : tdef;
  258. stpos : tfileposinfo;
  259. again : boolean;
  260. srsym : tsym;
  261. srsymtable : tsymtable;
  262. begin
  263. { Check only typesyms or record/object fields }
  264. case tsym(p).typ of
  265. typesym :
  266. pd:=ttypesym(p).restype.def;
  267. varsym :
  268. if (tsym(p).owner.symtabletype in [objectsymtable,recordsymtable]) then
  269. pd:=tvarsym(p).vartype.def
  270. else
  271. exit;
  272. else
  273. exit;
  274. end;
  275. repeat
  276. again:=false;
  277. case pd.deftype of
  278. arraydef :
  279. begin
  280. { elementtype could also be defined using a forwarddef }
  281. pd:=tarraydef(pd).elementtype.def;
  282. again:=true;
  283. end;
  284. pointerdef,
  285. classrefdef :
  286. begin
  287. { classrefdef inherits from pointerdef }
  288. hpd:=tpointerdef(pd).pointertype.def;
  289. { still a forward def ? }
  290. if hpd.deftype=forwarddef then
  291. begin
  292. { try to resolve the forward }
  293. { get the correct position for it }
  294. stpos:=akttokenpos;
  295. akttokenpos:=tforwarddef(hpd).forwardpos;
  296. resolving_forward:=true;
  297. make_ref:=false;
  298. if not assigned(tforwarddef(hpd).tosymname) then
  299. internalerror(20021120);
  300. searchsym(tforwarddef(hpd).tosymname^,srsym,srsymtable);
  301. make_ref:=true;
  302. resolving_forward:=false;
  303. akttokenpos:=stpos;
  304. { we don't need the forwarddef anymore, dispose it }
  305. hpd.free;
  306. tpointerdef(pd).pointertype.def:=nil; { if error occurs }
  307. { was a type sym found ? }
  308. if assigned(srsym) and
  309. (srsym.typ=typesym) then
  310. begin
  311. tpointerdef(pd).pointertype.setsym(srsym);
  312. { avoid wrong unused warnings web bug 801 PM }
  313. inc(tstoredsym(srsym).refs);
  314. {$ifdef GDB}
  315. if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
  316. (tsym(p).owner.symtabletype in [globalsymtable,staticsymtable]) then
  317. begin
  318. ttypesym(p).isusedinstab := true;
  319. ttypesym(p).concatstabto(debuglist);
  320. end;
  321. {$endif GDB}
  322. { we need a class type for classrefdef }
  323. if (pd.deftype=classrefdef) and
  324. not(is_class(ttypesym(srsym).restype.def)) then
  325. Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename);
  326. end
  327. else
  328. begin
  329. MessagePos1(tsym(p).fileinfo,sym_e_forward_type_not_resolved,tsym(p).realname);
  330. { try to recover }
  331. tpointerdef(pd).pointertype:=generrortype;
  332. end;
  333. end;
  334. end;
  335. recorddef :
  336. trecorddef(pd).symtable.foreach_static({$ifdef FPCPROCVAR}@{$endif}resolve_type_forward,nil);
  337. objectdef :
  338. begin
  339. if not(m_fpc in aktmodeswitches) and
  340. (oo_is_forward in tobjectdef(pd).objectoptions) then
  341. begin
  342. { only give an error as the implementation may follow in an
  343. other type block which is allowed by FPC modes }
  344. MessagePos1(tsym(p).fileinfo,sym_e_forward_type_not_resolved,tsym(p).realname);
  345. end
  346. else
  347. begin
  348. { Check all fields of the object declaration, but don't
  349. check objectdefs in objects/records, because these
  350. can't exist (anonymous objects aren't allowed) }
  351. if not(tsym(p).owner.symtabletype in [objectsymtable,recordsymtable]) then
  352. tobjectdef(pd).symtable.foreach_static({$ifdef FPCPROCVAR}@{$endif}resolve_type_forward,nil);
  353. end;
  354. end;
  355. end;
  356. until not again;
  357. end;
  358. { reads a type declaration to the symbol table }
  359. procedure type_dec;
  360. var
  361. typename,orgtypename : stringid;
  362. newtype : ttypesym;
  363. sym : tsym;
  364. srsymtable : tsymtable;
  365. tt : ttype;
  366. oldfilepos,
  367. defpos,storetokenpos : tfileposinfo;
  368. old_block_type : tblock_type;
  369. ch : tclassheader;
  370. unique,istyperenaming : boolean;
  371. begin
  372. old_block_type:=block_type;
  373. block_type:=bt_type;
  374. consume(_TYPE);
  375. typecanbeforward:=true;
  376. repeat
  377. typename:=pattern;
  378. orgtypename:=orgpattern;
  379. defpos:=akttokenpos;
  380. istyperenaming:=false;
  381. consume(_ID);
  382. consume(_EQUAL);
  383. { support 'ttype=type word' syntax }
  384. if token=_TYPE then
  385. begin
  386. Consume(_TYPE);
  387. unique:=true;
  388. end
  389. else
  390. unique:=false;
  391. { is the type already defined? }
  392. searchsym(typename,sym,srsymtable);
  393. newtype:=nil;
  394. { found a symbol with this name? }
  395. if assigned(sym) then
  396. begin
  397. if (sym.typ=typesym) then
  398. begin
  399. if ((token=_CLASS) or
  400. (token=_INTERFACE)) and
  401. (assigned(ttypesym(sym).restype.def)) and
  402. is_class_or_interface(ttypesym(sym).restype.def) and
  403. (oo_is_forward in tobjectdef(ttypesym(sym).restype.def).objectoptions) then
  404. begin
  405. { we can ignore the result }
  406. { the definition is modified }
  407. object_dec(orgtypename,tobjectdef(ttypesym(sym).restype.def));
  408. newtype:=ttypesym(sym);
  409. tt:=newtype.restype;
  410. end
  411. else
  412. message1(parser_h_type_redef,typename);
  413. end;
  414. end;
  415. { no old type reused ? Then insert this new type }
  416. if not assigned(newtype) then
  417. begin
  418. { insert the new type first with an errordef, so that
  419. referencing the type before it's really set it
  420. will give an error (PFV) }
  421. tt:=generrortype;
  422. storetokenpos:=akttokenpos;
  423. newtype:=ttypesym.create(orgtypename,tt);
  424. symtablestack.insert(newtype);
  425. akttokenpos:=defpos;
  426. akttokenpos:=storetokenpos;
  427. { read the type definition }
  428. read_type(tt,orgtypename,false);
  429. { update the definition of the type }
  430. newtype.restype:=tt;
  431. if assigned(tt.sym) then
  432. istyperenaming:=true
  433. else
  434. tt.sym:=newtype;
  435. if unique and assigned(tt.def) then
  436. begin
  437. tt.setdef(tstoreddef(tt.def).getcopy);
  438. include(tt.def.defoptions,df_unique);
  439. newtype.restype:=tt;
  440. end;
  441. if assigned(tt.def) and not assigned(tt.def.typesym) then
  442. tt.def.typesym:=newtype;
  443. { KAZ: handle TGUID declaration in system unit }
  444. if (cs_compilesystem in aktmoduleswitches) and not assigned(rec_tguid) and
  445. (typename='TGUID') and { name: TGUID and size=16 bytes that is 128 bits }
  446. assigned(tt.def) and (tt.def.deftype=recorddef) and (tt.def.size=16) then
  447. rec_tguid:=trecorddef(tt.def);
  448. end;
  449. if assigned(tt.def) then
  450. begin
  451. case tt.def.deftype of
  452. pointerdef :
  453. begin
  454. consume(_SEMICOLON);
  455. if try_to_consume(_FAR) then
  456. begin
  457. tpointerdef(tt.def).is_far:=true;
  458. consume(_SEMICOLON);
  459. end;
  460. end;
  461. procvardef :
  462. begin
  463. { in case of type renaming, don't parse proc directives }
  464. if istyperenaming then
  465. consume(_SEMICOLON)
  466. else
  467. begin
  468. if not is_proc_directive(token,true) then
  469. consume(_SEMICOLON);
  470. parse_var_proc_directives(tsym(newtype));
  471. handle_calling_convention(tprocvardef(tt.def));
  472. calc_parast(tprocvardef(tt.def));
  473. end;
  474. end;
  475. objectdef,
  476. recorddef :
  477. begin
  478. try_consume_hintdirective(newtype.symoptions);
  479. consume(_SEMICOLON);
  480. end;
  481. else
  482. consume(_SEMICOLON);
  483. end;
  484. end;
  485. { Write tables if we are the typesym that defines
  486. this type. This will not be done for simple type renamings }
  487. if (tt.def.typesym=newtype) then
  488. begin
  489. { file position }
  490. oldfilepos:=aktfilepos;
  491. aktfilepos:=newtype.fileinfo;
  492. { generate persistent init/final tables when it's declared in the interface so it can
  493. be reused in other used }
  494. if current_module.in_interface and
  495. ((is_class(tt.def) and
  496. tobjectdef(tt.def).members_need_inittable) or
  497. tt.def.needs_inittable) then
  498. generate_inittable(newtype);
  499. { for objects we should write the vmt and interfaces.
  500. This need to be done after the rtti has been written, because
  501. it can contain a reference to that data (PFV)
  502. This is not for forward classes }
  503. if (tt.def.deftype=objectdef) and
  504. not(oo_is_forward in tobjectdef(tt.def).objectoptions) then
  505. begin
  506. ch:=cclassheader.create(tobjectdef(tt.def));
  507. { generate and check virtual methods, must be done
  508. before RTTI is written }
  509. ch.genvmt;
  510. { generate rtti info if published items are available }
  511. if (oo_can_have_published in tobjectdef(tt.def).objectoptions) then
  512. generate_rtti(newtype);
  513. if is_interface(tobjectdef(tt.def)) then
  514. ch.writeinterfaceids;
  515. if (oo_has_vmt in tobjectdef(tt.def).objectoptions) then
  516. ch.writevmt;
  517. ch.free;
  518. end;
  519. aktfilepos:=oldfilepos;
  520. end;
  521. until token<>_ID;
  522. typecanbeforward:=false;
  523. symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}resolve_type_forward,nil);
  524. block_type:=old_block_type;
  525. end;
  526. procedure var_dec;
  527. { parses variable declarations and inserts them in }
  528. { the top symbol table of symtablestack }
  529. begin
  530. consume(_VAR);
  531. read_var_decs(false,false,false);
  532. end;
  533. procedure threadvar_dec;
  534. { parses thread variable declarations and inserts them in }
  535. { the top symbol table of symtablestack }
  536. begin
  537. consume(_THREADVAR);
  538. if not(symtablestack.symtabletype in [staticsymtable,globalsymtable]) then
  539. message(parser_e_threadvars_only_sg);
  540. if not(cs_threading in aktmoduleswitches) and
  541. not(cs_compilesystem in aktmoduleswitches) then
  542. Comment(V_Error,'Threading is turned off');
  543. read_var_decs(false,false,true);
  544. end;
  545. procedure resourcestring_dec;
  546. var
  547. orgname : stringid;
  548. p : tnode;
  549. storetokenpos,filepos : tfileposinfo;
  550. old_block_type : tblock_type;
  551. sp : pchar;
  552. begin
  553. consume(_RESOURCESTRING);
  554. if not(symtablestack.symtabletype in [staticsymtable,globalsymtable]) then
  555. message(parser_e_resourcestring_only_sg);
  556. old_block_type:=block_type;
  557. block_type:=bt_const;
  558. repeat
  559. orgname:=orgpattern;
  560. filepos:=akttokenpos;
  561. consume(_ID);
  562. case token of
  563. _EQUAL:
  564. begin
  565. consume(_EQUAL);
  566. p:=comp_expr(true);
  567. storetokenpos:=akttokenpos;
  568. akttokenpos:=filepos;
  569. case p.nodetype of
  570. ordconstn:
  571. begin
  572. if is_constcharnode(p) then
  573. begin
  574. getmem(sp,2);
  575. sp[0]:=chr(tordconstnode(p).value);
  576. sp[1]:=#0;
  577. symtablestack.insert(tconstsym.create_string(orgname,constresourcestring,sp,1));
  578. end
  579. else
  580. Message(cg_e_illegal_expression);
  581. end;
  582. stringconstn:
  583. begin
  584. getmem(sp,tstringconstnode(p).len+1);
  585. move(tstringconstnode(p).value_str^,sp^,tstringconstnode(p).len+1);
  586. symtablestack.insert(tconstsym.create_string(orgname,constresourcestring,sp,tstringconstnode(p).len));
  587. end;
  588. else
  589. Message(cg_e_illegal_expression);
  590. end;
  591. akttokenpos:=storetokenpos;
  592. consume(_SEMICOLON);
  593. p.free;
  594. end;
  595. else consume(_EQUAL);
  596. end;
  597. until token<>_ID;
  598. block_type:=old_block_type;
  599. end;
  600. end.
  601. {
  602. $Log$
  603. Revision 1.72 2003-11-12 15:48:48 peter
  604. * don't give redefinition warning for forward classes
  605. Revision 1.71 2003/10/03 14:45:09 peter
  606. * more proc directive for procvar fixes
  607. Revision 1.70 2003/10/02 21:13:09 peter
  608. * procvar directive parsing fixes
  609. Revision 1.69 2003/09/23 17:56:05 peter
  610. * locals and paras are allocated in the code generation
  611. * tvarsym.localloc contains the location of para/local when
  612. generating code for the current procedure
  613. Revision 1.68 2003/07/02 22:18:04 peter
  614. * paraloc splitted in callerparaloc,calleeparaloc
  615. * sparc calling convention updates
  616. Revision 1.67 2003/04/27 11:21:33 peter
  617. * aktprocdef renamed to current_procdef
  618. * procinfo renamed to current_procinfo
  619. * procinfo will now be stored in current_module so it can be
  620. cleaned up properly
  621. * gen_main_procsym changed to create_main_proc and release_main_proc
  622. to also generate a tprocinfo structure
  623. * fixed unit implicit initfinal
  624. Revision 1.66 2003/04/27 07:29:50 peter
  625. * current_procdef cleanup, current_procdef is now always nil when parsing
  626. a new procdef declaration
  627. * aktprocsym removed
  628. * lexlevel removed, use symtable.symtablelevel instead
  629. * implicit init/final code uses the normal genentry/genexit
  630. * funcret state checking updated for new funcret handling
  631. Revision 1.65 2003/04/01 16:17:15 peter
  632. * reset symbol for unique types
  633. Revision 1.64 2003/01/05 15:54:15 florian
  634. + added proper support of type = type <type>; for simple types
  635. Revision 1.63 2002/12/29 14:57:50 peter
  636. * unit loading changed to first register units and load them
  637. afterwards. This is needed to support uses xxx in yyy correctly
  638. * unit dependency check fixed
  639. Revision 1.62 2002/12/05 19:27:40 carl
  640. - remove lower in hint
  641. Revision 1.61 2002/11/25 18:43:32 carl
  642. - removed the invalid if <> checking (Delphi is strange on this)
  643. + implemented abstract warning on instance creation of class with
  644. abstract methods.
  645. * some error message cleanups
  646. Revision 1.60 2002/11/23 22:50:06 carl
  647. * some small speed optimizations
  648. + added several new warnings/hints
  649. Revision 1.59 2002/11/17 16:31:56 carl
  650. * memory optimization (3-4%) : cleanup of tai fields,
  651. cleanup of tdef and tsym fields.
  652. * make it work for m68k
  653. Revision 1.58 2002/11/15 16:29:30 peter
  654. * made tasmsymbol.refs private (merged)
  655. Revision 1.57 2002/10/20 15:34:16 peter
  656. * removed df_unique flag. It breaks code. For a good type=type <id>
  657. a def copy is required
  658. Revision 1.56 2002/10/19 15:09:25 peter
  659. + tobjectdef.members_need_inittable that is used to generate only the
  660. inittable when it is really used. This saves a lot of useless calls
  661. to fpc_finalize when destroying classes
  662. Revision 1.55 2002/10/14 19:45:02 peter
  663. * only allow threadvar when threading switch is defined
  664. Revision 1.54 2002/10/06 12:25:05 florian
  665. + proper support of type <id> = type <another id>;
  666. Revision 1.53 2002/08/25 19:25:19 peter
  667. * sym.insert_in_data removed
  668. * symtable.insertvardata/insertconstdata added
  669. * removed insert_in_data call from symtable.insert, it needs to be
  670. called separatly. This allows to deref the address calculation
  671. * procedures now calculate the parast addresses after the procedure
  672. directives are parsed. This fixes the cdecl parast problem
  673. * push_addr_param has an extra argument that specifies if cdecl is used
  674. or not
  675. Revision 1.52 2002/08/12 15:08:40 carl
  676. + stab register indexes for powerpc (moved from gdb to cpubase)
  677. + tprocessor enumeration moved to cpuinfo
  678. + linker in target_info is now a class
  679. * many many updates for m68k (will soon start to compile)
  680. - removed some ifdef or correct them for correct cpu
  681. Revision 1.51 2002/08/11 14:32:27 peter
  682. * renamed current_library to objectlibrary
  683. Revision 1.50 2002/08/11 13:24:12 peter
  684. * saving of asmsymbols in ppu supported
  685. * asmsymbollist global is removed and moved into a new class
  686. tasmlibrarydata that will hold the info of a .a file which
  687. corresponds with a single module. Added librarydata to tmodule
  688. to keep the library info stored for the module. In the future the
  689. objectfiles will also be stored to the tasmlibrarydata class
  690. * all getlabel/newasmsymbol and friends are moved to the new class
  691. Revision 1.49 2002/07/29 21:23:43 florian
  692. * more fixes for the ppc
  693. + wrappers for the tcnvnode.first_* stuff introduced
  694. Revision 1.48 2002/07/01 18:46:25 peter
  695. * internal linker
  696. * reorganized aasm layer
  697. Revision 1.47 2002/06/12 13:20:29 jonas
  698. * fix from Florian for init/final info of forward classes
  699. Revision 1.46 2002/05/18 13:34:12 peter
  700. * readded missing revisions
  701. Revision 1.45 2002/05/16 19:46:42 carl
  702. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  703. + try to fix temp allocation (still in ifdef)
  704. + generic constructor calls
  705. + start of tassembler / tmodulebase class cleanup
  706. Revision 1.43 2002/05/12 16:53:08 peter
  707. * moved entry and exitcode to ncgutil and cgobj
  708. * foreach gets extra argument for passing local data to the
  709. iterator function
  710. * -CR checks also class typecasts at runtime by changing them
  711. into as
  712. * fixed compiler to cycle with the -CR option
  713. * fixed stabs with elf writer, finally the global variables can
  714. be watched
  715. * removed a lot of routines from cga unit and replaced them by
  716. calls to cgobj
  717. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  718. u32bit then the other is typecasted also to u32bit without giving
  719. a rangecheck warning/error.
  720. * fixed pascal calling method with reversing also the high tree in
  721. the parast, detected by tcalcst3 test
  722. Revision 1.42 2002/04/19 15:46:02 peter
  723. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  724. in most cases and not written to the ppu
  725. * add mangeledname_prefix() routine to generate the prefix of
  726. manglednames depending on the current procedure, object and module
  727. * removed static procprefix since the mangledname is now build only
  728. on demand from tprocdef.mangledname
  729. Revision 1.41 2002/03/04 17:54:59 peter
  730. * allow oridinal labels again
  731. }