From patchwork Sun Jan 16 13:44:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 79087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1F4D6B6EE9 for ; Mon, 17 Jan 2011 00:45:06 +1100 (EST) Received: (qmail 14378 invoked by alias); 16 Jan 2011 13:45:01 -0000 Received: (qmail 14336 invoked by uid 22791); 16 Jan 2011 13:45:00 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 16 Jan 2011 13:44:54 +0000 Received: from eggs.gnu.org ([140.186.70.92]:38459) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PeSuX-0007TO-0T for gcc-patches@gnu.org; Sun, 16 Jan 2011 08:44:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PeSuZ-0006vJ-4f for gcc-patches@gnu.org; Sun, 16 Jan 2011 08:44:52 -0500 Received: from smtp191.iad.emailsrvr.com ([207.97.245.191]:33489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PeSuZ-0006v2-24 for gcc-patches@gnu.org; Sun, 16 Jan 2011 08:44:51 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp49.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 9FD85190285 for ; Sun, 16 Jan 2011 08:44:49 -0500 (EST) Received: from dynamic14.wm-web.iad.mlsrvr.com (dynamic14.wm-web.iad1a.rsapps.net [192.168.2.221]) by smtp49.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 8E3851901B6 for ; Sun, 16 Jan 2011 08:44:49 -0500 (EST) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic14.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 76A5C2E9802E for ; Sun, 16 Jan 2011 08:44:49 -0500 (EST) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Sun, 16 Jan 2011 14:44:49 +0100 (CET) Date: Sun, 16 Jan 2011 14:44:49 +0100 (CET) Subject: Fix for PR objc/47314 From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1295185489.484710811@192.168.4.58> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 + + 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 PR 19162 Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 168850) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2011-01-16 Nicola Pero + + PR objc/47314 + * objc.dg/selector-warn-1.m: New. + * obj-c++.dg/selector-warn-1.mm: New. + 2011-01-13 Jan Hubicka 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 , January 2011. */ +/* { dg-options "-Wselector" } */ +/* { dg-do compile } */ + +#include + +@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 , January 2011. */ +/* { dg-options "-Wselector" } */ +/* { dg-do compile } */ + +#include + +@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" } */