Skip to content

Code cleanup at class procedure tnodeutils.InsertThreadvars

by 'lagprogramming'.

compiler/ngenutil.pas has

      class procedure tnodeutils.InsertThreadvars;
        var
          s : TSymStr;
          tcb: ttai_typedconstbuilder;
          sym: tasmsymbol;
          tabledef: trecorddef;
          add : boolean;
        begin
           if (tf_section_threadvars in target_info.flags) then
             exit;
           tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_new_section]);
           tabledef:=tcb.begin_anonymous_record('',default_settings.packrecords,voidpointertype.alignment,targetinfos[target_info.system]^.alignment.recordalignmin);
           if assigned(current_module.globalsymtable) then
             current_module.globalsymtable.SymList.ForEachCall(@AddToThreadvarList,tcb);
           current_module.localsymtable.SymList.ForEachCall(@AddToThreadvarList,tcb);
           if trecordsymtable(tabledef.symtable).datasize<>0 then
             { terminator }
             tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
           tcb.end_anonymous_record;
           add:=trecordsymtable(tabledef.symtable).datasize<>0;
           if add then
             begin
               s:=make_mangledname('THREADVARLIST',current_module.localsymtable,'');
               sym:=current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA_FORCEINDIRECT,tabledef);
               current_asmdata.asmlists[al_globals].concatlist(
                 tcb.get_final_asmlist(sym,tabledef,sec_data,s,const_align(sizeof(pint))));
               include(current_module.moduleflags,mf_threadvars);
               current_module.add_public_asmsym(sym);
             end
           else
             s:='';
           tcb.Free;
        end;

let's remove the useless "else s:='';" at the end of the procedure.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information