Sfoglia il codice sorgente

* don't show notes about "unused" private fields of external obj-c class
declarations (since even though they're not used in the Pascal code,
they probably are in the Objective-C code that actually implements them)

git-svn-id: branches/objc@13764 -

Jonas Maebe 16 anni fa
parent
commit
046b652c28
2 ha cambiato i file con 18 aggiunte e 4 eliminazioni
  1. 4 2
      compiler/pdecl.pas
  2. 14 2
      compiler/symdef.pas

+ 4 - 2
compiler/pdecl.pas

@@ -528,10 +528,12 @@ implementation
                     { In case of an objcclass, verify that all methods have a message
                     { In case of an objcclass, verify that all methods have a message
                       name set. We only check this now, because message names can be set
                       name set. We only check this now, because message names can be set
                       during the protocol (interface) mapping. At the same time, set the
                       during the protocol (interface) mapping. At the same time, set the
-                      mangled names (these depend on the "external" name of the class).
+                      mangled names (these depend on the "external" name of the class),
+                      and mark private fields of external classes as "used" (to avoid
+                      bogus notes about them being unused)
                     }
                     }
                     if is_objc_class_or_protocol(hdef) then
                     if is_objc_class_or_protocol(hdef) then
-                      tobjectdef(hdef).check_and_finish_messages;
+                      tobjectdef(hdef).finish_objc_data;
 
 
                   end;
                   end;
                 recorddef :
                 recorddef :

+ 14 - 2
compiler/symdef.pas

@@ -306,7 +306,7 @@ interface
           procedure register_vmt_call(index:longint);
           procedure register_vmt_call(index:longint);
           { ObjC }
           { ObjC }
           procedure make_all_methods_external;
           procedure make_all_methods_external;
-          procedure check_and_finish_messages;
+          procedure finish_objc_data;
        end;
        end;
 
 
        tclassrefdef = class(tabstractpointerdef)
        tclassrefdef = class(tabstractpointerdef)
@@ -4536,9 +4536,21 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tobjectdef.check_and_finish_messages;
+    procedure mark_private_fields_used(data: tobject; arg: pointer);
+      var
+        sym: tsym absolute data;
+      begin
+        if (sym.typ=fieldvarsym) and
+           (tfieldvarsym(sym).visibility in [vis_private,vis_strictprivate]) then
+          sym.IncRefCount;
+      end;
+
+
+    procedure tobjectdef.finish_objc_data;
       begin
       begin
         self.symtable.DefList.foreachcall(@check_and_finish_msg,nil);
         self.symtable.DefList.foreachcall(@check_and_finish_msg,nil);
+        if (oo_is_external in objectoptions) then
+          self.symtable.SymList.ForEachCall(@mark_private_fields_used,nil);
       end;
       end;