Recent

Author Topic: Code cleanup at class procedure tnodeutils.InsertThreadvars;  (Read 853 times)

lagprogramming

  • Sr. Member
  • ****
  • Posts: 407
Code cleanup at class procedure tnodeutils.InsertThreadvars;
« on: November 20, 2023, 10:16:28 am »
compiler/ngenutil.pas has
Code: Pascal  [Select][+][-]
  1.   class procedure tnodeutils.InsertThreadvars;
  2.     var
  3.       s : TSymStr;
  4.       tcb: ttai_typedconstbuilder;
  5.       sym: tasmsymbol;
  6.       tabledef: trecorddef;
  7.       add : boolean;
  8.     begin
  9.        if (tf_section_threadvars in target_info.flags) then
  10.          exit;
  11.        tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_new_section]);
  12.        tabledef:=tcb.begin_anonymous_record('',default_settings.packrecords,voidpointertype.alignment,targetinfos[target_info.system]^.alignment.recordalignmin);
  13.        if assigned(current_module.globalsymtable) then
  14.          current_module.globalsymtable.SymList.ForEachCall(@AddToThreadvarList,tcb);
  15.        current_module.localsymtable.SymList.ForEachCall(@AddToThreadvarList,tcb);
  16.        if trecordsymtable(tabledef.symtable).datasize<>0 then
  17.          { terminator }
  18.          tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
  19.        tcb.end_anonymous_record;
  20.        add:=trecordsymtable(tabledef.symtable).datasize<>0;
  21.        if add then
  22.          begin
  23.            s:=make_mangledname('THREADVARLIST',current_module.localsymtable,'');
  24.            sym:=current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA_FORCEINDIRECT,tabledef);
  25.            current_asmdata.asmlists[al_globals].concatlist(
  26.              tcb.get_final_asmlist(sym,tabledef,sec_data,s,const_align(sizeof(pint))));
  27.            include(current_module.moduleflags,mf_threadvars);
  28.            current_module.add_public_asmsym(sym);
  29.          end
  30.        else
  31.          s:='';
  32.        tcb.Free;
  33.     end;

The attached patch removes the useless "else s:='';" at the end of the procedure.


 

TinyPortal © 2005-2018