public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc/47682] New: unused-but-set-variabled warning when using fast enumeration
@ 2011-02-10 17:04 jos at kuijpersvof dot nl
  2011-02-10 18:28 ` [Bug objc/47682] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jos at kuijpersvof dot nl @ 2011-02-10 17:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47682

           Summary: unused-but-set-variabled warning when using fast
                    enumeration
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jos@kuijpersvof.nl


When setting a variable and enumerating through it using fast enumeration, the
compiler does not see it as usage of the variable. Using -Wall gives a warning:

$ objfw-compile -Wall -o fetest fetest.m
fetest.m: In function â-[test applicationDidFinishLaunching]â:
fetest.m:11:11: warning: variable âarrâ set but not used
[-Wunused-but-set-variable]

$ ./fetest
[2011-02-10 17:43:35.021 fetest(22073)] Item: Foo
[2011-02-10 17:43:35.022 fetest(22073)] Item: Bar

$ cat fetest.m
#import <ObjFW/ObjFW.h>

@interface test : OFObject @end

OF_APPLICATION_DELEGATE(test)

@implementation test

- (void)applicationDidFinishLaunching
{
        OFArray *arr;
        arr = [OFArray arrayWithObjects:@"Foo",@"Bar",nil];

        for(OFString *str in arr)
        {
                of_log(@"Item: %@",str);
        }
}

@end


$ gcc-4.6 -v
Using built-in specs.
COLLECT_GCC=gcc-4.6
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --disable-multilib --program-suffix=-4.6
--prefix=/usr/local/ --enable-languages=c,c++,objc,obj-c++ --enable-threads
Thread model: posix
gcc version 4.6.0 20101219 (experimental) (GCC)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug objc/47682] unused-but-set-variabled warning when using fast enumeration
  2011-02-10 17:04 [Bug objc/47682] New: unused-but-set-variabled warning when using fast enumeration jos at kuijpersvof dot nl
@ 2011-02-10 18:28 ` pinskia at gcc dot gnu.org
  2011-02-10 19:28 ` nicola at gcc dot gnu.org
  2011-05-24 12:42 ` nicola at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-02-10 18:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47682

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-02-10 18:27:03 UTC ---
This was supposed to be fixed by
http://gcc.gnu.org/ml/gcc-cvs/2010-12/msg00199.html .


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug objc/47682] unused-but-set-variabled warning when using fast enumeration
  2011-02-10 17:04 [Bug objc/47682] New: unused-but-set-variabled warning when using fast enumeration jos at kuijpersvof dot nl
  2011-02-10 18:28 ` [Bug objc/47682] " pinskia at gcc dot gnu.org
@ 2011-02-10 19:28 ` nicola at gcc dot gnu.org
  2011-05-24 12:42 ` nicola at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-02-10 19:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47682

Nicola Pero <nicola at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.02.10 19:24:33
                 CC|                            |nicola at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #2 from Nicola Pero <nicola at gcc dot gnu.org> 2011-02-10 19:24:33 UTC ---
Yes, this is supposed to have been fixed, even if not by me ;-)

It was Iain who fixed it --

http://gcc.gnu.org/ml/gcc-cvs/2011-01/msg00219.html

I see that Jos is using "gcc version 4.6.0 20101219 (experimental) (GCC)",
which
I'd expect wouldn't include the fix.

I asked him (offline) if he could try again with a newer compiler.  It works
for me with GNUstep and GCC 4.6 trunk.

Thanks


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug objc/47682] unused-but-set-variabled warning when using fast enumeration
  2011-02-10 17:04 [Bug objc/47682] New: unused-but-set-variabled warning when using fast enumeration jos at kuijpersvof dot nl
  2011-02-10 18:28 ` [Bug objc/47682] " pinskia at gcc dot gnu.org
  2011-02-10 19:28 ` nicola at gcc dot gnu.org
@ 2011-05-24 12:42 ` nicola at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-05-24 12:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47682

Nicola Pero <nicola at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Nicola Pero <nicola at gcc dot gnu.org> 2011-05-24 11:56:54 UTC ---
3 months have passed with no reply; assuming resolved.  It certainly works for 
me. :-)

Thanks


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-24 12:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 17:04 [Bug objc/47682] New: unused-but-set-variabled warning when using fast enumeration jos at kuijpersvof dot nl
2011-02-10 18:28 ` [Bug objc/47682] " pinskia at gcc dot gnu.org
2011-02-10 19:28 ` nicola at gcc dot gnu.org
2011-05-24 12:42 ` 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).