Bug 47232 - Confusing ObjC error message "attributes may not be specified before before ‘class’"
Summary: Confusing ObjC error message "attributes may not be specified before before ‘...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 4.6.0
: P3 minor
Target Milestone: 4.6.0
Assignee: Nicola Pero
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-09 14:09 UTC by Nicola Pero
Modified: 2011-01-09 22:48 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.6.0
Known to fail:
Last reconfirmed: 2011-01-09 14:21:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola Pero 2011-01-09 14:09:31 UTC
The following ObjC testcase:

__attribute__ ((deprecated)) @class A;

triggers the error

test5.m:1:30: error: attributes may not be specified before before ‘class’

which is clumsy.  It is due to c-parser.c producing the error "attributes may not be specified before" which is then joined with "before 'class'".

Thanks
Comment 1 Nicola Pero 2011-01-09 14:21:22 UTC
I was looking at the other parser messages; maybe we could simply replace "attributes may not be specified before" with "unexpected attribute".

Then, the error message would become

 unexpected attribute before 'class'

which is quite consistent with the other error messages.

Thanks
Comment 2 Nicola Pero 2011-01-09 22:47:27 UTC
Author: nicola
Date: Sun Jan  9 22:47:22 2011
New Revision: 168619

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168619
Log:
In gcc/:
2011-01-09  Nicola Pero  <nicola.pero@meta-innovation.com>

	PR objc/47232
	* c-parser.c (c_parser_declaration_or_fndef): Improved
	error message.

In gcc/testsuite/:
2011-01-09  Nicola Pero  <nicola.pero@meta-innovation.com>

	PR objc/47232
	* objc.dg/attributes/invalid-attribute-1.m: New.
	* obj-c++.dg/attributes/invalid-attribute-1.mm: New.	

Added:
    trunk/gcc/testsuite/obj-c++.dg/attributes/invalid-attribute-1.mm
    trunk/gcc/testsuite/objc.dg/attributes/invalid-attribute-1.m
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-parser.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Nicola Pero 2011-01-09 22:48:51 UTC
Fixed in trunk (4.6.0).

Thanks