Przeglądaj źródła

- removed some unused variables
* fixed some (harmless) ptrint warnings
- removed some commented code in agppcmpw
* added one missing field in a typed constant in cp1251

git-svn-id: trunk@8081 -

Jonas Maebe 18 lat temu
rodzic
commit
28bab3fb4f

+ 0 - 6
compiler/aggas.pas

@@ -443,13 +443,10 @@ implementation
       do_line  : boolean;
 
       sepChar : char;
-      nextdwarffileidx : longint;
     begin
       if not assigned(p) then
        exit;
 
-       nextdwarffileidx:=1;
-
       last_align := 2;
       InlineLevel:=0;
       { lineinfo is only needed for al_procedures (PFV) }
@@ -995,9 +992,6 @@ implementation
                   if CurrSecType<>sec_none then
                     WriteSection(CurrSecType,'',secorder_default);
                   AsmStartSize:=AsmSize;
-
-                  { reset dwarf file index }
-                  nextdwarffileidx:=1;
                 end;
              end;
 

+ 3 - 3
compiler/cfileutl.pas

@@ -177,9 +177,9 @@ implementation
                 Result:=0;
             end
           else
-            Result:=PtrInt(DirectoryEntries.Find(Lower(AName)))
+            Result:=PtrUInt(DirectoryEntries.Find(Lower(AName)))
         else
-          Result:=PtrInt(DirectoryEntries.Find(AName));
+          Result:=PtrUInt(DirectoryEntries.Find(AName));
       end;
 
 
@@ -367,7 +367,7 @@ implementation
             else
               begin
                 Res.Name:=Res.CachedDir.DirectoryEntries.NameOfIndex(Res.EntryIndex);
-                Res.Attr:=PtrInt(Res.CachedDir.DirectoryEntries[Res.EntryIndex]);
+                Res.Attr:=PtrUInt(Res.CachedDir.DirectoryEntries[Res.EntryIndex]);
               end;
             inc(Res.EntryIndex);
             Result:=true;

+ 5 - 18
compiler/constexp.pas

@@ -199,7 +199,7 @@ function sub_from(const a:Tconstexprint;b:qword):Tconstexprint;
 
 const abs_low_int64=qword(9223372036854775808);   {abs(low(int64)) -> overflow error}
 
-var sspace,uspace:qword;
+var sspace:qword;
 
 label try_qword,ov;
 
@@ -375,7 +375,6 @@ end;
 operator mod (const a,b:Tconstexprint):Tconstexprint;
 
 var aa,bb:qword;
-    sa,sb:boolean;
 
 begin
   if a.overflow or b.overflow then
@@ -385,25 +384,13 @@ begin
     end;
   result.overflow:=false;
   if a.signed then
-    begin
-      aa:=qword(a.svalue);
-      sa:=a.svalue<0;
-    end
+    aa:=qword(a.svalue)
   else
-    begin
-      aa:=a.uvalue;
-      sa:=false;
-    end;
+    aa:=a.uvalue;
   if b.signed then
-    begin
-      bb:=qword(b.svalue);
-      sb:=b.svalue<0;
-    end
+    bb:=qword(b.svalue)
   else
-    begin
-      bb:=b.uvalue;
-      sb:=false;
-    end;
+    bb:=b.uvalue;
   if bb=0 then
     result.overflow:=true
   else

+ 1 - 1
compiler/cp1251.pas

@@ -162,7 +162,7 @@ unit cp1251;
        (unicode : 8226; flag : umf_noinfo; reserved : 0),
        (unicode : 8211; flag : umf_noinfo; reserved : 0),
        (unicode : 8212; flag : umf_noinfo; reserved : 0),
-       (unicode : 65535; flag : umf_unused),
+       (unicode : 65535; flag : umf_unused; reserved : 0),
        (unicode : 8482; flag : umf_noinfo; reserved : 0),
        (unicode : 1113; flag : umf_noinfo; reserved : 0),
        (unicode : 8250; flag : umf_noinfo; reserved : 0),

+ 2 - 2
compiler/cstreams.pas

@@ -462,7 +462,7 @@ begin
     begin
     Result:=FSize-FPosition;
     If Result>Count then Result:=Count;
-    Move (Pointer(PtrInt(FMemory)+FPosition)^,Buffer,Result);
+    Move (Pointer(PtrUInt(FMemory)+FPosition)^,Buffer,Result);
     FPosition:=Fposition+Result;
     end;
 end;
@@ -613,7 +613,7 @@ begin
       SetCapacity (NewPos);
     FSize:=Newpos;
     end;
-  System.Move (Buffer,Pointer(Ptrint(FMemory)+FPosition)^,Count);
+  System.Move (Buffer,Pointer(Ptruint(FMemory)+FPosition)^,Count);
   FPosition:=NewPos;
   Result:=Count;
 end;

+ 0 - 3
compiler/dbgdwarf.pas

@@ -1620,8 +1620,6 @@ implementation
       var
         procendlabel   : tasmlabel;
         funcrettype    : tasmsymbol;
-        mangled_length : longint;
-        p              : pchar;
         procentry      : string;
         dreg           : byte;
       begin
@@ -2489,7 +2487,6 @@ implementation
         lastfileinfo : tfileposinfo;
         currfuncname : pshortstring;
         currsectype  : TAsmSectiontype;
-        hlabel       : tasmlabel;
         hp : tai;
         infile : tinputfile;
         prevcolumn,

+ 1 - 2
compiler/fmodule.pas

@@ -413,9 +413,8 @@ implementation
 
     constructor tmodule.create(LoadedFrom:TModule;const s:string;_is_unit:boolean);
       var
-        p,n : string;
+        n : string;
       begin
-        p:=ExtractFilePath(s);
         n:=ChangeFileExt(ExtractFileName(s),'');
         { Programs have the name 'Program' to don't conflict with dup id's }
         if _is_unit then

+ 0 - 4
compiler/fppu.pas

@@ -982,8 +982,6 @@ uses
 
 
     procedure tppumodule.writeppu;
-      var
-        pu : tused_unit;
       begin
          Message1(unit_u_ppu_write,realmodulename^);
 
@@ -1195,11 +1193,9 @@ uses
     procedure tppumodule.load_usedunits;
       var
         pu           : tused_unit;
-        load_refs    : boolean;
       begin
         if current_module<>self then
          internalerror(200212284);
-        load_refs:=true;
 
         { load the used units from interface }
         in_interface:=true;

+ 1 - 3
compiler/globals.pas

@@ -487,7 +487,7 @@ implementation
     procedure TLinkStrMap.Expand(Src:TCmdStrList;Dest:TLinkStrMap);
       // expands every thing in Src to Dest for linkorder purposes.
       var
-        l,r  : longint;
+        r  : longint;
         LibN    : TCmdStr;
       begin
         while not src.empty do
@@ -1082,8 +1082,6 @@ implementation
      end;
 
    procedure InitGlobals;
-     var
-       i : tfeature;
      begin
         get_exepath;
 

+ 1 - 2
compiler/htypechk.pas

@@ -2339,8 +2339,7 @@ implementation
         end;
 
       var
-        paraidx,
-        res: integer;
+        paraidx : integer;
         currpara, bestpara: tparavarsym;
         currvcl, bestvcl: tvariantequaltype;
       begin

+ 1 - 1
compiler/nadd.pas

@@ -1684,7 +1684,7 @@ implementation
       var
         p: tnode;
         newstatement : tstatementnode;
-        tempnode,tempnode2 : ttempcreatenode;
+        tempnode (*,tempnode2*) : ttempcreatenode;
         cmpfuncname: string;
       begin
         { when we get here, we are sure that both the left and the right }

+ 0 - 2
compiler/nbas.pas

@@ -443,8 +443,6 @@ implementation
 
 
     function tblocknode.simplify: tnode;
-      var
-        hp, next: tstatementnode;
       begin
         result := nil;
         { Warning: never replace a blocknode with another node type,      }

+ 0 - 1
compiler/ncal.pas

@@ -1422,7 +1422,6 @@ implementation
         objectdf : tobjectdef;
         parents : tlinkedlist;
         objectinfo : tobjectinfoitem;
-        stritem : TCmdStrListItem;
         pd : tprocdef;
         i  : integer;
         first : boolean;

+ 4 - 0
compiler/ncgutil.pas

@@ -2138,9 +2138,11 @@ implementation
 ****************************************************************************}
 
     procedure gen_external_stub(list:TAsmList;pd:tprocdef;const externalname:string);
+{$ifdef x86}
       var
         ref : treference;
         sym : tasmsymbol;
+{$endif x86}
       begin
         { add the procedure to the al_procedures }
         maybe_new_object_file(list);
@@ -2765,8 +2767,10 @@ implementation
 
 
     procedure gen_pic_helpers(list : TAsmList);
+{$ifdef i386}
       var
         href : treference;
+{$endif i386}
       begin
         { if other cpus require such helpers as well, it can be solved more cleaner }
 {$ifdef i386}

+ 0 - 1
compiler/ninl.pas

@@ -853,7 +853,6 @@ implementation
         filetemp      : Ttempcreatenode;
         name          : string[31];
         textsym       : ttypesym;
-        readfunctype  : tdef;
         is_typed,
         do_read,
         is_rwstr,

+ 0 - 4
compiler/nmat.pas

@@ -104,7 +104,6 @@ implementation
     function tmoddivnode.simplify:tnode;
       var
         t : tnode;
-        rd,ld : torddef;
         rv,lv : tconstexprint;
       begin
         result:=nil;
@@ -125,9 +124,6 @@ implementation
 
         if is_constintnode(right) and is_constintnode(left) then
           begin
-            rd:=torddef(right.resultdef);
-            ld:=torddef(left.resultdef);
-
             rv:=tordconstnode(right).value;
             lv:=tordconstnode(left).value;
 

+ 0 - 1
compiler/pdecl.pas

@@ -393,7 +393,6 @@ implementation
          sym      : tsym;
          srsymtable : TSymtable;
          hdef     : tdef;
-         oldfilepos,
          defpos,storetokenpos : tfileposinfo;
          old_block_type : tblock_type;
          isgeneric,

+ 0 - 1
compiler/pdecsub.pas

@@ -1282,7 +1282,6 @@ end;
 procedure pd_dispid(pd:tabstractprocdef);
 
 var pt:Tnode;
-    v:Tconstexprint;
 
 begin
   if pd.typ<>procdef then

+ 2 - 7
compiler/pexpr.pas

@@ -1362,15 +1362,13 @@ implementation
        procedure factor_read_id(var p1:tnode;var again:boolean);
          var
            pc    : pchar;
-           len   : longint;
            srsym : tsym;
-           unit_found,
-           possible_error : boolean;
+           unit_found : boolean;
            srsymtable : TSymtable;
            hdef  : tdef;
-           static_name : string;
            orgstoredpattern,
            storedpattern : string;
+           len   : longint;
          begin
            { allow post fix operators }
            again:=true;
@@ -2208,9 +2206,6 @@ implementation
          l          : longint;
          ic         : int64;
          qc         : qword;
-{$ifndef cpu64}
-         card       : cardinal;
-{$endif cpu64}
          oldp1,
          p1         : tnode;
          code       : integer;

+ 1 - 36
compiler/powerpc/agppcmpw.pas

@@ -675,9 +675,7 @@ interface
 
     procedure TPPCMPWAssembler.WriteTree(p:TAsmList);
     var
-      s,
-      prefix,
-      suffix   : string;
+      s        : string;
       hp       : tai;
       hp1      : tailineinfo;
       counter,
@@ -685,11 +683,8 @@ interface
       InlineLevel : longint;
       i,j,l    : longint;
       consttype : taiconst_type;
-      found,
       do_line,DoNotSplitLine,
       quoted   : boolean;
-      sep      : char;
-      replaced : boolean;
       sin      : single;
       d        : double;
 
@@ -1215,43 +1210,13 @@ interface
 
 
     function TPPCMPWAssembler.DoAssemble : boolean;
-    var f : file;
     begin
       DoAssemble:=Inherited DoAssemble;
-      (*
-      { masm does not seem to recognize specific extensions and uses .obj allways PM }
-      if (target_asm.id = as_i386_masm) then
-        begin
-          if not(cs_asm_extern in current_settings.globalswitches) then
-            begin
-              if Not FileExists(objfile) and
-                 FileExists(ForceExtension(objfile,'.obj')) then
-                begin
-                  Assign(F,ForceExtension(objfile,'.obj'));
-                  Rename(F,objfile);
-                end;
-            end
-          else
-            AsmRes.AddAsmCommand('mv',ForceExtension(objfile,'.obj')+' '+objfile,objfile);
-        end;
-      *)
     end;
 
     procedure TPPCMPWAssembler.WriteAsmFileHeader;
 
     begin
-      (*
-      AsmWriteLn(#9'.386p');
-      { masm 6.11 does not seem to like LOCALS PM }
-      if (target_asm.id = as_i386_tasm) then
-        begin
-          AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
-        end;
-      AsmWriteLn('DGROUP'#9'GROUP'#9'_BSS,_DATA');
-      AsmWriteLn(#9'ASSUME'#9'CS:_CODE,ES:DGROUP,DS:DGROUP,SS:DGROUP');
-      AsmLn;
-      *)
-
       AsmWriteLn(#9'string asis');  {Interpret strings just to be the content between the quotes.}
       AsmWriteLn(#9'aligning off'); {We do our own aligning.}
       AsmLn;

+ 2 - 2
compiler/powerpc/cgcpu.pas

@@ -890,8 +890,8 @@ const
      var regcounter,firstregfpu,firstregint: TSuperRegister;
          href : treference;
          usesfpr,usesgpr,gotgot : boolean;
-         cond : tasmcond;
-         instr : taicpu;
+{         cond : tasmcond;
+         instr : taicpu; }
 
       begin
         { CR and LR only have to be saved in case they are modified by the current }

+ 1 - 1
compiler/powerpc/rappcgas.pas

@@ -653,7 +653,7 @@ Unit rappcgas;
             dec(ord(hs[0]));
             actcondition.dirhint:=DH_Plus;
           end;
-	actopcode := tasmop(ptrint(iasmops.find(hs)));
+	actopcode := tasmop(ptruint(iasmops.find(hs)));
         if actopcode <> A_NONE then
           begin
             if actcondition.dirhint<>DH_None then

+ 2 - 2
compiler/ppcgen/aasmcpu.pas

@@ -485,7 +485,7 @@ uses cutils, cclasses;
         p: tai;
         newjmp: taicpu;
         labelpositions: TFPList;
-        instrpos: ptrint;
+        instrpos: ptruint;
         l: tasmlabel;
         inserted_something: boolean;
       begin
@@ -539,7 +539,7 @@ uses cutils, cclasses;
 {$q-}
 {$define overflowon}
 {$endif}
-                           (ptruint(abs(ptrint(labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr]-instrpos)) - (low(smallint) div 4)) > ptruint((high(smallint) - low(smallint)) div 4)) then
+                           (ptruint(abs(ptruint(labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr]-instrpos)) - (low(smallint) div 4)) > ptruint((high(smallint) - low(smallint)) div 4)) then
 {$ifdef overflowon}
 {$q+}
 {$undef overflowon}

+ 0 - 1
compiler/ppcgen/cgppc.pas

@@ -483,7 +483,6 @@ unit cgppc;
   procedure tcgppcgen.g_profilecode(list: TAsmList);
     var
       paraloc1 : tcgpara;
-      reg: tregister;
     begin
       if (target_info.system in [system_powerpc_darwin]) then
         begin

+ 0 - 2
compiler/ppcgen/rgcpu.pas

@@ -57,7 +57,6 @@ unit rgcpu;
       var
         tmpref : treference;
         helplist : TAsmList;
-        l : tasmlabel;
         hreg : tregister;
         ins : Taicpu;
       begin
@@ -109,7 +108,6 @@ unit rgcpu;
       var
         tmpref : treference;
         helplist : TAsmList;
-        l : tasmlabel;
         hreg : tregister;
         ins : Taicpu;
       begin

+ 0 - 3
compiler/ppu.pas

@@ -1035,9 +1035,6 @@ procedure tppufile.putsmallset(const b);
 procedure tppufile.putnormalset(const b);
   type
     SetLongintArray = Array [0..7] of longint;
-  var
-    i : longint;
-    tempb : setlongintarray;
   begin
     putdata(b,32);
   end;