|
From: | David Ayers |
Subject: | Re: PATCH: Find more ObjC methods |
Date: | Sun, 05 Oct 2003 16:12:09 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030827 |
Ziemowit Laski wrote:
Fine, I must admit for large files with multiple categories the old behavior gives a reassurance that such methods are only used within the corresponding category. But if you must, then collect all implementations prototypes of a class.Example: @interface Foo -(void)somePublicMethod; @end @implementation Foo -(void)somePublicMethod {}; -(void)somePrivatMethod {}; -(void)someOtherPrivateMethod { [self somePrivateMethod]; } @end @implementation Foo (aCategory) -(void)somePrivatCategoryMethod {}; -(void)someOtherCategoryMethod { [self somePrivatCategoryMethod];[self somePrivatMethod]; /* <- should not see the prototype and warn! */} @endNo, here is where I disagree. Clearly, the compiler has seen the @implementation containing the method in question, so it knows it is there. Not sure why you'd want the compiler to look the other way? :-)
Yet the implementation you have committed is broken, as it goes way to far. Actually, it's even inconsistently broken. You're making these private prototypes globally visitable (i.e. to code outside of the class) by adding it to the @interface structure. Feel free to /use/ the prototype (as that is what the runtime will do), but *do* emit a warning when they are used outside of the class. And if you start pooling prototypes please. also do it for category implementations, as this is where the broken implementation is currently inconsistent.
I've opened a bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12516 Cheers, David
[Prev in Thread] | Current Thread | [Next in Thread] |