From patchwork Sun Jan 9 14:56:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 78022 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 E3FACB708B for ; Mon, 10 Jan 2011 01:56:14 +1100 (EST) Received: (qmail 27172 invoked by alias); 9 Jan 2011 14:56:13 -0000 Received: (qmail 27164 invoked by uid 22791); 9 Jan 2011 14:56:12 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL, BAYES_00, SARE_HEAD_8BIT_SPAM, SARE_SUB_ENC_UTF8, 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, 09 Jan 2011 14:56:08 +0000 Received: from eggs.gnu.org ([140.186.70.92]:52520) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Pbwgc-0005vY-Gj for gcc-patches@gnu.org; Sun, 09 Jan 2011 09:56:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pbwge-0007fU-O9 for gcc-patches@gnu.org; Sun, 09 Jan 2011 09:56:05 -0500 Received: from smtp121.iad.emailsrvr.com ([207.97.245.121]:43121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pbwge-0007fN-Jy for gcc-patches@gnu.org; Sun, 09 Jan 2011 09:56:04 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp42.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id AC9B1148A6B for ; Sun, 9 Jan 2011 09:56:03 -0500 (EST) Received: from dynamic7.wm-web.iad.mlsrvr.com (dynamic7.wm-web.iad1a.rsapps.net [192.168.2.148]) by smtp42.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 9AD731481FA for ; Sun, 9 Jan 2011 09:56:03 -0500 (EST) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic7.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 7A393153806A for ; Sun, 9 Jan 2011 09:56:03 -0500 (EST) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Sun, 9 Jan 2011 15:56:03 +0100 (CET) Date: Sun, 9 Jan 2011 15:56:03 +0100 (CET) Subject: =?UTF-8?Q?Fix=20for=20PR=20objc/47232=20("Confusing=20ObjC=20error=20mes?= =?UTF-8?Q?sage=20"attributes=20may=20not=20be=20specified=20before=20befo?= =?UTF-8?Q?re=20=E2=80=98class=E2=80=99")?= From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1294584963.498131375@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 This patch fixes PR objc/47232. The problem is simply the ObjC error message (new in 4.6) error: attributes may not be specified before before ‘class’ which is hard to read and jumps out as convoluted if not wrong because of the repeated 'before'. This patch changes it to read error: unexpected attribute before 'class' which is consistent with the rest of the parser errors, and is more readable (if anyone has better suggestions, let me know!). ;-) Ok to commit ? Thanks Index: ChangeLog =================================================================== --- ChangeLog (revision 168611) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2011-01-09 Nicola Pero + + PR objc/47232 + * c-parser.c (c_parser_declaration_or_fndef): Improved + error message. + 2011-01-09 Iain Sandoe PR gcc/46902 Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 168611) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2011-01-09 Nicola Pero + + PR objc/47232 + * objc.dg/attributes/invalid-attribute-1.m: New. + * obj-c++.dg/attributes/invalid-attribute-1.mm: New. + 2011-01-09 Janus Weil PR fortran/46313 Index: testsuite/objc.dg/attributes/invalid-attribute-1.m =================================================================== --- testsuite/objc.dg/attributes/invalid-attribute-1.m (revision 0) +++ testsuite/objc.dg/attributes/invalid-attribute-1.m (revision 0) @@ -0,0 +1,6 @@ +/* Contributed by Nicola Pero , January 2011. */ +/* { dg-do compile } */ + +#include + +__attribute__ ((deprecated)) @class A; /* { dg-error "unexpected attribute before .class." } */ Index: testsuite/obj-c++.dg/attributes/invalid-attribute-1.mm =================================================================== --- testsuite/obj-c++.dg/attributes/invalid-attribute-1.mm (revision 0) +++ testsuite/obj-c++.dg/attributes/invalid-attribute-1.mm (revision 0) @@ -0,0 +1,6 @@ +/* Contributed by Nicola Pero , January 2011. */ +/* { dg-do compile } */ + +#include + +__attribute__ ((deprecated)) @class A; /* { dg-error "attributes may not be specified before the ..class. Objective-C.. keyword" } */ Index: c-parser.c =================================================================== --- c-parser.c (revision 168611) +++ c-parser.c (working copy) @@ -1555,8 +1555,7 @@ c_parser_declaration_or_fndef (c_parser case RID_AT_PROPERTY: if (specs->attrs) { - c_parser_error (parser, - "attributes may not be specified before" ); + c_parser_error (parser, "unexpected attribute"); specs->attrs = NULL; } break;