Author: raja
Date: 2005-04-13 07:05:05 -0400 (Wed, 13 Apr 2005)
New Revision: 42902

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/decl.cs
Log:
* decl.cs (MemberCache.AddMethods): Don't warn if
System.Object.Finalize has buggy MethodAttributes.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-04-13 10:55:35 UTC (rev 42901)
+++ trunk/mcs/mcs/ChangeLog     2005-04-13 11:05:05 UTC (rev 42902)
@@ -1,5 +1,8 @@
 2005-04-13  Raja R Harinath  <[EMAIL PROTECTED]>
 
+       * decl.cs (MemberCache.AddMethods): Don't warn if
+       System.Object.Finalize has buggy MethodAttributes.
+
        * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
        removed below.
 

Modified: trunk/mcs/mcs/decl.cs
===================================================================
--- trunk/mcs/mcs/decl.cs       2005-04-13 10:55:35 UTC (rev 42901)
+++ trunk/mcs/mcs/decl.cs       2005-04-13 11:05:05 UTC (rev 42902)
@@ -1418,18 +1418,22 @@
                                        method_hash.Add (name, list);
                                }
 
-                               if (member.IsVirtual &&
-                                   (member.Attributes & 
MethodAttributes.NewSlot) == 0) {
-                                       MethodInfo base_method = ((MethodInfo) 
member).GetBaseDefinition ();
+                               MethodInfo curr = (MethodInfo) member;
+                               while (curr.IsVirtual && (curr.Attributes & 
MethodAttributes.NewSlot) == 0) {
+                                       MethodInfo base_method = 
curr.GetBaseDefinition ();
 
-                                       if (base_method == member) {
+                                       if (base_method == curr) {
                                                //
                                                // Both mcs and CSC 1.1 seem to 
emit a somewhat broken
                                                // ...Invoke () function for 
delegates: it's missing a 'newslot'.
                                                // CSC 2.0 emits a 'newslot' 
for a delegate's Invoke.
                                                //
-                                               if (member.Name != "Invoke" ||
-                                                   !type.IsSubclassOf 
(TypeManager.multicast_delegate_type)) {
+                                               // Also, CSC 1.1 appears to 
emit 'Finalize' without a newslot.
+                                               //
+                                               if ((member.Name != "Invoke" ||
+                                                    !type.IsSubclassOf 
(TypeManager.multicast_delegate_type)) &&
+                                                   (member.Name != "Finalize" 
||
+                                                    type != 
TypeManager.object_type)) {
                                                        
Report.SymbolRelatedToPreviousError (base_method);
                                                        Report.Warning (-28, 
                                                                "The method 
'{0}' is marked 'override'," + 
@@ -1437,33 +1441,13 @@
                                                                " it may be 
ignored during overload resolution",
                                                                
TypeManager.CSharpSignature (base_method));
                                                }
-                                               goto skip;
-                                       }
 
-                                       for (;;) {
-                                               list.Add (new CacheEntry (null, 
base_method, MemberTypes.Method, bf));
-                                               if ((base_method.Attributes & 
MethodAttributes.NewSlot) != 0)
-                                                       break;
-
-                                               //
-                                               // Shouldn't get here.  Mono 
appears to be buggy.
-                                               //
-                                               MethodInfo new_base_method = 
base_method.GetBaseDefinition ();
-                                               if (new_base_method == 
base_method) {
-                                                       
Report.SymbolRelatedToPreviousError (base_method);
-                                                       Report.Warning (-28, 
-                                                               "The method 
'{0}' is marked 'override'," +
-                                                               " but doesn't 
appear to overrided any virtual or abstract method:" + 
-                                                               " it may be 
ignored during overload resolution",
-                                                               
TypeManager.CSharpSignature (base_method));
-                                                       break;
-                                               }
-                                               base_method = new_base_method;
+                                               break;
                                        }
-
-
+                                       
+                                       list.Add (new CacheEntry (null, 
base_method, MemberTypes.Method, bf));
+                                       curr = base_method;
                                }
-                       skip:
 
                                // Unfortunately, the elements returned by 
Type.GetMethods() aren't
                                // sorted so we need to do this check for every 
member.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to