http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45895
Summary: -Wunused-but-set-variable complains for almost all Objective-C objects Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: objc AssignedTo: unassig...@gcc.gnu.org ReportedBy: nic...@gcc.gnu.org It seems that -Wunused-but-set-variable complains any time an Objective-C object variable is set, and only used to invoke methods. This is incorrect; when a variable is used to invoke a method, it is used. :-) (hence, compiling any Objective-C with -Wall generates lots of wrong warnings). Here is a testcase -- #include <objc/objc.h> #include <objc/Object.h> int main (void) { id o = nil; [o hash]; return 0; } Here are what happens when you compile: [nic...@lampone ~]$ gcc -Wall bug.m -lobjc -c bug.m: In function ‘main’: bug.m:6:6: warning: variable ‘o’ set but not used [-Wunused-but-set-variable] [nic...@lampone ~]$ The warning is obviously incorrect because 'o' *is* used. This is on a i686-pc-linux-gnu. Thanks