public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix for PR objc/47314
@ 2011-01-16 17:06 Nicola Pero
  2011-01-17 11:42 ` Mike Stump
  0 siblings, 1 reply; 2+ messages in thread
From: Nicola Pero @ 2011-01-16 17:06 UTC (permalink / raw)
  To: gcc-patches

While rewriting some ObjC code for performance - a work that I'll submit for GCC 4.7 -
I spotted a typo in the existing 4.6 code, which causes GCC 4.6 to produce an incorrect
message when -Wselector is used to check for duplicate methods.  The error produced is

  warning: multiple selectors named ‘+method’ found

while it should be

  warning: multiple selectors named ‘-method’ found

It seems worthwhile to apply ("backport") this trivial one-liner bug fix to GCC 4.6,
so I'm submitting it as GCC 4.6 patch.

Ok to commit ?

Thanks

Index: objc/objc-act.c
===================================================================
--- objc/objc-act.c     (revision 168850)
+++ objc/objc-act.c     (working copy)
@@ -12986,7 +12986,7 @@
          for (hsh = cls_method_hash_list[slot]; hsh; hsh = hsh->next)
            check_duplicates (hsh, 0, 1);
          for (hsh = nst_method_hash_list[slot]; hsh; hsh = hsh->next)
-           check_duplicates (hsh, 0, 1);
+           check_duplicates (hsh, 0, 0);
        }
     }
 
Index: objc/ChangeLog
===================================================================
--- objc/ChangeLog      (revision 168850)
+++ objc/ChangeLog      (working copy)
@@ -1,3 +1,9 @@
+2011-01-16  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR objc/47314
+       * objc-act.c (finish_objc): When calling check_duplicates to check
+       duplicated instance methods, set 'is_class' to 0, not 1.
+
 2011-01-14  Ben Elliston  <bje@au.ibm.com>
 
        PR 19162
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 168850)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2011-01-16  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR objc/47314
+       * objc.dg/selector-warn-1.m: New.
+       * obj-c++.dg/selector-warn-1.mm: New.
+
 2011-01-13  Jan Hubicka  <jh@suse.cz>
 
        PR tree-optimization/47276 
Index: testsuite/objc.dg/selector-warn-1.m
===================================================================
--- testsuite/objc.dg/selector-warn-1.m (revision 0)
+++ testsuite/objc.dg/selector-warn-1.m (revision 0)
@@ -0,0 +1,16 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, January 2011.  */
+/* { dg-options "-Wselector" } */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@interface RootObject
+@end
+
+@interface MyObject : RootObject
+- (void) method; /* { dg-message "found" } */
+@end
+
+@interface MyObject2  : RootObject
+- (int) method; /* { dg-message "also found" } */
+@end /* { dg-warning "multiple selectors named .-method. found" } */
Index: testsuite/obj-c++.dg/selector-warn-1.mm
===================================================================
--- testsuite/obj-c++.dg/selector-warn-1.mm     (revision 0)
+++ testsuite/obj-c++.dg/selector-warn-1.mm     (revision 0)
@@ -0,0 +1,16 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, January 2011.  */
+/* { dg-options "-Wselector" } */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@interface RootObject
+@end
+
+@interface MyObject : RootObject
+- (void) method; /* { dg-message "found" } */
+@end
+
+@interface MyObject2  : RootObject
+- (int) method; /* { dg-message "also found" } */
+@end /* { dg-warning "multiple selectors named .-method. found" } */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix for PR objc/47314
  2011-01-16 17:06 Fix for PR objc/47314 Nicola Pero
@ 2011-01-17 11:42 ` Mike Stump
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Stump @ 2011-01-17 11:42 UTC (permalink / raw)
  To: Nicola Pero; +Cc: gcc-patches

On Jan 16, 2011, at 5:44 AM, Nicola Pero wrote:
> While rewriting some ObjC code for performance - a work that I'll submit for GCC 4.7 -
> I spotted a typo in the existing 4.6 code, which causes GCC 4.6 to produce an incorrect
> message when -Wselector is used to check for duplicate methods.

> Ok to commit ?

Ok.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-17 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-16 17:06 Fix for PR objc/47314 Nicola Pero
2011-01-17 11:42 ` Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).