Incorrect block warnings
Incorrect block warnings
- Subject: Incorrect block warnings
- From: Rick Mann <email@hidden>
- Date: Sat, 14 May 2011 01:46:49 -0400
Xcode 3.2.6, GCC 4.2, Cocoa App, OS X 10.6.7
I have a simple bit of code in a .mm file:
- (IBAction)
exportList: (id) inSender // Shadowed decl is here
{
NSSavePanel* sp = [NSSavePanel savePanel]; // Shadowed decl is here
sp.prompt = NSLocalizedString(@"Export", @"");
sp.allowedFileTypes = [NSArray arrayWithObject: @"osm"];
NSString* defaultFilename = self.fileURL.lastPathComponent.stringByDeletingPathExtension;
if (defaultFilename.length == 0)
{
defaultFilename = @"List";
}
sp.nameFieldStringValue = [defaultFilename stringByAppendingPathExtension: @"osm"];
[sp beginSheetModalForWindow: mFooController.window
completionHandler: ^(NSInteger inResult)
{
if (inResult == NSFileHandlingPanelOKButton)
{
NSURL* dir = sp.directoryURL; // Decl of 'sp' shadows a previous local
NSString* filename = sp.nameFieldStringValue;
NSURL* fileURL = [dir URLByAppendingPathComponent: filename];
[self exportListToURL: fileURL]; // declaration of 'FooDocument* const self' shadows a parameter
}
}
];
}
I get the following complaints from the compiler. However, the code seems to run just fine.
CompileC build/Foo.build/Debug/Foo.build/Objects-normal/x86_64/FooDocument.o ../src/Cocoa/Foo/FooDocument.mm normal x86_64 objective-c++ com.apple.compilers.gcc.4_2
cd /Users/me/LZRepo/Foo/trunk/xcode
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wmissing-prototypes -Wreturn-type -Wunused-variable -Wshadow -Wnewline-eof -Wconversion -Wundeclared-selector -isysroot /Developer/SDKs/MacOSX10.6.sdk -mfix-and-continue -fobjc-gc-only -fvisibility-inlines-hidden -mmacosx-version-min=10.6 -gdwarf-2 -I/Users/me/LZRepo/Foo/trunk/xcode/build/Foo.build/Debug/Foo.build/Foo.hmap -F/Users/me/LZRepo/Foo/trunk/xcode/build/Debug -F/Users/me/LZRepo/Foo/trunk/xcode -F/Users/me/LZRepo/Foo/trunk/xcode/../Frameworks -I/Users/me/LZRepo/Foo/trunk/xcode/build/Debug/include -I/Users/me/LZRepo/Foo/trunk/xcode/build/Foo.build/Debug/Foo.build/DerivedSources/x86_64 -I/Users/me/LZRepo/Foo/trunk/xcode/build/Foo.build/Debug/Foo.build/DerivedSources -include /var/folders/0O/0O9Zc+ZKFCy+BtbYF754gk+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Foo_Prefix-bumhfqiazdbyfwaekwmldygrhgmq/Foo_Prefix.pch -c /Users/me/LZRepo/Foo/trunk/xcode/../src/Cocoa/Foo/FooDocument.mm -o /Users/me/LZRepo/Foo/trunk/xcode/build/Foo.build/Debug/Foo.build/Objects-normal/x86_64/FooDocument.o
/Users/me/LZRepo/Foo/trunk/xcode/../src/Cocoa/Foo/FooDocument.mm:231: warning: declaration of 'sp' shadows a previous local
/Users/me/LZRepo/Foo/trunk/xcode/../src/Cocoa/Foo/FooDocument.mm:210: warning: shadowed declaration is here
/Users/me/LZRepo/Foo/trunk/xcode/../src/Cocoa/Foo/FooDocument.mm:235: warning: declaration of 'FooDocument* const self' shadows a parameter
/Users/me/LZRepo/Foo/trunk/xcode/../src/Cocoa/Foo/FooDocument.mm:208: warning: shadowed declaration is here
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden