This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[RFI]: getting objc to grok attributes ??
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc at gcc dot gnu dot org, patch at caip dot rutgers dot edu
- Cc: jsm28 at cam dot ac dot uk, nicola at brainstorm dot co dot uk, ovidiu at cup dot hp dot com, shebs at apple dot com
- Date: Sun, 16 Jun 2002 22:22:07 -0400 (EDT)
- Subject: [RFI]: getting objc to grok attributes ??
I was trying to fix these warnings:
> libobjc/Object.m:273: warning: unused parameter `argFrame'
> libobjc/Object.m:366: warning: unused parameter `aStream'
> libobjc/Object.m:372: warning: unused parameter `aStream'
But when I put in attribute "unused", I get parser errors. I tried to
fix the objc parser, and I got it to accept the attributes. However
it does nothing with them and the warnings remain.
I can't figure out what to do with the attribute once the parser gets
a hold of it. Can someone please explain it to me?
Thanks,
--Kaveh
Here's my "wild guess" parser patch along with the attributes I'm
trying to add. I don't know objc, I got this far by trial and error.
Apologies if I'm on the wrong track.
diff -rup orig/egcc-CVS20020616/gcc/c-parse.in egcc-CVS20020616/gcc/c-parse.in
--- orig/egcc-CVS20020616/gcc/c-parse.in 2002-06-16 16:00:39.000000000 -0400
+++ egcc-CVS20020616/gcc/c-parse.in 2002-06-16 21:50:15.177222915 -0400
@@ -3153,24 +3153,24 @@ reservedwords:
;
keyworddecl:
- selector ':' '(' typename ')' identifier
+ selector ':' '(' typename ')' identifier maybe_attribute
{
- $$ = build_keyword_decl ($1, $4, $6);
+ $$ = build_keyword_decl ($1, $4, chainon ($6, $7));
}
- | selector ':' identifier
+ | selector ':' identifier maybe_attribute
{
- $$ = build_keyword_decl ($1, NULL_TREE, $3);
+ $$ = build_keyword_decl ($1, NULL_TREE, chainon ($3, $4));
}
- | ':' '(' typename ')' identifier
+ | ':' '(' typename ')' identifier maybe_attribute
{
- $$ = build_keyword_decl (NULL_TREE, $3, $5);
+ $$ = build_keyword_decl (NULL_TREE, $3, chainon ($5, $6));
}
- | ':' identifier
+ | ':' identifier maybe_attribute
{
- $$ = build_keyword_decl (NULL_TREE, NULL_TREE, $2);
+ $$ = build_keyword_decl (NULL_TREE, NULL_TREE, chainon ($2, $3));
}
;
diff -rup orig/egcc-CVS20020616/libobjc/Object.m egcc-CVS20020616/libobjc/Object.m
--- orig/egcc-CVS20020616/libobjc/Object.m 2002-06-15 13:47:43.000000000 -0400
+++ egcc-CVS20020616/libobjc/Object.m 2002-06-16 21:02:11.420110717 -0400
@@ -269,7 +269,7 @@ extern int errno;
return (*msg)(self, aSel, anObject1, anObject2);
}
-- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame
+- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame __attribute__ ((__unused__))
{
return (retval_t)[self doesNotRecognize: aSel];
}
@@ -362,13 +362,13 @@ extern int errno;
// before doing their own archiving. These methods are private, in
// the sense that they should only be called from subclasses.
-- read: (TypedStream*)aStream
+- read: (TypedStream*)aStream __attribute__ ((__unused__))
{
// [super read: aStream];
return self;
}
-- write: (TypedStream*)aStream
+- write: (TypedStream*)aStream __attribute__ ((__unused__))
{
// [super write: aStream];
return self;