This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]