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}
              ait_comp :
                begin
+{$ifdef FPC}
+                 co:=comp(pai_comp(hp)^.value);
+{$else}
                  co:=pai_comp(hp)^.value;
+{$endif}
                  objectoutput^.writebytes(co,8);
                end;
 {$endif I386}
@@ -823,7 +827,12 @@ unit ag386bin;
 end.
 {
   $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
     * stabs correct but externalbss disabled
       would need a special treatment in writestabs

+ 10 - 9
compiler/ag386int.pas

@@ -99,15 +99,11 @@ unit ag386int;
         c  : comp;
         dd : pdouble;
       begin
-{$ifdef TP}
-         c:=d;
-{$else TP}
-{$ifdef Delphi}
-         c:=d;
-{$else Delphi}
+{$ifdef FPC}
          c:=comp(d);
-{$endif Delphi}
-{$endif TP}
+{$else}
+         c:=d;
+{$endif}
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          comp2str:=double2str(dd^);
       end;
@@ -773,7 +769,12 @@ ait_stab_function_name : ;
 end.
 {
   $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
 
   Revision 1.37  1999/05/06 09:05:09  peter

+ 10 - 9
compiler/ag386nsm.pas

@@ -99,15 +99,11 @@ unit ag386nsm;
         c  : comp;
         dd : pdouble;
       begin
-{$ifdef TP}
-         c:=d;
-{$else TP}
-{$ifdef Delphi}
-         c:=d;
-{$else Delphi}
+{$ifdef FPC}
          c:=comp(d);
-{$endif Delphi}
-{$endif TP}
+{$else}
+         c:=d;
+{$endif}
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          comp2str:=double2str(dd^);
       end;
@@ -737,7 +733,12 @@ ait_stab_function_name : ;
 end.
 {
   $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
 
   Revision 1.32  1999/05/06 09:05:11  peter

+ 19 - 1
compiler/symdef.inc

@@ -2230,6 +2230,7 @@
          deftype:=procdef;
          _mangledname:=nil;
          nextoverloaded:=nil;
+         fileinfo:=aktfilepos;
          extnumber:=-1;
          localst:=new(psymtable,init(localsymtable));
          parast:=new(psymtable,init(parasymtable));
@@ -2289,6 +2290,7 @@
          extnumber:=readlong;
          nextoverloaded:=pprocdef(readdefref);
          _class := pobjectdef(readdefref);
+         readposinfo(fileinfo);
 
          if (cs_link_deffile in aktglobalswitches) and ((options and poexports)<>0) then
            deffile.AddExport(mangledname);
@@ -2531,6 +2533,7 @@ Const local_symtable_index : longint = $8001;
                 writedefref(nil);
            end;
          writedefref(_class);
+         writeposinfo(fileinfo);
          if (options and poinline) <> 0 then
            begin
               { we need to save
@@ -2545,6 +2548,16 @@ Const local_symtable_index : longint = $8001;
       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}
     procedure addparaname(p : psym);
       var vs : char;
@@ -3460,7 +3473,12 @@ Const local_symtable_index : longint = $8001;
 
 {
   $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)
 
   Revision 1.110  1999/05/06 09:05:28  peter

+ 10 - 1
compiler/symdefh.inc

@@ -380,6 +380,9 @@
           extnumber : longint;
           messageinf : tmessageinf;
           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 }
           localst : psymtable;
           { pointer to the parameter symbol table }
@@ -428,6 +431,7 @@
 {$ifdef BrowserLog}
           procedure add_to_browserlog;
 {$endif BrowserLog}
+          function haspara:boolean;
        end;
 
        tstringtype = (st_shortstring, st_longstring, st_ansistring, st_widestring);
@@ -506,7 +510,12 @@
 
 {
   $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
     * fixed constant float conversions
 

+ 13 - 12
compiler/symsym.inc

@@ -339,7 +339,7 @@
       end;
 
     { we need to remove it from the prevsym chain ! }
-    
+
     destructor tunitsym.done;
       var pus,ppus : punitsym;
       begin
@@ -441,10 +441,8 @@
       end;
 
     procedure tprocsym.check_forward;
-
       var
          pd : pprocdef;
-         oldaktfilepos : tfileposinfo;
       begin
          { don't check if errors !! }
          if Errorcount>0 then
@@ -454,13 +452,11 @@
            begin
               if pd^.forwarddef then
                 begin
-                   oldaktfilepos:=aktfilepos;
-                   aktfilepos:=fileinfo;
                    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
-                     Message1(sym_e_forward_not_resolved,name+pd^.demangled_paras);
-                   aktfilepos:=oldaktfilepos;
+                     MessagePos1(fileinfo,sym_e_forward_not_resolved,name+pd^.demangled_paras);
                 end;
               pd:=pd^.nextoverloaded;
            end;
@@ -1126,8 +1122,8 @@
          else
            data_align:=1;
       end;
-      
-    
+
+
     procedure tvarsym.insert_in_data;
       var
          l,ali,modulo : longint;
@@ -1190,7 +1186,7 @@
                      begin
                         (* this is done
                            either by the assembler or in ag386bin
-                           
+
                         bsssegment^.concat(new(pai_align,init(ali))); *)
                         modulo:=owner^.datasize mod ali;
                         if modulo>0 then
@@ -2020,7 +2016,12 @@
 
 {
   $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
       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;
 
     procedure varsymbolused(p : {$ifndef OLDPPU}pnamedindexobject{$else}psym{$endif});
-      var
-        oldaktfilepos : tfileposinfo;
       begin
          if (psym(p)^.typ=varsym) and
             ((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 claim for high param of open parameters (PM) }
            if (pvarsym(p)^.refs=0) and
+              (Errorcount=0) 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
-                oldaktfilepos:=aktfilepos;
-                aktfilepos:=psym(p)^.fileinfo;
                 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
-                  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;
 
@@ -3213,7 +3208,12 @@ const localsymtablestack : psymtable = nil;
 end.
 {
   $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
 
   Revision 1.7  1999/05/06 09:05:31  peter

+ 55 - 2
compiler/verbose.pas

@@ -24,7 +24,7 @@ unit verbose;
 interface
 
 uses
-  messages;
+  messages,cobjects;
 
 {$ifdef TP}
   {$define EXTERN_MSG}
@@ -80,6 +80,10 @@ procedure Message(w:tmsgconst);
 procedure Message1(w:tmsgconst;const s1:string);
 procedure Message2(w:tmsgconst;const s1,s2: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 DoneVerbose;
@@ -441,6 +445,50 @@ begin
 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;
 begin
 { Init }
@@ -467,7 +515,12 @@ end.
 
 {
   $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
 
   Revision 1.37  1999/04/21 07:41:06  pierre