Browse Source

* fixed ttypesym bug finally
* fileinfo in the symtable and better using for unused vars

peter 27 years ago
parent
commit
5e5e2fd78d
5 changed files with 92 additions and 26 deletions
  1. 13 4
      compiler/pbase.pas
  2. 30 4
      compiler/pdecl.pas
  3. 8 4
      compiler/scanner.pas
  4. 17 1
      compiler/symdef.inc
  5. 24 13
      compiler/symsym.inc

+ 13 - 4
compiler/pbase.pas

@@ -207,11 +207,17 @@ unit pbase;
 
 
       begin
-        s:=sc^.get_with_tokeninfo(filepos);
-         while s<>'' do
+         while not sc^.empty do
            begin
+              s:=sc^.get_with_tokeninfo(filepos);
               ss:=new(pvarsym,init(s,def));
+{$ifdef NEWINPUT}       
+
+              ss^.fileinfo:=filepos;
+{$else}
               ss^.line_no:=filepos.line;
+{$endif}        
+
               st^.insert(ss);
               { static data fields are inserted in the globalsymtable }
               if (st^.symtabletype=objectsymtable) and
@@ -220,7 +226,6 @@ unit pbase;
                    s:=lower(st^.name^)+'_'+s;
                    st^.defowner^.owner^.insert(new(pvarsym,init(s,def)));
                 end;
-              s:=sc^.get_with_tokeninfo(filepos);
            end;
          dispose(sc,done);
       end;
@@ -229,7 +234,11 @@ end.
 
 {
   $Log$
-  Revision 1.11  1998-07-07 11:20:02  peter
+  Revision 1.12  1998-07-09 23:59:59  peter
+    * fixed ttypesym bug finally
+    * fileinfo in the symtable and better using for unused vars
+
+  Revision 1.11  1998/07/07 11:20:02  peter
     + NEWINPUT for a better inputfile and scanner object
 
   Revision 1.10  1998/06/05 14:37:31  pierre

+ 30 - 4
compiler/pdecl.pas

@@ -188,7 +188,8 @@ unit pdecl;
          symdone : boolean;
          { to handle absolute }
          abssym : pabsolutesym;
-{$ifdef i386}	 
+{$ifdef i386}   
+
          l    : longint;
          code : word;
 {$endif i386}
@@ -196,7 +197,7 @@ unit pdecl;
          Csym : pvarsym;
          is_cdecl,extern_Csym,export_Csym : boolean;
          C_name : string;
-	 { case }
+         { case }
          p,casedef : pdef;
          { maxsize contains the max. size of a variant }
          { startvarrec contains the start of the variant part of a record }
@@ -240,7 +241,13 @@ unit pdecl;
                    abssym^.typ:=absolutesym;
                    abssym^.abstyp:=tovar;
                    abssym^.ref:=srsym;
+{$ifdef NEWINPUT}
+                   abssym^.fileinfo:=filepos;
+{$else}         
+
                    abssym^.line_no:=filepos.line;
+{$endif}                
+
                    symtablestack^.insert(abssym);
                  end
                 else
@@ -252,7 +259,13 @@ unit pdecl;
                     abssym^.typ:=absolutesym;
                     abssym^.abstyp:=toasm;
                     abssym^.asmname:=stringdup(s);
+{$ifdef NEWINPUT}
+                    abssym^.fileinfo:=filepos;
+{$else}         
+
                     abssym^.line_no:=filepos.line;
+{$endif}                
+
                     symtablestack^.insert(abssym);
                   end
                 else
@@ -266,7 +279,13 @@ unit pdecl;
                        abssym^.typ:=absolutesym;
                        abssym^.abstyp:=toaddr;
                        abssym^.absseg:=false;
+{$ifdef NEWINPUT}
+                       abssym^.fileinfo:=filepos;
+{$else}         
+
                        abssym^.line_no:=filepos.line;
+{$endif}                
+
                        s:=pattern;
                        consume(INTCONST);
                        val(s,abssym^.address,code);
@@ -1754,7 +1773,10 @@ unit pdecl;
                 else
                   begin
                      newtype:=new(ptypesym,init(typename,read_type(typename)));
-                     symtablestack^.insert(newtype);
+                     { load newtype with the new pointer to the inserted type
+
+                       because it can be an already defined forwarded type !! }
+                     newtype:=ptypesym(symtablestack^.insert(newtype));
                   end;
              end;
            consume(SEMICOLON);
@@ -1860,7 +1882,11 @@ unit pdecl;
 end.
 {
   $Log$
-  Revision 1.29  1998-06-25 14:04:21  peter
+  Revision 1.30  1998-07-10 00:00:00  peter
+    * fixed ttypesym bug finally
+    * fileinfo in the symtable and better using for unused vars
+
+  Revision 1.29  1998/06/25 14:04:21  peter
     + internal inc/dec
 
   Revision 1.28  1998/06/24 12:26:45  peter

+ 8 - 4
compiler/scanner.pas

@@ -33,10 +33,10 @@ unit scanner;
     const
 {$ifdef TP}
        maxmacrolen=1024;
-       InputFileBufSize=75;
+       InputFileBufSize=1024;
 {$else}
        maxmacrolen=16*1024;
-       InputFileBufSize=1024;
+       InputFileBufSize=32*1024;
 {$endif}
 
        id_len = 14;
@@ -1753,8 +1753,12 @@ exit_label:
 end.
 {
   $Log$
-  Revision 1.31  1998-07-07 17:39:38  peter
-    * fixed {$I } with following eof
+  Revision 1.32  1998-07-10 00:00:02  peter
+    * fixed ttypesym bug finally
+    * fileinfo in the symtable and better using for unused vars
+
+  Revision 1.31  1998/07/07 17:39:38  peter
+    * fixed $I  with following eof
 
   Revision 1.30  1998/07/07 12:32:55  peter
     * status.currentsource is now calculated in verbose (more accurated)

+ 17 - 1
compiler/symdef.inc

@@ -204,7 +204,13 @@
       if assigned(sym) then
         begin
            name := sym^.name;
+{$ifdef NEWINPUT}       
+
+           sym_line_no:=sym^.fileinfo.line;
+{$else}
            sym_line_no:=sym^.line_no;
+{$endif}        
+
         end
       else
         begin
@@ -1045,7 +1051,13 @@
                 if assigned(sym) then
                   begin
                      st := sym^.name;
+{$ifdef NEWINPUT}       
+
+                     sym_line_no:=sym^.fileinfo.line;
+{$else}
                      sym_line_no:=sym^.line_no;
+{$endif}        
+
                   end
                 else
                   begin
@@ -2646,7 +2658,11 @@
 
 {
   $Log$
-  Revision 1.16  1998-07-07 11:20:13  peter
+  Revision 1.17  1998-07-10 00:00:03  peter
+    * fixed ttypesym bug finally
+    * fileinfo in the symtable and better using for unused vars
+
+  Revision 1.16  1998/07/07 11:20:13  peter
     + NEWINPUT for a better inputfile and scanner object
 
   Revision 1.15  1998/06/24 14:48:37  peter

+ 24 - 13
compiler/symsym.inc

@@ -35,7 +35,7 @@
          isstabwritten := false;
 {$endif GDB}
 {$ifdef NEWINPUT}
-         line_no:=aktfilepos.line;
+         fileinfo:=aktfilepos;
 {$else}
          if assigned(current_module) and assigned(current_module^.current_inputfile) then
            line_no:=current_module^.current_inputfile^.line_no
@@ -62,7 +62,14 @@
          right:=nil;
          setname(readstring);
          typ:=abstractsym;
+{$ifdef NEWINPUT}       
+
+         fillchar(fileinfo,sizeof(fileinfo),0);
+{$else} 
+
          line_no:=0;
+{$endif}        
+
          if object_options then
            properties:=symprop(readbyte)
          else
@@ -330,7 +337,7 @@
     function tsym.stabstring : pchar;
 
       begin
-         stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+tostr(line_no)+',0');
+         stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0');
       end;
 
     procedure tsym.concatstabto(asmlist : paasmoutput);
@@ -1084,7 +1091,7 @@
             if use_gsym then st := 'G' else st := 'S';
             stabstring := strpnew('"'+owner^.name^+'__'+name+':'+
                      +definition^.numberstring+'",'+
-                     tostr(N_LCSYM)+',0,'+tostr(line_no)+','+mangledname);
+                     tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
          end
        else if (owner^.symtabletype = globalsymtable) or
           (owner^.symtabletype = unitsymtable) then
@@ -1096,13 +1103,13 @@
             if use_gsym then st := 'G' else st := 'S';
             stabstring := strpnew('"'+name+':'+st
                      +definition^.numberstring+'",'+
-                     tostr(N_LCSYM)+',0,'+tostr(line_no)+','+mangledname);
+                     tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
          end
        else if owner^.symtabletype = staticsymtable then
          begin
             stabstring := strpnew('"'+name+':S'
                   +definition^.numberstring+'",'+
-                  tostr(N_LCSYM)+',0,'+tostr(line_no)+','+mangledname);
+                  tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
          end
        else if (owner^.symtabletype=parasymtable) then
          begin
@@ -1116,7 +1123,7 @@
               end;
             stabstring := strpnew('"'+name+':'+st
                   +definition^.numberstring+'",'+
-                  tostr(N_PSYM)+',0,'+tostr(line_no)+','+tostr(address+owner^.call_offset))
+                  tostr(N_PSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(address+owner^.call_offset))
                   {offset to ebp => will not work if the framepointer is esp
                   so some optimizing will make things harder to debug }
          end
@@ -1128,13 +1135,13 @@
               { this is the register order for GDB}
               stabstring:=strpnew('"'+name+':r'
                         +definition^.numberstring+'",'+
-                        tostr(N_RSYM)+',0,'+tostr(line_no)+','+tostr(GDB_i386index[reg]));
+                        tostr(N_RSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(GDB_i386index[reg]));
            end
          else
    {$endif i386}
            stabstring := strpnew('"'+name+':'
                   +definition^.numberstring+'",'+
-                  tostr(N_LSYM)+',0,'+tostr(line_no)+',-'+tostr(address))
+                  tostr(N_LSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',-'+tostr(address))
        else
          stabstring := inherited stabstring;
   end;
@@ -1153,7 +1160,7 @@
            { this is the register order for GDB}
               stab_str:=strpnew('"'+name+':r'
                      +definition^.numberstring+'",'+
-                     tostr(N_RSYM)+',0,'+tostr(line_no)+','+tostr(GDB_i386index[reg]));
+                     tostr(N_RSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(GDB_i386index[reg]));
               asmlist^.concat(new(pai_stabs,init(stab_str)));
            end;
 {$endif i386}
@@ -1271,7 +1278,7 @@
     else
       st := 'S';
     stabstring := strpnew('"'+name+':'+st
-            +definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+tostr(line_no)+','+mangledname);
+            +definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
     end;
 {$endif GDB}
 
@@ -1395,7 +1402,7 @@
          { sets are not recognized by GDB}
             {***}
         end;
-    stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+tostr(line_no)+',0');
+    stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0');
     end;
 
     procedure tconstsym.concatstabto(asmlist : paasmoutput);
@@ -1567,7 +1574,7 @@
       else
         stabchar := 't';
       short := '"'+name+':'+stabchar+definition^.numberstring
-               +'",'+tostr(N_LSYM)+',0,'+tostr(line_no)+',0';
+               +'",'+tostr(N_LSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0';
       stabstring := strpnew(short);
     end;
 
@@ -1625,7 +1632,11 @@
 
 {
   $Log$
-  Revision 1.19  1998-07-07 17:40:39  peter
+  Revision 1.20  1998-07-10 00:00:05  peter
+    * fixed ttypesym bug finally
+    * fileinfo in the symtable and better using for unused vars
+
+  Revision 1.19  1998/07/07 17:40:39  peter
     * packrecords 4 works
     * word aligning of parameters