Browse Source

+ MessagePos() which is enhanced Message() function but also gets the
position info
* Removed comp warnings

peter 26 years ago
parent
commit
2bb065a00a
8 changed files with 137 additions and 45 deletions
  1. 10 1
      compiler/ag386bin.pas
  2. 10 9
      compiler/ag386int.pas
  3. 10 9
      compiler/ag386nsm.pas
  4. 19 1
      compiler/symdef.inc
  5. 10 1
      compiler/symdefh.inc
  6. 13 12
      compiler/symsym.inc
  7. 10 10
      compiler/symtable.pas
  8. 55 2
      compiler/verbose.pas

+ 10 - 1
compiler/ag386bin.pas

@@ -651,7 +651,11 @@ unit ag386bin;
 {$ifdef I386}
 {$ifdef I386}
              ait_comp :
              ait_comp :
                begin
                begin
+{$ifdef FPC}
+                 co:=comp(pai_comp(hp)^.value);
+{$else}
                  co:=pai_comp(hp)^.value;
                  co:=pai_comp(hp)^.value;
+{$endif}
                  objectoutput^.writebytes(co,8);
                  objectoutput^.writebytes(co,8);
                end;
                end;
 {$endif I386}
 {$endif I386}
@@ -823,7 +827,12 @@ unit ag386bin;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  1999-05-07 00:36:58  pierre
+  Revision 1.7  1999-05-08 19:52:32  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.6  1999/05/07 00:36:58  pierre
     * added alignment code for .bss
     * added alignment code for .bss
     * stabs correct but externalbss disabled
     * stabs correct but externalbss disabled
       would need a special treatment in writestabs
       would need a special treatment in writestabs

+ 10 - 9
compiler/ag386int.pas

@@ -99,15 +99,11 @@ unit ag386int;
         c  : comp;
         c  : comp;
         dd : pdouble;
         dd : pdouble;
       begin
       begin
-{$ifdef TP}
-         c:=d;
-{$else TP}
-{$ifdef Delphi}
-         c:=d;
-{$else Delphi}
+{$ifdef FPC}
          c:=comp(d);
          c:=comp(d);
-{$endif Delphi}
-{$endif TP}
+{$else}
+         c:=d;
+{$endif}
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          comp2str:=double2str(dd^);
          comp2str:=double2str(dd^);
       end;
       end;
@@ -773,7 +769,12 @@ ait_stab_function_name : ;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.38  1999-05-07 00:08:49  pierre
+  Revision 1.39  1999-05-08 19:52:33  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.38  1999/05/07 00:08:49  pierre
    * AG386BIN cond -> OLDASM, only cosmetic
    * AG386BIN cond -> OLDASM, only cosmetic
 
 
   Revision 1.37  1999/05/06 09:05:09  peter
   Revision 1.37  1999/05/06 09:05:09  peter

+ 10 - 9
compiler/ag386nsm.pas

@@ -99,15 +99,11 @@ unit ag386nsm;
         c  : comp;
         c  : comp;
         dd : pdouble;
         dd : pdouble;
       begin
       begin
-{$ifdef TP}
-         c:=d;
-{$else TP}
-{$ifdef Delphi}
-         c:=d;
-{$else Delphi}
+{$ifdef FPC}
          c:=comp(d);
          c:=comp(d);
-{$endif Delphi}
-{$endif TP}
+{$else}
+         c:=d;
+{$endif}
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          comp2str:=double2str(dd^);
          comp2str:=double2str(dd^);
       end;
       end;
@@ -737,7 +733,12 @@ ait_stab_function_name : ;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.33  1999-05-07 00:08:48  pierre
+  Revision 1.34  1999-05-08 19:52:34  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.33  1999/05/07 00:08:48  pierre
    * AG386BIN cond -> OLDASM, only cosmetic
    * AG386BIN cond -> OLDASM, only cosmetic
 
 
   Revision 1.32  1999/05/06 09:05:11  peter
   Revision 1.32  1999/05/06 09:05:11  peter

+ 19 - 1
compiler/symdef.inc

@@ -2230,6 +2230,7 @@
          deftype:=procdef;
          deftype:=procdef;
          _mangledname:=nil;
          _mangledname:=nil;
          nextoverloaded:=nil;
          nextoverloaded:=nil;
+         fileinfo:=aktfilepos;
          extnumber:=-1;
          extnumber:=-1;
          localst:=new(psymtable,init(localsymtable));
          localst:=new(psymtable,init(localsymtable));
          parast:=new(psymtable,init(parasymtable));
          parast:=new(psymtable,init(parasymtable));
@@ -2289,6 +2290,7 @@
          extnumber:=readlong;
          extnumber:=readlong;
          nextoverloaded:=pprocdef(readdefref);
          nextoverloaded:=pprocdef(readdefref);
          _class := pobjectdef(readdefref);
          _class := pobjectdef(readdefref);
+         readposinfo(fileinfo);
 
 
          if (cs_link_deffile in aktglobalswitches) and ((options and poexports)<>0) then
          if (cs_link_deffile in aktglobalswitches) and ((options and poexports)<>0) then
            deffile.AddExport(mangledname);
            deffile.AddExport(mangledname);
@@ -2531,6 +2533,7 @@ Const local_symtable_index : longint = $8001;
                 writedefref(nil);
                 writedefref(nil);
            end;
            end;
          writedefref(_class);
          writedefref(_class);
+         writeposinfo(fileinfo);
          if (options and poinline) <> 0 then
          if (options and poinline) <> 0 then
            begin
            begin
               { we need to save
               { we need to save
@@ -2545,6 +2548,16 @@ Const local_symtable_index : longint = $8001;
       end;
       end;
 
 
 
 
+    function tprocdef.haspara:boolean;
+      begin
+{$ifndef OLDPPU}
+        haspara:=assigned(aktprocsym^.definition^.parast^.symindex^.first);
+{$else}
+        haspara:=assigned(aktprocsym^.definition^.parast^.searchroot);
+{$endif}
+      end;
+
+
 {$ifdef GDB}
 {$ifdef GDB}
     procedure addparaname(p : psym);
     procedure addparaname(p : psym);
       var vs : char;
       var vs : char;
@@ -3460,7 +3473,12 @@ Const local_symtable_index : longint = $8001;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.111  1999-05-07 11:06:37  florian
+  Revision 1.112  1999-05-08 19:52:35  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.111  1999/05/07 11:06:37  florian
     * enumeration type names are now written in lowercase (rtti)
     * enumeration type names are now written in lowercase (rtti)
 
 
   Revision 1.110  1999/05/06 09:05:28  peter
   Revision 1.110  1999/05/06 09:05:28  peter

+ 10 - 1
compiler/symdefh.inc

@@ -380,6 +380,9 @@
           extnumber : longint;
           extnumber : longint;
           messageinf : tmessageinf;
           messageinf : tmessageinf;
           nextoverloaded : pprocdef;
           nextoverloaded : pprocdef;
+          { where is this function defined, needed here because there
+            is only one symbol for all overloaded functions }
+          fileinfo : tfileposinfo;
           { pointer to the local symbol table }
           { pointer to the local symbol table }
           localst : psymtable;
           localst : psymtable;
           { pointer to the parameter symbol table }
           { pointer to the parameter symbol table }
@@ -428,6 +431,7 @@
 {$ifdef BrowserLog}
 {$ifdef BrowserLog}
           procedure add_to_browserlog;
           procedure add_to_browserlog;
 {$endif BrowserLog}
 {$endif BrowserLog}
+          function haspara:boolean;
        end;
        end;
 
 
        tstringtype = (st_shortstring, st_longstring, st_ansistring, st_widestring);
        tstringtype = (st_shortstring, st_longstring, st_ansistring, st_widestring);
@@ -506,7 +510,12 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.24  1999-05-06 09:05:30  peter
+  Revision 1.25  1999-05-08 19:52:37  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.24  1999/05/06 09:05:30  peter
     * generic write_float and str_float
     * generic write_float and str_float
     * fixed constant float conversions
     * fixed constant float conversions
 
 

+ 13 - 12
compiler/symsym.inc

@@ -339,7 +339,7 @@
       end;
       end;
 
 
     { we need to remove it from the prevsym chain ! }
     { we need to remove it from the prevsym chain ! }
-    
+
     destructor tunitsym.done;
     destructor tunitsym.done;
       var pus,ppus : punitsym;
       var pus,ppus : punitsym;
       begin
       begin
@@ -441,10 +441,8 @@
       end;
       end;
 
 
     procedure tprocsym.check_forward;
     procedure tprocsym.check_forward;
-
       var
       var
          pd : pprocdef;
          pd : pprocdef;
-         oldaktfilepos : tfileposinfo;
       begin
       begin
          { don't check if errors !! }
          { don't check if errors !! }
          if Errorcount>0 then
          if Errorcount>0 then
@@ -454,13 +452,11 @@
            begin
            begin
               if pd^.forwarddef then
               if pd^.forwarddef then
                 begin
                 begin
-                   oldaktfilepos:=aktfilepos;
-                   aktfilepos:=fileinfo;
                    if assigned(pd^._class) then
                    if assigned(pd^._class) then
-                     Message1(sym_e_forward_not_resolved,pd^._class^.objname^+'.'+name+demangledparas(pd^.demangled_paras))
+                     MessagePos1(fileinfo,sym_e_forward_not_resolved,pd^._class^.objname^+'.'+name+
+                       demangledparas(pd^.demangled_paras))
                    else
                    else
-                     Message1(sym_e_forward_not_resolved,name+pd^.demangled_paras);
-                   aktfilepos:=oldaktfilepos;
+                     MessagePos1(fileinfo,sym_e_forward_not_resolved,name+pd^.demangled_paras);
                 end;
                 end;
               pd:=pd^.nextoverloaded;
               pd:=pd^.nextoverloaded;
            end;
            end;
@@ -1126,8 +1122,8 @@
          else
          else
            data_align:=1;
            data_align:=1;
       end;
       end;
-      
-    
+
+
     procedure tvarsym.insert_in_data;
     procedure tvarsym.insert_in_data;
       var
       var
          l,ali,modulo : longint;
          l,ali,modulo : longint;
@@ -1190,7 +1186,7 @@
                      begin
                      begin
                         (* this is done
                         (* this is done
                            either by the assembler or in ag386bin
                            either by the assembler or in ag386bin
-                           
+
                         bsssegment^.concat(new(pai_align,init(ali))); *)
                         bsssegment^.concat(new(pai_align,init(ali))); *)
                         modulo:=owner^.datasize mod ali;
                         modulo:=owner^.datasize mod ali;
                         if modulo>0 then
                         if modulo>0 then
@@ -2020,7 +2016,12 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.86  1999-05-07 00:06:22  pierre
+  Revision 1.87  1999-05-08 19:52:38  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.86  1999/05/07 00:06:22  pierre
     + added aligmnent of data for typed consts
     + added aligmnent of data for typed consts
       for var it is done by AS or LD or in ag386bin for direct object output
       for var it is done by AS or LD or in ag386bin for direct object output
 
 

+ 10 - 10
compiler/symtable.pas

@@ -750,8 +750,6 @@ const localsymtablestack : psymtable = nil;
       end;
       end;
 
 
     procedure varsymbolused(p : {$ifndef OLDPPU}pnamedindexobject{$else}psym{$endif});
     procedure varsymbolused(p : {$ifndef OLDPPU}pnamedindexobject{$else}psym{$endif});
-      var
-        oldaktfilepos : tfileposinfo;
       begin
       begin
          if (psym(p)^.typ=varsym) and
          if (psym(p)^.typ=varsym) and
             ((psym(p)^.owner^.symtabletype in [parasymtable,localsymtable,staticsymtable])) then
             ((psym(p)^.owner^.symtabletype in [parasymtable,localsymtable,staticsymtable])) then
@@ -761,17 +759,14 @@ const localsymtablestack : psymtable = nil;
            { also don't count the value parameters which have local copies }
            { also don't count the value parameters which have local copies }
            { also don't claim for high param of open parameters (PM) }
            { also don't claim for high param of open parameters (PM) }
            if (pvarsym(p)^.refs=0) and
            if (pvarsym(p)^.refs=0) and
+              (Errorcount=0) and
               (copy(p^.name,1,3)<>'val') and
               (copy(p^.name,1,3)<>'val') and
-              (copy(p^.name,1,4)<>'high') and
-              (Errorcount=0) then
+              (copy(p^.name,1,4)<>'high') then
              begin
              begin
-                oldaktfilepos:=aktfilepos;
-                aktfilepos:=psym(p)^.fileinfo;
                 if (psym(p)^.owner^.symtabletype=parasymtable) or pvarsym(p)^.islocalcopy then
                 if (psym(p)^.owner^.symtabletype=parasymtable) or pvarsym(p)^.islocalcopy then
-                  Message1(sym_h_para_identifier_not_used,p^.name)
+                  MessagePos1(psym(p)^.fileinfo,sym_h_para_identifier_not_used,p^.name)
                 else
                 else
-                  Message1(sym_n_local_identifier_not_used,p^.name);
-                aktfilepos:=oldaktfilepos;
+                  MessagePos1(psym(p)^.fileinfo,sym_n_local_identifier_not_used,p^.name);
              end;
              end;
       end;
       end;
 
 
@@ -3213,7 +3208,12 @@ const localsymtablestack : psymtable = nil;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.8  1999-05-06 21:38:38  peter
+  Revision 1.9  1999-05-08 19:52:40  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.8  1999/05/06 21:38:38  peter
     * don't register errordef
     * don't register errordef
 
 
   Revision 1.7  1999/05/06 09:05:31  peter
   Revision 1.7  1999/05/06 09:05:31  peter

+ 55 - 2
compiler/verbose.pas

@@ -24,7 +24,7 @@ unit verbose;
 interface
 interface
 
 
 uses
 uses
-  messages;
+  messages,cobjects;
 
 
 {$ifdef TP}
 {$ifdef TP}
   {$define EXTERN_MSG}
   {$define EXTERN_MSG}
@@ -80,6 +80,10 @@ procedure Message(w:tmsgconst);
 procedure Message1(w:tmsgconst;const s1:string);
 procedure Message1(w:tmsgconst;const s1:string);
 procedure Message2(w:tmsgconst;const s1,s2:string);
 procedure Message2(w:tmsgconst;const s1,s2:string);
 procedure Message3(w:tmsgconst;const s1,s2,s3:string);
 procedure Message3(w:tmsgconst;const s1,s2,s3:string);
+procedure MessagePos(const pos:tfileposinfo;w:tmsgconst);
+procedure MessagePos1(const pos:tfileposinfo;w:tmsgconst;const s1:string);
+procedure MessagePos2(const pos:tfileposinfo;w:tmsgconst;const s1,s2:string);
+procedure MessagePos3(const pos:tfileposinfo;w:tmsgconst;const s1,s2,s3:string);
 
 
 procedure InitVerbose;
 procedure InitVerbose;
 procedure DoneVerbose;
 procedure DoneVerbose;
@@ -441,6 +445,50 @@ begin
 end;
 end;
 
 
 
 
+procedure MessagePos(const pos:tfileposinfo;w:tmsgconst);
+var
+  oldpos : tfileposinfo;
+begin
+  oldpos:=aktfilepos;
+  aktfilepos:=pos;
+  Msg2Comment(msg^.Get(ord(w)));
+  aktfilepos:=oldpos;
+end;
+
+
+procedure MessagePos1(const pos:tfileposinfo;w:tmsgconst;const s1:string);
+var
+  oldpos : tfileposinfo;
+begin
+  oldpos:=aktfilepos;
+  aktfilepos:=pos;
+  Msg2Comment(msg^.Get1(ord(w),s1));
+  aktfilepos:=oldpos;
+end;
+
+
+procedure MessagePos2(const pos:tfileposinfo;w:tmsgconst;const s1,s2:string);
+var
+  oldpos : tfileposinfo;
+begin
+  oldpos:=aktfilepos;
+  aktfilepos:=pos;
+  Msg2Comment(msg^.Get2(ord(w),s1,s2));
+  aktfilepos:=oldpos;
+end;
+
+
+procedure MessagePos3(const pos:tfileposinfo;w:tmsgconst;const s1,s2,s3:string);
+var
+  oldpos : tfileposinfo;
+begin
+  oldpos:=aktfilepos;
+  aktfilepos:=pos;
+  Msg2Comment(msg^.Get3(ord(w),s1,s2,s3));
+  aktfilepos:=oldpos;
+end;
+
+
 procedure InitVerbose;
 procedure InitVerbose;
 begin
 begin
 { Init }
 { Init }
@@ -467,7 +515,12 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.38  1999-05-04 21:45:09  florian
+  Revision 1.39  1999-05-08 19:52:42  peter
+    + MessagePos() which is enhanced Message() function but also gets the
+      position info
+    * Removed comp warnings
+
+  Revision 1.38  1999/05/04 21:45:09  florian
     * changes to compile it with Delphi 4.0
     * changes to compile it with Delphi 4.0
 
 
   Revision 1.37  1999/04/21 07:41:06  pierre
   Revision 1.37  1999/04/21 07:41:06  pierre