Re: -Wall
Re: -Wall
- Subject: Re: -Wall
- From: Jason Stephenson <email@hidden>
- Date: Wed, 04 Jun 2008 23:10:31 -0400
Stuart Malin wrote:
Thanks Jens!
Adding
#pragma unused (paramName)
to the top of the function (inside the block) does suppress the warning.
Googling this led me to some posts that imply this #pragma is deprecated
but still functioning. I saw references to using __unused__ instead, but
only saw examples of that with C function prototypes, and couldn't get
it to work with Obj-C.
#pragma unused (variableName)
Should work with gcc regardless of options (unless there is one to
disable pragmas that I am not aware of).
__attibute__ ((__unused__)) being an attribute is a gcc extension. It
only works if you specify one of the options that enable gcc extensions.
In Xcode, you can do this most easily by choosing either GNU89 or GNU99
as the C Language Dialect in the Project Settings. (On the command line
or in a Makefile, pass -std=gnu89 or -std=gnu99 to gcc.) The __unused__
attribute *should* then work with your Objective-C code.
However, that said, I see several bug reports relating to this attribute
when googling, so I wouldn't necessarily count on it always working as
expected.
The situation being as it is, I'd recommend using the #pragma. At best,
it works. At worst, the compiler will ignore and issue warnings.
Oh, and I must be odd, but I really don't mind warnings from the
compiler as long as I know why the compiler is issuing the warnings and
can determine that they really are not a problem with the code, such as
warnings about unused variables.
Cheers,
Jason
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
- Follow-Ups:
- Re: -Wall
- From: "Sean McBride" <email@hidden>
References: | |
| >-Wall (From: Stuart Malin <email@hidden>) |
| >Re: -Wall (From: "Sean McBride" <email@hidden>) |
| >Re: -Wall (From: Stuart Malin <email@hidden>) |
| >Re: -Wall (From: Stefan Werner <email@hidden>) |
| >Re: -Wall (From: Stuart Malin <email@hidden>) |