[Mono-bugs] [Bug 623723] Gendarme - AvoidCodeDuplicatedInSameClassRule, AvoidCodeDuplicatedInSiblingClassesRule false positives

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Aug 19 20:52:25 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=623723

https://bugzilla.novell.com/show_bug.cgi?id=623723#c4


--- Comment #4 from Sebastien Pouliot <spouliot at novell.com> 2010-08-20 00:52:22 UTC ---
The worst case (at least the one in your original report) seems to vanish when
ignoring NOP instructions. They should not matter* individually but CSC likes
to emit them a lot (like "NOP NOP NOP RET" as method epilogue) - so much it
gets tagged as a pattern.

* so I'm likely to commit that anyway, in the mean time here's the patch...

Index: CodeDuplicatedLocator.cs
===================================================================
--- CodeDuplicatedLocator.cs    (revision 160394)
+++ CodeDuplicatedLocator.cs    (working copy)
@@ -151,6 +151,9 @@

             for (int index = method.Body.Instructions.Count - 1; index >= 0;
index--) {
                 Instruction currentInstruction =
method.Body.Instructions[index];
+                // CSC abuse NOP
+                if (currentInstruction.Is (Code.Nop))
+                    continue;
                 stackCounter += currentInstruction.GetPushCount ();
                 stackCounter -= currentInstruction.GetPopCount (method);

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list