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

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).