Переглянути джерело

* moved tprocdef.isempty to a new set called implprocoptions that
contains flags related to the procdef's implementation (and that
don't influence the interface crc)

git-svn-id: trunk@27189 -

Jonas Maebe 11 роки тому
батько
коміт
7d8e9cf0f6
4 змінених файлів з 67 додано та 6 видалено
  1. 1 1
      compiler/ppu.pas
  2. 8 0
      compiler/symconst.pas
  3. 22 4
      compiler/symdef.pas
  4. 36 1
      compiler/utils/ppuutils/ppudump.pp

+ 1 - 1
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion = 165;
+  CurrentPPUVersion = 166;
 
 { buffer sizes }
   maxentrysize = 1024;

+ 8 - 0
compiler/symconst.pas

@@ -358,6 +358,14 @@ type
   );
   tprocoptions=set of tprocoption;
 
+  { options that should not trigger the recompilation of a unit if they change
+    between the interface and the implementation }
+  timplprocoption = (
+    { the routine contains no code }
+    pio_empty
+  );
+  timplprocoptions = set of timplprocoption;
+
   { kinds of synthetic procdefs that can be generated }
   tsynthetickind = (
     tsk_none,

+ 22 - 4
compiler/symdef.pas

@@ -642,6 +642,8 @@ interface
          procedure Setinterfacedef(AValue: boolean);
          function Gethasforward: boolean;
          procedure Sethasforward(AValue: boolean);
+         function GetIsEmpty: boolean;
+         procedure SetIsEmpty(AValue: boolean);
        public
           messageinf : tmessageinf;
           dispid : longint;
@@ -665,6 +667,7 @@ interface
           funcretsymderef : tderef;
           struct : tabstractrecorddef;
           structderef : tderef;
+          implprocoptions: timplprocoptions;
 {$if defined(powerpc) or defined(m68k)}
           { library symbol for AmigaOS/MorphOS }
           libsym : tsym;
@@ -703,8 +706,6 @@ interface
           { set to a value different from tsk_none in case this procdef is for
             a routine that has to be internally generated by the compiler }
           synthetickind : tsynthetickind;
-          { true, if the procedure contains no code }
-          isempty: boolean;
           constructor create(level:byte);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
@@ -768,6 +769,8 @@ interface
           property interfacedef: boolean read Getinterfacedef write Setinterfacedef;
           { true if the procedure has a forward declaration }
           property hasforward: boolean read Gethasforward write Sethasforward;
+          { true if the routine's body is empty }
+          property isempty: boolean read GetIsEmpty write SetIsEmpty;
        end;
 
        { single linked list of overloaded procs }
@@ -4659,6 +4662,21 @@ implementation
       end;
 
 
+    function tprocdef.GetIsEmpty: boolean;
+      begin
+        result:=pio_empty in implprocoptions;
+      end;
+
+
+    procedure tprocdef.SetIsEmpty(AValue: boolean);
+      begin
+        if AValue then
+          include(implprocoptions,pio_empty)
+        else
+          include(implprocoptions,pio_empty);
+      end;
+
+
     procedure tprocdef.Setinterfacedef(AValue: boolean);
       begin
         if not assigned(implprocdefinfo) then
@@ -4788,7 +4806,7 @@ implementation
          for i:=1 to aliasnamescount do
            aliasnames.insert(ppufile.getstring);
 
-         isempty:=ppufile.getbyte<>0;
+         ppufile.getsmallset(implprocoptions);
 
          { load para symtable }
          parast:=tparasymtable.create(self,level);
@@ -4947,7 +4965,7 @@ implementation
             item:=TCmdStrListItem(item.next);
           end;
 
-         ppufile.putbyte(ord(isempty));
+         ppufile.putsmallset(implprocoptions);
 
          ppufile.do_crc:=oldintfcrc;
 

+ 36 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -1952,6 +1952,41 @@ begin
 end;
 
 
+procedure readprocimploptions(const space: string);
+type
+  tpiopt=record
+    mask : timplprocoption;
+    str  : string[30];
+  end;
+const
+  piopt : array[low(timplprocoption)..high(timplprocoption)] of tpiopt=(
+    (mask:pio_empty; str:'IsEmpty')
+  );
+var
+  implprocoptions: timplprocoptions;
+  i: timplprocoption;
+  first: boolean;
+begin
+  ppufile.getsmallset(implprocoptions);
+  if implprocoptions<>[] then
+    begin
+      first:=true;
+      write([space,'          Options : ']);
+      for i:=low(piopt) to high(piopt) do
+        begin
+          if i in implprocoptions then
+            begin
+              if first then
+                first:=false
+              else
+                write(', ');
+              write(piopt[i].str);
+            end;
+        end;
+      writeln;
+    end;
+end;
+
 procedure readarraydefoptions(ArrayDef: TPpuArrayDef);
 { type tarraydefoption is in unit symconst }
 const
@@ -2889,7 +2924,7 @@ begin
                    end;
                  writeln;
                end;
-             writeln([space,'            Empty : ',getbyte<>0]);
+             readprocimploptions(space);
              if not EndOfEntry then
                HasMoreInfos;
              space:='    '+space;