public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc/45895] New: -Wunused-but-set-variable complains for almost all Objective-C objects
@ 2010-10-05 12:48 nicola at gcc dot gnu.org
2010-10-05 13:27 ` [Bug objc/45895] " jakub at gcc dot gnu.org
2010-10-07 22:52 ` nicola at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: nicola at gcc dot gnu.org @ 2010-10-05 12:48 UTC (permalink / raw)
To: gcc-bugs
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: unassigned@gcc.gnu.org
ReportedBy: nicola@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:
[nicola@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]
[nicola@lampone ~]$
The warning is obviously incorrect because 'o' *is* used. This is on a
i686-pc-linux-gnu.
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug objc/45895] -Wunused-but-set-variable complains for almost all Objective-C objects
2010-10-05 12:48 [Bug objc/45895] New: -Wunused-but-set-variable complains for almost all Objective-C objects nicola at gcc dot gnu.org
@ 2010-10-05 13:27 ` jakub at gcc dot gnu.org
2010-10-07 22:52 ` nicola at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-10-05 13:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45895
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-10-05 13:27:34 UTC ---
That means some mark_exp_read calls need to be added, supposedly in objc-act.c,
on the right spots. I'm not familiar enough with ObjC to know where exactly,
please CC me on any fixes you write though.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug objc/45895] -Wunused-but-set-variable complains for almost all Objective-C objects
2010-10-05 12:48 [Bug objc/45895] New: -Wunused-but-set-variable complains for almost all Objective-C objects nicola at gcc dot gnu.org
2010-10-05 13:27 ` [Bug objc/45895] " jakub at gcc dot gnu.org
@ 2010-10-07 22:52 ` nicola at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: nicola at gcc dot gnu.org @ 2010-10-07 22:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45895
Nicola Pero <nicola at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #2 from Nicola Pero <nicola at gcc dot gnu.org> 2010-10-07 22:52:40 UTC ---
IainS fixed this in trunk. I tested the fix and it seems to work fine. :-)
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-07 22:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-05 12:48 [Bug objc/45895] New: -Wunused-but-set-variable complains for almost all Objective-C objects nicola at gcc dot gnu.org
2010-10-05 13:27 ` [Bug objc/45895] " jakub at gcc dot gnu.org
2010-10-07 22:52 ` nicola at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).